1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 03:14:38 +00:00

Some GCC flags improvements (#1903)

* Some GCC flags improvements

* Move -fno-reorder-blocks -fno-zero-initialized-in-bss to assets only

* Add -fno-PIC since some gcc versions use -fPIC as default

* Enable builtin functions on gcc, with appropriate changes to missing_gcc_functions.c
  and ultra64/libc.h

* Move -fno-merge-constants -mno-explicit-relocs -mno-split-addresses to overlays only
  as they are only needed there for reloc reasons

* Remove unneeded casts in missing_gcc_functions.c

* Change gcc assets flags handling
This commit is contained in:
Tharo 2024-02-29 20:11:54 +00:00 committed by GitHub
parent 1b60dcf6dd
commit 3670a48aee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 10 deletions

View file

@ -10,10 +10,10 @@
// Self-hosted libc memory functions, gcc assumes these exist even in a freestanding
// environment and there is no way to tell it otherwise.
int memcmp(void* s1, const void* s2, size_t n) {
u8* m1 = (u8*)s1;
u8* m2 = (u8*)s2;
u32 i;
int memcmp(const void* s1, const void* s2, size_t n) {
const u8* m1 = s1;
const u8* m2 = s2;
size_t i;
for (i = 0; i < n; i++) {
if (m1[i] < m2[i]) {
@ -26,17 +26,38 @@ int memcmp(void* s1, const void* s2, size_t n) {
return 0;
}
void* memset(void* str, s32 c, size_t n) {
u8* m1 = (u8*)str;
u32 i;
void* memset(void* str, int c, size_t n) {
u8* m = str;
size_t i;
for (i = 0; i < n; i++) {
m1[i] = c;
m[i] = c;
}
return str;
}
void* memmove(void* dest, const void* src, size_t len) {
u8* d = dest;
const u8* s = src;
if (d == s) {
return dest;
}
if (d < s) {
while (len--) {
*d++ = *s++;
}
} else {
d += len - 1;
s += len - 1;
while (len--) {
*d-- = *s--;
}
}
return dest;
}
// Conversions involving 64-bit integer types required by the O32 MIPS ABI.
// f32 -> u64, negative values become 0