Closed kas1e closed 1 year ago
More info about issue:
This is happening with ALL binutils ever released for amigaos4, be it last ones, adtools ones, or 20 years old 2.14 ones . The problems seems to be because of prebuild ldscripts used for build amigaos4 binaries.
Once i use my own ldscript, like:
SECTIONS
{
. = SIZEOF_HEADERS;
.text : { *(.text) }
}
and compile it like:
ppc-amigaos-ld -Tldscript -q test_new.o -o test_new /usr/local/amiga/ppc-amigaos/SDK/newlib/lib/crtbegin.o /usr/local/amiga/ppc-amigaos/SDK/newlib/lib/LibC.a /usr/local/amiga/ppc-amigaos/SDK/newlib/lib/crtend.o
Then, .text segment is AX, and not WAX.
But if i didn't provide any ldscript (so default ones used), then we always have WAX for .text segment.
So this is perhaps an issue with prebuild ldscripts.
Turns out it was a false alarm. The problem was that i use "-N" swith for LD , which i just copied from my old hacking-tests, and this -N swith mean exactly to make .text to be writable.
So, new binutils generate it all correct once -N ommited (and if use GCC11 binary, it also works fine).
Currently, we do have .text segment marked as writable:
But .text must not be writable. If elf.library ignores it for code it may not be a problem, but if it doesn't and allocates the code in writable memory it's a problem.