You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Newer gcc (>8 maybe) uses different optimizations, which breaks compilation of some programs that have the -Os flag and use problematic static functions like memset.
Logs:
arm-vita-eabi-gcc -fPIE -fno-zero-initialized-in-bss -std=c99 -mcpu=cortex-a9 -Os -mthumb -c -o payload.o payload.c
arm-vita-eabi-gcc -fPIE -fno-zero-initialized-in-bss -std=c99 -mcpu=cortex-a9 -Os -mthumb payload.o -o payload.elf -T linker.x -nostartfiles -nostdlib -pie
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld.exe: payload.o: infunction`one':
payload.c:(.text+0xa34): undefined reference to `memset'/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld.exe: payload.o: in function `two':payload.c:(.text+0x19b0): undefined reference to `memset'/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld.exe: payload.o: in function `three':
payload.c:(.text+0x1faa): undefined reference to `memset'collect2.exe: error: ld returned 1 exit status
Known workarounds are:
Replace -Os with -O0. Compiles but produces a broken executable (kernel panic).
Search what optimizations are enabled on gcc10 for -Os that are not on gcc8, and disable them. Not tried.
Remove the static attribute of the problematic function. Produces a good executable but modifies output size because of more or less optimizations.
Add -fno-builtin flag but attribute(used) might be needed for those problematic static functions
This issue might have a common cause with issue #226.
A valid fix should be either a regression in gcc10 directly, or an automating of broken optimizations disabling.
The text was updated successfully, but these errors were encountered:
CelesteBlue-dev
changed the title
New gcc breaks compilation of -Os programs that redefine memset or memcpy
New gcc breaks compilation of -Os programs that use problematic static functions
Sep 23, 2023
Newer gcc (>8 maybe) uses different optimizations, which breaks compilation of some programs that have the
-Os
flag and use problematic static functions like memset.Logs:
Known workarounds are:
-Os
with-O0
. Compiles but produces a broken executable (kernel panic).-Os
that are not on gcc8, and disable them. Not tried.-fno-builtin
flag butattribute(used)
might be needed for those problematic static functionsThis issue might have a common cause with issue #226.
A valid fix should be either a regression in gcc10 directly, or an automating of broken optimizations disabling.
The text was updated successfully, but these errors were encountered: