binutils-gdb/ld/testsuite/ld-i386
H.J. Lu 04ebc307f9 Skip PLT for function pointer initialization
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.
2015-09-01 05:06:33 -07:00
..
abs-iamcu.d Add Intel MCU support to ld 2015-05-11 11:29:03 -07:00
abs.d
abs.s
alloc.d
alloc.s
alloc.t
combreloc.d
combreloc.s
compressed1.d Use nm/readelf with "failif" 2015-02-19 04:45:27 -08:00
compressed1.s
copyreloc-lib.c i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
copyreloc-main.S i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
copyreloc-main.out i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
copyreloc-main1.rd i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
copyreloc-main2.rd i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
discarded1.d
discarded1.s
discarded1.t
dummy.c i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
dummy.s Add Intel MCU support to ld 2015-05-11 11:29:03 -07:00
emit-relocs-nacl.rd
emit-relocs.rd
emit-relocs.s
export-class.exp ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
foo.s Add Intel MCU support to ld 2015-05-11 11:29:03 -07:00
hidden1.d
hidden1.s
hidden2.d
hidden2.s
hidden3.d
hidden3.s
i386-export-class.rd * ld-elf/export-class.sd: New test. 2012-08-28 20:29:19 +00:00
i386-export-class.xd * ld-elf/export-class.sd: New test. 2012-08-28 20:29:19 +00:00
i386.exp Skip PLT for function pointer initialization 2015-09-01 05:06:33 -07:00
iamcu-1.d Add Intel MCU support to ld 2015-05-11 11:29:03 -07:00
iamcu-2.d Add Intel MCU support to ld 2015-05-11 11:29:03 -07:00
iamcu-3.d Add Intel MCU support to ld 2015-05-11 11:29:03 -07:00
iamcu-4.d Default e_machine to EM_IAMCU for i?86-*-elfiamcu 2015-05-11 12:06:33 -07:00
lea1.s Convert mov to lea for loading local function address 2012-08-31 04:26:17 +00:00
lea1a.d Convert mov to lea for loading local function address 2012-08-31 04:26:17 +00:00
lea1b.d Convert mov to lea for loading local function address 2012-08-31 04:26:17 +00:00
lea1c.d Convert mov to lea for loading local function address 2012-08-31 04:26:17 +00:00
lea1d.d Convert mov to lea in size_dynamic_sections 2012-08-31 20:41:41 +00:00
lea1e.d Convert mov to lea in size_dynamic_sections 2012-08-31 20:41:41 +00:00
lea1f.d Convert mov to lea in size_dynamic_sections 2012-08-31 20:41:41 +00:00
mov1.s Don't optimize relocation against _DYNAMIC 2012-09-01 02:50:14 +00:00
mov1a.d Don't optimize relocation against _DYNAMIC 2012-09-01 02:50:14 +00:00
mov1b.d Don't optimize relocation against _DYNAMIC 2012-09-01 02:50:14 +00:00
nogot1.d
nogot1.s
nogot2.d
nogot2.s
pcrel8.d
pcrel8.s
pcrel16.d
pcrel16.s
pcrel16abs.d
pcrel16abs.s
plt-lib.c Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main.out Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main.rd Optimize out i386/x86-64 JUMP_SLOT relocation 2014-11-25 05:05:39 -08:00
plt-main1.c Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main1.rd Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main2.c Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main2.rd Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main3.c Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main3.rd Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main4.c Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main4.rd Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-main5.c Add function and function pointer tests for i386 2014-11-21 08:45:02 -08:00
plt-nacl.pd
plt-pic-nacl.pd
plt-pic.pd
plt-pic.s
plt.pd
plt.s
pltgot-1.d Keep .plt section and DT_PLTGOT for prelink 2015-06-24 13:47:37 -07:00
pltgot-1.s Allocate the first .plt entry space only if needed 2015-05-12 13:11:48 -07:00
pltgot-2.d Keep .plt section and DT_PLTGOT for prelink 2015-06-24 13:47:37 -07:00
pltlib.s
pr12570a.d
pr12570a.s
pr12570b.d
pr12570b.s
pr12627.d
pr12627.s
pr12627.t
pr12718.d Don't align text/data/bss sections for ELF 2013-05-31 17:27:28 +00:00
pr12718.s
pr12921.d bfd/ 2012-06-06 10:50:18 +00:00
pr12921.s
pr13302.d
pr13302.s
pr14215.d Don't hardcode .got.plt into DATA_SEGMENT_RELRO_END evaluation 2012-06-11 13:23:51 +00:00
pr14215.s Don't hardcode .got.plt into DATA_SEGMENT_RELRO_END evaluation 2012-06-11 13:23:51 +00:00
pr17057.d Update elf_i386_compute_jump_table_size 2014-07-15 13:09:55 -07:00
pr17057.s Update elf_i386_compute_jump_table_size 2014-07-15 13:09:55 -07:00
pr17306a.s Use bfd_is_abs_section to check discarded input section 2014-08-27 07:59:48 -07:00
pr17306b.s Use bfd_is_abs_section to check discarded input section 2014-08-27 07:59:48 -07:00
pr17689.out i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
pr17689.rd i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
pr17689a.c i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
pr17689a.t i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
pr17689b.S i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
pr17689now.rd Don't generate PLT relocations for now binding 2015-05-16 07:00:55 -07:00
pr17689ver.rd i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
pr17709-nacl.rd Add extern_protected_data and set it for x86 2015-04-10 11:06:34 -07:00
pr17709.rd Add extern_protected_data and set it for x86 2015-04-10 11:06:34 -07:00
pr17709a.s Add extern_protected_data and set it for x86 2015-04-10 11:06:34 -07:00
pr17709b.s Add extern_protected_data and set it for x86 2015-04-10 11:06:34 -07:00
pr17827.rd i386: Allow copy relocs for building PIE 2015-04-22 05:30:01 -07:00
pr17935-1.d Issue relocation in RO section warning for -z text 2015-02-07 05:28:06 -08:00
pr17935-1.s Issue relocation in RO section warning for -z text 2015-02-07 05:28:06 -08:00
pr17935-2.d Issue relocation in RO section warning for -z text 2015-02-07 05:28:06 -08:00
pr17935-2.s Issue relocation in RO section warning for -z text 2015-02-07 05:28:06 -08:00
pr18801.d Issue an error for read-only segment with dynamic IFUNC relocations 2015-08-13 04:31:38 -07:00
pr18801.s Issue an error for read-only segment with dynamic IFUNC relocations 2015-08-13 04:31:38 -07:00
pr18815.d Set EI_OSABI to ELFOSABI_GNU for local IFUNC symbols 2015-08-12 13:47:41 -07:00
pr18815.s Set EI_OSABI to ELFOSABI_GNU for local IFUNC symbols 2015-08-12 13:47:41 -07:00
pr18900.out Skip PLT for function pointer initialization 2015-09-01 05:06:33 -07:00
pr18900a.c Skip PLT for function pointer initialization 2015-09-01 05:06:33 -07:00
pr18900a.rd Skip PLT for function pointer initialization 2015-09-01 05:06:33 -07:00
pr18900b.c Skip PLT for function pointer initialization 2015-09-01 05:06:33 -07:00
pr18900b.rd Skip PLT for function pointer initialization 2015-09-01 05:06:33 -07:00
pr18900c.c Skip PLT for function pointer initialization 2015-09-01 05:06:33 -07:00
protected1.d
protected1.s
protected2.d
protected2.s
protected3.d Add extern_protected_data and set it for x86 2015-04-10 11:06:34 -07:00
protected3.s Add extern_protected_data and set it for x86 2015-04-10 11:06:34 -07:00
protected4.d
protected4.s
protected5.d
protected5.s
protected6.s Check GOTOFF reloc against protected data on x86 2015-04-10 14:02:23 -07:00
protected6a.d Replace SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL 2015-04-11 07:56:48 -07:00
protected6b.d Add -z noextern-protected-data to ld for ELF/x86 2015-04-14 04:13:11 -07:00
reloc.d
reloc.s
start.s Add Intel MCU support to ld 2015-05-11 11:29:03 -07:00
tlsbin-nacl.rd Properly place the NULL STT_FILE symbol 2015-02-16 04:54:45 -08:00
tlsbin.dd
tlsbin.rd Properly place the NULL STT_FILE symbol 2015-02-16 04:54:45 -08:00
tlsbin.s
tlsbin.sd
tlsbin.td
tlsbindesc-nacl.rd Properly place the NULL STT_FILE symbol 2015-02-16 04:54:45 -08:00
tlsbindesc.dd Don't align text/data/bss sections for ELF 2013-05-31 17:27:28 +00:00
tlsbindesc.rd Properly place the NULL STT_FILE symbol 2015-02-16 04:54:45 -08:00
tlsbindesc.s
tlsbindesc.sd
tlsbindesc.td
tlsbinpic.s
tlsdesc-nacl.rd Properly place the NULL STT_FILE symbol revistited 2015-02-18 00:31:52 +10:30
tlsdesc.dd
tlsdesc.rd Properly place the NULL STT_FILE symbol revistited 2015-02-18 00:31:52 +10:30
tlsdesc.s
tlsdesc.sd
tlsdesc.td
tlsg.s
tlsg.sd
tlsgd1.dd
tlsgd1.s
tlsgd2.d
tlsgd2.s
tlsgdesc-nacl.rd ld/testsuite/ 2012-07-02 18:20:31 +00:00
tlsgdesc.dd
tlsgdesc.rd ld/ 2012-06-15 15:13:41 +00:00
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 Properly place the NULL STT_FILE symbol revistited 2015-02-18 00:31:52 +10:30
tlsnopic.dd Don't align text/data/bss sections for ELF 2013-05-31 17:27:28 +00:00
tlsnopic.rd Properly place the NULL STT_FILE symbol revistited 2015-02-18 00:31:52 +10:30
tlsnopic.sd
tlsnopic1.s
tlsnopic2.s
tlspic-nacl.rd Properly place the NULL STT_FILE symbol revistited 2015-02-18 00:31:52 +10:30
tlspic.dd Don't align text/data/bss sections for ELF 2013-05-31 17:27:28 +00:00
tlspic.rd Properly place the NULL STT_FILE symbol revistited 2015-02-18 00:31:52 +10:30
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