old-cross-binutils/ld/testsuite/ld-arm/ifunc-8.gd
Richard Sandiford 34e77a920a include/elf/
* arm.h (R_ARM_IRELATIVE): New relocation.

bfd/
	* reloc.c (BFD_RELOC_ARM_IRELATIVE): New relocation.
	* bfd-in2.h: Regenerate.
	* elf32-arm.c (elf32_arm_howto_table_2): Rename existing definition
	to elf32_arm_howto_table_3 and replace with a single R_ARM_IRELATIVE
	entry.
	(elf32_arm_howto_from_type): Update accordingly.
	(elf32_arm_reloc_map): Map BFD_RELOC_ARM_IRELATIVE to R_ARM_IRELATIVE.
	(elf32_arm_reloc_name_lookup): Handle elf32_arm_howto_table_3.
	(arm_plt_info): New structure, split out from elf32_arm_link_hash_entry
	with an extra noncall_refcount field.
	(arm_local_iplt_info): New structure.
	(elf_arm_obj_tdata): Add local_iplt.
	(elf32_arm_local_iplt): New accessor macro.
	(elf32_arm_link_hash_entry): Replace plt_thumb_refcount,
	plt_maybe_thumb_refcount and plt_got_offset with an arm_plt_info.
	Change tls_type to a bitfield and add is_iplt.
	(elf32_arm_link_hash_newfunc): Update accordingly.
	(elf32_arm_allocate_local_sym_info): New function.
	(elf32_arm_create_local_iplt): Likewise.
	(elf32_arm_get_plt_info): Likewise.
	(elf32_arm_plt_needs_thumb_stub_p): Likewise.
	(elf32_arm_get_local_dynreloc_list): Likewise.
	(create_ifunc_sections): Likewise.
	(elf32_arm_copy_indirect_symbol): Update after the changes to
	elf32_arm_link_hash_entry.  Assert the is_iplt has not yet been set.
	(arm_type_of_stub): Add an st_type argument.  Use elf32_arm_get_plt_info
	to get PLT information.  Assert that all STT_GNU_IFUNC references
	are turned into PLT references.
	(arm_build_one_stub): Pass the symbol type to
	elf32_arm_final_link_relocate.
	(elf32_arm_size_stubs): Pass the symbol type to arm_type_of_stub.
	(elf32_arm_allocate_irelocs): New function.
	(elf32_arm_add_dynreloc): In static objects, use .rel.iplt for
	all R_ARM_IRELATIVE.
	(elf32_arm_allocate_plt_entry): New function.
	(elf32_arm_populate_plt_entry): Likewise.
	(elf32_arm_final_link_relocate): Add an st_type parameter.
	Set srelgot to null for static objects.  Use separate variables
	to record which st_value and st_type should be used when generating
	a dynamic relocation.  Use elf32_arm_get_plt_info to find the
	symbol's PLT information, setting has_iplt_entry, splt,
	plt_offset and gotplt_offset accordingly.  Check whether
	STT_GNU_IFUNC symbols should resolve to an .iplt entry, and change
	the relocation target accordingly.  Broaden assert to include
	.iplts.  Don't set sreloc for static relocations.  Assert that
	we only generate dynamic R_ARM_RELATIVE relocations for R_ARM_ABS32
	and R_ARM_ABS32_NOI.  Generate R_ARM_IRELATIVE relocations instead
	of R_ARM_RELATIVE relocations if the target is an STT_GNU_IFUNC
	symbol.  Pass the symbol type to arm_type_of_stub.  Conditionally
	resolve GOT references to the .igot.plt entry.
	(elf32_arm_relocate_section): Update the call to
	elf32_arm_final_link_relocate.
	(elf32_arm_gc_sweep_hook): Use elf32_arm_get_plt_info to get PLT
	information.  Treat R_ARM_REL32 and R_ARM_REL32_NOI as call
	relocations in shared libraries and relocatable executables.
	Count non-call PLT references.  Use elf32_arm_get_local_dynreloc_list
	to get the list of dynamic relocations for a local symbol.
	(elf32_arm_check_relocs): Always create ifunc sections.  Set isym
	at the same time as setting h.  Use elf32_arm_allocate_local_sym_info
	to allocate local symbol information.  Treat R_ARM_REL32 and
	R_ARM_REL32_NOI as call relocations in shared libraries and
	relocatable executables.  Record PLT information for local
	STT_GNU_IFUNC functions as well as global functions.   Count
	non-call PLT references.  Use elf32_arm_get_local_dynreloc_list
	to get the list of dynamic relocations for a local symbol.
	(elf32_arm_adjust_dynamic_symbol): Handle STT_GNU_IFUNC symbols.
	Don't remove STT_GNU_IFUNC PLTs unless all references have been
	removed.  Update after the changes to elf32_arm_link_hash_entry.
	(allocate_dynrelocs_for_symbol): Decide whether STT_GNU_IFUNC PLT
	entries should live in .plt or .iplt.  Check whether the .igot.plt
	and .got entries can be combined.  Use elf32_arm_allocate_plt_entry
	to allocate .plt and .(i)got.plt entries.  Detect which .got
	entries will need R_ARM_IRELATIVE relocations and use
	elf32_arm_allocate_irelocs to allocate them.  Likewise other
	non-.got dynamic relocations.
	(elf32_arm_size_dynamic_sections): Allocate .iplt, .igot.plt
	and dynamic relocations for local STT_GNU_IFUNC symbols.
	Check whether the .igot.plt and .got entries can be combined.
	Detect which .got entries will need R_ARM_IRELATIVE relocations
	and use elf32_arm_allocate_irelocs to allocate them.  Use stashed
	section pointers intead of strcmp checks.  Handle iplt and igotplt.
	(elf32_arm_finish_dynamic_symbol): Use elf32_arm_populate_plt_entry
	to fill in .plt, .got.plt and .rel(a).plt entries.  Point
	STT_GNU_IFUNC symbols at an .iplt entry if non-call relocations
	resolve to it.
	(elf32_arm_output_plt_map_1): New function, split out from
	elf32_arm_output_plt_map.  Handle .iplt entries.  Use
	elf32_arm_plt_needs_thumb_stub_p.
	(elf32_arm_output_plt_map): Call it.
	(elf32_arm_output_arch_local_syms): Add mapping symbols for
	local .iplt entries.
	(elf32_arm_swap_symbol_in): Handle Thumb STT_GNU_IFUNC symbols.
	(elf32_arm_swap_symbol_out): Likewise.
	(elf32_arm_add_symbol_hook): New function.
	(elf_backend_add_symbol_hook): Define for all targets.

