mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 02:52:44 +02:00
sm: update to excise unnecessary library code
This commit is contained in:
parent
2fc9035b7d
commit
07073a7580
@ -34,7 +34,8 @@ export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
||||
-Wl,--wrap,_Unwind_Resume \
|
||||
-Wl,--wrap,_ZSt19__throw_logic_errorPKc \
|
||||
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
||||
-Wl,--wrap,_ZNSt11logic_errorC2EPKc
|
||||
-Wl,--wrap,_ZNSt11logic_errorC2EPKc \
|
||||
-Wl,--wrap,exit
|
||||
|
||||
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) $(CXXWRAPS) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
|
@ -124,6 +124,7 @@ $(OFILES_SRC) : $(HFILES_BIN)
|
||||
|
||||
ams_environment_weak.o: CXXFLAGS += -fno-lto
|
||||
pm_info_api_weak.o: CXXFLAGS += -fno-lto
|
||||
hos_stratosphere_api.o: CXXFLAGS += -fno-lto
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%_bin.h %.bin.o : %.bin
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
extern "C" void NORETURN __real_exit(int rc);
|
||||
|
||||
namespace ams {
|
||||
|
||||
WEAK_SYMBOL void *Malloc(size_t size) {
|
||||
@ -37,6 +39,11 @@ namespace ams {
|
||||
return std::free(ptr);
|
||||
}
|
||||
|
||||
WEAK_SYMBOL void NORETURN Exit(int rc) {
|
||||
__real_exit(rc);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@ -46,4 +53,6 @@ extern "C" {
|
||||
WRAP_ABORT_FUNC(__cxa_pure_virtual)
|
||||
#undef WRAP_ABORT_FUNC
|
||||
|
||||
void NORETURN __wrap_exit(int rc) { ::ams::Exit(rc); __builtin_unreachable(); }
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "hos_version_api_private.hpp"
|
||||
#include "../os/impl/os_rng_manager.hpp"
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
@ -22,6 +23,15 @@ namespace ams::os {
|
||||
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
/* Provide libnx address space allocation shim. */
|
||||
uintptr_t __libnx_virtmem_rng(void) {
|
||||
return static_cast<uintptr_t>(::ams::os::impl::GetRngManager().GenerateRandomU64());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace ams::hos {
|
||||
|
||||
void InitializeForStratosphere() {
|
||||
|
@ -21,12 +21,12 @@ namespace ams::os::impl {
|
||||
class RngManager {
|
||||
private:
|
||||
util::TinyMT mt;
|
||||
os::Mutex lock;
|
||||
os::SdkMutex lock;
|
||||
bool initialized;
|
||||
private:
|
||||
void Initialize();
|
||||
public:
|
||||
constexpr RngManager() : mt(), lock(false), initialized() { /* ... */ }
|
||||
constexpr RngManager() : mt(), lock(), initialized() { /* ... */ }
|
||||
public:
|
||||
u64 GenerateRandomU64();
|
||||
};
|
||||
|
@ -20,9 +20,9 @@ namespace ams::os {
|
||||
|
||||
namespace {
|
||||
|
||||
util::TinyMT g_random;
|
||||
os::Mutex g_random_mutex(false);
|
||||
bool g_initialized_random;
|
||||
constinit util::TinyMT g_random;
|
||||
constinit os::SdkMutex g_random_mutex;
|
||||
constinit bool g_initialized_random;
|
||||
|
||||
template<typename T>
|
||||
inline T GenerateRandomTImpl(T max) {
|
||||
|
Loading…
Reference in New Issue
Block a user