Remove output-section fill from linker scripts

The linker scripts use to fill alignment gaps within the text section
with the magic value 0x90909090, which correponds to the opcodes of four
nop instructions on x86. This patch removes this value because it
apparently solves no problem. If, for some reason (e.g., due to a dangling
pointer) a thread executes instructions within alignment paddings, NOP
instructions are not any better than any other instruction. The program
will eventually execute the instructions after the padding, which is
most likely fatal. It would be more reasonable to fill the padding with
the opcode of an illegal instruction so that such an error can be
immediately detected. That said, I cannot remember a single instance,
where the fill value has helped us during debugging.

Even if the mechanism served a purpose on x86, it is still better to
remove it because it does not equally work on the other architectures
where the linker scripts are used. I.e., on ARM, the opcode 0x90909090
is not a NOP instruction.
This commit is contained in:
Norman Feske 2015-01-16 09:59:59 +01:00 committed by Christian Helmuth
parent e1667e61cc
commit a0abb093ed
6 changed files with 10 additions and 10 deletions

View File

@ -58,7 +58,7 @@ SECTIONS
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
_dtors_end = .;
} : ro = 0x90909090
} : ro = 0x0
/* Linux: exception section for uaccess mechanism */
__ex_table : { *(__ex_table) }

View File

@ -49,7 +49,7 @@ SECTIONS
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
_dtors_end = .;
} : ro = 0x90909090
} : ro = 0x0
/* Linux: exception section for uaccess mechanism */
__ex_table : { *(__ex_table) }

View File

@ -40,7 +40,7 @@ SECTIONS
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
_dtors_end = .;
} : ro = 0x90909090
} : ro = 0x0
/* Linux: exception section for uaccess mechanism */
__ex_table : { *(__ex_table) }

View File

@ -44,7 +44,7 @@ SECTIONS
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
_dtors_end = .;
} : ro = 0x90909090
} : ro = 0x0
/* Linux: exception section for uaccess mechanism */
__ex_table : { *(__ex_table) }

View File

@ -37,7 +37,7 @@ SECTIONS
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} : ro =0x90909090
} : ro =0x0
.interp : { *(.interp) } : interp : ro
.note.gnu.build-id : { *(.note.gnu.build-id) }
@ -77,13 +77,13 @@ SECTIONS
.init :
{
KEEP (*(.init))
} =0x90909090
} = 0x0
.plt : { *(.plt) }
.fini :
{
KEEP (*(.fini))
} =0x90909090
} = 0x0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);

View File

@ -66,18 +66,18 @@ SECTIONS
.init :
{
KEEP (*(.init))
} =0x90909090
} = 0x0
.plt : { *(.plt) }
.text :
{
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
} =0x90909090
} = 0x0
.fini :
{
KEEP (*(.fini))
} =0x90909090
} =0x0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);