opcodes/
	* arm-dis.c (get_sym_code_type): Treat STT_GNU_IFUNCs as code.

gas/
	* config/tc-arm.c (md_pcrel_from_section): Use S_FORCE_RELOC to
	determine whether a relocation is needed.
	(md_apply_fix, arm_apply_sym_value): Likewise.

ld/testsuite/
	* ld-arm/ifunc-1.s, ld-arm/ifunc-1.dd, ld-arm/ifunc-1.gd,
	ld-arm/ifunc-1.rd, ld-arm/ifunc-2.s, ld-arm/ifunc-2.dd,
	ld-arm/ifunc-2.gd, ld-arm/ifunc-2.rd, ld-arm/ifunc-3.s,
	ld-arm/ifunc-3.dd, ld-arm/ifunc-3.gd, ld-arm/ifunc-3.rd,
	ld-arm/ifunc-4.s, ld-arm/ifunc-4.dd, ld-arm/ifunc-4.gd,
	ld-arm/ifunc-4.rd, ld-arm/ifunc-5.s, ld-arm/ifunc-5.dd,
	ld-arm/ifunc-5.gd, ld-arm/ifunc-5.rd, ld-arm/ifunc-6.s,
	ld-arm/ifunc-6.dd, ld-arm/ifunc-6.gd, ld-arm/ifunc-6.rd,
	ld-arm/ifunc-7.s, ld-arm/ifunc-7.dd, ld-arm/ifunc-7.gd,
	ld-arm/ifunc-7.rd, ld-arm/ifunc-8.s, ld-arm/ifunc-8.dd,
	ld-arm/ifunc-8.gd, ld-arm/ifunc-8.rd, ld-arm/ifunc-9.s,
	ld-arm/ifunc-9.dd, ld-arm/ifunc-9.gd, ld-arm/ifunc-9.rd,
	ld-arm/ifunc-10.s, ld-arm/ifunc-10.dd, ld-arm/ifunc-10.gd,
	ld-arm/ifunc-10.rd, ld-arm/ifunc-11.s, ld-arm/ifunc-11.dd,
	ld-arm/ifunc-11.gd, ld-arm/ifunc-11.rd, ld-arm/ifunc-12.s,
	ld-arm/ifunc-12.dd, ld-arm/ifunc-12.gd, ld-arm/ifunc-12.rd,
	ld-arm/ifunc-13.s, ld-arm/ifunc-13.dd, ld-arm/ifunc-13.gd,
	ld-arm/ifunc-13.rd, ld-arm/ifunc-14.s, ld-arm/ifunc-14.dd,
	ld-arm/ifunc-14.gd, ld-arm/ifunc-14.rd, ld-arm/ifunc-15.s,
	ld-arm/ifunc-15.dd, ld-arm/ifunc-15.gd, ld-arm/ifunc-15.rd,
	ld-arm/ifunc-16.s, ld-arm/ifunc-16.dd, ld-arm/ifunc-16.gd,
	ld-arm/ifunc-16.rd, ld-arm/ifunc-dynamic.ld,
	ld-arm/ifunc-static.ld: New tests.
	* ld-arm/farcall-group.d, ld-arm/farcall-group-size2.d,
	ld-arm/farcall-mixed-lib-v4t.d, ld-arm/farcall-mixed-lib.d: Update
	for new stub hashes.
	* ld-arm/arm-elf.exp: Run them.
