The NOP padding in the GCC linker scripts ensures that all empty regions in the ELF binary are filled with x86 NOP instructions. There is no upside to doing this: if the CPU ends up executing these instructions, we have little hope of resuming normal execution of the program anyway. And having NOP slides in memory only makes it easier for attackers to launch exploits. So remove them. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18130 6f19259b-4bc3-4df7-8a09-765794883524
45 lines
740 B
Plaintext
45 lines
740 B
Plaintext
/* OUTPUT_FORMAT(efi-bsdrv-x86_64) */
|
|
SECTIONS
|
|
{
|
|
/* . = 0 + SIZEOF_HEADERS; */
|
|
. = 0x280;
|
|
.text ALIGN(0x20) :
|
|
{
|
|
*(.text .stub .text.* .gnu.linkonce.t.*)
|
|
. = ALIGN(0x20);
|
|
}
|
|
.data ALIGN(0x40) :
|
|
{
|
|
*(
|
|
.rodata .rodata.* .gnu.linkonce.r.*
|
|
.data .data.* .gnu.linkonce.d.*
|
|
.bss .bss.*
|
|
*COM*
|
|
)
|
|
. = ALIGN(0x20);
|
|
}
|
|
.eh_frame ALIGN(0x20) :
|
|
{
|
|
KEEP (*(.eh_frame))
|
|
}
|
|
.got ALIGN(0x20) :
|
|
{
|
|
*(.got .got.*)
|
|
. = ALIGN(0x20);
|
|
}
|
|
.rela ALIGN(0x20) :
|
|
{
|
|
*(.rela .rela.*)
|
|
}
|
|
/DISCARD/ : {
|
|
*(.note.GNU-stack) *(.gnu_debuglink)
|
|
*(.interp)
|
|
*(.dynsym)
|
|
*(.dynstr)
|
|
*(.dynamic)
|
|
*(.hash)
|
|
*(.comment)
|
|
}
|
|
}
|
|
|