caa65211bb
The ld linker can transform indirect call to a locally defined function, foo, via its GOT slot, to either "NOP call foo" or "call foo NOP" where NOP is a 1-byte NOP padding. This patch adds a "-z call-nop=PADDING" option to x86 ld to control 1-byte NOP padding for x86 call instruction. PADDING is one of prefix-addr, prefix-nop, suffix-nop, prefix-NUMBER or suffix-NUMBER. bfd/ * elf32-i386.c (elf_i386_convert_load): Use call_nop_byte and check call_nop_as_suffix for 1-byte NOP padding to pad call. * elf64-x86-64.c (elf_x86_64_convert_load): Likewise. include/ * bfdlink.h (bfd_link_info): Add call_nop_as_suffix and call_nop_byte. ld/ * ld/ld.texinfo: Document "-z call-nop=PADDING" option. * emulparams/call_nop.sh: New file. * emulparams/elf_i386_be.sh: Source ${srcdir}/emulparams/call_nop.sh. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set link_info.call_nop_byte if $CALL_NOP_BYTE isn't empty. ld/testsuite/ * ld-i386/call3.s: New file. * ld-i386/call3a.d: Likewise. * ld-i386/call3b.d: Likewise. * ld-i386/call3c.d: Likewise. * ld-i386/call3d.d: Likewise. * ld-i386/call3e.d: Likewise. * ld-i386/call3f.d: Likewise. * ld-i386/call3g.d: Likewise. * ld-i386/call3h.d: Likewise. * ld-i386/load1-nacl.d: Likewise. * ld-x86-64/call1.s: Likewise. * ld-x86-64/call1a.d: Likewise. * ld-x86-64/call1b.d: Likewise. * ld-x86-64/call1c.d: Likewise. * ld-x86-64/call1d.d: Likewise. * ld-x86-64/call1e.d: Likewise. * ld-x86-64/call1f.d: Likewise. * ld-x86-64/call1g.d: Likewise. * ld-x86-64/call1h.d: Likewise. * ld-x86-64/call1i.d: Likewise. * ld-x86-64/load1a-nacl.d: Likewise. * ld-x86-64/load1b-nacl.d: Likewise. * ld-x86-64/load1c-nacl.d: Likewise. * ld-x86-64/load1d-nacl.d: Likewise.
48 lines
3.8 KiB
Makefile
48 lines
3.8 KiB
Makefile
#source: load1.s
|
|
#as: --64
|
|
#ld: -shared -melf_x86_64
|
|
#objdump: -dw
|
|
#target: x86_64-*-nacl*
|
|
|
|
.*: +file format .*
|
|
|
|
Disassembly of section .text:
|
|
|
|
0+ <_start>:
|
|
[ ]*[a-f0-9]+: 13 05 22 03 01 10 adc 0x10010322\(%rip\),%eax # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 03 1d 1c 03 01 10 add 0x1001031c\(%rip\),%ebx # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 23 0d 16 03 01 10 and 0x10010316\(%rip\),%ecx # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 3b 15 10 03 01 10 cmp 0x10010310\(%rip\),%edx # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 0b 35 0a 03 01 10 or 0x1001030a\(%rip\),%esi # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 1b 3d 04 03 01 10 sbb 0x10010304\(%rip\),%edi # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 2b 2d fe 02 01 10 sub 0x100102fe\(%rip\),%ebp # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 44 33 05 f7 02 01 10 xor 0x100102f7\(%rip\),%r8d # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 44 85 3d f0 02 01 10 test %r15d,0x100102f0\(%rip\) # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 48 13 05 e9 02 01 10 adc 0x100102e9\(%rip\),%rax # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 48 03 1d e2 02 01 10 add 0x100102e2\(%rip\),%rbx # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 48 23 0d db 02 01 10 and 0x100102db\(%rip\),%rcx # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 48 3b 15 d4 02 01 10 cmp 0x100102d4\(%rip\),%rdx # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 48 0b 3d cd 02 01 10 or 0x100102cd\(%rip\),%rdi # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 48 1b 35 c6 02 01 10 sbb 0x100102c6\(%rip\),%rsi # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 48 2b 2d bf 02 01 10 sub 0x100102bf\(%rip\),%rbp # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 4c 33 05 b8 02 01 10 xor 0x100102b8\(%rip\),%r8 # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 4c 85 3d b1 02 01 10 test %r15,0x100102b1\(%rip\) # 10010328 <_DYNAMIC\+0xe0>
|
|
[ ]*[a-f0-9]+: 13 05 b3 02 01 10 adc 0x100102b3\(%rip\),%eax # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 03 1d ad 02 01 10 add 0x100102ad\(%rip\),%ebx # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 23 0d a7 02 01 10 and 0x100102a7\(%rip\),%ecx # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 3b 15 a1 02 01 10 cmp 0x100102a1\(%rip\),%edx # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 0b 35 9b 02 01 10 or 0x1001029b\(%rip\),%esi # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 1b 3d 95 02 01 10 sbb 0x10010295\(%rip\),%edi # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 2b 2d 8f 02 01 10 sub 0x1001028f\(%rip\),%ebp # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 44 33 05 88 02 01 10 xor 0x10010288\(%rip\),%r8d # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 44 85 3d 81 02 01 10 test %r15d,0x10010281\(%rip\) # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 48 13 05 7a 02 01 10 adc 0x1001027a\(%rip\),%rax # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 48 03 1d 73 02 01 10 add 0x10010273\(%rip\),%rbx # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 48 23 0d 6c 02 01 10 and 0x1001026c\(%rip\),%rcx # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 48 3b 15 65 02 01 10 cmp 0x10010265\(%rip\),%rdx # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 48 0b 3d 5e 02 01 10 or 0x1001025e\(%rip\),%rdi # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 48 1b 35 57 02 01 10 sbb 0x10010257\(%rip\),%rsi # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 48 2b 2d 50 02 01 10 sub 0x10010250\(%rip\),%rbp # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 4c 33 05 49 02 01 10 xor 0x10010249\(%rip\),%r8 # 10010330 <_DYNAMIC\+0xe8>
|
|
[ ]*[a-f0-9]+: 4c 85 3d 42 02 01 10 test %r15,0x10010242\(%rip\) # 10010330 <_DYNAMIC\+0xe8>
|
|
#pass
|