LibC: Remove cxx abi stuff from libc

These will cause multiple definitions when linking with libstdc++
This commit is contained in:
Bananymous 2024-08-09 16:58:11 +03:00
parent f60e265397
commit 46b1d4d194
2 changed files with 1 additions and 26 deletions

View File

@ -39,26 +39,3 @@ extern "C" void __cxa_finalize(void* f)
} }
} }
}; };
namespace __cxxabiv1
{
using __guard = uint64_t;
extern "C" int __cxa_guard_acquire (__guard* g)
{
uint8_t* byte = reinterpret_cast<uint8_t*>(g);
uint8_t zero = 0;
return __atomic_compare_exchange_n(byte, &zero, 1, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
}
extern "C" void __cxa_guard_release (__guard* g)
{
uint8_t* byte = reinterpret_cast<uint8_t*>(g);
__atomic_store_n(byte, 0, __ATOMIC_RELEASE);
}
extern "C" void __cxa_guard_abort (__guard*)
{
ASSERT_NOT_REACHED();
}
}

View File

@ -733,14 +733,12 @@ FILE* tmpfile(void);
char* tmpnam(char* storage) char* tmpnam(char* storage)
{ {
static int s_counter = rand();
static char s_storage[PATH_MAX]; static char s_storage[PATH_MAX];
if (storage == nullptr) if (storage == nullptr)
storage = s_storage; storage = s_storage;
for (int i = 0; i < TMP_MAX; i++) for (int i = 0; i < TMP_MAX; i++)
{ {
sprintf(storage, "/tmp/tmp_%04x", s_counter); sprintf(storage, "/tmp/tmp_%04x", rand());
s_counter = rand();
struct stat st; struct stat st;
if (stat(storage, &st) == -1 && errno == ENOENT) if (stat(storage, &st) == -1 && errno == ENOENT)