When I link together object files, the resulting ELF executable has (only) the following LOAD segment:
LOAD off 0x00000000 vaddr 0x00008000 paddr 0x00008000 align 2**15 filesz 0x000010f0 memsz 0x000010f0 flags rwx
The linker ld
combined all sections into one rwx
segment, instead of separating writable and executable parts. I want to prevent this. The relocatable objects have the sections marked as writable or executable as appropriate, so this problem appears at the link time.
So, what determines how ld
assigns permissions to the segments? The linker script does not seem to have anything related to that. Is it something specified when the toolchain is built?
I am targeting the ARM, and the toolchain is arm-linux-gnueabi
, binutils
version 2.22.
Edit: The linker script is here. The other linker options are -Bdynamic
, --gc-sections
, -z nocopyreloc
and --no-undefined
.
arm-eabi
ld produced executables with the segments separated, even with the same linker script. I still don't know what specifies this. - Juho Östman