04ebc307f9
We use its PLT entry to initialize function pointer at run-time. If there is no other usage for the PLT entry, we can generate run-time function pointer relocations in read-write section, which can be resolved by dynamic linker, to initialize function pointers. It avoids the extra indirect branch overhead in PLT. bfd/ PR ld/18900 * elf32-i386.c (elf_i386_link_hash_entry): Add func_pointer_refcount. (elf_i386_link_hash_newfunc): Clear func_pointer_refcount. (elf_i386_get_local_sym_hash): Likewise. (elf_i386_copy_indirect_symbol): Also copy func_pointer_refcount. (elf_i386_check_relocs): Increment func_pointer_refcount. (elf_i386_gc_sweep_hook): Decrement func_pointer_refcount. (elf_i386_allocate_dynrelocs): Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. Keep dynanamic relocations for run-time function pointer initialization. (elf_i386_relocate_section): Copy dynamic function pointer relocations. * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add func_pointer_refcount. (elf_x86_64_link_hash_newfunc): Clear func_pointer_refcount. (elf_x86_64_get_local_sym_hash): Likewise. (elf_x86_64_copy_indirect_symbol): Also copy func_pointer_refcount. (elf_x86_64_check_relocs): Increment func_pointer_refcount. (elf_x86_64_gc_sweep_hook): Decrement func_pointer_refcount. (elf_x86_64_allocate_dynrelocs): Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. Keep dynanamic relocations for run-time function pointer initialization. (elf_x86_64_relocate_section): Copy dynamic function pointer relocations. ld/testsuite/ PR ld/18900 * ld-i386/i386.exp: Run tests for PR ld/18900. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pr18900.out: New file. * ld-i386/pr18900a.c: Likewise. * ld-i386/pr18900a.c: Likewise. * ld-i386/pr18900a.rd: Likewise. * ld-i386/pr18900b.c: Likewise. * ld-i386/pr18900b.rd: Likewise. * ld-i386/pr18900c.c: Likewise. * ld-x86-64/pr18900.out: Likewise. * ld-x86-64/pr18900a.c: Likewise. * ld-x86-64/pr18900a.rd: Likewise. * ld-x86-64/pr18900b.c: Likewise. * ld-x86-64/pr18900b.rd: Likewise. * ld-x86-64/pr18900c.c: Likewise. * ld-x86-64/mpx3.dd: Updated. |
||
---|---|---|
.. | ||
abs-iamcu.d | ||
abs.d | ||
abs.s | ||
alloc.d | ||
alloc.s | ||
alloc.t | ||
combreloc.d | ||
combreloc.s | ||
compressed1.d | ||
compressed1.s | ||
copyreloc-lib.c | ||
copyreloc-main.out | ||
copyreloc-main.S | ||
copyreloc-main1.rd | ||
copyreloc-main2.rd | ||
discarded1.d | ||
discarded1.s | ||
discarded1.t | ||
dummy.c | ||
dummy.s | ||
emit-relocs-nacl.rd | ||
emit-relocs.rd | ||
emit-relocs.s | ||
export-class.exp | ||
foo.s | ||
hidden1.d | ||
hidden1.s | ||
hidden2.d | ||
hidden2.s | ||
hidden3.d | ||
hidden3.s | ||
i386-export-class.rd | ||
i386-export-class.xd | ||
i386.exp | ||
iamcu-1.d | ||
iamcu-2.d | ||
iamcu-3.d | ||
iamcu-4.d | ||
lea1.s | ||
lea1a.d | ||
lea1b.d | ||
lea1c.d | ||
lea1d.d | ||
lea1e.d | ||
lea1f.d | ||
mov1.s | ||
mov1a.d | ||
mov1b.d | ||
nogot1.d | ||
nogot1.s | ||
nogot2.d | ||
nogot2.s | ||
pcrel8.d | ||
pcrel8.s | ||
pcrel16.d | ||
pcrel16.s | ||
pcrel16abs.d | ||
pcrel16abs.s | ||
plt-lib.c | ||
plt-main.out | ||
plt-main.rd | ||
plt-main1.c | ||
plt-main1.rd | ||
plt-main2.c | ||
plt-main2.rd | ||
plt-main3.c | ||
plt-main3.rd | ||
plt-main4.c | ||
plt-main4.rd | ||
plt-main5.c | ||
plt-nacl.pd | ||
plt-pic-nacl.pd | ||
plt-pic.pd | ||
plt-pic.s | ||
plt.pd | ||
plt.s | ||
pltgot-1.d | ||
pltgot-1.s | ||
pltgot-2.d | ||
pltlib.s | ||
pr12570a.d | ||
pr12570a.s | ||
pr12570b.d | ||
pr12570b.s | ||
pr12627.d | ||
pr12627.s | ||
pr12627.t | ||
pr12718.d | ||
pr12718.s | ||
pr12921.d | ||
pr12921.s | ||
pr13302.d | ||
pr13302.s | ||
pr14215.d | ||
pr14215.s | ||
pr17057.d | ||
pr17057.s | ||
pr17306a.s | ||
pr17306b.s | ||
pr17689.out | ||
pr17689.rd | ||
pr17689a.c | ||
pr17689a.t | ||
pr17689b.S | ||
pr17689now.rd | ||
pr17689ver.rd | ||
pr17709-nacl.rd | ||
pr17709.rd | ||
pr17709a.s | ||
pr17709b.s | ||
pr17827.rd | ||
pr17935-1.d | ||
pr17935-1.s | ||
pr17935-2.d | ||
pr17935-2.s | ||
pr18801.d | ||
pr18801.s | ||
pr18815.d | ||
pr18815.s | ||
pr18900.out | ||
pr18900a.c | ||
pr18900a.rd | ||
pr18900b.c | ||
pr18900b.rd | ||
pr18900c.c | ||
protected1.d | ||
protected1.s | ||
protected2.d | ||
protected2.s | ||
protected3.d | ||
protected3.s | ||
protected4.d | ||
protected4.s | ||
protected5.d | ||
protected5.s | ||
protected6.s | ||
protected6a.d | ||
protected6b.d | ||
reloc.d | ||
reloc.s | ||
start.s | ||
tlsbin-nacl.rd | ||
tlsbin.dd | ||
tlsbin.rd | ||
tlsbin.s | ||
tlsbin.sd | ||
tlsbin.td | ||
tlsbindesc-nacl.rd | ||
tlsbindesc.dd | ||
tlsbindesc.rd | ||
tlsbindesc.s | ||
tlsbindesc.sd | ||
tlsbindesc.td | ||
tlsbinpic.s | ||
tlsdesc-nacl.rd | ||
tlsdesc.dd | ||
tlsdesc.rd | ||
tlsdesc.s | ||
tlsdesc.sd | ||
tlsdesc.td | ||
tlsg.s | ||
tlsg.sd | ||
tlsgd1.dd | ||
tlsgd1.s | ||
tlsgd2.d | ||
tlsgd2.s | ||
tlsgdesc-nacl.rd | ||
tlsgdesc.dd | ||
tlsgdesc.rd | ||
tlsgdesc.s | ||
tlsie1.dd | ||
tlsie1.s | ||
tlsie2.d | ||
tlsie2.s | ||
tlsie3.d | ||
tlsie3.s | ||
tlsie4.d | ||
tlsie4.s | ||
tlsie5.d | ||
tlsie5.s | ||
tlsindntpoff.dd | ||
tlsindntpoff.s | ||
tlsld1.dd | ||
tlsld1.s | ||
tlslib.s | ||
tlsnopic-nacl.rd | ||
tlsnopic.dd | ||
tlsnopic.rd | ||
tlsnopic.sd | ||
tlsnopic1.s | ||
tlsnopic2.s | ||
tlspic-nacl.rd | ||
tlspic.dd | ||
tlspic.rd | ||
tlspic.sd | ||
tlspic.td | ||
tlspic1.s | ||
tlspic2.s | ||
tlspie1.d | ||
tlspie1.s | ||
tlspie2.d | ||
tlspie2.s | ||
vxworks1-lib.dd | ||
vxworks1-lib.nd | ||
vxworks1-lib.rd | ||
vxworks1-lib.s | ||
vxworks1-lib.td | ||
vxworks1-static.d | ||
vxworks1.dd | ||
vxworks1.ld | ||
vxworks1.rd | ||
vxworks1.s | ||
vxworks2-static.sd | ||
vxworks2.s | ||
vxworks2.sd | ||
warn1.d | ||
warn1.s | ||
zero.s |