2011-03-14 16:04:16 +00:00

167 lines
9.4 KiB
GDScript3

.*
Contents of section \.data:
#------------------------------------------------------------------------------
#------ 00010000: foo
#------ 00010004: contains aaf1 [R_ARM_IRELATIVE]
#------ 00010008: contains PC-relative offset of aaf1's .iplt entry
#------ 0001000c: contains atf1 [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
10000 44332211 00a00000 bc90ffff 04a00000 .*
#------------------------------------------------------------------------------
#------ 00010010: contains PC-relative offset of atf1's .iplt entry
#------ 00010014: contains abf1 [R_ARM_IRELATIVE]
#------ 00010018: contains PC-relative offset of abf1's .iplt entry
#------ 0001001c: contains taf1 [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
10010 c490ffff 08a00000 cc90ffff 0da00000 .*
#------------------------------------------------------------------------------
#------ 00010020: contains PC-relative offset of taf1's .iplt entry
#------ 00010024: contains ttf1 [R_ARM_IRELATIVE]
#------ 00010028: contains PC-relative offset of ttf1's .iplt entry
#------ 0001002c: contains tbf1 [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
10020 d090ffff 0fa00000 d890ffff 11a00000 .*
#------------------------------------------------------------------------------
#------ 00010030: contains PC-relative offset of tbf1's .iplt entry
#------ 00010034: aaf2 [R_ARM_ABS32]
#------ 00010038: aaf2 [R_ARM_REL32]
#------ 0001003c: atf2 [R_ARM_ABS32]
#------------------------------------------------------------------------------
10030 e090ffff 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 00010040: atf2 [R_ARM_REL32]
#------ 00010044: abf2 [R_ARM_ABS32]
#------ 00010048: abf2 [R_ARM_REL32]
#------ 0001004c: taf2 [R_ARM_ABS32]
#------------------------------------------------------------------------------
10040 00000000 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 00010050: taf2 [R_ARM_REL32]
#------ 00010054: ttf2 [R_ARM_ABS32]
#------ 00010058: ttf2 [R_ARM_REL32]
#------ 0001005c: tbf2 [R_ARM_ABS32]
#------------------------------------------------------------------------------
10050 00000000 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 00010060: tbf2 [R_ARM_REL32]
#------ 00010064: contains aaf3 [R_ARM_IRELATIVE]
#------ 00010068: contains PC-relative offset of aaf3's .iplt entry
#------ 0001006c: contains atf3 [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
10060 00000000 14a00000 0091ffff 18a00000 .*
#------------------------------------------------------------------------------
#------ 00010070: contains PC-relative offset of atf3's .iplt entry
#------ 00010074: contains abf3 [R_ARM_IRELATIVE]
#------ 00010078: contains PC-relative offset of abf3's .iplt entry
#------ 0001007c: contains taf3 [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
10070 b090ffff 1ca00000 b890ffff 21a00000 .*
#------------------------------------------------------------------------------
#------ 00010080: contains PC-relative offset of taf3's .iplt entry
#------ 00010084: contains ttf3 [R_ARM_IRELATIVE]
#------ 00010088: contains PC-relative offset of ttf3's .iplt entry
#------ 0001008c: contains tbf3 [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
10080 dc90ffff 23a00000 b890ffff 25a00000 .*
#------------------------------------------------------------------------------
#------ 00010090: contains PC-relative offset of tbf3's .iplt entry
#------ 00010094: aaf4 [R_ARM_ABS32]
#------ 00010098: aaf4 [R_ARM_REL32]
#------ 0001009c: atf4 [R_ARM_ABS32]
#------------------------------------------------------------------------------
10090 c090ffff 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 000100a0: atf4 [R_ARM_REL32]
#------ 000100a4: abf4 [R_ARM_ABS32]
#------ 000100a8: abf4 [R_ARM_REL32]
#------ 000100ac: taf4 [R_ARM_ABS32]
#------------------------------------------------------------------------------
100a0 00000000 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 000100b0: taf4 [R_ARM_REL32]
#------ 000100b4: ttf4 [R_ARM_ABS32]
#------ 000100b8: ttf4 [R_ARM_REL32]
#------ 000100bc: tbf4 [R_ARM_ABS32]
#------------------------------------------------------------------------------
100b0 00000000 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 000100c0: tbf4 [R_ARM_REL32]
#------------------------------------------------------------------------------
100c0 00000000 .*
Contents of section \.got:
#------------------------------------------------------------------------------
#------ 00011000: .got.plt
#------ 00011004: reserved .got.plt entry
#------ 00011008: reserved .got.plt entry
#------ 0001100c: atf2's .got.plt entry [R_ARM_JUMP_SLOT]
#------------------------------------------------------------------------------
11000 00200100 00000000 00000000 00900000 .*
#------------------------------------------------------------------------------
#------ 00011010: aaf4's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 00011014: ttf2's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 00011018: tbf2's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 0001101c: taf2's .got.plt entry [R_ARM_JUMP_SLOT]
#------------------------------------------------------------------------------
11010 00900000 00900000 00900000 00900000 .*
#------------------------------------------------------------------------------
#------ 00011020: aaf2's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 00011024: abf4's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 00011028: tbf4's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 0001102c: ttf4's .got.plt entry [R_ARM_JUMP_SLOT]
#------------------------------------------------------------------------------
11020 00900000 00900000 00900000 00900000 .*
#------------------------------------------------------------------------------
#------ 00011030: atf4's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 00011034: taf4's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 00011038: abf2's .got.plt entry [R_ARM_JUMP_SLOT]
#------ 0001103c: aaf1's .igot.plt entry [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
11030 00900000 00900000 00900000 00a00000 .*
#------------------------------------------------------------------------------
#------ 00011040: atf1's .igot.plt entry [R_ARM_IRELATIVE]
#------ 00011044: abf1's .igot.plt entry [R_ARM_IRELATIVE]
#------ 00011048: taf1's .igot.plt entry [R_ARM_IRELATIVE]
#------ 0001104c: ttf1's .igot.plt entry [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
11040 04a00000 08a00000 0da00000 0fa00000 .*
#------------------------------------------------------------------------------
#------ 00011050: tbf1's .igot.plt entry [R_ARM_IRELATIVE]
#------ 00011054: atf3's .igot.plt entry [R_ARM_IRELATIVE]
#------ 00011058: abf3's .igot.plt entry [R_ARM_IRELATIVE]
#------ 0001105c: ttf3's .igot.plt entry [R_ARM_IRELATIVE]
#------------------------------------------------------------------------------
11050 11a00000 18a00000 1ca00000 23a00000 .*
#------------------------------------------------------------------------------
#------ 00011060: tbf3's .igot.plt entry [R_ARM_IRELATIVE]
#------ 00011064: taf3's .igot.plt entry [R_ARM_IRELATIVE]
#------ 00011068: aaf3's .igot.plt entry [R_ARM_IRELATIVE]
#------ 0001106c: .got entry for foo [R_ARM_RELATIVE]
#------------------------------------------------------------------------------
11060 25a00000 21a00000 14a00000 00000100 .*
#------------------------------------------------------------------------------
#------ 00011070: .got entry for foo [R_ARM_RELATIVE]
#------ 00011074: .got entry for atf2 [R_ARM_GLOB_DAT]
#------ 00011078: .got entry for aaf4 [R_ARM_GLOB_DAT]
#------ 0001107c: .got entry for ttf2 [R_ARM_GLOB_DAT]
#------------------------------------------------------------------------------
11070 00000100 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 00011080: .got entry for tbf2 [R_ARM_GLOB_DAT]
#------ 00011084: .got entry for taf2 [R_ARM_GLOB_DAT]
#------ 00011088: .got entry for aaf2 [R_ARM_GLOB_DAT]
#------ 0001108c: .got entry for abf4 [R_ARM_GLOB_DAT]
#------------------------------------------------------------------------------
11080 00000000 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 00011090: .got entry for tbf4 [R_ARM_GLOB_DAT]
#------ 00011094: .got entry for ttf4 [R_ARM_GLOB_DAT]
#------ 00011098: .got entry for atf4 [R_ARM_GLOB_DAT]
#------ 0001109c: .got entry for taf4 [R_ARM_GLOB_DAT]
#------------------------------------------------------------------------------
11090 00000000 00000000 00000000 00000000 .*
#------------------------------------------------------------------------------
#------ 000110a0: .got entry for abf2 [R_ARM_GLOB_DAT]
#------------------------------------------------------------------------------
110a0 00000000 .*