linker - How to prevent ld from combining writable and executable sections? -


when link object files, resulting elf executable has (only) following load segment:

load off    0x00000000 vaddr 0x00008000 paddr 0x00008000 align 2**15      filesz 0x000010f0 memsz 0x000010f0 flags rwx 

the linker ld combined sections 1 rwx segment, instead of separating writable , executable parts. want prevent this. relocatable objects have sections marked writable or executable appropriate, problem appears @ link time.

so, determines how ld assigns permissions segments? linker script not seem have related that. specified when toolchain built?

i targeting arm, , toolchain arm-linux-gnueabi, binutils version 2.22.

edit: linker script here. other linker options -bdynamic, --gc-sections, -z nocopyreloc , --no-undefined.

usually linker scripts used define sections, order, whether keep them or trash them binary (release build linker script might chose remove debugging info).

here example of linker script: system-onesegment.ld

edit: modify section permission, put before whatever section want change permission of .section .section_name, "permission".

example:

.text mov r0, r0 b main .section .rodata, "ro" .word 0x00000001 .previous main: mov r0, r0 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -