binutils-gdb/ld/testsuite/ld-arm/ifunc-12.dd
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

96 lines
4.5 KiB
Plaintext

.*
Disassembly of section \.text:
0000a000 <f1>:
a000: e1a0f00e mov pc, lr
0000a004 <f2>:
a004: e1a0f00e mov pc, lr
0000a008 <f3>:
a008: e1a0f00e mov pc, lr
0000a00c <f1t>:
a00c: 46f7 mov pc, lr
0000a00e <f2t>:
a00e: 46f7 mov pc, lr
0000a010 <f3t>:
a010: 46f7 mov pc, lr
0000a012 <_start>:
a012: f8df 4004 ldr\.w r4, \[pc, #4\] ; a018 <_start\+0x6>
a016: 4c01 ldr r4, \[pc, #4\] ; \(a01c <_start\+0xa>\)
#------------------------------------------------------------------------------
#------ .got offset for foo
#------------------------------------------------------------------------------
a018: 00000018 \.word 0x00000018
#------------------------------------------------------------------------------
#------ PC-relative offset of .got entry for foo
#------------------------------------------------------------------------------
a01c: 00006ff0 \.word 0x00006ff0
a020: 4c00 ldr r4, \[pc, #0\] ; \(a024 <_start\+0x12>\)
a022: 4c01 ldr r4, \[pc, #4\] ; \(a028 <_start\+0x16>\)
#------------------------------------------------------------------------------
#------ .got offset for f1
#------------------------------------------------------------------------------
a024: 00000010 \.word 0x00000010
#------------------------------------------------------------------------------
#------ PC-relative offset of .got entry for f1
#------------------------------------------------------------------------------
a028: 00006fe8 \.word 0x00006fe8
a02c: 4c00 ldr r4, \[pc, #0\] ; \(a030 <_start\+0x1e>\)
a02e: 4c01 ldr r4, \[pc, #4\] ; \(a034 <_start\+0x22>\)
#------------------------------------------------------------------------------
#------ .got offset for f2
#------------------------------------------------------------------------------
a030: 00000024 \.word 0x00000024
#------------------------------------------------------------------------------
#------ PC-relative offset of .got entry for f2
#------------------------------------------------------------------------------
a034: 00006ff0 \.word 0x00006ff0
a038: 4c00 ldr r4, \[pc, #0\] ; \(a03c <_start\+0x2a>\)
a03a: 4c01 ldr r4, \[pc, #4\] ; \(a040 <_start\+0x2e>\)
#------------------------------------------------------------------------------
#------ .got offset for f3
#------------------------------------------------------------------------------
a03c: 00000020 \.word 0x00000020
#------------------------------------------------------------------------------
#------ PC-relative offset of .got entry for f3
#------------------------------------------------------------------------------
a040: 00006fe0 \.word 0x00006fe0
a044: 4c00 ldr r4, \[pc, #0\] ; \(a048 <_start\+0x36>\)
a046: 4c01 ldr r4, \[pc, #4\] ; \(a04c <_start\+0x3a>\)
#------------------------------------------------------------------------------
#------ .got offset for f1t
#------------------------------------------------------------------------------
a048: 00000014 \.word 0x00000014
#------------------------------------------------------------------------------
#------ PC-relative offset of .got entry for f1t
#------------------------------------------------------------------------------
a04c: 00006fc8 \.word 0x00006fc8
a050: 4c00 ldr r4, \[pc, #0\] ; \(a054 <_start\+0x42>\)
a052: 4c01 ldr r4, \[pc, #4\] ; \(a058 <_start\+0x46>\)
#------------------------------------------------------------------------------
#------ .got offset for f2t
#------------------------------------------------------------------------------
a054: 0000001c \.word 0x0000001c
#------------------------------------------------------------------------------
#------ PC-relative offset of .got entry for f2t
#------------------------------------------------------------------------------
a058: 00006fc4 \.word 0x00006fc4
a05c: 4c00 ldr r4, \[pc, #0\] ; \(a060 <_start\+0x4e>\)
a05e: 4c01 ldr r4, \[pc, #4\] ; \(a064 <_start\+0x52>\)
#------------------------------------------------------------------------------
#------ .got offset for f3t
#------------------------------------------------------------------------------
a060: 00000028 \.word 0x00000028
#------------------------------------------------------------------------------
#------ PC-relative offset of .got entry for f3t
#------------------------------------------------------------------------------
a064: 00006fc4 \.word 0x00006fc4