aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog98
-rw-r--r--bfd/bfd-in2.h3
-rw-r--r--bfd/elf32-arm.c1593
-rw-r--r--bfd/reloc.c5
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-arm.c25
-rw-r--r--include/elf/ChangeLog4
-rw-r--r--include/elf/arm.h2
-rw-r--r--ld/testsuite/ChangeLog30
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp82
-rw-r--r--ld/testsuite/ld-arm/farcall-group-size2.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-group.d42
-rw-r--r--ld/testsuite/ld-arm/farcall-mixed-lib-v4t.d16
-rw-r--r--ld/testsuite/ld-arm/farcall-mixed-lib.d16
-rw-r--r--ld/testsuite/ld-arm/ifunc-1.dd139
-rw-r--r--ld/testsuite/ld-arm/ifunc-1.gd29
-rw-r--r--ld/testsuite/ld-arm/ifunc-1.rd8
-rw-r--r--ld/testsuite/ld-arm/ifunc-1.s48
-rw-r--r--ld/testsuite/ld-arm/ifunc-10.dd951
-rw-r--r--ld/testsuite/ld-arm/ifunc-10.gd188
-rw-r--r--ld/testsuite/ld-arm/ifunc-10.rd42
-rw-r--r--ld/testsuite/ld-arm/ifunc-10.s90
-rw-r--r--ld/testsuite/ld-arm/ifunc-11.dd95
-rw-r--r--ld/testsuite/ld-arm/ifunc-11.gd29
-rw-r--r--ld/testsuite/ld-arm/ifunc-11.rd11
-rw-r--r--ld/testsuite/ld-arm/ifunc-11.s52
-rw-r--r--ld/testsuite/ld-arm/ifunc-12.dd95
-rw-r--r--ld/testsuite/ld-arm/ifunc-12.gd39
-rw-r--r--ld/testsuite/ld-arm/ifunc-12.rd19
-rw-r--r--ld/testsuite/ld-arm/ifunc-12.s58
-rw-r--r--ld/testsuite/ld-arm/ifunc-13.dd89
-rw-r--r--ld/testsuite/ld-arm/ifunc-13.gd29
-rw-r--r--ld/testsuite/ld-arm/ifunc-13.rd9
-rw-r--r--ld/testsuite/ld-arm/ifunc-13.s50
-rw-r--r--ld/testsuite/ld-arm/ifunc-14.dd100
-rw-r--r--ld/testsuite/ld-arm/ifunc-14.gd27
-rw-r--r--ld/testsuite/ld-arm/ifunc-14.rd12
-rw-r--r--ld/testsuite/ld-arm/ifunc-14.s47
-rw-r--r--ld/testsuite/ld-arm/ifunc-15.dd100
-rw-r--r--ld/testsuite/ld-arm/ifunc-15.gd27
-rw-r--r--ld/testsuite/ld-arm/ifunc-15.rd12
-rw-r--r--ld/testsuite/ld-arm/ifunc-15.s47
-rw-r--r--ld/testsuite/ld-arm/ifunc-16.dd88
-rw-r--r--ld/testsuite/ld-arm/ifunc-16.gd27
-rw-r--r--ld/testsuite/ld-arm/ifunc-16.rd9
-rw-r--r--ld/testsuite/ld-arm/ifunc-16.s49
-rw-r--r--ld/testsuite/ld-arm/ifunc-2.dd445
-rw-r--r--ld/testsuite/ld-arm/ifunc-2.gd48
-rw-r--r--ld/testsuite/ld-arm/ifunc-2.rd13
-rw-r--r--ld/testsuite/ld-arm/ifunc-2.s74
-rw-r--r--ld/testsuite/ld-arm/ifunc-3.dd126
-rw-r--r--ld/testsuite/ld-arm/ifunc-3.gd45
-rw-r--r--ld/testsuite/ld-arm/ifunc-3.rd20
-rw-r--r--ld/testsuite/ld-arm/ifunc-3.s49
-rw-r--r--ld/testsuite/ld-arm/ifunc-4.dd1055
-rw-r--r--ld/testsuite/ld-arm/ifunc-4.gd167
-rw-r--r--ld/testsuite/ld-arm/ifunc-4.rd74
-rw-r--r--ld/testsuite/ld-arm/ifunc-4.s95
-rw-r--r--ld/testsuite/ld-arm/ifunc-5.dd91
-rw-r--r--ld/testsuite/ld-arm/ifunc-5.gd23
-rw-r--r--ld/testsuite/ld-arm/ifunc-5.rd8
-rw-r--r--ld/testsuite/ld-arm/ifunc-5.s39
-rw-r--r--ld/testsuite/ld-arm/ifunc-6.dd175
-rw-r--r--ld/testsuite/ld-arm/ifunc-6.gd27
-rw-r--r--ld/testsuite/ld-arm/ifunc-6.rd9
-rw-r--r--ld/testsuite/ld-arm/ifunc-6.s59
-rw-r--r--ld/testsuite/ld-arm/ifunc-7.dd120
-rw-r--r--ld/testsuite/ld-arm/ifunc-7.gd45
-rw-r--r--ld/testsuite/ld-arm/ifunc-7.rd21
-rw-r--r--ld/testsuite/ld-arm/ifunc-7.s42
-rw-r--r--ld/testsuite/ld-arm/ifunc-8.dd1017
-rw-r--r--ld/testsuite/ld-arm/ifunc-8.gd167
-rw-r--r--ld/testsuite/ld-arm/ifunc-8.rd80
-rw-r--r--ld/testsuite/ld-arm/ifunc-8.s88
-rw-r--r--ld/testsuite/ld-arm/ifunc-9.dd154
-rw-r--r--ld/testsuite/ld-arm/ifunc-9.gd29
-rw-r--r--ld/testsuite/ld-arm/ifunc-9.rd10
-rw-r--r--ld/testsuite/ld-arm/ifunc-9.s44
-rw-r--r--ld/testsuite/ld-arm/ifunc-dynamic.ld33
-rw-r--r--ld/testsuite/ld-arm/ifunc-static.ld21
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/arm-dis.c2
82 files changed, 8544 insertions, 528 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0bdc2ad..a1131c8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,103 @@
2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+ * 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.
+
+2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+
* elf-bfd.h (elf_link_hash_entry): Add target_internal.
* elf.c (swap_out_syms): Set st_target_internal for each
Elf_Internal_Sym.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 84fc75d..5f3a31f 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -3186,6 +3186,9 @@ pc-relative or some form of GOT-indirect relocation. */
/* Annotation of BX instructions. */
BFD_RELOC_ARM_V4BX,
+/* ARM support for STT_GNU_IFUNC. */
+ BFD_RELOC_ARM_IRELATIVE,
+
/* These relocs are only used within the ARM assembler. They are not
(at present) written to any object files. */
BFD_RELOC_ARM_IMMEDIATE,
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 9f2b696..6b69fd6 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -1651,6 +1651,7 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
0x00000fff, /* dst_mask */
FALSE), /* pcrel_offset */
+ /* 112-127 private relocations. */
EMPTY_HOWTO (112),
EMPTY_HOWTO (113),
EMPTY_HOWTO (114),
@@ -1667,6 +1668,8 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
EMPTY_HOWTO (125),
EMPTY_HOWTO (126),
EMPTY_HOWTO (127),
+
+ /* R_ARM_ME_TOO, obsolete. */
EMPTY_HOWTO (128),
HOWTO (R_ARM_THM_TLS_DESCSEQ, /* type */
@@ -1684,13 +1687,26 @@ static reloc_howto_type elf32_arm_howto_table_1[] =
FALSE), /* pcrel_offset */
};
-/* 112-127 private relocations
- 128 R_ARM_ME_TOO, obsolete
- 129-255 unallocated in AAELF.
-
- 249-255 extended, currently unused, relocations: */
+/* 160 onwards: */
+static reloc_howto_type elf32_arm_howto_table_2[1] =
+{
+ HOWTO (R_ARM_IRELATIVE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_IRELATIVE", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE) /* pcrel_offset */
+};
-static reloc_howto_type elf32_arm_howto_table_2[4] =
+/* 249-255 extended, currently unused, relocations: */
+static reloc_howto_type elf32_arm_howto_table_3[4] =
{
HOWTO (R_ARM_RREL32, /* type */
0, /* rightshift */
@@ -1755,9 +1771,12 @@ elf32_arm_howto_from_type (unsigned int r_type)
if (r_type < ARRAY_SIZE (elf32_arm_howto_table_1))
return &elf32_arm_howto_table_1[r_type];
+ if (r_type == R_ARM_IRELATIVE)
+ return &elf32_arm_howto_table_2[r_type - R_ARM_IRELATIVE];
+
if (r_type >= R_ARM_RREL32
- && r_type < R_ARM_RREL32 + ARRAY_SIZE (elf32_arm_howto_table_2))
- return &elf32_arm_howto_table_2[r_type - R_ARM_RREL32];
+ && r_type < R_ARM_RREL32 + ARRAY_SIZE (elf32_arm_howto_table_3))
+ return &elf32_arm_howto_table_3[r_type - R_ARM_RREL32];
return NULL;
}
@@ -1827,6 +1846,7 @@ static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
{BFD_RELOC_ARM_TLS_TPOFF32, R_ARM_TLS_TPOFF32},
{BFD_RELOC_ARM_TLS_IE32, R_ARM_TLS_IE32},
{BFD_RELOC_ARM_TLS_LE32, R_ARM_TLS_LE32},
+ {BFD_RELOC_ARM_IRELATIVE, R_ARM_IRELATIVE},
{BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT},
{BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY},
{BFD_RELOC_ARM_MOVW, R_ARM_MOVW_ABS_NC},
@@ -1897,6 +1917,11 @@ elf32_arm_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
&& strcasecmp (elf32_arm_howto_table_2[i].name, r_name) == 0)
return &elf32_arm_howto_table_2[i];
+ for (i = 0; i < ARRAY_SIZE (elf32_arm_howto_table_3); i++)
+ if (elf32_arm_howto_table_3[i].name != NULL
+ && strcasecmp (elf32_arm_howto_table_3[i].name, r_name) == 0)
+ return &elf32_arm_howto_table_3[i];
+
return NULL;
}
@@ -2550,6 +2575,44 @@ struct a8_erratum_reloc {
/* The size of the thread control block. */
#define TCB_SIZE 8
+/* ARM-specific information about a PLT entry, over and above the usual
+ gotplt_union. */
+struct arm_plt_info {
+ /* We reference count Thumb references to a PLT entry separately,
+ so that we can emit the Thumb trampoline only if needed. */
+ bfd_signed_vma thumb_refcount;
+
+ /* Some references from Thumb code may be eliminated by BL->BLX
+ conversion, so record them separately. */
+ bfd_signed_vma maybe_thumb_refcount;
+
+ /* How many of the recorded PLT accesses were from non-call relocations.
+ This information is useful when deciding whether anything takes the
+ address of an STT_GNU_IFUNC PLT. A value of 0 means that all
+ non-call references to the function should resolve directly to the
+ real runtime target. */
+ unsigned int noncall_refcount;
+
+ /* Since PLT entries have variable size if the Thumb prologue is
+ used, we need to record the index into .got.plt instead of
+ recomputing it from the PLT offset. */
+ bfd_signed_vma got_offset;
+};
+
+/* Information about an .iplt entry for a local STT_GNU_IFUNC symbol. */
+struct arm_local_iplt_info {
+ /* The information that is usually found in the generic ELF part of
+ the hash table entry. */
+ union gotplt_union root;
+
+ /* The information that is usually found in the ARM-specific part of
+ the hash table entry. */
+ struct arm_plt_info arm;
+
+ /* A list of all potential dynamic relocations against this symbol. */
+ struct elf_dyn_relocs *dyn_relocs;
+};
+
struct elf_arm_obj_tdata
{
struct elf_obj_tdata root;
@@ -2560,6 +2623,9 @@ struct elf_arm_obj_tdata
/* GOTPLT entries for TLS descriptors. */
bfd_vma *local_tlsdesc_gotent;
+ /* Information for local symbols that need entries in .iplt. */
+ struct arm_local_iplt_info **local_iplt;
+
/* Zero to warn when linking objects with incompatible enum sizes. */
int no_enum_size_warning;
@@ -2576,6 +2642,9 @@ struct elf_arm_obj_tdata
#define elf32_arm_local_tlsdesc_gotent(bfd) \
(elf_arm_tdata (bfd)->local_tlsdesc_gotent)
+#define elf32_arm_local_iplt(bfd) \
+ (elf_arm_tdata (bfd)->local_iplt)
+
#define is_arm_elf(bfd) \
(bfd_get_flavour (bfd) == bfd_target_elf_flavour \
&& elf_tdata (bfd) != NULL \
@@ -2598,18 +2667,8 @@ struct elf32_arm_link_hash_entry
/* Track dynamic relocs copied for this symbol. */
struct elf_dyn_relocs *dyn_relocs;
- /* We reference count Thumb references to a PLT entry separately,
- so that we can emit the Thumb trampoline only if needed. */
- bfd_signed_vma plt_thumb_refcount;
-
- /* Some references from Thumb code may be eliminated by BL->BLX
- conversion, so record them separately. */
- bfd_signed_vma plt_maybe_thumb_refcount;
-
- /* Since PLT entries have variable size if the Thumb prologue is
- used, we need to record the index into .got.plt instead of
- recomputing it from the PLT offset. */
- bfd_signed_vma plt_got_offset;
+ /* ARM-specific PLT information. */
+ struct arm_plt_info plt;
#define GOT_UNKNOWN 0
#define GOT_NORMAL 1
@@ -2617,7 +2676,12 @@ struct elf32_arm_link_hash_entry
#define GOT_TLS_IE 4
#define GOT_TLS_GDESC 8
#define GOT_TLS_GD_ANY_P(type) ((type & GOT_TLS_GD) || (type & GOT_TLS_GDESC))
- unsigned char tls_type;
+ unsigned int tls_type : 8;
+
+ /* True if the symbol's PLT entry is in .iplt rather than .plt. */
+ unsigned int is_iplt : 1;
+
+ unsigned int unused : 23;
/* Offset of the GOTPLT entry reserved for the TLS descriptor,
starting at the end of the jump table. */
@@ -2833,9 +2897,11 @@ elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry,
ret->dyn_relocs = NULL;
ret->tls_type = GOT_UNKNOWN;
ret->tlsdesc_got = (bfd_vma) -1;
- ret->plt_thumb_refcount = 0;
- ret->plt_maybe_thumb_refcount = 0;
- ret->plt_got_offset = -1;
+ ret->plt.thumb_refcount = 0;
+ ret->plt.maybe_thumb_refcount = 0;
+ ret->plt.noncall_refcount = 0;
+ ret->plt.got_offset = -1;
+ ret->is_iplt = FALSE;
ret->export_glue = NULL;
ret->stub_cache = NULL;
@@ -2844,6 +2910,142 @@ elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry,
return (struct bfd_hash_entry *) ret;
}
+/* Ensure that we have allocated bookkeeping structures for ABFD's local
+ symbols. */
+
+static bfd_boolean
+elf32_arm_allocate_local_sym_info (bfd *abfd)
+{
+ if (elf_local_got_refcounts (abfd) == NULL)
+ {
+ bfd_size_type num_syms;
+ bfd_size_type size;
+ char *data;
+
+ num_syms = elf_tdata (abfd)->symtab_hdr.sh_info;
+ size = num_syms * (sizeof (bfd_signed_vma)
+ + sizeof (struct arm_local_iplt_info *)
+ + sizeof (bfd_vma)
+ + sizeof (char));
+ data = bfd_zalloc (abfd, size);
+ if (data == NULL)
+ return FALSE;
+
+ elf_local_got_refcounts (abfd) = (bfd_signed_vma *) data;
+ data += num_syms * sizeof (bfd_signed_vma);
+
+ elf32_arm_local_iplt (abfd) = (struct arm_local_iplt_info **) data;
+ data += num_syms * sizeof (struct arm_local_iplt_info *);
+
+ elf32_arm_local_tlsdesc_gotent (abfd) = (bfd_vma *) data;
+ data += num_syms * sizeof (bfd_vma);
+
+ elf32_arm_local_got_tls_type (abfd) = data;
+ }
+ return TRUE;
+}
+
+/* Return the .iplt information for local symbol R_SYMNDX, which belongs
+ to input bfd ABFD. Create the information if it doesn't already exist.
+ Return null if an allocation fails. */
+
+static struct arm_local_iplt_info *
+elf32_arm_create_local_iplt (bfd *abfd, unsigned long r_symndx)
+{
+ struct arm_local_iplt_info **ptr;
+
+ if (!elf32_arm_allocate_local_sym_info (abfd))
+ return NULL;
+
+ BFD_ASSERT (r_symndx < elf_tdata (abfd)->symtab_hdr.sh_info);
+ ptr = &elf32_arm_local_iplt (abfd)[r_symndx];
+ if (*ptr == NULL)
+ *ptr = bfd_zalloc (abfd, sizeof (**ptr));
+ return *ptr;
+}
+
+/* Try to obtain PLT information for the symbol with index R_SYMNDX
+ in ABFD's symbol table. If the symbol is global, H points to its
+ hash table entry, otherwise H is null.
+
+ Return true if the symbol does have PLT information. When returning
+ true, point *ROOT_PLT at the target-independent reference count/offset
+ union and *ARM_PLT at the ARM-specific information. */
+
+static bfd_boolean
+elf32_arm_get_plt_info (bfd *abfd, struct elf32_arm_link_hash_entry *h,
+ unsigned long r_symndx, union gotplt_union **root_plt,
+ struct arm_plt_info **arm_plt)
+{
+ struct arm_local_iplt_info *local_iplt;
+
+ if (h != NULL)
+ {
+ *root_plt = &h->root.plt;
+ *arm_plt = &h->plt;
+ return TRUE;
+ }
+
+ if (elf32_arm_local_iplt (abfd) == NULL)
+ return FALSE;
+
+ local_iplt = elf32_arm_local_iplt (abfd)[r_symndx];
+ if (local_iplt == NULL)
+ return FALSE;
+
+ *root_plt = &local_iplt->root;
+ *arm_plt = &local_iplt->arm;
+ return TRUE;
+}
+
+/* Return true if the PLT described by ARM_PLT requires a Thumb stub
+ before it. */
+
+static bfd_boolean
+elf32_arm_plt_needs_thumb_stub_p (struct bfd_link_info *info,
+ struct arm_plt_info *arm_plt)
+{
+ struct elf32_arm_link_hash_table *htab;
+
+ htab = elf32_arm_hash_table (info);
+ return (arm_plt->thumb_refcount != 0
+ || (!htab->use_blx && arm_plt->maybe_thumb_refcount != 0));
+}
+
+/* Return a pointer to the head of the dynamic reloc list that should
+ be used for local symbol ISYM, which is symbol number R_SYMNDX in
+ ABFD's symbol table. Return null if an error occurs. */
+
+static struct elf_dyn_relocs **
+elf32_arm_get_local_dynreloc_list (bfd *abfd, unsigned long r_symndx,
+ Elf_Internal_Sym *isym)
+{
+ if (ELF32_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
+ {
+ struct arm_local_iplt_info *local_iplt;
+
+ local_iplt = elf32_arm_create_local_iplt (abfd, r_symndx);
+ if (local_iplt == NULL)
+ return NULL;
+ return &local_iplt->dyn_relocs;
+ }
+ else
+ {
+ /* Track dynamic relocs needed for local syms too.
+ We really need local syms available to do this
+ easily. Oh well. */
+ asection *s;
+ void *vpp;
+
+ s = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ if (s == NULL)
+ abort ();
+
+ vpp = &elf_section_data (s)->local_dynrel;
+ return (struct elf_dyn_relocs **) vpp;
+ }
+}
+
/* Initialize an entry in the stub hash table. */
static struct bfd_hash_entry *
@@ -2909,6 +3111,53 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
return TRUE;
}
+/* Create the .iplt, .rel(a).iplt and .igot.plt sections. */
+
+static bfd_boolean
+create_ifunc_sections (struct bfd_link_info *info)
+{
+ struct elf32_arm_link_hash_table *htab;
+ const struct elf_backend_data *bed;
+ bfd *dynobj;
+ asection *s;
+ flagword flags;
+
+ htab = elf32_arm_hash_table (info);
+ dynobj = htab->root.dynobj;
+ bed = get_elf_backend_data (dynobj);
+ flags = bed->dynamic_sec_flags;
+
+ if (htab->root.iplt == NULL)
+ {
+ s = bfd_make_section_with_flags (dynobj, ".iplt",
+ flags | SEC_READONLY | SEC_CODE);
+ if (s == NULL
+ || !bfd_set_section_alignment (abfd, s, bed->plt_alignment))
+ return FALSE;
+ htab->root.iplt = s;
+ }
+
+ if (htab->root.irelplt == NULL)
+ {
+ s = bfd_make_section_with_flags (dynobj, RELOC_SECTION (htab, ".iplt"),
+ flags | SEC_READONLY);
+ if (s == NULL
+ || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+ return FALSE;
+ htab->root.irelplt = s;
+ }
+
+ if (htab->root.igotplt == NULL)
+ {
+ s = bfd_make_section_with_flags (dynobj, ".igot.plt", flags);
+ if (s == NULL
+ || !bfd_set_section_alignment (dynobj, s, bed->s->log_file_align))
+ return FALSE;
+ htab->root.igotplt = s;
+ }
+ return TRUE;
+}
+
/* Create .plt, .rel(a).plt, .got, .got.plt, .rel(a).got, .dynbss, and
.rel(a).bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
@@ -3008,10 +3257,16 @@ elf32_arm_copy_indirect_symbol (struct bfd_link_info *info,
if (ind->root.type == bfd_link_hash_indirect)
{
/* Copy over PLT info. */
- edir->plt_thumb_refcount += eind->plt_thumb_refcount;
- eind->plt_thumb_refcount = 0;
- edir->plt_maybe_thumb_refcount += eind->plt_maybe_thumb_refcount;
- eind->plt_maybe_thumb_refcount = 0;
+ edir->plt.thumb_refcount += eind->plt.thumb_refcount;
+ eind->plt.thumb_refcount = 0;
+ edir->plt.maybe_thumb_refcount += eind->plt.maybe_thumb_refcount;
+ eind->plt.maybe_thumb_refcount = 0;
+ edir->plt.noncall_refcount += eind->plt.noncall_refcount;
+ eind->plt.noncall_refcount = 0;
+
+ /* We should only allocate a function to .iplt once the final
+ symbol information is known. */
+ BFD_ASSERT (!eind->is_iplt);
if (dir->got.refcount <= 0)
{
@@ -3189,6 +3444,7 @@ static enum elf32_arm_stub_type
arm_type_of_stub (struct bfd_link_info *info,
asection *input_sec,
const Elf_Internal_Rela *rel,
+ unsigned char st_type,
enum arm_st_branch_type *actual_branch_type,
struct elf32_arm_link_hash_entry *hash,
bfd_vma destination,
@@ -3205,6 +3461,8 @@ arm_type_of_stub (struct bfd_link_info *info,
enum elf32_arm_stub_type stub_type = arm_stub_none;
int use_plt = 0;
enum arm_st_branch_type branch_type = *actual_branch_type;
+ union gotplt_union *root_plt;
+ struct arm_plt_info *arm_plt;
if (branch_type == ST_BRANCH_LONG)
return stub_type;
@@ -3224,27 +3482,42 @@ arm_type_of_stub (struct bfd_link_info *info,
r_type = ELF32_R_TYPE (rel->r_info);
- /* Keep a simpler condition, for the sake of clarity. */
- if (globals->root.splt != NULL
- && hash != NULL
- && hash->root.plt.offset != (bfd_vma) -1)
+ /* For TLS call relocs, it is the caller's responsibility to provide
+ the address of the appropriate trampoline. */
+ if (r_type != R_ARM_TLS_CALL
+ && r_type != R_ARM_THM_TLS_CALL
+ && elf32_arm_get_plt_info (input_bfd, hash, ELF32_R_SYM (rel->r_info),
+ &root_plt, &arm_plt)
+ && root_plt->offset != (bfd_vma) -1)
{
- use_plt = 1;
-
- /* Note when dealing with PLT entries: the main PLT stub is in
- ARM mode, so if the branch is in Thumb mode, another
- Thumb->ARM stub will be inserted later just before the ARM
- PLT stub. We don't take this extra distance into account
- here, because if a long branch stub is needed, we'll add a
- Thumb->Arm one and branch directly to the ARM PLT entry
- because it avoids spreading offset corrections in several
- places. */
+ asection *splt;
- destination = (globals->root.splt->output_section->vma
- + globals->root.splt->output_offset
- + hash->root.plt.offset);
- branch_type = ST_BRANCH_TO_ARM;
+ if (hash == NULL || hash->is_iplt)
+ splt = globals->root.iplt;
+ else
+ splt = globals->root.splt;
+ if (splt != NULL)
+ {
+ use_plt = 1;
+
+ /* Note when dealing with PLT entries: the main PLT stub is in
+ ARM mode, so if the branch is in Thumb mode, another
+ Thumb->ARM stub will be inserted later just before the ARM
+ PLT stub. We don't take this extra distance into account
+ here, because if a long branch stub is needed, we'll add a
+ Thumb->Arm one and branch directly to the ARM PLT entry
+ because it avoids spreading offset corrections in several
+ places. */
+
+ destination = (splt->output_section->vma
+ + splt->output_offset
+ + root_plt->offset);
+ st_type = STT_FUNC;
+ branch_type = ST_BRANCH_TO_ARM;
+ }
}
+ /* Calls to STT_GNU_IFUNC symbols should go through a PLT. */
+ BFD_ASSERT (st_type != STT_GNU_IFUNC);
branch_offset = (bfd_signed_vma)(destination - location);
@@ -3640,8 +3913,8 @@ elf32_arm_tls_transition (struct bfd_link_info *info, int r_type,
static bfd_reloc_status_type elf32_arm_final_link_relocate
(reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *,
- const char *, enum arm_st_branch_type, struct elf_link_hash_entry *,
- bfd_boolean *, char **);
+ const char *, unsigned char, enum arm_st_branch_type,
+ struct elf_link_hash_entry *, bfd_boolean *, char **);
static unsigned int
arm_stub_required_alignment (enum elf32_arm_stub_type stub_type)
@@ -3834,9 +4107,9 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
elf32_arm_final_link_relocate (elf32_arm_howto_from_type
(template_sequence[stub_reloc_idx[i]].r_type),
stub_bfd, info->output_bfd, stub_sec, stub_sec->contents, &rel,
- points_to, info, stub_entry->target_section, "", branch_type,
- (struct elf_link_hash_entry *) stub_entry->h, &unresolved_reloc,
- &error_message);
+ points_to, info, stub_entry->target_section, "", STT_FUNC,
+ branch_type, (struct elf_link_hash_entry *) stub_entry->h,
+ &unresolved_reloc, &error_message);
}
else
{
@@ -3854,7 +4127,7 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
elf32_arm_final_link_relocate (elf32_arm_howto_from_type
(template_sequence[stub_reloc_idx[i]].r_type),
stub_bfd, info->output_bfd, stub_sec, stub_sec->contents, &rel,
- points_to, info, stub_entry->target_section, "",
+ points_to, info, stub_entry->target_section, "", STT_FUNC,
stub_entry->branch_type,
(struct elf_link_hash_entry *) stub_entry->h, &unresolved_reloc,
&error_message);
@@ -4621,6 +4894,7 @@ elf32_arm_size_stubs (bfd *output_bfd,
const char *sym_name;
char *stub_name;
const asection *id_sec;
+ unsigned char st_type;
enum arm_st_branch_type branch_type;
bfd_boolean created_stub = FALSE;
@@ -4678,6 +4952,7 @@ elf32_arm_size_stubs (bfd *output_bfd,
sym_sec = htab->root.splt;
sym_value = htab->tls_trampoline;
hash = 0;
+ st_type = STT_FUNC;
branch_type = ST_BRANCH_TO_ARM;
}
else if (!hash)
@@ -4719,6 +4994,7 @@ elf32_arm_size_stubs (bfd *output_bfd,
destination = (sym_value + irela->r_addend
+ sym_sec->output_offset
+ sym_sec->output_section->vma);
+ st_type = ELF_ST_TYPE (sym->st_info);
branch_type = ARM_SYM_BRANCH_TYPE (sym);
sym_name
= bfd_elf_string_from_elf_section (input_bfd,
@@ -4793,6 +5069,7 @@ elf32_arm_size_stubs (bfd *output_bfd,
bfd_set_error (bfd_error_bad_value);
goto error_ret_free_internal;
}
+ st_type = hash->root.type;
branch_type = hash->root.target_internal;
sym_name = hash->root.root.root.string;
}
@@ -4801,8 +5078,8 @@ elf32_arm_size_stubs (bfd *output_bfd,
{
/* Determine what (if any) linker stub is needed. */
stub_type = arm_type_of_stub (info, section, irela,
- &branch_type, hash,
- destination, sym_sec,
+ st_type, &branch_type,
+ hash, destination, sym_sec,
input_bfd, sym_name);
if (stub_type == arm_stub_none)
break;
@@ -6930,6 +7207,26 @@ elf32_arm_allocate_dynrelocs (struct bfd_link_info *info, asection *sreloc,
sreloc->size += RELOC_SIZE (htab) * count;
}
+/* Reserve space for COUNT R_ARM_IRELATIVE relocations. If the link is
+ dynamic, the relocations should go in SRELOC, otherwise they should
+ go in the special .rel.iplt section. */
+
+static void
+elf32_arm_allocate_irelocs (struct bfd_link_info *info, asection *sreloc,
+ bfd_size_type count)
+{
+ struct elf32_arm_link_hash_table *htab;
+
+ htab = elf32_arm_hash_table (info);
+ if (!htab->root.dynamic_sections_created)
+ htab->root.irelplt->size += RELOC_SIZE (htab) * count;
+ else
+ {
+ BFD_ASSERT (sreloc != NULL);
+ sreloc->size += RELOC_SIZE (htab) * count;
+ }
+}
+
/* Add relocation REL to the end of relocation section SRELOC. */
static void
@@ -6940,6 +7237,9 @@ elf32_arm_add_dynreloc (bfd *output_bfd, struct bfd_link_info *info,
struct elf32_arm_link_hash_table *htab;
htab = elf32_arm_hash_table (info);
+ if (!htab->root.dynamic_sections_created
+ && ELF32_R_TYPE (rel->r_info) == R_ARM_IRELATIVE)
+ sreloc = htab->root.irelplt;
if (sreloc == NULL)
abort ();
loc = sreloc->contents;
@@ -6949,6 +7249,281 @@ elf32_arm_add_dynreloc (bfd *output_bfd, struct bfd_link_info *info,
SWAP_RELOC_OUT (htab) (output_bfd, rel, loc);
}
+/* Allocate room for a PLT entry described by ROOT_PLT and ARM_PLT.
+ IS_IPLT_ENTRY says whether the entry belongs to .iplt rather than
+ to .plt. */
+
+static void
+elf32_arm_allocate_plt_entry (struct bfd_link_info *info,
+ bfd_boolean is_iplt_entry,
+ union gotplt_union *root_plt,
+ struct arm_plt_info *arm_plt)
+{
+ struct elf32_arm_link_hash_table *htab;
+ asection *splt;
+ asection *sgotplt;
+
+ htab = elf32_arm_hash_table (info);
+
+ if (is_iplt_entry)
+ {
+ splt = htab->root.iplt;
+ sgotplt = htab->root.igotplt;
+
+ /* Allocate room for an R_ARM_IRELATIVE relocation in .rel.iplt. */
+ elf32_arm_allocate_irelocs (info, htab->root.irelplt, 1);
+ }
+ else
+ {
+ splt = htab->root.splt;
+ sgotplt = htab->root.sgotplt;
+
+ /* Allocate room for an R_JUMP_SLOT relocation in .rel.plt. */
+ elf32_arm_allocate_dynrelocs (info, htab->root.srelplt, 1);
+
+ /* If this is the first .plt entry, make room for the special
+ first entry. */
+ if (splt->size == 0)
+ splt->size += htab->plt_header_size;
+ }
+
+ /* Allocate the PLT entry itself, including any leading Thumb stub. */
+ if (elf32_arm_plt_needs_thumb_stub_p (info, arm_plt))
+ splt->size += PLT_THUMB_STUB_SIZE;
+ root_plt->offset = splt->size;
+ splt->size += htab->plt_entry_size;
+
+ if (!htab->symbian_p)
+ {
+ /* We also need to make an entry in the .got.plt section, which
+ will be placed in the .got section by the linker script. */
+ arm_plt->got_offset = sgotplt->size - 8 * htab->num_tls_desc;
+ sgotplt->size += 4;
+ }
+}
+
+/* Fill in a PLT entry and its associated GOT slot. If DYNINDX == -1,
+ the entry lives in .iplt and resolves to (*SYM_VALUE)().
+ Otherwise, DYNINDX is the index of the symbol in the dynamic
+ symbol table and SYM_VALUE is undefined.
+
+ ROOT_PLT points to the offset of the PLT entry from the start of its
+ section (.iplt or .plt). ARM_PLT points to the symbol's ARM-specific
+ bookkeeping information. */
+
+static void
+elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
+ union gotplt_union *root_plt,
+ struct arm_plt_info *arm_plt,
+ int dynindx, bfd_vma sym_value)
+{
+ struct elf32_arm_link_hash_table *htab;
+ asection *sgot;
+ asection *splt;
+ asection *srel;
+ bfd_byte *loc;
+ bfd_vma plt_index;
+ Elf_Internal_Rela rel;
+ bfd_vma plt_header_size;
+ bfd_vma got_header_size;
+
+ htab = elf32_arm_hash_table (info);
+
+ /* Pick the appropriate sections and sizes. */
+ if (dynindx == -1)
+ {
+ splt = htab->root.iplt;
+ sgot = htab->root.igotplt;
+ srel = htab->root.irelplt;
+
+ /* There are no reserved entries in .igot.plt, and no special
+ first entry in .iplt. */
+ got_header_size = 0;
+ plt_header_size = 0;
+ }
+ else
+ {
+ splt = htab->root.splt;
+ sgot = htab->root.sgotplt;
+ srel = htab->root.srelplt;
+
+ got_header_size = get_elf_backend_data (output_bfd)->got_header_size;
+ plt_header_size = htab->plt_header_size;
+ }
+ BFD_ASSERT (splt != NULL && srel != NULL);
+
+ /* Fill in the entry in the procedure linkage table. */
+ if (htab->symbian_p)
+ {
+ BFD_ASSERT (dynindx >= 0);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_symbian_plt_entry[0],
+ splt->contents + root_plt->offset);
+ bfd_put_32 (output_bfd,
+ elf32_arm_symbian_plt_entry[1],
+ splt->contents + root_plt->offset + 4);
+
+ /* Fill in the entry in the .rel.plt section. */
+ rel.r_offset = (splt->output_section->vma
+ + splt->output_offset
+ + root_plt->offset + 4);
+ rel.r_info = ELF32_R_INFO (dynindx, R_ARM_GLOB_DAT);
+
+ /* Get the index in the procedure linkage table which
+ corresponds to this symbol. This is the index of this symbol
+ in all the symbols for which we are making plt entries. The
+ first entry in the procedure linkage table is reserved. */
+ plt_index = ((root_plt->offset - plt_header_size)
+ / htab->plt_entry_size);
+ }
+ else
+ {
+ bfd_vma got_offset, got_address, plt_address;
+ bfd_vma got_displacement, initial_got_entry;
+ bfd_byte * ptr;
+
+ BFD_ASSERT (sgot != NULL);
+
+ /* Get the offset into the .(i)got.plt table of the entry that
+ corresponds to this function. */
+ got_offset = (arm_plt->got_offset & -2);
+
+ /* Get the index in the procedure linkage table which
+ corresponds to this symbol. This is the index of this symbol
+ in all the symbols for which we are making plt entries.
+ After the reserved .got.plt entries, all symbols appear in
+ the same order as in .plt. */
+ plt_index = (got_offset - got_header_size) / 4;
+
+ /* Calculate the address of the GOT entry. */
+ got_address = (sgot->output_section->vma
+ + sgot->output_offset
+ + got_offset);
+
+ /* ...and the address of the PLT entry. */
+ plt_address = (splt->output_section->vma
+ + splt->output_offset
+ + root_plt->offset);
+
+ ptr = splt->contents + root_plt->offset;
+ if (htab->vxworks_p && info->shared)
+ {
+ unsigned int i;
+ bfd_vma val;
+
+ for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
+ {
+ val = elf32_arm_vxworks_shared_plt_entry[i];
+ if (i == 2)
+ val |= got_address - sgot->output_section->vma;
+ if (i == 5)
+ val |= plt_index * RELOC_SIZE (htab);
+ if (i == 2 || i == 5)
+ bfd_put_32 (output_bfd, val, ptr);
+ else
+ put_arm_insn (htab, output_bfd, val, ptr);
+ }
+ }
+ else if (htab->vxworks_p)
+ {
+ unsigned int i;
+ bfd_vma val;
+
+ for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
+ {
+ val = elf32_arm_vxworks_exec_plt_entry[i];
+ if (i == 2)
+ val |= got_address;
+ if (i == 4)
+ val |= 0xffffff & -((root_plt->offset + i * 4 + 8) >> 2);
+ if (i == 5)
+ val |= plt_index * RELOC_SIZE (htab);
+ if (i == 2 || i == 5)
+ bfd_put_32 (output_bfd, val, ptr);
+ else
+ put_arm_insn (htab, output_bfd, val, ptr);
+ }
+
+ loc = (htab->srelplt2->contents
+ + (plt_index * 2 + 1) * RELOC_SIZE (htab));
+
+ /* Create the .rela.plt.unloaded R_ARM_ABS32 relocation
+ referencing the GOT for this PLT entry. */
+ rel.r_offset = plt_address + 8;
+ rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32);
+ rel.r_addend = got_offset;
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+ loc += RELOC_SIZE (htab);
+
+ /* Create the R_ARM_ABS32 relocation referencing the
+ beginning of the PLT for this GOT entry. */
+ rel.r_offset = got_address;
+ rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_ARM_ABS32);
+ rel.r_addend = 0;
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+ }
+ else
+ {
+ /* Calculate the displacement between the PLT slot and the
+ entry in the GOT. The eight-byte offset accounts for the
+ value produced by adding to pc in the first instruction
+ of the PLT stub. */
+ got_displacement = got_address - (plt_address + 8);
+
+ BFD_ASSERT ((got_displacement & 0xf0000000) == 0);
+
+ if (elf32_arm_plt_needs_thumb_stub_p (info, arm_plt))
+ {
+ put_thumb_insn (htab, output_bfd,
+ elf32_arm_plt_thumb_stub[0], ptr - 4);
+ put_thumb_insn (htab, output_bfd,
+ elf32_arm_plt_thumb_stub[1], ptr - 2);
+ }
+
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[0]
+ | ((got_displacement & 0x0ff00000) >> 20),
+ ptr + 0);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[1]
+ | ((got_displacement & 0x000ff000) >> 12),
+ ptr+ 4);
+ put_arm_insn (htab, output_bfd,
+ elf32_arm_plt_entry[2]
+ | (got_displacement & 0x00000fff),
+ ptr + 8);
+#ifdef FOUR_WORD_PLT
+ bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], ptr + 12);
+#endif
+ }
+
+ /* Fill in the entry in the .rel(a).(i)plt section. */
+ rel.r_offset = got_address;
+ rel.r_addend = 0;
+ if (dynindx == -1)
+ {
+ /* .igot.plt entries use IRELATIVE relocations against SYM_VALUE.
+ The dynamic linker or static executable then calls SYM_VALUE
+ to determine the correct run-time value of the .igot.plt entry. */
+ rel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
+ initial_got_entry = sym_value;
+ }
+ else
+ {
+ rel.r_info = ELF32_R_INFO (dynindx, R_ARM_JUMP_SLOT);
+ initial_got_entry = (splt->output_section->vma
+ + splt->output_offset);
+ }
+
+ /* Fill in the entry in the global offset table. */
+ bfd_put_32 (output_bfd, initial_got_entry,
+ sgot->contents + got_offset);
+ }
+
+ loc = srel->contents + plt_index * RELOC_SIZE (htab);
+ SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
+}
+
/* Some relocations map to different relocations depending on the
target. Return the real relocation. */
@@ -7242,7 +7817,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
struct bfd_link_info * info,
asection * sym_sec,
const char * sym_name,
- enum arm_st_branch_type branch_type,
+ unsigned char st_type,
+ enum arm_st_branch_type branch_type,
struct elf_link_hash_entry * h,
bfd_boolean * unresolved_reloc_p,
char ** error_message)
@@ -7252,13 +7828,21 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_byte * hit_data = contents + rel->r_offset;
bfd_vma * local_got_offsets;
bfd_vma * local_tlsdesc_gotents;
- asection * sgot = NULL;
- asection * splt = NULL;
+ asection * sgot;
+ asection * splt;
asection * sreloc = NULL;
asection * srelgot;
bfd_vma addend;
bfd_signed_vma signed_addend;
+ unsigned char dynreloc_st_type;
+ bfd_vma dynreloc_value;
struct elf32_arm_link_hash_table * globals;
+ struct elf32_arm_link_hash_entry *eh;
+ union gotplt_union *root_plt;
+ struct arm_plt_info *arm_plt;
+ bfd_vma plt_offset;
+ bfd_vma gotplt_offset;
+ bfd_boolean has_iplt_entry;
globals = elf32_arm_hash_table (info);
if (globals == NULL)
@@ -7289,12 +7873,16 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
if (bfd_get_start_address (output_bfd) != 0)
elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY;
+ eh = (struct elf32_arm_link_hash_entry *) h;
sgot = globals->root.sgot;
- splt = globals->root.splt;
- srelgot = globals->root.srelgot;
local_got_offsets = elf_local_got_offsets (input_bfd);
local_tlsdesc_gotents = elf32_arm_local_tlsdesc_gotent (input_bfd);
+ if (globals->root.dynamic_sections_created)
+ srelgot = globals->root.srelgot;
+ else
+ srelgot = NULL;
+
r_symndx = ELF32_R_SYM (rel->r_info);
if (globals->use_rel)
@@ -7313,6 +7901,65 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
else
addend = signed_addend = rel->r_addend;
+ /* Record the symbol information that should be used in dynamic
+ relocations. */
+ dynreloc_st_type = st_type;
+ dynreloc_value = value;
+ if (branch_type == ST_BRANCH_TO_THUMB)
+ dynreloc_value |= 1;
+
+ /* Find out whether the symbol has a PLT. Set ST_VALUE, BRANCH_TYPE and
+ VALUE appropriately for relocations that we resolve at link time. */
+ has_iplt_entry = FALSE;
+ if (elf32_arm_get_plt_info (input_bfd, eh, r_symndx, &root_plt, &arm_plt)
+ && root_plt->offset != (bfd_vma) -1)
+ {
+ plt_offset = root_plt->offset;
+ gotplt_offset = arm_plt->got_offset;
+
+ if (h == NULL || eh->is_iplt)
+ {
+ has_iplt_entry = TRUE;
+ splt = globals->root.iplt;
+
+ /* Populate .iplt entries here, because not all of them will
+ be seen by finish_dynamic_symbol. The lower bit is set if
+ we have already populated the entry. */
+ if (plt_offset & 1)
+ plt_offset--;
+ else
+ {
+ elf32_arm_populate_plt_entry (output_bfd, info, root_plt, arm_plt,
+ -1, dynreloc_value);
+ root_plt->offset |= 1;
+ }
+
+ /* Static relocations always resolve to the .iplt entry. */
+ st_type = STT_FUNC;
+ value = (splt->output_section->vma
+ + splt->output_offset
+ + plt_offset);
+ branch_type = ST_BRANCH_TO_ARM;
+
+ /* If there are non-call relocations that resolve to the .iplt
+ entry, then all dynamic ones must too. */
+ if (arm_plt->noncall_refcount != 0)
+ {
+ dynreloc_st_type = st_type;
+ dynreloc_value = value;
+ }
+ }
+ else
+ /* We populate the .plt entry in finish_dynamic_symbol. */
+ splt = globals->root.splt;
+ }
+ else
+ {
+ splt = NULL;
+ plt_offset = (bfd_vma) -1;
+ gotplt_offset = (bfd_vma) -1;
+ }
+
switch (r_type)
{
case R_ARM_NONE:
@@ -7345,18 +7992,17 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
&& r_type != R_ARM_CALL
&& r_type != R_ARM_JUMP24
&& r_type != R_ARM_PLT32)
- && h != NULL
- && splt != NULL
- && h->plt.offset != (bfd_vma) -1)
+ && plt_offset != (bfd_vma) -1)
{
- /* If we've created a .plt section, and assigned a PLT entry to
- this function, it should not be known to bind locally. If
- it were, we would have cleared the PLT entry. */
- BFD_ASSERT (!SYMBOL_CALLS_LOCAL (info, h));
+ /* If we've created a .plt section, and assigned a PLT entry
+ to this function, it must either be a STT_GNU_IFUNC reference
+ or not be known to bind locally. In other cases, we should
+ have cleared the PLT entry by now. */
+ BFD_ASSERT (has_iplt_entry || !SYMBOL_CALLS_LOCAL (info, h));
value = (splt->output_section->vma
+ splt->output_offset
- + h->plt.offset);
+ + plt_offset);
*unresolved_reloc_p = FALSE;
return _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset, value,
@@ -7388,7 +8034,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
*unresolved_reloc_p = FALSE;
- if (sreloc == NULL)
+ if (sreloc == NULL && globals->root.dynamic_sections_created)
{
sreloc = _bfd_elf_get_dynamic_reloc_section (input_bfd, input_section,
! globals->use_rel);
@@ -7424,8 +8070,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
int symbol;
/* This symbol is local, or marked to become local. */
- if (branch_type == ST_BRANCH_TO_THUMB)
- value |= 1;
+ BFD_ASSERT (r_type == R_ARM_ABS32 || r_type == R_ARM_ABS32_NOI);
if (globals->symbian_p)
{
asection *osec;
@@ -7465,11 +8110,18 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
relocate the text and data segments independently,
so the symbol does not matter. */
symbol = 0;
- outrel.r_info = ELF32_R_INFO (symbol, R_ARM_RELATIVE);
+ if (dynreloc_st_type == STT_GNU_IFUNC)
+ /* We have an STT_GNU_IFUNC symbol that doesn't resolve
+ to the .iplt entry. Instead, every non-call reference
+ must use an R_ARM_IRELATIVE relocation to obtain the
+ correct run-time address. */
+ outrel.r_info = ELF32_R_INFO (symbol, R_ARM_IRELATIVE);
+ else
+ outrel.r_info = ELF32_R_INFO (symbol, R_ARM_RELATIVE);
if (globals->use_rel)
relocate = TRUE;
else
- outrel.r_addend += value;
+ outrel.r_addend += dynreloc_value;
}
elf32_arm_add_dynreloc (output_bfd, info, sreloc, &outrel);
@@ -7481,8 +8133,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
return bfd_reloc_ok;
return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
+ contents, rel->r_offset,
+ dynreloc_value, (bfd_vma) 0);
}
else switch (r_type)
{
@@ -7535,8 +8187,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
hash = (struct elf32_arm_link_hash_entry *) h;
stub_type = arm_type_of_stub (info, input_section, rel,
- &branch_type, hash,
- value, sym_sec,
+ st_type, &branch_type,
+ hash, value, sym_sec,
input_bfd, sym_name);
if (stub_type != arm_stub_none)
@@ -7557,13 +8209,11 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
/* If the call goes through a PLT entry, make sure to
check distance to the right destination address. */
- if (h != NULL
- && splt != NULL
- && h->plt.offset != (bfd_vma) -1)
+ if (plt_offset != (bfd_vma) -1)
{
value = (splt->output_section->vma
+ splt->output_offset
- + h->plt.offset);
+ + plt_offset);
*unresolved_reloc_p = FALSE;
/* The PLT entry is in ARM mode, regardless of the
target function. */
@@ -7609,7 +8259,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
The jump to the next instruction is optimized as a NOP depending
on the architecture. */
if (h ? (h->root.type == bfd_link_hash_undefweak
- && !(splt != NULL && h->plt.offset != (bfd_vma) -1))
+ && plt_offset == (bfd_vma) -1)
: r_symndx != STN_UNDEF && bfd_is_und_section (sym_sec))
{
value = (bfd_get_32 (input_bfd, hit_data) & 0xf0000000);
@@ -7874,7 +8524,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
The jump to the next instruction is optimized as a NOP.W for
Thumb-2 enabled architectures. */
if (h && h->root.type == bfd_link_hash_undefweak
- && !(splt != NULL && h->plt.offset != (bfd_vma) -1))
+ && plt_offset == (bfd_vma) -1)
{
if (arch_has_thumb2_nop (globals))
{
@@ -7925,9 +8575,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
If it is a call relative to a section name, then it is not a
function call at all, but rather a long jump. Calls through
the PLT do not require stubs. */
- if (branch_type == ST_BRANCH_TO_ARM
- && (h == NULL || splt == NULL
- || h->plt.offset == (bfd_vma) -1))
+ if (branch_type == ST_BRANCH_TO_ARM && plt_offset == (bfd_vma) -1)
{
if (globals->use_blx && r_type == R_ARM_THM_CALL)
{
@@ -7966,7 +8614,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
hash = (struct elf32_arm_link_hash_entry *) h;
stub_type = arm_type_of_stub (info, input_section, rel,
- &branch_type, hash, value, sym_sec,
+ st_type, &branch_type,
+ hash, value, sym_sec,
input_bfd, sym_name);
if (stub_type != arm_stub_none)
@@ -7995,14 +8644,11 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
/* Handle calls via the PLT. */
- if (stub_type == arm_stub_none
- && h != NULL
- && splt != NULL
- && h->plt.offset != (bfd_vma) -1)
+ if (stub_type == arm_stub_none && plt_offset != (bfd_vma) -1)
{
value = (splt->output_section->vma
+ splt->output_offset
- + h->plt.offset);
+ + plt_offset);
if (globals->use_blx && r_type == R_ARM_THM_CALL)
{
@@ -8107,11 +8753,11 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
/* Handle calls via the PLT. */
- if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1)
+ if (plt_offset != (bfd_vma) -1)
{
value = (splt->output_section->vma
+ splt->output_offset
- + h->plt.offset);
+ + plt_offset);
/* Target the Thumb stub before the ARM PLT entry. */
value -= PLT_THUMB_STUB_SIZE;
*unresolved_reloc_p = FALSE;
@@ -8277,7 +8923,19 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
if (sgot == NULL)
return bfd_reloc_notsupported;
- if (h != NULL)
+ if (dynreloc_st_type == STT_GNU_IFUNC
+ && plt_offset != (bfd_vma) -1
+ && (h == NULL || SYMBOL_REFERENCES_LOCAL (info, h)))
+ {
+ /* We have a relocation against a locally-binding STT_GNU_IFUNC
+ symbol, and the relocation resolves directly to the runtime
+ target rather than to the .iplt entry. This means that any
+ .got entry would be the same value as the .igot.plt entry,
+ so there's no point creating both. */
+ sgot = globals->root.igotplt;
+ value = sgot->output_offset + gotplt_offset;
+ }
+ else if (h != NULL)
{
bfd_vma off;
@@ -8313,13 +8971,13 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
else
{
- if (info->shared)
- outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- else
- outrel.r_info = 0;
- outrel.r_addend = value;
- if (branch_type == ST_BRANCH_TO_THUMB)
- outrel.r_addend |= 1;
+ if (dynreloc_st_type == STT_GNU_IFUNC)
+ outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
+ else if (info->shared)
+ outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
+ else
+ outrel.r_info = 0;
+ outrel.r_addend = dynreloc_value;
}
/* The GOT entry is initialized to zero by default.
@@ -8359,27 +9017,21 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
off &= ~1;
else
{
- /* If we are addressing a Thumb function, we need to
- adjust the address by one, so that attempts to
- call the function pointer will correctly
- interpret it as Thumb code. */
- if (branch_type == ST_BRANCH_TO_THUMB)
- value |= 1;
-
if (globals->use_rel)
- bfd_put_32 (output_bfd, value, sgot->contents + off);
+ bfd_put_32 (output_bfd, dynreloc_value, sgot->contents + off);
- if (info->shared)
+ if (info->shared || dynreloc_st_type == STT_GNU_IFUNC)
{
Elf_Internal_Rela outrel;
- BFD_ASSERT (srelgot != NULL);
-
- outrel.r_addend = addend + value;
+ outrel.r_addend = addend + dynreloc_value;
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
+ off);
- outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
+ if (dynreloc_st_type == STT_GNU_IFUNC)
+ outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
+ else
+ outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
elf32_arm_add_dynreloc (output_bfd, info, srelgot, &outrel);
}
@@ -8647,7 +9299,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
bfd_signed_vma offset;
enum elf32_arm_stub_type stub_type
- = arm_type_of_stub (info, input_section, rel, &branch_type,
+ = arm_type_of_stub (info, input_section, rel,
+ st_type, &branch_type,
(struct elf32_arm_link_hash_entry *)h,
globals->tls_trampoline, globals->root.splt,
input_bfd, sym_name);
@@ -9677,7 +10330,7 @@ elf32_arm_relocate_section (bfd * output_bfd,
if (r == bfd_reloc_continue)
r = elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
input_section, contents, rel,
- relocation, info, sec, name,
+ relocation, info, sec, name, sym_type,
(h ? h->target_internal
: ARM_SYM_BRANCH_TYPE (sym)), h,
&unresolved_reloc, &error_message);
@@ -11247,8 +11900,11 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
struct elf_link_hash_entry *h = NULL;
struct elf32_arm_link_hash_entry *eh;
int r_type;
+ bfd_boolean call_reloc_p;
bfd_boolean may_become_dynamic_p;
bfd_boolean may_need_local_target_p;
+ union gotplt_union *root_plt;
+ struct arm_plt_info *arm_plt;
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx >= symtab_hdr->sh_info)
@@ -11260,6 +11916,7 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
}
eh = (struct elf32_arm_link_hash_entry *) h;
+ call_reloc_p = FALSE;
may_become_dynamic_p = FALSE;
may_need_local_target_p = FALSE;
@@ -11295,6 +11952,7 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
case R_ARM_THM_CALL:
case R_ARM_THM_JUMP24:
case R_ARM_THM_JUMP19:
+ call_reloc_p = TRUE;
may_need_local_target_p = TRUE;
break;
@@ -11319,10 +11977,17 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
case R_ARM_THM_MOVT_PREL:
/* Should the interworking branches be here also? */
if ((info->shared || globals->root.is_relocatable_executable)
- && (sec->flags & SEC_ALLOC) != 0
- && (h != NULL
- || (r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI)))
- may_become_dynamic_p = TRUE;
+ && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (h == NULL
+ && (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI))
+ {
+ call_reloc_p = TRUE;
+ may_need_local_target_p = TRUE;
+ }
+ else
+ may_become_dynamic_p = TRUE;
+ }
else
may_need_local_target_p = TRUE;
break;
@@ -11331,24 +11996,42 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
break;
}
- if (may_need_local_target_p && h != NULL)
+ if (may_need_local_target_p
+ && elf32_arm_get_plt_info (abfd, eh, r_symndx, &root_plt, &arm_plt))
{
- BFD_ASSERT (h->plt.refcount > 0);
- h->plt.refcount -= 1;
+ BFD_ASSERT (root_plt->refcount > 0);
+ root_plt->refcount -= 1;
+
+ if (!call_reloc_p)
+ arm_plt->noncall_refcount--;
if (r_type == R_ARM_THM_CALL)
- eh->plt_maybe_thumb_refcount--;
+ arm_plt->maybe_thumb_refcount--;
if (r_type == R_ARM_THM_JUMP24
|| r_type == R_ARM_THM_JUMP19)
- eh->plt_thumb_refcount--;
+ arm_plt->thumb_refcount--;
}
- if (may_become_dynamic_p && h != NULL)
+ if (may_become_dynamic_p)
{
struct elf_dyn_relocs **pp;
struct elf_dyn_relocs *p;
+ if (h != NULL)
+ pp = &((struct elf32_arm_link_hash_entry *) h)->dyn_relocs;
+ else
+ {
+ Elf_Internal_Sym *isym;
+
+ isym = bfd_sym_from_r_symndx (&globals->sym_cache,
+ abfd, r_symndx);
+ if (isym == NULL)
+ return FALSE;
+ pp = elf32_arm_get_local_dynreloc_list (abfd, r_symndx, isym);
+ if (pp == NULL)
+ return FALSE;
+ }
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
if (p->sec == sec)
{
@@ -11402,6 +12085,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (htab->root.dynobj == NULL)
htab->root.dynobj = abfd;
+ if (!create_ifunc_sections (info))
+ return FALSE;
dynobj = htab->root.dynobj;
@@ -11412,6 +12097,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
+ Elf_Internal_Sym *isym;
struct elf_link_hash_entry *h;
struct elf32_arm_link_hash_entry *eh;
unsigned long r_symndx;
@@ -11432,14 +12118,25 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
return FALSE;
}
- if (nsyms == 0 || r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
+ h = NULL;
+ isym = NULL;
+ if (nsyms > 0)
{
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ /* A local symbol. */
+ isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+ abfd, r_symndx);
+ if (isym == NULL)
+ return FALSE;
+ }
+ else
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
}
eh = (struct elf32_arm_link_hash_entry *) h;
@@ -11486,30 +12183,10 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
}
else
{
- bfd_signed_vma *local_got_refcounts;
-
/* This is a global offset table entry for a local symbol. */
- local_got_refcounts = elf_local_got_refcounts (abfd);
- if (local_got_refcounts == NULL)
- {
- bfd_size_type size;
-
- size = symtab_hdr->sh_info;
- size *= (sizeof (bfd_signed_vma)
- + sizeof (bfd_vma) + sizeof (char));
- local_got_refcounts = (bfd_signed_vma *)
- bfd_zalloc (abfd, size);
- if (local_got_refcounts == NULL)
- return FALSE;
- elf_local_got_refcounts (abfd) = local_got_refcounts;
- elf32_arm_local_tlsdesc_gotent (abfd)
- = (bfd_vma *) (local_got_refcounts
- + symtab_hdr->sh_info);
- elf32_arm_local_got_tls_type (abfd)
- = (char *) (elf32_arm_local_tlsdesc_gotent (abfd)
- + symtab_hdr->sh_info);
- }
- local_got_refcounts[r_symndx] += 1;
+ if (!elf32_arm_allocate_local_sym_info (abfd))
+ return FALSE;
+ elf_local_got_refcounts (abfd)[r_symndx] += 1;
old_tls_type = elf32_arm_local_got_tls_type (abfd) [r_symndx];
}
@@ -11602,15 +12279,26 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_ARM_THM_MOVT_PREL:
/* Should the interworking branches be listed here? */
- /* If we are creating a shared library or relocatable
- executable, and this is a reloc against a global symbol,
- or a non-PC-relative reloc against a local symbol,
- then we may need to copy the reloc into the output. */
if ((info->shared || htab->root.is_relocatable_executable)
- && (sec->flags & SEC_ALLOC) != 0
- && (h != NULL
- || (r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI)))
- may_become_dynamic_p = TRUE;
+ && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (h == NULL
+ && (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI))
+ {
+ /* In shared libraries and relocatable executables,
+ we treat local relative references as calls;
+ see the related SYMBOL_CALLS_LOCAL code in
+ allocate_dynrelocs. */
+ call_reloc_p = TRUE;
+ may_need_local_target_p = TRUE;
+ }
+ else
+ /* We are creating a shared library or relocatable
+ executable, and this is a reloc against a global symbol,
+ or a non-PC-relative reloc against a local symbol.
+ We may need to copy the reloc into the output. */
+ may_become_dynamic_p = TRUE;
+ }
else
may_need_local_target_p = TRUE;
break;
@@ -11650,22 +12338,44 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
h->non_got_ref = 1;
}
- if (may_need_local_target_p && h != NULL)
+ if (may_need_local_target_p
+ && (h != NULL || ELF32_ST_TYPE (isym->st_info) == STT_GNU_IFUNC))
{
+ union gotplt_union *root_plt;
+ struct arm_plt_info *arm_plt;
+ struct arm_local_iplt_info *local_iplt;
+
+ if (h != NULL)
+ {
+ root_plt = &h->plt;
+ arm_plt = &eh->plt;
+ }
+ else
+ {
+ local_iplt = elf32_arm_create_local_iplt (abfd, r_symndx);
+ if (local_iplt == NULL)
+ return FALSE;
+ root_plt = &local_iplt->root;
+ arm_plt = &local_iplt->arm;
+ }
+
/* If the symbol is a function that doesn't bind locally,
this relocation will need a PLT entry. */
- h->plt.refcount += 1;
+ root_plt->refcount += 1;
+
+ if (!call_reloc_p)
+ arm_plt->noncall_refcount++;
/* It's too early to use htab->use_blx here, so we have to
record possible blx references separately from
relocs that definitely need a thumb stub. */
if (r_type == R_ARM_THM_CALL)
- eh->plt_maybe_thumb_refcount += 1;
+ arm_plt->maybe_thumb_refcount += 1;
if (r_type == R_ARM_THM_JUMP24
|| r_type == R_ARM_THM_JUMP19)
- eh->plt_thumb_refcount += 1;
+ arm_plt->thumb_refcount += 1;
}
if (may_become_dynamic_p)
@@ -11698,24 +12408,9 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
head = &((struct elf32_arm_link_hash_entry *) h)->dyn_relocs;
else
{
- /* Track dynamic relocs needed for local syms too.
- We really need local syms available to do this
- easily. Oh well. */
- asection *s;
- void *vpp;
- Elf_Internal_Sym *isym;
-
- isym = bfd_sym_from_r_symndx (&htab->sym_cache,
- abfd, r_symndx);
- if (isym == NULL)
+ head = elf32_arm_get_local_dynreloc_list (abfd, r_symndx, isym);
+ if (head == NULL)
return FALSE;
-
- s = bfd_section_from_elf_index (abfd, isym->st_shndx);
- if (s == NULL)
- s = sec;
-
- vpp = &elf_section_data (s)->local_dynrel;
- head = (struct elf_dyn_relocs **) vpp;
}
p = *head;
@@ -11947,6 +12642,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
/* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL
&& (h->needs_plt
+ || h->type == STT_GNU_IFUNC
|| h->u.weakdef != NULL
|| (h->def_dynamic
&& h->ref_regular
@@ -11957,12 +12653,15 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later,
when we know the address of the .got section. */
- if (h->type == STT_FUNC || h->needs_plt)
+ if (h->type == STT_FUNC || h->type == STT_GNU_IFUNC || h->needs_plt)
{
+ /* Calls to STT_GNU_IFUNC symbols always use a PLT, even if the
+ symbol binds locally. */
if (h->plt.refcount <= 0
- || SYMBOL_CALLS_LOCAL (info, h)
- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
- && h->root.type == bfd_link_hash_undefweak))
+ || (h->type != STT_GNU_IFUNC
+ && (SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))))
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
@@ -11970,8 +12669,9 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
such a case, we don't actually need to build a procedure
linkage table, and we can just do a PC24 reloc instead. */
h->plt.offset = (bfd_vma) -1;
- eh->plt_thumb_refcount = 0;
- eh->plt_maybe_thumb_refcount = 0;
+ eh->plt.thumb_refcount = 0;
+ eh->plt.maybe_thumb_refcount = 0;
+ eh->plt.noncall_refcount = 0;
h->needs_plt = 0;
}
@@ -11985,8 +12685,9 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
and non-function syms in check-relocs; Objects loaded later in
the link may change h->type. So fix it now. */
h->plt.offset = (bfd_vma) -1;
- eh->plt_thumb_refcount = 0;
- eh->plt_maybe_thumb_refcount = 0;
+ eh->plt.thumb_refcount = 0;
+ eh->plt.maybe_thumb_refcount = 0;
+ eh->plt.noncall_refcount = 0;
}
/* If this is a weak symbol, and there is a real definition, the
@@ -12063,7 +12764,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
struct elf32_arm_link_hash_table *htab;
struct elf32_arm_link_hash_entry *eh;
struct elf_dyn_relocs *p;
- bfd_signed_vma thumb_refs;
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
@@ -12081,7 +12781,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
if (htab == NULL)
return FALSE;
- if (htab->root.dynamic_sections_created
+ if ((htab->root.dynamic_sections_created || h->type == STT_GNU_IFUNC)
&& h->plt.refcount > 0)
{
/* Make sure this symbol is output as a dynamic symbol.
@@ -12093,29 +12793,29 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
return FALSE;
}
+ /* If the call in the PLT entry binds locally, the associated
+ GOT entry should use an R_ARM_IRELATIVE relocation instead of
+ the usual R_ARM_JUMP_SLOT. Put it in the .iplt section rather
+ than the .plt section. */
+ if (h->type == STT_GNU_IFUNC && SYMBOL_CALLS_LOCAL (info, h))
+ {
+ eh->is_iplt = 1;
+ if (eh->plt.noncall_refcount == 0
+ && SYMBOL_REFERENCES_LOCAL (info, h))
+ /* All non-call references can be resolved directly.
+ This means that they can (and in some cases, must)
+ resolve directly to the run-time target, rather than
+ to the PLT. That in turns means that any .got entry
+ would be equal to the .igot.plt entry, so there's
+ no point having both. */
+ h->got.refcount = 0;
+ }
+
if (info->shared
+ || eh->is_iplt
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
- asection *s = htab->root.splt;
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->size == 0)
- s->size += htab->plt_header_size;
-
- h->plt.offset = s->size;
-
- /* If we will insert a Thumb trampoline before this PLT, leave room
- for it. */
- thumb_refs = eh->plt_thumb_refcount;
- if (!htab->use_blx)
- thumb_refs += eh->plt_maybe_thumb_refcount;
-
- if (thumb_refs > 0)
- {
- h->plt.offset += PLT_THUMB_STUB_SIZE;
- s->size += PLT_THUMB_STUB_SIZE;
- }
+ elf32_arm_allocate_plt_entry (info, eh->is_iplt, &h->plt, &eh->plt);
/* If this symbol is not defined in a regular file, and we are
not generating a shared library, then set the symbol to this
@@ -12125,7 +12825,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
if (! info->shared
&& !h->def_regular)
{
- h->root.u.def.section = s;
+ h->root.u.def.section = htab->root.splt;
h->root.u.def.value = h->plt.offset;
/* Make sure the function is not marked as Thumb, in case
@@ -12134,20 +12834,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
h->target_internal = ST_BRANCH_TO_ARM;
}
- /* Make room for this entry. */
- s->size += htab->plt_entry_size;
-
- if (!htab->symbian_p)
- {
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- eh->plt_got_offset = (htab->root.sgotplt->size
- - 8 * htab->num_tls_desc);
- htab->root.sgotplt->size += 4;
- }
-
- /* We also need to make an entry in the .rel(a).plt section. */
- elf32_arm_allocate_dynrelocs (info, htab->root.srelplt, 1);
htab->next_tls_desc_index++;
/* VxWorks executables have a second set of relocations for
@@ -12218,7 +12904,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
- elf32_arm_compute_jump_table_size (htab));
htab->root.sgotplt->size += 8;
h->got.offset = (bfd_vma) -2;
- /* plt_got_offset needs to know there's a TLS_DESC
+ /* plt.got_offset needs to know there's a TLS_DESC
reloc in the middle of .got.plt. */
htab->num_tls_desc++;
}
@@ -12274,6 +12960,12 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
/* Reserve room for the GOT entry's R_ARM_GLOB_DAT relocation. */
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
}
+ else if (h->type == STT_GNU_IFUNC
+ && eh->plt.noncall_refcount == 0)
+ /* No non-call references resolve the STT_GNU_IFUNC's PLT entry;
+ they all resolve dynamically instead. Reserve room for the
+ GOT entry's R_ARM_IRELATIVE relocation. */
+ elf32_arm_allocate_irelocs (info, htab->root.srelgot, 1);
else if (info->shared)
/* Reserve room for the GOT entry's R_ARM_RELATIVE relocation. */
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
@@ -12426,7 +13118,12 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
asection *sreloc = elf_section_data (p->sec)->sreloc;
- elf32_arm_allocate_dynrelocs (info, sreloc, p->count);
+ if (h->type == STT_GNU_IFUNC
+ && eh->plt.noncall_refcount == 0
+ && SYMBOL_REFERENCES_LOCAL (info, h))
+ elf32_arm_allocate_irelocs (info, sreloc, p->count);
+ else
+ elf32_arm_allocate_dynrelocs (info, sreloc, p->count);
}
return TRUE;
@@ -12513,12 +13210,14 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
{
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
+ struct arm_local_iplt_info **local_iplt_ptr, *local_iplt;
char *local_tls_type;
bfd_vma *local_tlsdesc_gotent;
bfd_size_type locsymcount;
Elf_Internal_Shdr *symtab_hdr;
asection *srel;
bfd_boolean is_vxworks = htab->vxworks_p;
+ unsigned int symndx;
if (! is_arm_elf (ibfd))
continue;
@@ -12562,16 +13261,56 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
symtab_hdr = & elf_symtab_hdr (ibfd);
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
+ local_iplt_ptr = elf32_arm_local_iplt (ibfd);
local_tls_type = elf32_arm_local_got_tls_type (ibfd);
local_tlsdesc_gotent = elf32_arm_local_tlsdesc_gotent (ibfd);
+ symndx = 0;
s = htab->root.sgot;
srel = htab->root.srelgot;
for (; local_got < end_local_got;
- ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
+ ++local_got, ++local_iplt_ptr, ++local_tls_type,
+ ++local_tlsdesc_gotent, ++symndx)
{
*local_tlsdesc_gotent = (bfd_vma) -1;
+ local_iplt = *local_iplt_ptr;
+ if (local_iplt != NULL)
+ {
+ struct elf_dyn_relocs *p;
+
+ if (local_iplt->root.refcount > 0)
+ {
+ elf32_arm_allocate_plt_entry (info, TRUE,
+ &local_iplt->root,
+ &local_iplt->arm);
+ if (local_iplt->arm.noncall_refcount == 0)
+ /* All references to the PLT are calls, so all
+ non-call references can resolve directly to the
+ run-time target. This means that the .got entry
+ would be the same as the .igot.plt entry, so there's
+ no point creating both. */
+ *local_got = 0;
+ }
+ else
+ {
+ BFD_ASSERT (local_iplt->arm.noncall_refcount == 0);
+ local_iplt->root.offset = (bfd_vma) -1;
+ }
+
+ for (p = local_iplt->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *psrel;
+
+ psrel = elf_section_data (p->sec)->sreloc;
+ if (local_iplt->arm.noncall_refcount == 0)
+ elf32_arm_allocate_irelocs (info, psrel, p->count);
+ else
+ elf32_arm_allocate_dynrelocs (info, psrel, p->count);
+ }
+ }
if (*local_got > 0)
{
+ Elf_Internal_Sym *isym;
+
*local_got = s->size;
if (*local_tls_type & GOT_TLS_GD)
/* TLS_GD relocs need an 8-byte structure in the GOT. */
@@ -12582,7 +13321,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
- elf32_arm_compute_jump_table_size (htab);
htab->root.sgotplt->size += 8;
*local_got = (bfd_vma) -2;
- /* plt_got_offset needs to know there's a TLS_DESC
+ /* plt.got_offset needs to know there's a TLS_DESC
reloc in the middle of .got.plt. */
htab->num_tls_desc++;
}
@@ -12597,8 +13336,19 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
s->size += 4;
}
- if ((info->shared && !(*local_tls_type & GOT_TLS_GDESC))
- || *local_tls_type & GOT_TLS_GD)
+ isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, symndx);
+ if (isym == NULL)
+ return FALSE;
+
+ /* If all references to an STT_GNU_IFUNC PLT are calls,
+ then all non-call references, including this GOT entry,
+ resolve directly to the run-time target. */
+ if (ELF32_ST_TYPE (isym->st_info) == STT_GNU_IFUNC
+ && (local_iplt == NULL
+ || local_iplt->arm.noncall_refcount == 0))
+ elf32_arm_allocate_irelocs (info, srel, 1);
+ else if ((info->shared && !(*local_tls_type & GOT_TLS_GDESC))
+ || *local_tls_type & GOT_TLS_GD)
elf32_arm_allocate_dynrelocs (info, srel, 1);
if (info->shared && *local_tls_type & GOT_TLS_GDESC)
@@ -12691,7 +13441,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- if (strcmp (name, ".plt") == 0)
+ if (s == htab->root.splt)
{
/* Remember whether there is a PLT. */
plt = s->size != 0;
@@ -12710,8 +13460,11 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (! CONST_STRNEQ (name, ".got")
- && strcmp (name, ".dynbss") != 0)
+ else if (s != htab->root.sgot
+ && s != htab->root.sgotplt
+ && s != htab->root.iplt
+ && s != htab->root.igotplt
+ && s != htab->sdynbss)
{
/* It's not one of our sections, so don't allocate space. */
continue;
@@ -12873,187 +13626,13 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd,
if (h->plt.offset != (bfd_vma) -1)
{
- asection * splt;
- asection * srel;
- bfd_byte *loc;
- bfd_vma plt_index;
- Elf_Internal_Rela rel;
-
- /* This symbol has an entry in the procedure linkage table. Set
- it up. */
-
- BFD_ASSERT (h->dynindx != -1);
-
- splt = htab->root.splt;
- srel = htab->root.srelplt;
- BFD_ASSERT (splt != NULL && srel != NULL);
-
- /* Fill in the entry in the procedure linkage table. */
- if (htab->symbian_p)
- {
- put_arm_insn (htab, output_bfd,
- elf32_arm_symbian_plt_entry[0],
- splt->contents + h->plt.offset);
- bfd_put_32 (output_bfd,
- elf32_arm_symbian_plt_entry[1],
- splt->contents + h->plt.offset + 4);
-
- /* Fill in the entry in the .rel.plt section. */
- rel.r_offset = (splt->output_section->vma
- + splt->output_offset
- + h->plt.offset + 4);
- rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
-
- /* Get the index in the procedure linkage table which
- corresponds to this symbol. This is the index of this symbol
- in all the symbols for which we are making plt entries. The
- first entry in the procedure linkage table is reserved. */
- plt_index = ((h->plt.offset - htab->plt_header_size)
- / htab->plt_entry_size);
- }
- else
+ if (!eh->is_iplt)
{
- bfd_vma got_offset, got_address, plt_address;
- bfd_vma got_displacement;
- asection * sgot;
- bfd_byte * ptr;
-
- sgot = htab->root.sgotplt;
- BFD_ASSERT (sgot != NULL);
-
- /* Get the offset into the .got.plt table of the entry that
- corresponds to this function. */
- got_offset = eh->plt_got_offset;
-
- /* Get the index in the procedure linkage table which
- corresponds to this symbol. This is the index of this symbol
- in all the symbols for which we are making plt entries. The
- first three entries in .got.plt are reserved; after that
- symbols appear in the same order as in .plt. */
- plt_index = (got_offset - 12) / 4;
-
- /* Calculate the address of the GOT entry. */
- got_address = (sgot->output_section->vma
- + sgot->output_offset
- + got_offset);
-
- /* ...and the address of the PLT entry. */
- plt_address = (splt->output_section->vma
- + splt->output_offset
- + h->plt.offset);
-
- ptr = splt->contents + h->plt.offset;
- if (htab->vxworks_p && info->shared)
- {
- unsigned int i;
- bfd_vma val;
-
- for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
- {
- val = elf32_arm_vxworks_shared_plt_entry[i];
- if (i == 2)
- val |= got_address - sgot->output_section->vma;
- if (i == 5)
- val |= plt_index * RELOC_SIZE (htab);
- if (i == 2 || i == 5)
- bfd_put_32 (output_bfd, val, ptr);
- else
- put_arm_insn (htab, output_bfd, val, ptr);
- }
- }
- else if (htab->vxworks_p)
- {
- unsigned int i;
- bfd_vma val;
-
- for (i = 0; i != htab->plt_entry_size / 4; i++, ptr += 4)
- {
- val = elf32_arm_vxworks_exec_plt_entry[i];
- if (i == 2)
- val |= got_address;
- if (i == 4)
- val |= 0xffffff & -((h->plt.offset + i * 4 + 8) >> 2);
- if (i == 5)
- val |= plt_index * RELOC_SIZE (htab);
- if (i == 2 || i == 5)
- bfd_put_32 (output_bfd, val, ptr);
- else
- put_arm_insn (htab, output_bfd, val, ptr);
- }
-
- loc = (htab->srelplt2->contents
- + (plt_index * 2 + 1) * RELOC_SIZE (htab));
-
- /* Create the .rela.plt.unloaded R_ARM_ABS32 relocation
- referencing the GOT for this PLT entry. */
- rel.r_offset = plt_address + 8;
- rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32);
- rel.r_addend = got_offset;
- SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
- loc += RELOC_SIZE (htab);
-
- /* Create the R_ARM_ABS32 relocation referencing the
- beginning of the PLT for this GOT entry. */
- rel.r_offset = got_address;
- rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_ARM_ABS32);
- rel.r_addend = 0;
- SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
- }
- else
- {
- bfd_signed_vma thumb_refs;
- /* Calculate the displacement between the PLT slot and the
- entry in the GOT. The eight-byte offset accounts for the
- value produced by adding to pc in the first instruction
- of the PLT stub. */
- got_displacement = got_address - (plt_address + 8);
-
- BFD_ASSERT ((got_displacement & 0xf0000000) == 0);
-
- thumb_refs = eh->plt_thumb_refcount;
- if (!htab->use_blx)
- thumb_refs += eh->plt_maybe_thumb_refcount;
-
- if (thumb_refs > 0)
- {
- put_thumb_insn (htab, output_bfd,
- elf32_arm_plt_thumb_stub[0], ptr - 4);
- put_thumb_insn (htab, output_bfd,
- elf32_arm_plt_thumb_stub[1], ptr - 2);
- }
-
- put_arm_insn (htab, output_bfd,
- elf32_arm_plt_entry[0]
- | ((got_displacement & 0x0ff00000) >> 20),
- ptr + 0);
- put_arm_insn (htab, output_bfd,
- elf32_arm_plt_entry[1]
- | ((got_displacement & 0x000ff000) >> 12),
- ptr+ 4);
- put_arm_insn (htab, output_bfd,
- elf32_arm_plt_entry[2]
- | (got_displacement & 0x00000fff),
- ptr + 8);
-#ifdef FOUR_WORD_PLT
- bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], ptr + 12);
-#endif
- }
-
- /* Fill in the entry in the global offset table. */
- bfd_put_32 (output_bfd,
- (splt->output_section->vma
- + splt->output_offset),
- sgot->contents + got_offset);
-
- /* Fill in the entry in the .rel(a).plt section. */
- rel.r_addend = 0;
- rel.r_offset = got_address;
- rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_JUMP_SLOT);
+ BFD_ASSERT (h->dynindx != -1);
+ elf32_arm_populate_plt_entry (output_bfd, info, &h->plt, &eh->plt,
+ h->dynindx, 0);
}
- loc = srel->contents + plt_index * RELOC_SIZE (htab);
- SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
-
if (!h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
@@ -13066,6 +13645,18 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd,
if (!h->ref_regular_nonweak)
sym->st_value = 0;
}
+ else if (eh->is_iplt && eh->plt.noncall_refcount != 0)
+ {
+ /* At least one non-call relocation references this .iplt entry,
+ so the .iplt entry is the function's canonical address. */
+ sym->st_info = ELF_ST_INFO (ELF_ST_BIND (sym->st_info), STT_FUNC);
+ sym->st_target_internal = ST_BRANCH_TO_ARM;
+ sym->st_shndx = (_bfd_elf_section_from_bfd_section
+ (output_bfd, htab->root.iplt->output_section));
+ sym->st_value = (h->plt.offset
+ + htab->root.iplt->output_section->vma
+ + htab->root.iplt->output_offset);
+ }
}
if (h->needs_copy)
@@ -13620,35 +14211,39 @@ elf32_arm_output_map_sym (output_arch_syminfo *osi,
return osi->func (osi->finfo, names[type], &sym, osi->sec, NULL) == 1;
}
-
-/* Output mapping symbols for PLT entries associated with H. */
+/* Output mapping symbols for the PLT entry described by ROOT_PLT and ARM_PLT.
+ IS_IPLT_ENTRY_P says whether the PLT is in .iplt rather than .plt. */
static bfd_boolean
-elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf)
+elf32_arm_output_plt_map_1 (output_arch_syminfo *osi,
+ bfd_boolean is_iplt_entry_p,
+ union gotplt_union *root_plt,
+ struct arm_plt_info *arm_plt)
{
- output_arch_syminfo *osi = (output_arch_syminfo *) inf;
struct elf32_arm_link_hash_table *htab;
- struct elf32_arm_link_hash_entry *eh;
- bfd_vma addr;
+ bfd_vma addr, plt_header_size;
- if (h->root.type == bfd_link_hash_indirect)
- return TRUE;
-
- if (h->root.type == bfd_link_hash_warning)
- /* When warning symbols are created, they **replace** the "real"
- entry in the hash table, thus we never get to see the real
- symbol in a hash traversal. So look at it now. */
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
- if (h->plt.offset == (bfd_vma) -1)
+ if (root_plt->offset == (bfd_vma) -1)
return TRUE;
htab = elf32_arm_hash_table (osi->info);
if (htab == NULL)
return FALSE;
- eh = (struct elf32_arm_link_hash_entry *) h;
- addr = h->plt.offset;
+ if (is_iplt_entry_p)
+ {
+ osi->sec = htab->root.iplt;
+ plt_header_size = 0;
+ }
+ else
+ {
+ osi->sec = htab->root.splt;
+ plt_header_size = htab->plt_header_size;
+ }
+ osi->sec_shndx = (_bfd_elf_section_from_bfd_section
+ (osi->info->output_bfd, osi->sec->output_section));
+
+ addr = root_plt->offset & -2;
if (htab->symbian_p)
{
if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
@@ -13669,13 +14264,10 @@ elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf)
}
else
{
- bfd_signed_vma thumb_refs;
+ bfd_boolean thumb_stub_p;
- thumb_refs = eh->plt_thumb_refcount;
- if (!htab->use_blx)
- thumb_refs += eh->plt_maybe_thumb_refcount;
-
- if (thumb_refs > 0)
+ thumb_stub_p = elf32_arm_plt_needs_thumb_stub_p (osi->info, arm_plt);
+ if (thumb_stub_p)
{
if (!elf32_arm_output_map_sym (osi, ARM_MAP_THUMB, addr - 4))
return FALSE;
@@ -13689,7 +14281,7 @@ elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf)
/* A three-word PLT with no Thumb thunk contains only Arm code,
so only need to output a mapping symbol for the first PLT entry and
entries with thumb thunks. */
- if (thumb_refs > 0 || addr == 20)
+ if (thumb_stub_p || addr == plt_header_size)
{
if (!elf32_arm_output_map_sym (osi, ARM_MAP_ARM, addr))
return FALSE;
@@ -13700,6 +14292,28 @@ elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf)
return TRUE;
}
+/* Output mapping symbols for PLT entries associated with H. */
+
+static bfd_boolean
+elf32_arm_output_plt_map (struct elf_link_hash_entry *h, void *inf)
+{
+ output_arch_syminfo *osi = (output_arch_syminfo *) inf;
+ struct elf32_arm_link_hash_entry *eh;
+
+ if (h->root.type == bfd_link_hash_indirect)
+ return TRUE;
+
+ if (h->root.type == bfd_link_hash_warning)
+ /* When warning symbols are created, they **replace** the "real"
+ entry in the hash table, thus we never get to see the real
+ symbol in a hash traversal. So look at it now. */
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ eh = (struct elf32_arm_link_hash_entry *) h;
+ return elf32_arm_output_plt_map_1 (osi, SYMBOL_CALLS_LOCAL (osi->info, h),
+ &h->plt, &eh->plt);
+}
+
/* Output a single local symbol for a generated stub. */
static bfd_boolean
@@ -13954,35 +14568,59 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
}
/* Finally, output mapping symbols for the PLT. */
- if (!htab->root.splt || htab->root.splt->size == 0)
- return TRUE;
-
- osi.sec = htab->root.splt;
- osi.sec_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
- osi.sec->output_section);
- /* Output mapping symbols for the plt header. SymbianOS does not have a
- plt header. */
- if (htab->vxworks_p)
+ if (htab->root.splt && htab->root.splt->size > 0)
{
- /* VxWorks shared libraries have no PLT header. */
- if (!info->shared)
+ osi.sec = htab->root.splt;
+ osi.sec_shndx = (_bfd_elf_section_from_bfd_section
+ (output_bfd, osi.sec->output_section));
+
+ /* Output mapping symbols for the plt header. SymbianOS does not have a
+ plt header. */
+ if (htab->vxworks_p)
+ {
+ /* VxWorks shared libraries have no PLT header. */
+ if (!info->shared)
+ {
+ if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
+ return FALSE;
+ if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, 12))
+ return FALSE;
+ }
+ }
+ else if (!htab->symbian_p)
{
if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
return FALSE;
- if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, 12))
+#ifndef FOUR_WORD_PLT
+ if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, 16))
return FALSE;
+#endif
}
}
- else if (!htab->symbian_p)
+ if ((htab->root.splt && htab->root.splt->size > 0)
+ || (htab->root.iplt && htab->root.iplt->size > 0))
{
- if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
- return FALSE;
-#ifndef FOUR_WORD_PLT
- if (!elf32_arm_output_map_sym (&osi, ARM_MAP_DATA, 16))
- return FALSE;
-#endif
- }
+ elf_link_hash_traverse (&htab->root, elf32_arm_output_plt_map, &osi);
+ for (input_bfd = info->input_bfds;
+ input_bfd != NULL;
+ input_bfd = input_bfd->link_next)
+ {
+ struct arm_local_iplt_info **local_iplt;
+ unsigned int i, num_syms;
+ local_iplt = elf32_arm_local_iplt (input_bfd);
+ if (local_iplt != NULL)
+ {
+ num_syms = elf_symtab_hdr (input_bfd).sh_info;
+ for (i = 0; i < num_syms; i++)
+ if (local_iplt[i] != NULL
+ && !elf32_arm_output_plt_map_1 (&osi, TRUE,
+ &local_iplt[i]->root,
+ &local_iplt[i]->arm))
+ return FALSE;
+ }
+ }
+ }
if (htab->dt_tlsdesc_plt != 0)
{
/* Mapping symbols for the lazy tls trampoline. */
@@ -14005,7 +14643,6 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
#endif
}
- elf_link_hash_traverse (&htab->root, elf32_arm_output_plt_map, (void *) &osi);
return TRUE;
}
@@ -14475,7 +15112,8 @@ elf32_arm_swap_symbol_in (bfd * abfd,
/* New EABI objects mark thumb function symbols by setting the low bit of
the address. */
- if ((ELF_ST_TYPE (dst->st_info) == STT_FUNC)
+ if ((ELF_ST_TYPE (dst->st_info) == STT_FUNC
+ || ELF_ST_TYPE (dst->st_info) == STT_GNU_IFUNC)
&& (dst->st_value & 1))
{
dst->st_value &= ~(bfd_vma) 1;
@@ -14512,7 +15150,8 @@ elf32_arm_swap_symbol_out (bfd *abfd,
if (src->st_target_internal == ST_BRANCH_TO_THUMB)
{
newsym = *src;
- newsym.st_info = ELF_ST_INFO (ELF_ST_BIND (src->st_info), STT_FUNC);
+ if (ELF_ST_TYPE (src->st_info) != STT_GNU_IFUNC)
+ newsym.st_info = ELF_ST_INFO (ELF_ST_BIND (src->st_info), STT_FUNC);
if (newsym.st_shndx != SHN_UNDEF)
{
/* Do this only for defined symbols. At link type, the static
@@ -14582,6 +15221,26 @@ elf32_arm_additional_program_headers (bfd *abfd,
return 0;
}
+/* Hook called by the linker routine which adds symbols from an object
+ file. */
+
+static bfd_boolean
+elf32_arm_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
+ Elf_Internal_Sym *sym, const char **namep,
+ flagword *flagsp, asection **secp, bfd_vma *valp)
+{
+ if ((abfd->flags & DYNAMIC) == 0
+ && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+ elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
+
+ if (elf32_arm_hash_table (info)->vxworks_p
+ && !elf_vxworks_add_symbol_hook (abfd, info, sym, namep,
+ flagsp, secp, valp))
+ return FALSE;
+
+ return TRUE;
+}
+
/* We use this to override swap_symbol_in and swap_symbol_out. */
const struct elf_size_info elf32_arm_size_info =
{
@@ -14667,6 +15326,7 @@ const struct elf_size_info elf32_arm_size_info =
#define elf_backend_additional_program_headers elf32_arm_additional_program_headers
#define elf_backend_output_arch_local_syms elf32_arm_output_arch_local_syms
#define elf_backend_begin_write_processing elf32_arm_begin_write_processing
+#define elf_backend_add_symbol_hook elf32_arm_add_symbol_hook
#define elf_backend_can_refcount 1
#define elf_backend_can_gc_sections 1
@@ -14734,8 +15394,6 @@ elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
#undef bfd_elf32_bfd_link_hash_table_create
#define bfd_elf32_bfd_link_hash_table_create elf32_arm_vxworks_link_hash_table_create
-#undef elf_backend_add_symbol_hook
-#define elf_backend_add_symbol_hook elf_vxworks_add_symbol_hook
#undef elf_backend_final_write_processing
#define elf_backend_final_write_processing elf32_arm_vxworks_final_write_processing
#undef elf_backend_emit_relocs
@@ -15103,7 +15761,6 @@ elf32_arm_symbian_plt_sym_val (bfd_vma i, const asection *plt,
#define ELF_DYNAMIC_SEC_FLAGS \
(SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED)
-#undef elf_backend_add_symbol_hook
#undef elf_backend_emit_relocs
#undef bfd_elf32_bfd_link_hash_table_create
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 719eb00..2e2dccd 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -3042,6 +3042,11 @@ ENUMDOC
Annotation of BX instructions.
ENUM
+ BFD_RELOC_ARM_IRELATIVE
+ENUMDOC
+ ARM support for STT_GNU_IFUNC.
+
+ENUM
BFD_RELOC_ARM_IMMEDIATE
ENUMX
BFD_RELOC_ARM_ADRL_IMMEDIATE
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e40a8a2..b08aa1c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,11 @@
2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+ * 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.
+
+2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+
* config/tc-arm.c (arm_adjust_symtab): Set the branch type
for Thumb symbols.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 8a70c37..28c4d24 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -19750,7 +19750,7 @@ md_pcrel_from_section (fixS * fixP, segT seg)
case BFD_RELOC_THUMB_PCREL_BRANCH23:
if (fixP->fx_addsy
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
- && (!S_IS_EXTERNAL (fixP->fx_addsy))
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& ARM_IS_FUNC (fixP->fx_addsy)
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t))
base = fixP->fx_where + fixP->fx_frag->fr_address;
@@ -19761,7 +19761,7 @@ md_pcrel_from_section (fixS * fixP, segT seg)
case BFD_RELOC_THUMB_PCREL_BLX:
if (fixP->fx_addsy
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
- && (!S_IS_EXTERNAL (fixP->fx_addsy))
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& THUMB_IS_FUNC (fixP->fx_addsy)
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t))
base = fixP->fx_where + fixP->fx_frag->fr_address;
@@ -19772,7 +19772,7 @@ md_pcrel_from_section (fixS * fixP, segT seg)
case BFD_RELOC_ARM_PCREL_BLX:
if (fixP->fx_addsy
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
- && (!S_IS_EXTERNAL (fixP->fx_addsy))
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& ARM_IS_FUNC (fixP->fx_addsy)
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t))
base = fixP->fx_where + fixP->fx_frag->fr_address;
@@ -19781,7 +19781,7 @@ md_pcrel_from_section (fixS * fixP, segT seg)
case BFD_RELOC_ARM_PCREL_CALL:
if (fixP->fx_addsy
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
- && (!S_IS_EXTERNAL (fixP->fx_addsy))
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& THUMB_IS_FUNC (fixP->fx_addsy)
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t))
base = fixP->fx_where + fixP->fx_frag->fr_address;
@@ -20595,7 +20595,7 @@ md_apply_fix (fixS * fixP,
if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)
&& fixP->fx_addsy
- && !S_IS_EXTERNAL (fixP->fx_addsy)
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
&& THUMB_IS_FUNC (fixP->fx_addsy))
/* Flip the bl to blx. This is a simple flip
@@ -20615,7 +20615,7 @@ md_apply_fix (fixS * fixP,
case BFD_RELOC_ARM_PCREL_JUMP:
if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)
&& fixP->fx_addsy
- && !S_IS_EXTERNAL (fixP->fx_addsy)
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
&& THUMB_IS_FUNC (fixP->fx_addsy))
{
@@ -20638,7 +20638,7 @@ md_apply_fix (fixS * fixP,
temp = 1;
if (ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)
&& fixP->fx_addsy
- && !S_IS_EXTERNAL (fixP->fx_addsy)
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
&& ARM_IS_FUNC (fixP->fx_addsy))
{
@@ -20746,8 +20746,7 @@ md_apply_fix (fixS * fixP,
case BFD_RELOC_THUMB_PCREL_BRANCH20:
if (fixP->fx_addsy
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
- && !S_IS_EXTERNAL (fixP->fx_addsy)
- && S_IS_DEFINED (fixP->fx_addsy)
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& ARM_IS_FUNC (fixP->fx_addsy)
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t))
{
@@ -20785,8 +20784,7 @@ md_apply_fix (fixS * fixP,
about it. */
if (fixP->fx_addsy
- && S_IS_DEFINED (fixP->fx_addsy)
- && !S_IS_EXTERNAL (fixP->fx_addsy)
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
&& THUMB_IS_FUNC (fixP->fx_addsy))
{
@@ -20810,8 +20808,7 @@ md_apply_fix (fixS * fixP,
is converted to a blx. */
if (fixP->fx_addsy
&& (S_GET_SEGMENT (fixP->fx_addsy) == seg)
- && !S_IS_EXTERNAL (fixP->fx_addsy)
- && S_IS_DEFINED (fixP->fx_addsy)
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE)
&& ARM_IS_FUNC (fixP->fx_addsy)
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t))
{
@@ -23716,7 +23713,7 @@ arm_apply_sym_value (struct fix * fixP)
{
if (fixP->fx_addsy
&& ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)
- && !S_IS_EXTERNAL (fixP->fx_addsy))
+ && !S_FORCE_RELOC (fixP->fx_addsy, TRUE))
{
switch (fixP->fx_r_type)
{
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 8fd7c5e..182a59b 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,5 +1,9 @@
2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+ * arm.h (R_ARM_IRELATIVE): New relocation.
+
+2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+
* internal.h (elf_internal_sym): Add st_target_internal.
* arm.h (arm_st_branch_type): New enum.
(ARM_SYM_BRANCH_TYPE): New macro.
diff --git a/include/elf/arm.h b/include/elf/arm.h
index e3df27f..5b01835 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -226,6 +226,8 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
RELOC_NUMBER (R_ARM_ME_TOO, 128) /* obsolete */
RELOC_NUMBER (R_ARM_THM_TLS_DESCSEQ ,129)
+ RELOC_NUMBER (R_ARM_IRELATIVE, 160)
+
/* Extensions? R=read-only? */
RELOC_NUMBER (R_ARM_RXPC25, 249)
RELOC_NUMBER (R_ARM_RSBREL32, 250)
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index d253267..1e145cd 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,35 @@
2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+ * 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 Richard Sandiford <richard.sandiford@linaro.org>
+
* ld-arm/arm-lib-plt-2a.s, ld-arm/arm-lib-plt-2b.s,
ld-arm/arm-lib-plt-2.dd, ld-arm/arm-lib-plt-2.rd: New tests.
* ld-arm/arm-elf.exp: Run them.
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 11ee575..5b50da5 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -311,6 +311,88 @@ set armelftests {
"" {exec-got-1b.s}
{{readelf --relocs exec-got-1.d}}
"exec-got-1"}
+ {"IFUNC test 1" "-T ifunc-static.ld" "" {ifunc-1.s}
+ {{objdump -d ifunc-1.dd}
+ {objdump {-s -j.data -j.got} ifunc-1.gd}
+ {readelf -dr ifunc-1.rd}}
+ "ifunc-1"}
+ {"IFUNC test 2" "-T ifunc-static.ld" "" {ifunc-2.s}
+ {{objdump -d ifunc-2.dd}
+ {objdump {-s -j.data -j.got} ifunc-2.gd}
+ {readelf -dr ifunc-2.rd}}
+ "ifunc-2"}
+ {"IFUNC test 3" "-T ifunc-dynamic.ld -shared" "" {ifunc-3.s}
+ {{objdump -d ifunc-3.dd}
+ {objdump {-s -j.data -j.got} ifunc-3.gd}
+ {readelf -r ifunc-3.rd}}
+ "ifunc-3.so"}
+ {"IFUNC test 4" "-T ifunc-dynamic.ld -shared" "" {ifunc-4.s}
+ {{objdump -d ifunc-4.dd}
+ {objdump {-s -j.data -j.got} ifunc-4.gd}
+ {readelf -r ifunc-4.rd}}
+ "ifunc-4.so"}
+ {"IFUNC test 5" "-T ifunc-static.ld" "" {ifunc-5.s}
+ {{objdump -d ifunc-5.dd}
+ {objdump {-s -j.data -j.got} ifunc-5.gd}
+ {readelf -dr ifunc-5.rd}}
+ "ifunc-5"}
+ {"IFUNC test 6" "-T ifunc-static.ld" "" {ifunc-6.s}
+ {{objdump -d ifunc-6.dd}
+ {objdump {-s -j.data -j.got} ifunc-6.gd}
+ {readelf -dr ifunc-6.rd}}
+ "ifunc-6"}
+ {"IFUNC test 7" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so -shared"
+ "" {ifunc-7.s}
+ {{objdump -d ifunc-7.dd}
+ {objdump {-s -j.data -j.got} ifunc-7.gd}
+ {readelf -r ifunc-7.rd}}
+ "ifunc-7.so"}
+ {"IFUNC test 8" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so -shared"
+ "" {ifunc-8.s}
+ {{objdump -d ifunc-8.dd}
+ {objdump {-s -j.data -j.got} ifunc-8.gd}
+ {readelf -r ifunc-8.rd}}
+ "ifunc-8.so"}
+ {"IFUNC test 9" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so" "" {ifunc-9.s}
+ {{objdump -d ifunc-9.dd}
+ {objdump {-s -j.data -j.got} ifunc-9.gd}
+ {readelf -r ifunc-9.rd}}
+ "ifunc-9"}
+ {"IFUNC test 10" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so" "" {ifunc-10.s}
+ {{objdump -d ifunc-10.dd}
+ {objdump {-s -j.data -j.got} ifunc-10.gd}
+ {readelf -r ifunc-10.rd}}
+ "ifunc-10"}
+ {"IFUNC test 11" "-T ifunc-static.ld" "" {ifunc-11.s}
+ {{objdump -d ifunc-11.dd}
+ {objdump {-s -j.data -j.got} ifunc-11.gd}
+ {readelf -dr ifunc-11.rd}}
+ "ifunc-11"}
+ {"IFUNC test 12" "-T ifunc-dynamic.ld -shared" "" {ifunc-12.s}
+ {{objdump -d ifunc-12.dd}
+ {objdump {-s -j.data -j.got} ifunc-12.gd}
+ {readelf -r ifunc-12.rd}}
+ "ifunc-12.so"}
+ {"IFUNC test 13" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" {ifunc-13.s}
+ {{objdump -d ifunc-13.dd}
+ {objdump {-s -j.data -j.got} ifunc-13.gd}
+ {readelf -r ifunc-13.rd}}
+ "ifunc-13"}
+ {"IFUNC test 14" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" {ifunc-14.s}
+ {{objdump -d ifunc-14.dd}
+ {objdump {-s -j.data -j.got} ifunc-14.gd}
+ {readelf -r ifunc-14.rd}}
+ "ifunc-14"}
+ {"IFUNC test 15" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" {ifunc-15.s}
+ {{objdump -d ifunc-15.dd}
+ {objdump {-s -j.data -j.got} ifunc-15.gd}
+ {readelf -r ifunc-15.rd}}
+ "ifunc-15"}
+ {"IFUNC test 16" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" {ifunc-16.s}
+ {{objdump -d ifunc-16.dd}
+ {objdump {-s -j.data -j.got} ifunc-16.gd}
+ {readelf -r ifunc-16.rd}}
+ "ifunc-16"}
}
run_ld_link_tests $armelftests
diff --git a/ld/testsuite/ld-arm/farcall-group-size2.d b/ld/testsuite/ld-arm/farcall-group-size2.d
index 8a35313..8b1f765 100644
--- a/ld/testsuite/ld-arm/farcall-group-size2.d
+++ b/ld/testsuite/ld-arm/farcall-group-size2.d
@@ -19,19 +19,19 @@ Disassembly of section .text:
00001020 <myfunc>:
1020: eb000008 bl 1048 <__bar3_veneer>
- 1024: eb000001 bl 1030 <__bar4_from_arm>
- 1028: eb000003 bl 103c <__bar5_from_arm>
+ 1024: eb000004 bl 103c <__bar4_from_arm>
+ 1028: eb000000 bl 1030 <__bar5_from_arm>
102c: 00000000 andeq r0, r0, r0
-00001030 <__bar4_from_arm>:
- 1030: e59fc000 ldr ip, \[pc, #0\] ; 1038 <__bar4_from_arm\+0x8>
+00001030 <__bar5_from_arm>:
+ 1030: e59fc000 ldr ip, \[pc, #0\] ; 1038 <__bar5_from_arm\+0x8>
1034: e12fff1c bx ip
- 1038: 0200302d .word 0x0200302d
+ 1038: 0200302f .word 0x0200302f
-0000103c <__bar5_from_arm>:
- 103c: e59fc000 ldr ip, \[pc, #0\] ; 1044 <__bar5_from_arm\+0x8>
+0000103c <__bar4_from_arm>:
+ 103c: e59fc000 ldr ip, \[pc, #0\] ; 1044 <__bar4_from_arm\+0x8>
1040: e12fff1c bx ip
- 1044: 0200302f .word 0x0200302f
+ 1044: 0200302d .word 0x0200302d
00001048 <__bar3_veneer>:
1048: e51ff004 ldr pc, \[pc, #-4\] ; 104c <__bar3_veneer\+0x4>
diff --git a/ld/testsuite/ld-arm/farcall-group.d b/ld/testsuite/ld-arm/farcall-group.d
index a72c14ff..f20b785 100644
--- a/ld/testsuite/ld-arm/farcall-group.d
+++ b/ld/testsuite/ld-arm/farcall-group.d
@@ -4,37 +4,37 @@
Disassembly of section .text:
00001000 <_start>:
- 1000: eb000009 bl 102c <__bar_from_arm>
- 1004: eb000006 bl 1024 <__bar2_veneer>
+ 1000: eb00000c bl 1038 <__bar_from_arm>
+ 1004: eb00000e bl 1044 <__bar2_veneer>
00001008 <myfunc>:
- 1008: eb00000d bl 1044 <__bar3_veneer>
- 100c: eb000001 bl 1018 <__bar4_from_arm>
- 1010: eb000008 bl 1038 <__bar5_from_arm>
+ 1008: eb000008 bl 1030 <__bar3_veneer>
+ 100c: eb000004 bl 1024 <__bar4_from_arm>
+ 1010: eb000000 bl 1018 <__bar5_from_arm>
1014: 00000000 andeq r0, r0, r0
-00001018 <__bar4_from_arm>:
- 1018: e59fc000 ldr ip, \[pc, #0\] ; 1020 <__bar4_from_arm\+0x8>
+00001018 <__bar5_from_arm>:
+ 1018: e59fc000 ldr ip, \[pc, #0\] ; 1020 <__bar5_from_arm\+0x8>
101c: e12fff1c bx ip
- 1020: 0200302d .word 0x0200302d
+ 1020: 0200302f .word 0x0200302f
-00001024 <__bar2_veneer>:
- 1024: e51ff004 ldr pc, \[pc, #-4\] ; 1028 <__bar2_veneer\+0x4>
- 1028: 02003024 .word 0x02003024
+00001024 <__bar4_from_arm>:
+ 1024: e59fc000 ldr ip, \[pc, #0\] ; 102c <__bar4_from_arm\+0x8>
+ 1028: e12fff1c bx ip
+ 102c: 0200302d .word 0x0200302d
-0000102c <__bar_from_arm>:
- 102c: e59fc000 ldr ip, \[pc, #0\] ; 1034 <__bar_from_arm\+0x8>
- 1030: e12fff1c bx ip
- 1034: 02003021 .word 0x02003021
+00001030 <__bar3_veneer>:
+ 1030: e51ff004 ldr pc, \[pc, #-4\] ; 1034 <__bar3_veneer\+0x4>
+ 1034: 02003028 .word 0x02003028
-00001038 <__bar5_from_arm>:
- 1038: e59fc000 ldr ip, \[pc, #0\] ; 1040 <__bar5_from_arm\+0x8>
+00001038 <__bar_from_arm>:
+ 1038: e59fc000 ldr ip, \[pc, #0\] ; 1040 <__bar_from_arm\+0x8>
103c: e12fff1c bx ip
- 1040: 0200302f .word 0x0200302f
+ 1040: 02003021 .word 0x02003021
-00001044 <__bar3_veneer>:
- 1044: e51ff004 ldr pc, \[pc, #-4\] ; 1048 <__bar3_veneer\+0x4>
- 1048: 02003028 .word 0x02003028
+00001044 <__bar2_veneer>:
+ 1044: e51ff004 ldr pc, \[pc, #-4\] ; 1048 <__bar2_veneer\+0x4>
+ 1048: 02003024 .word 0x02003024
...
Disassembly of section .foo:
diff --git a/ld/testsuite/ld-arm/farcall-mixed-lib-v4t.d b/ld/testsuite/ld-arm/farcall-mixed-lib-v4t.d
index b6729b2..0863e9d 100644
--- a/ld/testsuite/ld-arm/farcall-mixed-lib-v4t.d
+++ b/ld/testsuite/ld-arm/farcall-mixed-lib-v4t.d
@@ -89,26 +89,26 @@ Disassembly of section .text:
...
.* <__real_lib_func3>:
- .*: f000 f806 bl 2000380 <__app_func_from_thumb>
- .*: f000 f80c bl 2000390 <__app_func_weak_from_thumb>
+ .*: f000 f80e bl 2000390 <__app_func_from_thumb>
+ .*: f000 f804 bl 2000380 <__app_func_weak_from_thumb>
.*: 4770 bx lr
.*: 46c0 nop ; \(mov r8, r8\)
.*: 46c0 nop ; \(mov r8, r8\)
.*: 46c0 nop ; \(mov r8, r8\)
-.* <__app_func_from_thumb>:
+.* <__app_func_weak_from_thumb>:
.*: 4778 bx pc
.*: 46c0 nop ; \(mov r8, r8\)
- .*: e59fc000 ldr ip, \[pc, #0\] ; 200038c <__app_func_from_thumb\+0xc>
+ .*: e59fc000 ldr ip, \[pc, #0\] ; 200038c <__app_func_weak_from_thumb\+0xc>
.*: e08cf00f add pc, ip, pc
- .*: fdffff18 .word 0xfdffff18
+ .*: fdffff28 .word 0xfdffff28
-.* <__app_func_weak_from_thumb>:
+.* <__app_func_from_thumb>:
.*: 4778 bx pc
.*: 46c0 nop ; \(mov r8, r8\)
- .*: e59fc000 ldr ip, \[pc, #0\] ; 200039c <__app_func_weak_from_thumb\+0xc>
+ .*: e59fc000 ldr ip, \[pc, #0\] ; 200039c <__app_func_from_thumb\+0xc>
.*: e08cf00f add pc, ip, pc
- .*: fdffff18 .word 0xfdffff18
+ .*: fdffff08 .word 0xfdffff08
.* <lib_func3>:
.*: e59fc004 ldr ip, \[pc, #4\] ; 20003ac <lib_func3\+0xc>
diff --git a/ld/testsuite/ld-arm/farcall-mixed-lib.d b/ld/testsuite/ld-arm/farcall-mixed-lib.d
index 9df3933..2b0b9ac 100644
--- a/ld/testsuite/ld-arm/farcall-mixed-lib.d
+++ b/ld/testsuite/ld-arm/farcall-mixed-lib.d
@@ -73,20 +73,20 @@ Disassembly of section .text:
...
.* <lib_func3>:
- .*: f000 e806 blx 2000370 <__app_func_from_thumb>
- .*: f000 e80a blx 200037c <__app_func_weak_from_thumb>
+ .*: f000 e80c blx 200037c <__app_func_from_thumb>
+ .*: f000 e804 blx 2000370 <__app_func_weak_from_thumb>
.*: 4770 bx lr
.*: 46c0 nop ; \(mov r8, r8\)
.*: 46c0 nop ; \(mov r8, r8\)
.*: 46c0 nop ; \(mov r8, r8\)
-.* <__app_func_from_thumb>:
- .*: e59fc000 ldr ip, \[pc, #0\] ; 2000378 <__app_func_from_thumb\+0x8>
+.* <__app_func_weak_from_thumb>:
+ .*: e59fc000 ldr ip, \[pc, #0\] ; 2000378 <__app_func_weak_from_thumb\+0x8>
.*: e08ff00c add pc, pc, ip
- .*: fdffff28 .word 0xfdffff28
+ .*: fdffff34 .word 0xfdffff34
-.* <__app_func_weak_from_thumb>:
- .*: e59fc000 ldr ip, \[pc, #0\] ; 2000384 <__app_func_weak_from_thumb\+0x8>
+.* <__app_func_from_thumb>:
+ .*: e59fc000 ldr ip, \[pc, #0\] ; 2000384 <__app_func_from_thumb\+0x8>
.*: e08ff00c add pc, pc, ip
- .*: fdffff28 .word 0xfdffff28
+ .*: fdffff1c .word 0xfdffff1c
...
diff --git a/ld/testsuite/ld-arm/ifunc-1.dd b/ld/testsuite/ld-arm/ifunc-1.dd
new file mode 100644
index 0000000..de6d813
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-1.dd
@@ -0,0 +1,139 @@
+
+.*
+
+
+Disassembly of section \.iplt:
+
+00009000 <f3-0xc>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 9000: e28fc600 add ip, pc, #0
+ 9004: e28cca08 add ip, ip, #32768 ; 0x8000
+ 9008: e5bcf004 ldr pc, \[ip, #4\]!
+
+0000900c <f3>:
+ 900c: e28fc600 add ip, pc, #0
+ 9010: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9014: e5bcfffc ldr pc, \[ip, #4092\]! ; 0xffc
+
+00009018 <f2>:
+ 9018: e28fc600 add ip, pc, #0
+ 901c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9020: e5bcfff4 ldr pc, \[ip, #4084\]! ; 0xff4
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+ a004: e1a0f00e mov pc, lr
+ a008: e1a0f00e mov pc, lr
+
+0000a00c <_start>:
+ a00c: eb0017fb bl 10000 <foo>
+ a010: e59f400c ldr r4, \[pc, #12\] ; a024 <_start\+0x18>
+ a014: e59f400c ldr r4, \[pc, #12\] ; a028 <_start\+0x1c>
+ a018: e59f400c ldr r4, \[pc, #12\] ; a02c <_start\+0x20>
+ a01c: e59f400c ldr r4, \[pc, #12\] ; a030 <_start\+0x24>
+ a020: e59f500c ldr r5, \[pc, #12\] ; a034 <_start\+0x28>
+#------------------------------------------------------------------------------
+#------ foo
+#------------------------------------------------------------------------------
+ a024: 00010000 \.word 0x00010000
+#------------------------------------------------------------------------------
+#------ PC-relative offset of foo
+#------------------------------------------------------------------------------
+ a028: 00005fd8 \.word 0x00005fd8
+#------------------------------------------------------------------------------
+#------ GP-relative offset of foo
+#------------------------------------------------------------------------------
+ a02c: fffff000 \.word 0xfffff000
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a030: 00000020 \.word 0x00000020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a034: 00006fe4 \.word 0x00006fe4
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a038: ebfffbf0 bl 9000 <__irel_end\+0xfe8>
+ a03c: e59f400c ldr r4, \[pc, #12\] ; a050 <_start\+0x44>
+ a040: e59f400c ldr r4, \[pc, #12\] ; a054 <_start\+0x48>
+ a044: e59f400c ldr r4, \[pc, #12\] ; a058 <_start\+0x4c>
+ a048: e59f400c ldr r4, \[pc, #12\] ; a05c <_start\+0x50>
+ a04c: e59f500c ldr r5, \[pc, #12\] ; a060 <_start\+0x54>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a050: 00009000 \.word 0x00009000
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .iplt entry
+#------------------------------------------------------------------------------
+ a054: ffffefac \.word 0xffffefac
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f1's .iplt entry
+#------------------------------------------------------------------------------
+ a058: ffff8000 \.word 0xffff8000
+#------------------------------------------------------------------------------
+#------ .got offset for f1's .iplt entry
+#------------------------------------------------------------------------------
+ a05c: 0000001c \.word 0x0000001c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f1's .iplt entry
+#------------------------------------------------------------------------------
+ a060: 00006fbc \.word 0x00006fbc
+ a064: ebfffbeb bl 9018 <f2>
+ a068: e59f400c ldr r4, \[pc, #12\] ; a07c <_start\+0x70>
+ a06c: e59f400c ldr r4, \[pc, #12\] ; a080 <_start\+0x74>
+ a070: e59f400c ldr r4, \[pc, #12\] ; a084 <_start\+0x78>
+ a074: e59f400c ldr r4, \[pc, #12\] ; a088 <_start\+0x7c>
+ a078: e59f500c ldr r5, \[pc, #12\] ; a08c <_start\+0x80>
+#------------------------------------------------------------------------------
+#------ f2
+#------------------------------------------------------------------------------
+ a07c: 00009018 \.word 0x00009018
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f2
+#------------------------------------------------------------------------------
+ a080: ffffef98 \.word 0xffffef98
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f2
+#------------------------------------------------------------------------------
+ a084: ffff8018 \.word 0xffff8018
+#------------------------------------------------------------------------------
+#------ .got offset for f2
+#------------------------------------------------------------------------------
+ a088: 00000028 \.word 0x00000028
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f2
+#------------------------------------------------------------------------------
+ a08c: 00006f9c \.word 0x00006f9c
+ a090: ebfffbdd bl 900c <f3>
+ a094: e59f400c ldr r4, \[pc, #12\] ; a0a8 <_start\+0x9c>
+ a098: e59f400c ldr r4, \[pc, #12\] ; a0ac <_start\+0xa0>
+ a09c: e59f400c ldr r4, \[pc, #12\] ; a0b0 <_start\+0xa4>
+ a0a0: e59f400c ldr r4, \[pc, #12\] ; a0b4 <_start\+0xa8>
+ a0a4: e59f500c ldr r5, \[pc, #12\] ; a0b8 <_start\+0xac>
+#------------------------------------------------------------------------------
+#------ f3
+#------------------------------------------------------------------------------
+ a0a8: 0000900c \.word 0x0000900c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3
+#------------------------------------------------------------------------------
+ a0ac: ffffef60 \.word 0xffffef60
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f3
+#------------------------------------------------------------------------------
+ a0b0: ffff800c \.word 0xffff800c
+#------------------------------------------------------------------------------
+#------ .got offset for f3
+#------------------------------------------------------------------------------
+ a0b4: 00000024 \.word 0x00000024
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f3
+#------------------------------------------------------------------------------
+ a0b8: 00006f6c \.word 0x00006f6c
diff --git a/ld/testsuite/ld-arm/ifunc-1.gd b/ld/testsuite/ld-arm/ifunc-1.gd
new file mode 100644
index 0000000..ff51d37
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-1.gd
@@ -0,0 +1,29 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 00800000 18800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11000 00000000 00000000 00000000 00a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f3's .igot.plt pointer to 0xa008 [R_ARM_IRELATIVE]
+#------ 00011014: f2's .igot.plt pointer to 0xa004 [R_ARM_IRELATIVE]
+#------ 00011018: .got entry for foo
+#------ 0001101c: .got entry for f1's .iplt entry
+#------------------------------------------------------------------------------
+ 11010 08a00000 04a00000 00000100 00900000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for foo
+#------ 00011024: .got entry for f3
+#------ 00011028: .got entry for f2
+#------------------------------------------------------------------------------
+ 11020 00000100 0c900000 18900000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-1.rd b/ld/testsuite/ld-arm/ifunc-1.rd
new file mode 100644
index 0000000..75e6d70
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-1.rd
@@ -0,0 +1,8 @@
+
+There is no dynamic section in this file\.
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 3 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......a0 R_ARM_IRELATIVE
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
diff --git a/ld/testsuite/ld-arm/ifunc-1.s b/ld/testsuite/ld-arm/ifunc-1.s
new file mode 100644
index 0000000..7745c54
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-1.s
@@ -0,0 +1,48 @@
+ .macro define,name
+ .type \name,%gnu_indirect_function
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ bl \name
+ ldr r4,1f
+ ldr r4,2f
+ ldr r4,3f
+ ldr r4,4f
+ ldr r5,5f
+1:
+ .word \name
+2:
+ .word \name-.
+3:
+ .word \name(GOTOFF)
+4:
+ .word \name(GOT)
+5:
+ .word \name(GOT_PREL)
+ .endm
+
+ .global f2
+
+ .global f3
+ .hidden f3
+
+ define f1
+ define f2
+ define f3
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-10.dd b/ld/testsuite/ld-arm/ifunc-10.dd
new file mode 100644
index 0000000..5f876fb
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-10.dd
@@ -0,0 +1,951 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <atf3-0x110>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ 9014: 4778 bx pc
+ 9016: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf2's .plt entry
+#------------------------------------------------------------------------------
+ 9018: e28fc600 add ip, pc, #0
+ 901c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9020: e5bcffec ldr pc, \[ip, #4076\]! ; 0xfec
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ 9024: e28fc600 add ip, pc, #0
+ 9028: e28cca07 add ip, ip, #28672 ; 0x7000
+ 902c: e5bcffe4 ldr pc, \[ip, #4068\]! ; 0xfe4
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ 9030: 4778 bx pc
+ 9032: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf2's .plt entry
+#------------------------------------------------------------------------------
+ 9034: e28fc600 add ip, pc, #0
+ 9038: e28cca07 add ip, ip, #28672 ; 0x7000
+ 903c: e5bcffd8 ldr pc, \[ip, #4056\]! ; 0xfd8
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ 9040: 4778 bx pc
+ 9042: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ 9044: e28fc600 add ip, pc, #0
+ 9048: e28cca07 add ip, ip, #28672 ; 0x7000
+ 904c: e5bcffcc ldr pc, \[ip, #4044\]! ; 0xfcc
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ 9050: e28fc600 add ip, pc, #0
+ 9054: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9058: e5bcffc4 ldr pc, \[ip, #4036\]! ; 0xfc4
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ 905c: e28fc600 add ip, pc, #0
+ 9060: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9064: e5bcffbc ldr pc, \[ip, #4028\]! ; 0xfbc
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .plt entry
+#------------------------------------------------------------------------------
+ 9068: 4778 bx pc
+ 906a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ 906c: e28fc600 add ip, pc, #0
+ 9070: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9074: e5bcffb0 ldr pc, \[ip, #4016\]! ; 0xfb0
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .plt entry
+#------------------------------------------------------------------------------
+ 9078: 4778 bx pc
+ 907a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ 907c: e28fc600 add ip, pc, #0
+ 9080: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9084: e5bcffa4 ldr pc, \[ip, #4004\]! ; 0xfa4
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .plt entry
+#------------------------------------------------------------------------------
+ 9088: 4778 bx pc
+ 908a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf4's .plt entry
+#------------------------------------------------------------------------------
+ 908c: e28fc600 add ip, pc, #0
+ 9090: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9094: e5bcff98 ldr pc, \[ip, #3992\]! ; 0xf98
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .plt entry
+#------------------------------------------------------------------------------
+ 9098: 4778 bx pc
+ 909a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf4's .plt entry
+#------------------------------------------------------------------------------
+ 909c: e28fc600 add ip, pc, #0
+ 90a0: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90a4: e5bcff8c ldr pc, \[ip, #3980\]! ; 0xf8c
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ 90a8: e28fc600 add ip, pc, #0
+ 90ac: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90b0: e5bcff84 ldr pc, \[ip, #3972\]! ; 0xf84
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ 90b4: 4778 bx pc
+ 90b6: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ 90b8: e28fc600 add ip, pc, #0
+ 90bc: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90c0: e5bcff78 ldr pc, \[ip, #3960\]! ; 0xf78
+
+Disassembly of section \.iplt:
+
+000090c4 <atf3-0x5c>:
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90c4: e28fc600 add ip, pc, #0
+ 90c8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90cc: e5bcff70 ldr pc, \[ip, #3952\]! ; 0xf70
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90d0: 4778 bx pc
+ 90d2: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90d4: e28fc600 add ip, pc, #0
+ 90d8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90dc: e5bcff64 ldr pc, \[ip, #3940\]! ; 0xf64
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90e0: 4778 bx pc
+ 90e2: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90e4: e28fc600 add ip, pc, #0
+ 90e8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90ec: e5bcff58 ldr pc, \[ip, #3928\]! ; 0xf58
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90f0: e28fc600 add ip, pc, #0
+ 90f4: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90f8: e5bcff50 ldr pc, \[ip, #3920\]! ; 0xf50
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90fc: 4778 bx pc
+ 90fe: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ 9100: e28fc600 add ip, pc, #0
+ 9104: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9108: e5bcff44 ldr pc, \[ip, #3908\]! ; 0xf44
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ 910c: 4778 bx pc
+ 910e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ 9110: e28fc600 add ip, pc, #0
+ 9114: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9118: e5bcff38 ldr pc, \[ip, #3896\]! ; 0xf38
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3
+#------------------------------------------------------------------------------
+ 911c: 4778 bx pc
+ 911e: 46c0 nop ; \(mov r8, r8\)
+
+00009120 <atf3>:
+ 9120: e28fc600 add ip, pc, #0
+ 9124: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9128: e5bcff2c ldr pc, \[ip, #3884\]! ; 0xf2c
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3
+#------------------------------------------------------------------------------
+ 912c: 4778 bx pc
+ 912e: 46c0 nop ; \(mov r8, r8\)
+
+00009130 <abf3>:
+ 9130: e28fc600 add ip, pc, #0
+ 9134: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9138: e5bcff20 ldr pc, \[ip, #3872\]! ; 0xf20
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3
+#------------------------------------------------------------------------------
+ 913c: 4778 bx pc
+ 913e: 46c0 nop ; \(mov r8, r8\)
+
+00009140 <ttf3>:
+ 9140: e28fc600 add ip, pc, #0
+ 9144: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9148: e5bcff14 ldr pc, \[ip, #3860\]! ; 0xf14
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3
+#------------------------------------------------------------------------------
+ 914c: 4778 bx pc
+ 914e: 46c0 nop ; \(mov r8, r8\)
+
+00009150 <tbf3>:
+ 9150: e28fc600 add ip, pc, #0
+ 9154: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9158: e5bcff08 ldr pc, \[ip, #3848\]! ; 0xf08
+
+0000915c <taf3>:
+ 915c: e28fc600 add ip, pc, #0
+ 9160: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9164: e5bcff00 ldr pc, \[ip, #3840\]! ; 0xf00
+
+00009168 <aaf3>:
+ 9168: e28fc600 add ip, pc, #0
+ 916c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9170: e5bcfef8 ldr pc, \[ip, #3832\]! ; 0xef8
+
+Disassembly of section \.text:
+
+0000a000 <aaf1>:
+ a000: e1a0f00e mov pc, lr
+
+0000a004 <atf1>:
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <abf1>:
+ a008: e1a0f00e mov pc, lr
+
+0000a00c <taf1>:
+ a00c: 46f7 mov pc, lr
+
+0000a00e <ttf1>:
+ a00e: 46f7 mov pc, lr
+
+0000a010 <tbf1>:
+ a010: 46f7 mov pc, lr
+ a012: 0000 movs r0, r0
+ a014: e1a0f00e mov pc, lr
+ a018: e1a0f00e mov pc, lr
+ a01c: e1a0f00e mov pc, lr
+ a020: 46f7 mov pc, lr
+ a022: 46f7 mov pc, lr
+ a024: 46f7 mov pc, lr
+ \.\.\.
+
+0000a028 <_start>:
+ a028: eb0017f4 bl 10000 <foo>
+ a02c: ea0017f3 b 10000 <foo>
+ a030: 0a0017f2 beq 10000 <foo>
+ a034: e59f4000 ldr r4, \[pc, #0\] ; a03c <_start\+0x14>
+ a038: e59f4000 ldr r4, \[pc, #0\] ; a040 <_start\+0x18>
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a03c: 00000088 \.word 0x00000088
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a040: 0000702c \.word 0x0000702c
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a044: ebfffc1e bl 90c4 <atf3-0x5c>
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a048: eafffc1d b 90c4 <atf3-0x5c>
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a04c: 0afffc1c beq 90c4 <atf3-0x5c>
+ a050: e59f4000 ldr r4, \[pc, #0\] ; a058 <_start\+0x30>
+ a054: e59f4000 ldr r4, \[pc, #0\] ; a05c <_start\+0x34>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a058: 00000070 \.word 0x00000070
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a05c: 00007014 \.word 0x00007014
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a060: ebfffc22 bl 90f0 <atf3-0x30>
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a064: eafffc21 b 90f0 <atf3-0x30>
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a068: 0afffc20 beq 90f0 <atf3-0x30>
+ a06c: e59f4000 ldr r4, \[pc, #0\] ; a074 <_start\+0x4c>
+ a070: e59f4000 ldr r4, \[pc, #0\] ; a078 <_start\+0x50>
+#------------------------------------------------------------------------------
+#------ .got offset for taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a074: 0000007c \.word 0x0000007c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a078: 00007004 \.word 0x00007004
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a07c: ebfffc18 bl 90e4 <atf3-0x3c>
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a080: eafffc17 b 90e4 <atf3-0x3c>
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a084: 0afffc16 beq 90e4 <atf3-0x3c>
+ a088: e59f4000 ldr r4, \[pc, #0\] ; a090 <_start\+0x68>
+ a08c: e59f4000 ldr r4, \[pc, #0\] ; a094 <_start\+0x6c>
+#------------------------------------------------------------------------------
+#------ .got offset for abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a090: 00000078 \.word 0x00000078
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a094: 00006fe4 \.word 0x00006fe4
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a098: ebfffc1c bl 9110 <atf3-0x10>
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a09c: eafffc1b b 9110 <atf3-0x10>
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0a0: 0afffc1a beq 9110 <atf3-0x10>
+ a0a4: e59f4000 ldr r4, \[pc, #0\] ; a0ac <_start\+0x84>
+ a0a8: e59f4000 ldr r4, \[pc, #0\] ; a0b0 <_start\+0x88>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0ac: 00000084 \.word 0x00000084
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0b0: 00006fd4 \.word 0x00006fd4
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0b4: ebfffbe8 bl 905c <atf3-0xc4>
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0b8: eafffbe7 b 905c <atf3-0xc4>
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0bc: 0afffbe6 beq 905c <atf3-0xc4>
+ a0c0: e59f4000 ldr r4, \[pc, #0\] ; a0c8 <_start\+0xa0>
+ a0c4: e59f4000 ldr r4, \[pc, #0\] ; a0cc <_start\+0xa4>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf2
+#------------------------------------------------------------------------------
+ a0c8: 000000a8 \.word 0x000000a8
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf2
+#------------------------------------------------------------------------------
+ a0cc: 00006fdc \.word 0x00006fdc
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0d0: ebfffbde bl 9050 <atf3-0xd0>
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0d4: eafffbdd b 9050 <atf3-0xd0>
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0d8: 0afffbdc beq 9050 <atf3-0xd0>
+ a0dc: e59f4000 ldr r4, \[pc, #0\] ; a0e4 <_start\+0xbc>
+ a0e0: e59f4000 ldr r4, \[pc, #0\] ; a0e8 <_start\+0xc0>
+#------------------------------------------------------------------------------
+#------ .got offset for taf2
+#------------------------------------------------------------------------------
+ a0e4: 000000a4 \.word 0x000000a4
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf2
+#------------------------------------------------------------------------------
+ a0e8: 00006fbc \.word 0x00006fbc
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a0ec: ebfffbf1 bl 90b8 <atf3-0x68>
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a0f0: eafffbf0 b 90b8 <atf3-0x68>
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a0f4: 0afffbef beq 90b8 <atf3-0x68>
+ a0f8: e59f4000 ldr r4, \[pc, #0\] ; a100 <_start\+0xd8>
+ a0fc: e59f4000 ldr r4, \[pc, #0\] ; a104 <_start\+0xdc>
+#------------------------------------------------------------------------------
+#------ .got offset for abf2
+#------------------------------------------------------------------------------
+ a100: 000000d0 \.word 0x000000d0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf2
+#------------------------------------------------------------------------------
+ a104: 00006fcc \.word 0x00006fcc
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a108: ebfffbcd bl 9044 <atf3-0xdc>
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a10c: eafffbcc b 9044 <atf3-0xdc>
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a110: 0afffbcb beq 9044 <atf3-0xdc>
+ a114: e59f4000 ldr r4, \[pc, #0\] ; a11c <_start\+0xf4>
+ a118: e59f4000 ldr r4, \[pc, #0\] ; a120 <_start\+0xf8>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf2
+#------------------------------------------------------------------------------
+ a11c: 00000098 \.word 0x00000098
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf2
+#------------------------------------------------------------------------------
+ a120: 00006f78 \.word 0x00006f78
+ a124: ebfffc0f bl 9168 <aaf3>
+ a128: eafffc0e b 9168 <aaf3>
+ a12c: 0afffc0d beq 9168 <aaf3>
+ a130: e59f4000 ldr r4, \[pc, #0\] ; a138 <_start\+0x110>
+ a134: e59f4000 ldr r4, \[pc, #0\] ; a13c <_start\+0x114>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf3
+#------------------------------------------------------------------------------
+ a138: 000000c4 \.word 0x000000c4
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf3
+#------------------------------------------------------------------------------
+ a13c: 00006f88 \.word 0x00006f88
+ a140: ebfffc05 bl 915c <taf3>
+ a144: eafffc04 b 915c <taf3>
+ a148: 0afffc03 beq 915c <taf3>
+ a14c: e59f4000 ldr r4, \[pc, #0\] ; a154 <_start\+0x12c>
+ a150: e59f4000 ldr r4, \[pc, #0\] ; a158 <_start\+0x130>
+#------------------------------------------------------------------------------
+#------ .got offset for taf3
+#------------------------------------------------------------------------------
+ a154: 000000b4 \.word 0x000000b4
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf3
+#------------------------------------------------------------------------------
+ a158: 00006f5c \.word 0x00006f5c
+ a15c: ebfffbf3 bl 9130 <abf3>
+ a160: eafffbf2 b 9130 <abf3>
+ a164: 0afffbf1 beq 9130 <abf3>
+ a168: e59f4000 ldr r4, \[pc, #0\] ; a170 <_start\+0x148>
+ a16c: e59f4000 ldr r4, \[pc, #0\] ; a174 <_start\+0x14c>
+#------------------------------------------------------------------------------
+#------ .got offset for abf3
+#------------------------------------------------------------------------------
+ a170: 000000a0 \.word 0x000000a0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf3
+#------------------------------------------------------------------------------
+ a174: 00006f2c \.word 0x00006f2c
+ a178: ebfffbf4 bl 9150 <tbf3>
+ a17c: eafffbf3 b 9150 <tbf3>
+ a180: 0afffbf2 beq 9150 <tbf3>
+ a184: e59f4000 ldr r4, \[pc, #0\] ; a18c <_start\+0x164>
+ a188: e59f4000 ldr r4, \[pc, #0\] ; a190 <_start\+0x168>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf3
+#------------------------------------------------------------------------------
+ a18c: 000000b0 \.word 0x000000b0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf3
+#------------------------------------------------------------------------------
+ a190: 00006f20 \.word 0x00006f20
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ a194: ebfffba2 bl 9024 <atf3-0xfc>
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ a198: eafffba1 b 9024 <atf3-0xfc>
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ a19c: 0afffba0 beq 9024 <atf3-0xfc>
+ a1a0: e59f4000 ldr r4, \[pc, #0\] ; a1a8 <_start\+0x180>
+ a1a4: e59f4000 ldr r4, \[pc, #0\] ; a1ac <_start\+0x184>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf4
+#------------------------------------------------------------------------------
+ a1a8: 00000090 \.word 0x00000090
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf4
+#------------------------------------------------------------------------------
+ a1ac: 00006ee4 \.word 0x00006ee4
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ a1b0: ebfffbbc bl 90a8 <atf3-0x78>
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ a1b4: eafffbbb b 90a8 <atf3-0x78>
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ a1b8: 0afffbba beq 90a8 <atf3-0x78>
+ a1bc: e59f4000 ldr r4, \[pc, #0\] ; a1c4 <_start\+0x19c>
+ a1c0: e59f4000 ldr r4, \[pc, #0\] ; a1c8 <_start\+0x1a0>
+#------------------------------------------------------------------------------
+#------ .got offset for taf4
+#------------------------------------------------------------------------------
+ a1c4: 000000cc \.word 0x000000cc
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf4
+#------------------------------------------------------------------------------
+ a1c8: 00006f04 \.word 0x00006f04
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a1cc: ebfffba6 bl 906c <atf3-0xb4>
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a1d0: eafffba5 b 906c <atf3-0xb4>
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a1d4: 0afffba4 beq 906c <atf3-0xb4>
+ a1d8: e59f4000 ldr r4, \[pc, #0\] ; a1e0 <_start\+0x1b8>
+ a1dc: e59f4000 ldr r4, \[pc, #0\] ; a1e4 <_start\+0x1bc>
+#------------------------------------------------------------------------------
+#------ .got offset for abf4
+#------------------------------------------------------------------------------
+ a1e0: 000000b8 \.word 0x000000b8
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf4
+#------------------------------------------------------------------------------
+ a1e4: 00006ed4 \.word 0x00006ed4
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a1e8: ebfffba3 bl 907c <atf3-0xa4>
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a1ec: eafffba2 b 907c <atf3-0xa4>
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a1f0: 0afffba1 beq 907c <atf3-0xa4>
+ a1f4: e59f4000 ldr r4, \[pc, #0\] ; a1fc <_start\+0x1d4>
+ a1f8: e59f4000 ldr r4, \[pc, #0\] ; a200 <_start\+0x1d8>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf4
+#------------------------------------------------------------------------------
+ a1fc: 000000bc \.word 0x000000bc
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf4
+#------------------------------------------------------------------------------
+ a200: 00006ebc \.word 0x00006ebc
+
+0000a204 <_thumb>:
+ a204: f005 fefc bl 10000 <foo>
+ a208: f005 befa b\.w 10000 <foo>
+ a20c: f005 86f8 beq\.w 10000 <foo>
+ a210: 4c00 ldr r4, \[pc, #0\] ; \(a214 <_thumb\+0x10>\)
+ a212: 4c01 ldr r4, \[pc, #4\] ; \(a218 <_thumb\+0x14>\)
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a214: 00000088 \.word 0x00000088
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a218: 00006e54 \.word 0x00006e54
+#------------------------------------------------------------------------------
+#------ atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a21c: f7fe ef5a blx 90d4 <atf3-0x4c>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a220: f7fe bf56 b\.w 90d0 <atf3-0x50>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a224: f43e af54 beq\.w 90d0 <atf3-0x50>
+ a228: 4c00 ldr r4, \[pc, #0\] ; \(a22c <_thumb\+0x28>\)
+ a22a: 4c01 ldr r4, \[pc, #4\] ; \(a230 <_thumb\+0x2c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a22c: 00000074 \.word 0x00000074
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a230: 00006e44 \.word 0x00006e44
+#------------------------------------------------------------------------------
+#------ ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a234: f7fe ef64 blx 9100 <atf3-0x20>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a238: f7fe bf60 b\.w 90fc <atf3-0x24>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a23c: f43e af5e beq\.w 90fc <atf3-0x24>
+ a240: 4c00 ldr r4, \[pc, #0\] ; \(a244 <_thumb\+0x40>\)
+ a242: 4c01 ldr r4, \[pc, #4\] ; \(a248 <_thumb\+0x44>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a244: 00000080 \.word 0x00000080
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a248: 00006e38 \.word 0x00006e38
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a24c: f7fe ef4a blx 90e4 <atf3-0x3c>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a250: f7fe bf46 b\.w 90e0 <atf3-0x40>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a254: f43e af44 beq\.w 90e0 <atf3-0x40>
+ a258: 4c00 ldr r4, \[pc, #0\] ; \(a25c <_thumb\+0x58>\)
+ a25a: 4c01 ldr r4, \[pc, #4\] ; \(a260 <_thumb\+0x5c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a25c: 00000078 \.word 0x00000078
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a260: 00006e18 \.word 0x00006e18
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a264: f7fe ef54 blx 9110 <atf3-0x10>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a268: f7fe bf50 b\.w 910c <atf3-0x14>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a26c: f43e af4e beq\.w 910c <atf3-0x14>
+ a270: 4c00 ldr r4, \[pc, #0\] ; \(a274 <_thumb\+0x70>\)
+ a272: 4c01 ldr r4, \[pc, #4\] ; \(a278 <_thumb\+0x74>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a274: 00000084 \.word 0x00000084
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a278: 00006e0c \.word 0x00006e0c
+#------------------------------------------------------------------------------
+#------ atf2's .plt entry
+#------------------------------------------------------------------------------
+ a27c: f7fe eecc blx 9018 <atf3-0x108>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ a280: f7fe bec8 b\.w 9014 <atf3-0x10c>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ a284: f43e aec6 beq\.w 9014 <atf3-0x10c>
+ a288: 4c00 ldr r4, \[pc, #0\] ; \(a28c <_thumb\+0x88>\)
+ a28a: 4c01 ldr r4, \[pc, #4\] ; \(a290 <_thumb\+0x8c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf2
+#------------------------------------------------------------------------------
+ a28c: 0000008c \.word 0x0000008c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf2
+#------------------------------------------------------------------------------
+ a290: 00006dfc \.word 0x00006dfc
+#------------------------------------------------------------------------------
+#------ ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a294: f7fe eece blx 9034 <atf3-0xec>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a298: f7fe beca b\.w 9030 <atf3-0xf0>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a29c: f43e aec8 beq\.w 9030 <atf3-0xf0>
+ a2a0: 4c00 ldr r4, \[pc, #0\] ; \(a2a4 <_thumb\+0xa0>\)
+ a2a2: 4c01 ldr r4, \[pc, #4\] ; \(a2a8 <_thumb\+0xa4>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf2
+#------------------------------------------------------------------------------
+ a2a4: 00000094 \.word 0x00000094
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf2
+#------------------------------------------------------------------------------
+ a2a8: 00006dec \.word 0x00006dec
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2ac: f7fe ef04 blx 90b8 <atf3-0x68>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2b0: f7fe bf00 b\.w 90b4 <atf3-0x6c>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2b4: f43e aefe beq\.w 90b4 <atf3-0x6c>
+ a2b8: 4c00 ldr r4, \[pc, #0\] ; \(a2bc <_thumb\+0xb8>\)
+ a2ba: 4c01 ldr r4, \[pc, #4\] ; \(a2c0 <_thumb\+0xbc>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf2
+#------------------------------------------------------------------------------
+ a2bc: 000000d0 \.word 0x000000d0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf2
+#------------------------------------------------------------------------------
+ a2c0: 00006e10 \.word 0x00006e10
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2c4: f7fe eebe blx 9044 <atf3-0xdc>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2c8: f7fe beba b\.w 9040 <atf3-0xe0>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2cc: f43e aeb8 beq\.w 9040 <atf3-0xe0>
+ a2d0: 4c00 ldr r4, \[pc, #0\] ; \(a2d4 <_thumb\+0xd0>\)
+ a2d2: 4c01 ldr r4, \[pc, #4\] ; \(a2d8 <_thumb\+0xd4>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf2
+#------------------------------------------------------------------------------
+ a2d4: 00000098 \.word 0x00000098
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf2
+#------------------------------------------------------------------------------
+ a2d8: 00006dc0 \.word 0x00006dc0
+ a2dc: f7fe ef20 blx 9120 <atf3>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3
+#------------------------------------------------------------------------------
+ a2e0: f7fe bf1c b\.w 911c <atf3-0x4>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3
+#------------------------------------------------------------------------------
+ a2e4: f43e af1a beq\.w 911c <atf3-0x4>
+ a2e8: 4c00 ldr r4, \[pc, #0\] ; \(a2ec <_thumb\+0xe8>\)
+ a2ea: 4c01 ldr r4, \[pc, #4\] ; \(a2f0 <_thumb\+0xec>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf3
+#------------------------------------------------------------------------------
+ a2ec: 0000009c \.word 0x0000009c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf3
+#------------------------------------------------------------------------------
+ a2f0: 00006dac \.word 0x00006dac
+ a2f4: f7fe ef24 blx 9140 <ttf3>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3
+#------------------------------------------------------------------------------
+ a2f8: f7fe bf20 b\.w 913c <abf3\+0xc>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3
+#------------------------------------------------------------------------------
+ a2fc: f43e af1e beq\.w 913c <abf3\+0xc>
+ a300: 4c00 ldr r4, \[pc, #0\] ; \(a304 <_thumb\+0x100>\)
+ a302: 4c01 ldr r4, \[pc, #4\] ; \(a308 <_thumb\+0x104>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf3
+#------------------------------------------------------------------------------
+ a304: 000000ac \.word 0x000000ac
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf3
+#------------------------------------------------------------------------------
+ a308: 00006da4 \.word 0x00006da4
+ a30c: f7fe ef10 blx 9130 <abf3>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3
+#------------------------------------------------------------------------------
+ a310: f7fe bf0c b\.w 912c <atf3\+0xc>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3
+#------------------------------------------------------------------------------
+ a314: f43e af0a beq\.w 912c <atf3\+0xc>
+ a318: 4c00 ldr r4, \[pc, #0\] ; \(a31c <_thumb\+0x118>\)
+ a31a: 4c01 ldr r4, \[pc, #4\] ; \(a320 <_thumb\+0x11c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf3
+#------------------------------------------------------------------------------
+ a31c: 000000a0 \.word 0x000000a0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf3
+#------------------------------------------------------------------------------
+ a320: 00006d80 \.word 0x00006d80
+ a324: f7fe ef14 blx 9150 <tbf3>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3
+#------------------------------------------------------------------------------
+ a328: f7fe bf10 b\.w 914c <ttf3\+0xc>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3
+#------------------------------------------------------------------------------
+ a32c: f43e af0e beq\.w 914c <ttf3\+0xc>
+ a330: 4c00 ldr r4, \[pc, #0\] ; \(a334 <_thumb\+0x130>\)
+ a332: 4c01 ldr r4, \[pc, #4\] ; \(a338 <_thumb\+0x134>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf3
+#------------------------------------------------------------------------------
+ a334: 000000b0 \.word 0x000000b0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf3
+#------------------------------------------------------------------------------
+ a338: 00006d78 \.word 0x00006d78
+#------------------------------------------------------------------------------
+#------ atf4's .plt entry
+#------------------------------------------------------------------------------
+ a33c: f7fe eeae blx 909c <atf3-0x84>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .plt entry
+#------------------------------------------------------------------------------
+ a340: f7fe beaa b\.w 9098 <atf3-0x88>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .plt entry
+#------------------------------------------------------------------------------
+ a344: f43e aea8 beq\.w 9098 <atf3-0x88>
+ a348: 4c00 ldr r4, \[pc, #0\] ; \(a34c <_thumb\+0x148>\)
+ a34a: 4c01 ldr r4, \[pc, #4\] ; \(a350 <_thumb\+0x14c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf4
+#------------------------------------------------------------------------------
+ a34c: 000000c8 \.word 0x000000c8
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf4
+#------------------------------------------------------------------------------
+ a350: 00006d78 \.word 0x00006d78
+#------------------------------------------------------------------------------
+#------ ttf4's .plt entry
+#------------------------------------------------------------------------------
+ a354: f7fe ee9a blx 908c <atf3-0x94>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .plt entry
+#------------------------------------------------------------------------------
+ a358: f7fe be96 b\.w 9088 <atf3-0x98>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .plt entry
+#------------------------------------------------------------------------------
+ a35c: f43e ae94 beq\.w 9088 <atf3-0x98>
+ a360: 4c00 ldr r4, \[pc, #0\] ; \(a364 <_thumb\+0x160>\)
+ a362: 4c01 ldr r4, \[pc, #4\] ; \(a368 <_thumb\+0x164>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf4
+#------------------------------------------------------------------------------
+ a364: 000000c0 \.word 0x000000c0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf4
+#------------------------------------------------------------------------------
+ a368: 00006d58 \.word 0x00006d58
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a36c: f7fe ee7e blx 906c <atf3-0xb4>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .plt entry
+#------------------------------------------------------------------------------
+ a370: f7fe be7a b\.w 9068 <atf3-0xb8>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .plt entry
+#------------------------------------------------------------------------------
+ a374: f43e ae78 beq\.w 9068 <atf3-0xb8>
+ a378: 4c00 ldr r4, \[pc, #0\] ; \(a37c <_thumb\+0x178>\)
+ a37a: 4c01 ldr r4, \[pc, #4\] ; \(a380 <_thumb\+0x17c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf4
+#------------------------------------------------------------------------------
+ a37c: 000000b8 \.word 0x000000b8
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf4
+#------------------------------------------------------------------------------
+ a380: 00006d38 \.word 0x00006d38
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a384: f7fe ee7a blx 907c <atf3-0xa4>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a388: f7fe be76 b\.w 9078 <atf3-0xa8>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a38c: f43e ae74 beq\.w 9078 <atf3-0xa8>
+ a390: 4c00 ldr r4, \[pc, #0\] ; \(a394 <_thumb\+0x190>\)
+ a392: 4c01 ldr r4, \[pc, #4\] ; \(a398 <_thumb\+0x194>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf4
+#------------------------------------------------------------------------------
+ a394: 000000bc \.word 0x000000bc
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf4
+#------------------------------------------------------------------------------
+ a398: 00006d24 \.word 0x00006d24
diff --git a/ld/testsuite/ld-arm/ifunc-10.gd b/ld/testsuite/ld-arm/ifunc-10.gd
new file mode 100644
index 0000000..be3e09f
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-10.gd
@@ -0,0 +1,188 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------ 00010004: contains aaf1's .iplt entry
+#------ 00010008: contains PC-relative offset of aaf1's .iplt entry
+#------ 0001000c: contains atf1's .iplt entry
+#------------------------------------------------------------------------------
+ 10000 44332211 c4900000 bc90ffff d4900000 .*
+#------------------------------------------------------------------------------
+#------ 00010010: contains PC-relative offset of atf1's .iplt entry
+#------ 00010014: contains abf1's .iplt entry
+#------ 00010018: contains PC-relative offset of abf1's .iplt entry
+#------ 0001001c: contains taf1's .iplt entry
+#------------------------------------------------------------------------------
+ 10010 c490ffff e4900000 cc90ffff f0900000 .*
+#------------------------------------------------------------------------------
+#------ 00010020: contains PC-relative offset of taf1's .iplt entry
+#------ 00010024: contains ttf1's .iplt entry
+#------ 00010028: contains PC-relative offset of ttf1's .iplt entry
+#------ 0001002c: contains tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ 10020 d090ffff 00910000 d890ffff 10910000 .*
+#------------------------------------------------------------------------------
+#------ 00010030: contains PC-relative offset of tbf1's .iplt entry
+#------ 00010034: contains aaf2's .plt entry
+#------ 00010038: contains PC-relative offset of aaf2's .plt entry
+#------ 0001003c: contains atf2's .plt entry
+#------------------------------------------------------------------------------
+ 10030 e090ffff 5c900000 2490ffff 18900000 .*
+#------------------------------------------------------------------------------
+#------ 00010040: contains PC-relative offset of atf2's .plt entry
+#------ 00010044: contains abf2's .plt entry
+#------ 00010048: contains PC-relative offset of abf2's .plt entry
+#------ 0001004c: contains taf2's .plt entry
+#------------------------------------------------------------------------------
+ 10040 d88fffff b8900000 7090ffff 50900000 .*
+#------------------------------------------------------------------------------
+#------ 00010050: contains PC-relative offset of taf2's .plt entry
+#------ 00010054: contains ttf2's .plt entry
+#------ 00010058: contains PC-relative offset of ttf2's .plt entry
+#------ 0001005c: contains tbf2's .plt entry
+#------------------------------------------------------------------------------
+ 10050 0090ffff 34900000 dc8fffff 44900000 .*
+#------------------------------------------------------------------------------
+#------ 00010060: contains PC-relative offset of tbf2's .plt entry
+#------ 00010064: contains aaf3
+#------ 00010068: contains PC-relative offset of aaf3
+#------ 0001006c: contains atf3
+#------------------------------------------------------------------------------
+ 10060 e48fffff 68910000 0091ffff 20910000 .*
+#------------------------------------------------------------------------------
+#------ 00010070: contains PC-relative offset of atf3
+#------ 00010074: contains abf3
+#------ 00010078: contains PC-relative offset of abf3
+#------ 0001007c: contains taf3
+#------------------------------------------------------------------------------
+ 10070 b090ffff 30910000 b890ffff 5c910000 .*
+#------------------------------------------------------------------------------
+#------ 00010080: contains PC-relative offset of taf3
+#------ 00010084: contains ttf3
+#------ 00010088: contains PC-relative offset of ttf3
+#------ 0001008c: contains tbf3
+#------------------------------------------------------------------------------
+ 10080 dc90ffff 40910000 b890ffff 50910000 .*
+#------------------------------------------------------------------------------
+#------ 00010090: contains PC-relative offset of tbf3
+#------ 00010094: contains aaf4's .plt entry
+#------ 00010098: contains PC-relative offset of aaf4's .plt entry
+#------ 0001009c: contains atf4's .plt entry
+#------------------------------------------------------------------------------
+ 10090 c090ffff 24900000 8c8fffff 9c900000 .*
+#------------------------------------------------------------------------------
+#------ 000100a0: contains PC-relative offset of atf4's .plt entry
+#------ 000100a4: contains abf4's .plt entry
+#------ 000100a8: contains PC-relative offset of abf4's .plt entry
+#------ 000100ac: contains taf4's .plt entry
+#------------------------------------------------------------------------------
+ 100a0 fc8fffff 6c900000 c48fffff a8900000 .*
+#------------------------------------------------------------------------------
+#------ 000100b0: contains PC-relative offset of taf4's .plt entry
+#------ 000100b4: contains ttf4's .plt entry
+#------ 000100b8: contains PC-relative offset of ttf4's .plt entry
+#------ 000100bc: contains tbf4's .plt entry
+#------------------------------------------------------------------------------
+ 100b0 f88fffff 8c900000 d48fffff 7c900000 .*
+#------------------------------------------------------------------------------
+#------ 000100c0: contains PC-relative offset of tbf4's .plt entry
+#------------------------------------------------------------------------------
+ 100c0 bc8fffff .*
+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 pointer to 0xa018 [R_ARM_IRELATIVE]
+#------ 00011058: abf3's .igot.plt pointer to 0xa01c [R_ARM_IRELATIVE]
+#------ 0001105c: ttf3's .igot.plt pointer to 0xa023 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11050 11a00000 18a00000 1ca00000 23a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011060: tbf3's .igot.plt pointer to 0xa025 [R_ARM_IRELATIVE]
+#------ 00011064: taf3's .igot.plt pointer to 0xa021 [R_ARM_IRELATIVE]
+#------ 00011068: aaf3's .igot.plt pointer to 0xa014 [R_ARM_IRELATIVE]
+#------ 0001106c: .got entry for foo
+#------------------------------------------------------------------------------
+ 11060 25a00000 21a00000 14a00000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011070: .got entry for aaf1's .iplt entry
+#------ 00011074: .got entry for atf1's .iplt entry
+#------ 00011078: .got entry for abf1's .iplt entry
+#------ 0001107c: .got entry for taf1's .iplt entry
+#------------------------------------------------------------------------------
+ 11070 c4900000 d4900000 e4900000 f0900000 .*
+#------------------------------------------------------------------------------
+#------ 00011080: .got entry for ttf1's .iplt entry
+#------ 00011084: .got entry for tbf1's .iplt entry
+#------ 00011088: .got entry for foo
+#------ 0001108c: .got entry for atf2 [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 11080 00910000 10910000 00000100 00000000 .*
+#------------------------------------------------------------------------------
+#------ 00011090: .got entry for aaf4 [R_ARM_GLOB_DAT]
+#------ 00011094: .got entry for ttf2 [R_ARM_GLOB_DAT]
+#------ 00011098: .got entry for tbf2 [R_ARM_GLOB_DAT]
+#------ 0001109c: .got entry for atf3
+#------------------------------------------------------------------------------
+ 11090 00000000 00000000 00000000 20910000 .*
+#------------------------------------------------------------------------------
+#------ 000110a0: .got entry for abf3
+#------ 000110a4: .got entry for taf2 [R_ARM_GLOB_DAT]
+#------ 000110a8: .got entry for aaf2 [R_ARM_GLOB_DAT]
+#------ 000110ac: .got entry for ttf3
+#------------------------------------------------------------------------------
+ 110a0 30910000 00000000 00000000 40910000 .*
+#------------------------------------------------------------------------------
+#------ 000110b0: .got entry for tbf3
+#------ 000110b4: .got entry for taf3
+#------ 000110b8: .got entry for abf4 [R_ARM_GLOB_DAT]
+#------ 000110bc: .got entry for tbf4 [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 110b0 50910000 5c910000 00000000 00000000 .*
+#------------------------------------------------------------------------------
+#------ 000110c0: .got entry for ttf4 [R_ARM_GLOB_DAT]
+#------ 000110c4: .got entry for aaf3
+#------ 000110c8: .got entry for atf4 [R_ARM_GLOB_DAT]
+#------ 000110cc: .got entry for taf4 [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 110c0 00000000 68910000 00000000 00000000 .*
+#------------------------------------------------------------------------------
+#------ 000110d0: .got entry for abf2 [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 110d0 00000000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-10.rd b/ld/testsuite/ld-arm/ifunc-10.rd
new file mode 100644
index 0000000..8846197
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-10.rd
@@ -0,0 +1,42 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 24 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001103c ......a0 R_ARM_IRELATIVE
+00011040 ......a0 R_ARM_IRELATIVE
+00011044 ......a0 R_ARM_IRELATIVE
+00011048 ......a0 R_ARM_IRELATIVE
+0001104c ......a0 R_ARM_IRELATIVE
+00011050 ......a0 R_ARM_IRELATIVE
+00011054 ......a0 R_ARM_IRELATIVE
+00011058 ......a0 R_ARM_IRELATIVE
+0001105c ......a0 R_ARM_IRELATIVE
+00011060 ......a0 R_ARM_IRELATIVE
+00011064 ......a0 R_ARM_IRELATIVE
+00011068 ......a0 R_ARM_IRELATIVE
+0001108c ......15 R_ARM_GLOB_DAT 00009018 atf2
+00011090 ......15 R_ARM_GLOB_DAT 00009024 aaf4
+00011094 ......15 R_ARM_GLOB_DAT 00009034 ttf2
+00011098 ......15 R_ARM_GLOB_DAT 00009044 tbf2
+000110a4 ......15 R_ARM_GLOB_DAT 00009050 taf2
+000110a8 ......15 R_ARM_GLOB_DAT 0000905c aaf2
+000110b8 ......15 R_ARM_GLOB_DAT 0000906c abf4
+000110bc ......15 R_ARM_GLOB_DAT 0000907c tbf4
+000110c0 ......15 R_ARM_GLOB_DAT 0000908c ttf4
+000110c8 ......15 R_ARM_GLOB_DAT 0000909c atf4
+000110cc ......15 R_ARM_GLOB_DAT 000090a8 taf4
+000110d0 ......15 R_ARM_GLOB_DAT 000090b8 abf2
+
+Relocation section '\.rel\.plt' at offset 0x80c0 contains 12 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT 00009018 atf2
+00011010 ......16 R_ARM_JUMP_SLOT 00009024 aaf4
+00011014 ......16 R_ARM_JUMP_SLOT 00009034 ttf2
+00011018 ......16 R_ARM_JUMP_SLOT 00009044 tbf2
+0001101c ......16 R_ARM_JUMP_SLOT 00009050 taf2
+00011020 ......16 R_ARM_JUMP_SLOT 0000905c aaf2
+00011024 ......16 R_ARM_JUMP_SLOT 0000906c abf4
+00011028 ......16 R_ARM_JUMP_SLOT 0000907c tbf4
+0001102c ......16 R_ARM_JUMP_SLOT 0000908c ttf4
+00011030 ......16 R_ARM_JUMP_SLOT 0000909c atf4
+00011034 ......16 R_ARM_JUMP_SLOT 000090a8 taf4
+00011038 ......16 R_ARM_JUMP_SLOT 000090b8 abf2
diff --git a/ld/testsuite/ld-arm/ifunc-10.s b/ld/testsuite/ld-arm/ifunc-10.s
new file mode 100644
index 0000000..5b1912f
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-10.s
@@ -0,0 +1,90 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro define2,name
+ define aa\name,.arm
+ define at\name,.arm
+ define ab\name,.arm
+ define ta\name,.thumb_func
+ define tt\name,.thumb_func
+ define tb\name,.thumb_func
+ .endm
+
+ .macro test_relocs,name,width
+ bl \name(PLT)
+ b\width \name
+ beq\width \name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .macro test_relocs2,name,type,width
+ test_relocs a\type\name,\width
+ test_relocs t\type\name,\width
+ test_relocs ab\name,\width
+ test_relocs tb\name,\width
+ .endm
+
+ .macro diff,name
+ .word \name
+ .word \name-.
+ .endm
+
+ .macro alldirs,doit,name
+ \doit aa\name
+ \doit at\name
+ \doit ab\name
+ \doit ta\name
+ \doit tt\name
+ \doit tb\name
+ .endm
+
+ define2 f1
+ # f2 provided by ifunc-4.so
+ define2 f3
+ # f4 provided by ifunc-4.so
+
+ alldirs .globl,f3
+ alldirs .hidden,f3
+
+ .globl _start
+ .type _start,%function
+ .arm
+_start:
+ test_relocs foo
+ test_relocs2 f1,a,
+ test_relocs2 f2,a,
+ test_relocs2 f3,a,
+ test_relocs2 f4,a,
+ .size _start,.-_start
+
+ .globl _thumb
+ .type _thumb,%function
+ .thumb_func
+_thumb:
+ test_relocs foo
+ test_relocs2 f1,t,.w
+ test_relocs2 f2,t,.w
+ test_relocs2 f3,t,.w
+ test_relocs2 f4,t,.w
+ .size _thumb,.-_thumb
+
+ .data
+foo:
+ .word 0x11223344
+ alldirs diff,f1
+ alldirs diff,f2
+ alldirs diff,f3
+ alldirs diff,f4
diff --git a/ld/testsuite/ld-arm/ifunc-11.dd b/ld/testsuite/ld-arm/ifunc-11.dd
new file mode 100644
index 0000000..89a7530
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-11.dd
@@ -0,0 +1,95 @@
+
+.*
+
+
+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
diff --git a/ld/testsuite/ld-arm/ifunc-11.gd b/ld/testsuite/ld-arm/ifunc-11.gd
new file mode 100644
index 0000000..aea1583
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-11.gd
@@ -0,0 +1,29 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 00800000 30800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: .got entry for foo
+#------------------------------------------------------------------------------
+ 11000 00000000 00000000 00000000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011010: .got entry for f1 [R_ARM_IRELATIVE]
+#------ 00011014: .got entry for f1t [R_ARM_IRELATIVE]
+#------ 00011018: .got entry for foo
+#------ 0001101c: .got entry for f2t [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11010 00a00000 0da00000 00000100 0fa00000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for f3 [R_ARM_IRELATIVE]
+#------ 00011024: .got entry for f2 [R_ARM_IRELATIVE]
+#------ 00011028: .got entry for f3t [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11020 08a00000 04a00000 11a00000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-11.rd b/ld/testsuite/ld-arm/ifunc-11.rd
new file mode 100644
index 0000000..82ce9b7
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-11.rd
@@ -0,0 +1,11 @@
+
+There is no dynamic section in this file\.
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 6 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00011010 ......a0 R_ARM_IRELATIVE
+00011024 ......a0 R_ARM_IRELATIVE
+00011020 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+0001101c ......a0 R_ARM_IRELATIVE
+00011028 ......a0 R_ARM_IRELATIVE
diff --git a/ld/testsuite/ld-arm/ifunc-11.s b/ld/testsuite/ld-arm/ifunc-11.s
new file mode 100644
index 0000000..36ebc24
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-11.s
@@ -0,0 +1,52 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .global f2
+ .global f2t
+
+ .global f3
+ .hidden f3
+ .global f3t
+ .hidden f3t
+
+ define f1,.arm
+ define f2,.arm
+ define f3,.arm
+
+ define f1t,.thumb_func
+ define f2t,.thumb_func
+ define f3t,.thumb_func
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f1t
+ test_relocs f2t
+ test_relocs f3t
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-12.dd b/ld/testsuite/ld-arm/ifunc-12.dd
new file mode 100644
index 0000000..89a7530
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-12.dd
@@ -0,0 +1,95 @@
+
+.*
+
+
+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
diff --git a/ld/testsuite/ld-arm/ifunc-12.gd b/ld/testsuite/ld-arm/ifunc-12.gd
new file mode 100644
index 0000000..721c315
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-12.gd
@@ -0,0 +1,39 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------ 00010004: contains f1 [R_ARM_IRELATIVE]
+#------ 00010008: f2 [R_ARM_ABS32]
+#------ 0001000c: contains f3 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 10000 44332211 00a00000 00000000 08a00000 .*
+#------------------------------------------------------------------------------
+#------ 00010010: contains f1t [R_ARM_IRELATIVE]
+#------ 00010014: f2t [R_ARM_ABS32]
+#------ 00010018: contains f3t [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 10010 0da00000 00000000 11a00000 80800000 .*
+ 10020 80800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: .got entry for foo [R_ARM_RELATIVE]
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011010: .got entry for f1 [R_ARM_IRELATIVE]
+#------ 00011014: .got entry for f1t [R_ARM_IRELATIVE]
+#------ 00011018: .got entry for foo [R_ARM_RELATIVE]
+#------ 0001101c: .got entry for f2t [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 11010 00a00000 0da00000 00000100 00000000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for f3 [R_ARM_IRELATIVE]
+#------ 00011024: .got entry for f2 [R_ARM_GLOB_DAT]
+#------ 00011028: .got entry for f3t [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11020 08a00000 00000000 11a00000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-12.rd b/ld/testsuite/ld-arm/ifunc-12.rd
new file mode 100644
index 0000000..c5d62c1
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-12.rd
@@ -0,0 +1,19 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 16 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001001c ......17 R_ARM_RELATIVE
+00010020 ......17 R_ARM_RELATIVE
+0001100c ......17 R_ARM_RELATIVE
+00011018 ......17 R_ARM_RELATIVE
+00010004 ......a0 R_ARM_IRELATIVE
+0001000c ......a0 R_ARM_IRELATIVE
+00010010 ......a0 R_ARM_IRELATIVE
+00010018 ......a0 R_ARM_IRELATIVE
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011020 ......a0 R_ARM_IRELATIVE
+00011028 ......a0 R_ARM_IRELATIVE
+00010008 ......02 R_ARM_ABS32 f2\(\) f2
+00011024 ......15 R_ARM_GLOB_DAT f2\(\) f2
+00010014 ......02 R_ARM_ABS32 f2t\(\) f2t
+0001101c ......15 R_ARM_GLOB_DAT f2t\(\) f2t
diff --git a/ld/testsuite/ld-arm/ifunc-12.s b/ld/testsuite/ld-arm/ifunc-12.s
new file mode 100644
index 0000000..388ac34
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-12.s
@@ -0,0 +1,58 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .global f2
+ .global f2t
+
+ .global f3
+ .hidden f3
+ .global f3t
+ .hidden f3t
+
+ define f1,.arm
+ define f2,.arm
+ define f3,.arm
+
+ define f1t,.thumb_func
+ define f2t,.thumb_func
+ define f3t,.thumb_func
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f1t
+ test_relocs f2t
+ test_relocs f3t
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word f1
+ .word f2
+ .word f3
+ .word f1t
+ .word f2t
+ .word f3t
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-13.dd b/ld/testsuite/ld-arm/ifunc-13.dd
new file mode 100644
index 0000000..d5df382
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-13.dd
@@ -0,0 +1,89 @@
+
+.*
+
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+
+0000a004 <f3>:
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <f1t>:
+ a008: 46f7 mov pc, lr
+
+0000a00a <f3t>:
+ a00a: 46f7 mov pc, lr
+
+0000a00c <_start>:
+ a00c: 4c00 ldr r4, \[pc, #0\] ; \(a010 <_start\+0x4>\)
+ a00e: 4c01 ldr r4, \[pc, #4\] ; \(a014 <_start\+0x8>\)
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a010: 00000018 \.word 0x00000018
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a014: 00006ff8 \.word 0x00006ff8
+ a018: 4c00 ldr r4, \[pc, #0\] ; \(a01c <_start\+0x10>\)
+ a01a: 4c01 ldr r4, \[pc, #4\] ; \(a020 <_start\+0x14>\)
+#------------------------------------------------------------------------------
+#------ .got offset for f1
+#------------------------------------------------------------------------------
+ a01c: 00000010 \.word 0x00000010
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f1
+#------------------------------------------------------------------------------
+ a020: 00006ff0 \.word 0x00006ff0
+ a024: 4c00 ldr r4, \[pc, #0\] ; \(a028 <_start\+0x1c>\)
+ a026: 4c01 ldr r4, \[pc, #4\] ; \(a02c <_start\+0x20>\)
+#------------------------------------------------------------------------------
+#------ .got offset for f2
+#------------------------------------------------------------------------------
+ a028: 00000024 \.word 0x00000024
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f2
+#------------------------------------------------------------------------------
+ a02c: 00006ff8 \.word 0x00006ff8
+ a030: 4c00 ldr r4, \[pc, #0\] ; \(a034 <_start\+0x28>\)
+ a032: 4c01 ldr r4, \[pc, #4\] ; \(a038 <_start\+0x2c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for f3
+#------------------------------------------------------------------------------
+ a034: 00000020 \.word 0x00000020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f3
+#------------------------------------------------------------------------------
+ a038: 00006fe8 \.word 0x00006fe8
+ a03c: 4c00 ldr r4, \[pc, #0\] ; \(a040 <_start\+0x34>\)
+ a03e: 4c01 ldr r4, \[pc, #4\] ; \(a044 <_start\+0x38>\)
+#------------------------------------------------------------------------------
+#------ .got offset for f1t
+#------------------------------------------------------------------------------
+ a040: 00000014 \.word 0x00000014
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f1t
+#------------------------------------------------------------------------------
+ a044: 00006fd0 \.word 0x00006fd0
+ a048: 4c00 ldr r4, \[pc, #0\] ; \(a04c <_start\+0x40>\)
+ a04a: 4c01 ldr r4, \[pc, #4\] ; \(a050 <_start\+0x44>\)
+#------------------------------------------------------------------------------
+#------ .got offset for f2t
+#------------------------------------------------------------------------------
+ a04c: 0000001c \.word 0x0000001c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f2t
+#------------------------------------------------------------------------------
+ a050: 00006fcc \.word 0x00006fcc
+ a054: 4c00 ldr r4, \[pc, #0\] ; \(a058 <_start\+0x4c>\)
+ a056: 4c01 ldr r4, \[pc, #4\] ; \(a05c <_start\+0x50>\)
+#------------------------------------------------------------------------------
+#------ .got offset for f3t
+#------------------------------------------------------------------------------
+ a058: 00000028 \.word 0x00000028
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f3t
+#------------------------------------------------------------------------------
+ a05c: 00006fcc \.word 0x00006fcc
diff --git a/ld/testsuite/ld-arm/ifunc-13.gd b/ld/testsuite/ld-arm/ifunc-13.gd
new file mode 100644
index 0000000..9b5dbcb
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-13.gd
@@ -0,0 +1,29 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 30800000 30800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: .got entry for foo
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011010: .got entry for f1 [R_ARM_IRELATIVE]
+#------ 00011014: .got entry for f1t [R_ARM_IRELATIVE]
+#------ 00011018: .got entry for foo
+#------ 0001101c: .got entry for f2t [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 11010 00a00000 09a00000 00000100 00000000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for f3 [R_ARM_IRELATIVE]
+#------ 00011024: .got entry for f2 [R_ARM_GLOB_DAT]
+#------ 00011028: .got entry for f3t [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11020 04a00000 00000000 0ba00000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-13.rd b/ld/testsuite/ld-arm/ifunc-13.rd
new file mode 100644
index 0000000..c58ab8a
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-13.rd
@@ -0,0 +1,9 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 6 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011020 ......a0 R_ARM_IRELATIVE
+00011028 ......a0 R_ARM_IRELATIVE
+0001101c ......15 R_ARM_GLOB_DAT 00000000 f2t
+00011024 ......15 R_ARM_GLOB_DAT 00000000 f2
diff --git a/ld/testsuite/ld-arm/ifunc-13.s b/ld/testsuite/ld-arm/ifunc-13.s
new file mode 100644
index 0000000..467f06f
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-13.s
@@ -0,0 +1,50 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .global f2
+ .global f2t
+
+ .global f3
+ .hidden f3
+ .global f3t
+ .hidden f3t
+
+ define f1,.arm
+ define f3,.arm
+
+ define f1t,.thumb_func
+ define f3t,.thumb_func
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f1t
+ test_relocs f2t
+ test_relocs f3t
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-14.dd b/ld/testsuite/ld-arm/ifunc-14.dd
new file mode 100644
index 0000000..8df338a
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-14.dd
@@ -0,0 +1,100 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <__irel_end\+0xff0>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ f2t's .plt entry
+#------------------------------------------------------------------------------
+ 9014: e28fc600 add ip, pc, #0
+ 9018: e28cca07 add ip, ip, #28672 ; 0x7000
+ 901c: e5bcfff0 ldr pc, \[ip, #4080\]! ; 0xff0
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ 9020: e28fc600 add ip, pc, #0
+ 9024: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9028: e5bcffe8 ldr pc, \[ip, #4072\]! ; 0xfe8
+
+Disassembly of section \.iplt:
+
+0000902c <f3-0x18>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 902c: e28fc600 add ip, pc, #0
+ 9030: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9034: e5bcffe0 ldr pc, \[ip, #4064\]! ; 0xfe0
+#------------------------------------------------------------------------------
+#------ f1t's .iplt entry
+#------------------------------------------------------------------------------
+ 9038: e28fc600 add ip, pc, #0
+ 903c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9040: e5bcffd8 ldr pc, \[ip, #4056\]! ; 0xfd8
+
+00009044 <f3>:
+ 9044: e28fc600 add ip, pc, #0
+ 9048: e28cca07 add ip, ip, #28672 ; 0x7000
+ 904c: e5bcffd0 ldr pc, \[ip, #4048\]! ; 0xfd0
+
+00009050 <f3t>:
+ 9050: e28fc600 add ip, pc, #0
+ 9054: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9058: e5bcffc8 ldr pc, \[ip, #4040\]! ; 0xfc8
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <f1t>:
+ a008: 46f7 mov pc, lr
+ a00a: 46f7 mov pc, lr
+
+0000a00c <_start>:
+ a00c: f8df 4000 ldr\.w r4, \[pc\] ; a010 <_start\+0x4>
+#------------------------------------------------------------------------------
+#------ PC-relative offset of foo
+#------------------------------------------------------------------------------
+ a010: 00005ff0 \.word 0x00005ff0
+ a014: f8df 4000 ldr\.w r4, \[pc\] ; a018 <_start\+0xc>
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .iplt entry
+#------------------------------------------------------------------------------
+ a018: fffff014 \.word 0xfffff014
+ a01c: f8df 4000 ldr\.w r4, \[pc\] ; a020 <_start\+0x14>
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f2's .plt entry
+#------------------------------------------------------------------------------
+ a020: fffff000 \.word 0xfffff000
+ a024: f8df 4000 ldr\.w r4, \[pc\] ; a028 <_start\+0x1c>
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3
+#------------------------------------------------------------------------------
+ a028: fffff01c \.word 0xfffff01c
+ a02c: f8df 4000 ldr\.w r4, \[pc\] ; a030 <_start\+0x24>
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1t's .iplt entry
+#------------------------------------------------------------------------------
+ a030: fffff008 \.word 0xfffff008
+ a034: f8df 4000 ldr\.w r4, \[pc\] ; a038 <_start\+0x2c>
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f2t's .plt entry
+#------------------------------------------------------------------------------
+ a038: ffffefdc \.word 0xffffefdc
+ a03c: f8df 4000 ldr\.w r4, \[pc\] ; a040 <_start\+0x34>
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3t
+#------------------------------------------------------------------------------
+ a040: fffff010 \.word 0xfffff010
diff --git a/ld/testsuite/ld-arm/ifunc-14.gd b/ld/testsuite/ld-arm/ifunc-14.gd
new file mode 100644
index 0000000..c054e6b
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-14.gd
@@ -0,0 +1,27 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 00800000 20800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f2t's .got.plt entry [R_ARM_JUMP_SLOT]
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00900000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------ 00011014: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011018: f1t's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001101c: f3's .igot.plt pointer to 0xa004 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11010 00900000 00a00000 09a00000 04a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: f3t's .igot.plt pointer to 0xa00b [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11020 0ba00000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-14.rd b/ld/testsuite/ld-arm/ifunc-14.rd
new file mode 100644
index 0000000..59ea29b
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-14.rd
@@ -0,0 +1,12 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 4 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00011014 ......a0 R_ARM_IRELATIVE
+00011018 ......a0 R_ARM_IRELATIVE
+0001101c ......a0 R_ARM_IRELATIVE
+00011020 ......a0 R_ARM_IRELATIVE
+
+Relocation section '\.rel\.plt' at offset 0x8020 contains 2 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT 00009014 f2t
+00011010 ......16 R_ARM_JUMP_SLOT 00009020 f2
diff --git a/ld/testsuite/ld-arm/ifunc-14.s b/ld/testsuite/ld-arm/ifunc-14.s
new file mode 100644
index 0000000..8a166af
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-14.s
@@ -0,0 +1,47 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ ldr r4,1f
+1:
+ .word \name - .
+ .endm
+
+ .global f2
+ .global f2t
+
+ .global f3
+ .hidden f3
+ .global f3t
+ .hidden f3t
+
+ define f1,.arm
+ define f3,.arm
+
+ define f1t,.thumb_func
+ define f3t,.thumb_func
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f1t
+ test_relocs f2t
+ test_relocs f3t
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-15.dd b/ld/testsuite/ld-arm/ifunc-15.dd
new file mode 100644
index 0000000..886d355
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-15.dd
@@ -0,0 +1,100 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <__irel_end\+0xff0>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ f2t's .plt entry
+#------------------------------------------------------------------------------
+ 9014: e28fc600 add ip, pc, #0
+ 9018: e28cca07 add ip, ip, #28672 ; 0x7000
+ 901c: e5bcfff0 ldr pc, \[ip, #4080\]! ; 0xff0
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ 9020: e28fc600 add ip, pc, #0
+ 9024: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9028: e5bcffe8 ldr pc, \[ip, #4072\]! ; 0xfe8
+
+Disassembly of section \.iplt:
+
+0000902c <f3-0x18>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 902c: e28fc600 add ip, pc, #0
+ 9030: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9034: e5bcffe0 ldr pc, \[ip, #4064\]! ; 0xfe0
+#------------------------------------------------------------------------------
+#------ f1t's .iplt entry
+#------------------------------------------------------------------------------
+ 9038: e28fc600 add ip, pc, #0
+ 903c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9040: e5bcffd8 ldr pc, \[ip, #4056\]! ; 0xfd8
+
+00009044 <f3>:
+ 9044: e28fc600 add ip, pc, #0
+ 9048: e28cca07 add ip, ip, #28672 ; 0x7000
+ 904c: e5bcffd0 ldr pc, \[ip, #4048\]! ; 0xfd0
+
+00009050 <f3t>:
+ 9050: e28fc600 add ip, pc, #0
+ 9054: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9058: e5bcffc8 ldr pc, \[ip, #4040\]! ; 0xfc8
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <f1t>:
+ a008: 46f7 mov pc, lr
+ a00a: 46f7 mov pc, lr
+
+0000a00c <_start>:
+ a00c: f8df 4000 ldr\.w r4, \[pc\] ; a010 <_start\+0x4>
+#------------------------------------------------------------------------------
+#------ foo
+#------------------------------------------------------------------------------
+ a010: 00010000 \.word 0x00010000
+ a014: f8df 4000 ldr\.w r4, \[pc\] ; a018 <_start\+0xc>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a018: 0000902c \.word 0x0000902c
+ a01c: f8df 4000 ldr\.w r4, \[pc\] ; a020 <_start\+0x14>
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ a020: 00009020 \.word 0x00009020
+ a024: f8df 4000 ldr\.w r4, \[pc\] ; a028 <_start\+0x1c>
+#------------------------------------------------------------------------------
+#------ f3
+#------------------------------------------------------------------------------
+ a028: 00009044 \.word 0x00009044
+ a02c: f8df 4000 ldr\.w r4, \[pc\] ; a030 <_start\+0x24>
+#------------------------------------------------------------------------------
+#------ f1t's .iplt entry
+#------------------------------------------------------------------------------
+ a030: 00009038 \.word 0x00009038
+ a034: f8df 4000 ldr\.w r4, \[pc\] ; a038 <_start\+0x2c>
+#------------------------------------------------------------------------------
+#------ f2t's .plt entry
+#------------------------------------------------------------------------------
+ a038: 00009014 \.word 0x00009014
+ a03c: f8df 4000 ldr\.w r4, \[pc\] ; a040 <_start\+0x34>
+#------------------------------------------------------------------------------
+#------ f3t
+#------------------------------------------------------------------------------
+ a040: 00009050 \.word 0x00009050
diff --git a/ld/testsuite/ld-arm/ifunc-15.gd b/ld/testsuite/ld-arm/ifunc-15.gd
new file mode 100644
index 0000000..c054e6b
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-15.gd
@@ -0,0 +1,27 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 00800000 20800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f2t's .got.plt entry [R_ARM_JUMP_SLOT]
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00900000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------ 00011014: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011018: f1t's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001101c: f3's .igot.plt pointer to 0xa004 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11010 00900000 00a00000 09a00000 04a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: f3t's .igot.plt pointer to 0xa00b [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11020 0ba00000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-15.rd b/ld/testsuite/ld-arm/ifunc-15.rd
new file mode 100644
index 0000000..59ea29b
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-15.rd
@@ -0,0 +1,12 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 4 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00011014 ......a0 R_ARM_IRELATIVE
+00011018 ......a0 R_ARM_IRELATIVE
+0001101c ......a0 R_ARM_IRELATIVE
+00011020 ......a0 R_ARM_IRELATIVE
+
+Relocation section '\.rel\.plt' at offset 0x8020 contains 2 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT 00009014 f2t
+00011010 ......16 R_ARM_JUMP_SLOT 00009020 f2
diff --git a/ld/testsuite/ld-arm/ifunc-15.s b/ld/testsuite/ld-arm/ifunc-15.s
new file mode 100644
index 0000000..91cb997
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-15.s
@@ -0,0 +1,47 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ ldr r4,1f
+1:
+ .word \name
+ .endm
+
+ .global f2
+ .global f2t
+
+ .global f3
+ .hidden f3
+ .global f3t
+ .hidden f3t
+
+ define f1,.arm
+ define f3,.arm
+
+ define f1t,.thumb_func
+ define f3t,.thumb_func
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f1t
+ test_relocs f2t
+ test_relocs f3t
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-16.dd b/ld/testsuite/ld-arm/ifunc-16.dd
new file mode 100644
index 0000000..d3b39bd
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-16.dd
@@ -0,0 +1,88 @@
+
+.*
+
+
+Disassembly of section \.iplt:
+
+00009000 <f2t-0x18>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 9000: e28fc600 add ip, pc, #0
+ 9004: e28cca08 add ip, ip, #32768 ; 0x8000
+ 9008: e5bcf004 ldr pc, \[ip, #4\]!
+#------------------------------------------------------------------------------
+#------ f1t's .iplt entry
+#------------------------------------------------------------------------------
+ 900c: e28fc600 add ip, pc, #0
+ 9010: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9014: e5bcfffc ldr pc, \[ip, #4092\]! ; 0xffc
+
+00009018 <f2t>:
+ 9018: e28fc600 add ip, pc, #0
+ 901c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9020: e5bcfff4 ldr pc, \[ip, #4084\]! ; 0xff4
+
+00009024 <f3>:
+ 9024: e28fc600 add ip, pc, #0
+ 9028: e28cca07 add ip, ip, #28672 ; 0x7000
+ 902c: e5bcffec ldr pc, \[ip, #4076\]! ; 0xfec
+
+00009030 <f2>:
+ 9030: e28fc600 add ip, pc, #0
+ 9034: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9038: e5bcffe4 ldr pc, \[ip, #4068\]! ; 0xfe4
+
+0000903c <f3t>:
+ 903c: e28fc600 add ip, pc, #0
+ 9040: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9044: e5bcffdc ldr pc, \[ip, #4060\]! ; 0xfdc
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+ a004: e1a0f00e mov pc, lr
+ a008: e1a0f00e mov pc, lr
+
+0000a00c <f1t>:
+ a00c: 46f7 mov pc, lr
+ a00e: 46f7 mov pc, lr
+ a010: 46f7 mov pc, lr
+
+0000a012 <_start>:
+ a012: 4c00 ldr r4, \[pc, #0\] ; \(a014 <_start\+0x2>\)
+#------------------------------------------------------------------------------
+#------ foo
+#------------------------------------------------------------------------------
+ a014: 00010000 \.word 0x00010000
+ a018: f8df 4000 ldr\.w r4, \[pc\] ; a01c <_start\+0xa>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a01c: 00009000 \.word 0x00009000
+ a020: f8df 4000 ldr\.w r4, \[pc\] ; a024 <_start\+0x12>
+#------------------------------------------------------------------------------
+#------ f2
+#------------------------------------------------------------------------------
+ a024: 00009030 \.word 0x00009030
+ a028: f8df 4000 ldr\.w r4, \[pc\] ; a02c <_start\+0x1a>
+#------------------------------------------------------------------------------
+#------ f3
+#------------------------------------------------------------------------------
+ a02c: 00009024 \.word 0x00009024
+ a030: f8df 4000 ldr\.w r4, \[pc\] ; a034 <_start\+0x22>
+#------------------------------------------------------------------------------
+#------ f1t's .iplt entry
+#------------------------------------------------------------------------------
+ a034: 0000900c \.word 0x0000900c
+ a038: f8df 4000 ldr\.w r4, \[pc\] ; a03c <_start\+0x2a>
+#------------------------------------------------------------------------------
+#------ f2t
+#------------------------------------------------------------------------------
+ a03c: 00009018 \.word 0x00009018
+ a040: f8df 4000 ldr\.w r4, \[pc\] ; a044 <_start\+0x32>
+#------------------------------------------------------------------------------
+#------ f3t
+#------------------------------------------------------------------------------
+ a044: 0000903c \.word 0x0000903c
diff --git a/ld/testsuite/ld-arm/ifunc-16.gd b/ld/testsuite/ld-arm/ifunc-16.gd
new file mode 100644
index 0000000..7c4e820
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-16.gd
@@ -0,0 +1,27 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 00800000 30800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f1t's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011014: f2t's .igot.plt pointer to 0xa00f [R_ARM_IRELATIVE]
+#------ 00011018: f3's .igot.plt pointer to 0xa008 [R_ARM_IRELATIVE]
+#------ 0001101c: f2's .igot.plt pointer to 0xa004 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11010 0da00000 0fa00000 08a00000 04a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: f3t's .igot.plt pointer to 0xa011 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11020 11a00000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-16.rd b/ld/testsuite/ld-arm/ifunc-16.rd
new file mode 100644
index 0000000..7296316
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-16.rd
@@ -0,0 +1,9 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 6 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......a0 R_ARM_IRELATIVE
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011018 ......a0 R_ARM_IRELATIVE
+0001101c ......a0 R_ARM_IRELATIVE
+00011020 ......a0 R_ARM_IRELATIVE
diff --git a/ld/testsuite/ld-arm/ifunc-16.s b/ld/testsuite/ld-arm/ifunc-16.s
new file mode 100644
index 0000000..80fe282
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-16.s
@@ -0,0 +1,49 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ ldr r4,1f
+1:
+ .word \name
+ .endm
+
+ .global f2
+ .global f2t
+
+ .global f3
+ .hidden f3
+ .global f3t
+ .hidden f3t
+
+ define f1,.arm
+ define f2,.arm
+ define f3,.arm
+
+ define f1t,.thumb_func
+ define f2t,.thumb_func
+ define f3t,.thumb_func
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f1t
+ test_relocs f2t
+ test_relocs f3t
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-2.dd b/ld/testsuite/ld-arm/ifunc-2.dd
new file mode 100644
index 0000000..994069c
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-2.dd
@@ -0,0 +1,445 @@
+
+.*
+
+
+Disassembly of section \.iplt:
+
+00009000 <f7-0x3c>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 9000: e28fc600 add ip, pc, #0
+ 9004: e28cca08 add ip, ip, #32768 ; 0x8000
+ 9008: e5bcf004 ldr pc, \[ip, #4\]!
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ 900c: e28fc600 add ip, pc, #0
+ 9010: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9014: e5bcfffc ldr pc, \[ip, #4092\]! ; 0xffc
+#------------------------------------------------------------------------------
+#------ thumb entry to f3's .iplt entry
+#------------------------------------------------------------------------------
+ 9018: 4778 bx pc
+ 901a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ 901c: e28fc600 add ip, pc, #0
+ 9020: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9024: e5bcfff0 ldr pc, \[ip, #4080\]! ; 0xff0
+#------------------------------------------------------------------------------
+#------ thumb entry to f4's .iplt entry
+#------------------------------------------------------------------------------
+ 9028: 4778 bx pc
+ 902a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ f4's .iplt entry
+#------------------------------------------------------------------------------
+ 902c: e28fc600 add ip, pc, #0
+ 9030: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9034: e5bcffe4 ldr pc, \[ip, #4068\]! ; 0xfe4
+#------------------------------------------------------------------------------
+#------ thumb entry to f7
+#------------------------------------------------------------------------------
+ 9038: 4778 bx pc
+ 903a: 46c0 nop ; \(mov r8, r8\)
+
+0000903c <f7>:
+ 903c: e28fc600 add ip, pc, #0
+ 9040: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9044: e5bcffd8 ldr pc, \[ip, #4056\]! ; 0xfd8
+
+00009048 <f5>:
+ 9048: e28fc600 add ip, pc, #0
+ 904c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9050: e5bcffd0 ldr pc, \[ip, #4048\]! ; 0xfd0
+#------------------------------------------------------------------------------
+#------ thumb entry to f8
+#------------------------------------------------------------------------------
+ 9054: 4778 bx pc
+ 9056: 46c0 nop ; \(mov r8, r8\)
+
+00009058 <f8>:
+ 9058: e28fc600 add ip, pc, #0
+ 905c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9060: e5bcffc4 ldr pc, \[ip, #4036\]! ; 0xfc4
+
+00009064 <f6>:
+ 9064: e28fc600 add ip, pc, #0
+ 9068: e28cca07 add ip, ip, #28672 ; 0x7000
+ 906c: e5bcffbc ldr pc, \[ip, #4028\]! ; 0xfbc
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+
+0000a004 <f2>:
+ a004: 46f7 mov pc, lr
+ \.\.\.
+
+0000a008 <f3>:
+ a008: e1a0f00e mov pc, lr
+
+0000a00c <f4>:
+ a00c: 46f7 mov pc, lr
+ a00e: 0000 movs r0, r0
+ a010: e1a0f00e mov pc, lr
+ a014: 46f7 mov pc, lr
+ a016: 0000 movs r0, r0
+ a018: e1a0f00e mov pc, lr
+ a01c: 46f7 mov pc, lr
+ \.\.\.
+
+0000a020 <_start>:
+ a020: eb0017f6 bl 10000 <foo>
+ a024: ea0017f5 b 10000 <foo>
+ a028: 0a0017f4 beq 10000 <foo>
+ a02c: e59f4014 ldr r4, \[pc, #20\] ; a048 <_start\+0x28>
+ a030: e59f4014 ldr r4, \[pc, #20\] ; a04c <_start\+0x2c>
+ a034: e59f4014 ldr r4, \[pc, #20\] ; a050 <_start\+0x30>
+ a038: e59f4014 ldr r4, \[pc, #20\] ; a054 <_start\+0x34>
+ a03c: e59f5014 ldr r5, \[pc, #20\] ; a058 <_start\+0x38>
+ a040: e3004000 movw r4, #0
+ a044: e3404001 movt r4, #1
+#------------------------------------------------------------------------------
+#------ foo
+#------------------------------------------------------------------------------
+ a048: 00010000 \.word 0x00010000
+#------------------------------------------------------------------------------
+#------ PC-relative offset of foo
+#------------------------------------------------------------------------------
+ a04c: 00005fb4 \.word 0x00005fb4
+#------------------------------------------------------------------------------
+#------ GP-relative offset of foo
+#------------------------------------------------------------------------------
+ a050: fffff000 \.word 0xfffff000
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a054: 00000040 \.word 0x00000040
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a058: 00006fd4 \.word 0x00006fd4
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a05c: ebfffbe7 bl 9000 <f7-0x3c>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a060: eafffbe6 b 9000 <f7-0x3c>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a064: 0afffbe5 beq 9000 <f7-0x3c>
+ a068: e59f4014 ldr r4, \[pc, #20\] ; a084 <_start\+0x64>
+ a06c: e59f4014 ldr r4, \[pc, #20\] ; a088 <_start\+0x68>
+ a070: e59f4014 ldr r4, \[pc, #20\] ; a08c <_start\+0x6c>
+ a074: e59f4014 ldr r4, \[pc, #20\] ; a090 <_start\+0x70>
+ a078: e59f5014 ldr r5, \[pc, #20\] ; a094 <_start\+0x74>
+ a07c: e3094000 movw r4, #36864 ; 0x9000
+ a080: e3404000 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a084: 00009000 \.word 0x00009000
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .iplt entry
+#------------------------------------------------------------------------------
+ a088: ffffef78 \.word 0xffffef78
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f1's .iplt entry
+#------------------------------------------------------------------------------
+ a08c: ffff8000 \.word 0xffff8000
+#------------------------------------------------------------------------------
+#------ .got offset for f1's .iplt entry
+#------------------------------------------------------------------------------
+ a090: 00000030 \.word 0x00000030
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f1's .iplt entry
+#------------------------------------------------------------------------------
+ a094: 00006f9c \.word 0x00006f9c
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a098: ebfffbdb bl 900c <f7-0x30>
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a09c: eafffbda b 900c <f7-0x30>
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a0a0: 0afffbd9 beq 900c <f7-0x30>
+ a0a4: e59f4014 ldr r4, \[pc, #20\] ; a0c0 <_start\+0xa0>
+ a0a8: e59f4014 ldr r4, \[pc, #20\] ; a0c4 <_start\+0xa4>
+ a0ac: e59f4014 ldr r4, \[pc, #20\] ; a0c8 <_start\+0xa8>
+ a0b0: e59f4014 ldr r4, \[pc, #20\] ; a0cc <_start\+0xac>
+ a0b4: e59f5014 ldr r5, \[pc, #20\] ; a0d0 <_start\+0xb0>
+ a0b8: e309400c movw r4, #36876 ; 0x900c
+ a0bc: e3404000 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a0c0: 0000900c \.word 0x0000900c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f2's .iplt entry
+#------------------------------------------------------------------------------
+ a0c4: ffffef48 \.word 0xffffef48
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f2's .iplt entry
+#------------------------------------------------------------------------------
+ a0c8: ffff800c \.word 0xffff800c
+#------------------------------------------------------------------------------
+#------ .got offset for f2's .iplt entry
+#------------------------------------------------------------------------------
+ a0cc: 00000034 \.word 0x00000034
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f2's .iplt entry
+#------------------------------------------------------------------------------
+ a0d0: 00006f64 \.word 0x00006f64
+ a0d4: ebfffbdb bl 9048 <f5>
+ a0d8: eafffbda b 9048 <f5>
+ a0dc: 0afffbd9 beq 9048 <f5>
+ a0e0: e59f4014 ldr r4, \[pc, #20\] ; a0fc <_start\+0xdc>
+ a0e4: e59f4014 ldr r4, \[pc, #20\] ; a100 <_start\+0xe0>
+ a0e8: e59f4014 ldr r4, \[pc, #20\] ; a104 <_start\+0xe4>
+ a0ec: e59f4014 ldr r4, \[pc, #20\] ; a108 <_start\+0xe8>
+ a0f0: e59f5014 ldr r5, \[pc, #20\] ; a10c <_start\+0xec>
+ a0f4: e3094048 movw r4, #36936 ; 0x9048
+ a0f8: e3404000 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f5
+#------------------------------------------------------------------------------
+ a0fc: 00009048 \.word 0x00009048
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f5
+#------------------------------------------------------------------------------
+ a100: ffffef48 \.word 0xffffef48
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f5
+#------------------------------------------------------------------------------
+ a104: ffff8048 \.word 0xffff8048
+#------------------------------------------------------------------------------
+#------ .got offset for f5
+#------------------------------------------------------------------------------
+ a108: 00000048 \.word 0x00000048
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f5
+#------------------------------------------------------------------------------
+ a10c: 00006f3c \.word 0x00006f3c
+ a110: ebfffbd3 bl 9064 <f6>
+ a114: eafffbd2 b 9064 <f6>
+ a118: 0afffbd1 beq 9064 <f6>
+ a11c: e59f4014 ldr r4, \[pc, #20\] ; a138 <_start\+0x118>
+ a120: e59f4014 ldr r4, \[pc, #20\] ; a13c <_start\+0x11c>
+ a124: e59f4014 ldr r4, \[pc, #20\] ; a140 <_start\+0x120>
+ a128: e59f4014 ldr r4, \[pc, #20\] ; a144 <_start\+0x124>
+ a12c: e59f5014 ldr r5, \[pc, #20\] ; a148 <_start\+0x128>
+ a130: e3094064 movw r4, #36964 ; 0x9064
+ a134: e3404000 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f6
+#------------------------------------------------------------------------------
+ a138: 00009064 \.word 0x00009064
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f6
+#------------------------------------------------------------------------------
+ a13c: ffffef28 \.word 0xffffef28
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f6
+#------------------------------------------------------------------------------
+ a140: ffff8064 \.word 0xffff8064
+#------------------------------------------------------------------------------
+#------ .got offset for f6
+#------------------------------------------------------------------------------
+ a144: 00000050 \.word 0x00000050
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f6
+#------------------------------------------------------------------------------
+ a148: 00006f08 \.word 0x00006f08
+
+0000a14c <_thumb>:
+ a14c: f005 ff58 bl 10000 <foo>
+ a150: f005 bf56 b\.w 10000 <foo>
+ a154: f005 8754 beq\.w 10000 <foo>
+ a158: 4c04 ldr r4, \[pc, #16\] ; \(a16c <_thumb\+0x20>\)
+ a15a: f8df 4014 ldr\.w r4, \[pc, #20\] ; a170 <_thumb\+0x24>
+ a15e: 4c05 ldr r4, \[pc, #20\] ; \(a174 <_thumb\+0x28>\)
+ a160: 4c05 ldr r4, \[pc, #20\] ; \(a178 <_thumb\+0x2c>\)
+ a162: 4d06 ldr r5, \[pc, #24\] ; \(a17c <_thumb\+0x30>\)
+ a164: f240 0400 movw r4, #0
+ a168: f2c0 0401 movt r4, #1
+#------------------------------------------------------------------------------
+#------ foo
+#------------------------------------------------------------------------------
+ a16c: 00010000 \.word 0x00010000
+#------------------------------------------------------------------------------
+#------ PC-relative offset of foo
+#------------------------------------------------------------------------------
+ a170: 00005e90 \.word 0x00005e90
+#------------------------------------------------------------------------------
+#------ GP-relative offset of foo
+#------------------------------------------------------------------------------
+ a174: fffff000 \.word 0xfffff000
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a178: 00000040 \.word 0x00000040
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a17c: 00006eb0 \.word 0x00006eb0
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ a180: f7fe ef4c blx 901c <f7-0x20>
+#------------------------------------------------------------------------------
+#------ thumb entry to f3's .iplt entry
+#------------------------------------------------------------------------------
+ a184: f7fe bf48 b\.w 9018 <f7-0x24>
+#------------------------------------------------------------------------------
+#------ thumb entry to f3's .iplt entry
+#------------------------------------------------------------------------------
+ a188: f43e af46 beq\.w 9018 <f7-0x24>
+ a18c: 4c04 ldr r4, \[pc, #16\] ; \(a1a0 <_thumb\+0x54>\)
+ a18e: f8df 4014 ldr\.w r4, \[pc, #20\] ; a1a4 <_thumb\+0x58>
+ a192: 4c05 ldr r4, \[pc, #20\] ; \(a1a8 <_thumb\+0x5c>\)
+ a194: 4c05 ldr r4, \[pc, #20\] ; \(a1ac <_thumb\+0x60>\)
+ a196: 4d06 ldr r5, \[pc, #24\] ; \(a1b0 <_thumb\+0x64>\)
+ a198: f249 041c movw r4, #36892 ; 0x901c
+ a19c: f2c0 0400 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ a1a0: 0000901c \.word 0x0000901c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3's .iplt entry
+#------------------------------------------------------------------------------
+ a1a4: ffffee78 \.word 0xffffee78
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f3's .iplt entry
+#------------------------------------------------------------------------------
+ a1a8: ffff801c \.word 0xffff801c
+#------------------------------------------------------------------------------
+#------ .got offset for f3's .iplt entry
+#------------------------------------------------------------------------------
+ a1ac: 00000038 \.word 0x00000038
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f3's .iplt entry
+#------------------------------------------------------------------------------
+ a1b0: 00006e88 \.word 0x00006e88
+#------------------------------------------------------------------------------
+#------ f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1b4: f7fe ef3a blx 902c <f7-0x10>
+#------------------------------------------------------------------------------
+#------ thumb entry to f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1b8: f7fe bf36 b\.w 9028 <f7-0x14>
+#------------------------------------------------------------------------------
+#------ thumb entry to f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1bc: f43e af34 beq\.w 9028 <f7-0x14>
+ a1c0: 4c04 ldr r4, \[pc, #16\] ; \(a1d4 <_thumb\+0x88>\)
+ a1c2: f8df 4014 ldr\.w r4, \[pc, #20\] ; a1d8 <_thumb\+0x8c>
+ a1c6: 4c05 ldr r4, \[pc, #20\] ; \(a1dc <_thumb\+0x90>\)
+ a1c8: 4c05 ldr r4, \[pc, #20\] ; \(a1e0 <_thumb\+0x94>\)
+ a1ca: 4d06 ldr r5, \[pc, #24\] ; \(a1e4 <_thumb\+0x98>\)
+ a1cc: f249 042c movw r4, #36908 ; 0x902c
+ a1d0: f2c0 0400 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1d4: 0000902c \.word 0x0000902c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1d8: ffffee54 \.word 0xffffee54
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1dc: ffff802c \.word 0xffff802c
+#------------------------------------------------------------------------------
+#------ .got offset for f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1e0: 0000003c \.word 0x0000003c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f4's .iplt entry
+#------------------------------------------------------------------------------
+ a1e4: 00006e58 \.word 0x00006e58
+ a1e8: f7fe ef28 blx 903c <f7>
+#------------------------------------------------------------------------------
+#------ thumb entry to f7
+#------------------------------------------------------------------------------
+ a1ec: f7fe bf24 b\.w 9038 <f7-0x4>
+#------------------------------------------------------------------------------
+#------ thumb entry to f7
+#------------------------------------------------------------------------------
+ a1f0: f43e af22 beq\.w 9038 <f7-0x4>
+ a1f4: 4c04 ldr r4, \[pc, #16\] ; \(a208 <_thumb\+0xbc>\)
+ a1f6: f8df 4014 ldr\.w r4, \[pc, #20\] ; a20c <_thumb\+0xc0>
+ a1fa: 4c05 ldr r4, \[pc, #20\] ; \(a210 <_thumb\+0xc4>\)
+ a1fc: 4c05 ldr r4, \[pc, #20\] ; \(a214 <_thumb\+0xc8>\)
+ a1fe: 4d06 ldr r5, \[pc, #24\] ; \(a218 <_thumb\+0xcc>\)
+ a200: f249 043c movw r4, #36924 ; 0x903c
+ a204: f2c0 0400 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f7
+#------------------------------------------------------------------------------
+ a208: 0000903c \.word 0x0000903c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f7
+#------------------------------------------------------------------------------
+ a20c: ffffee30 \.word 0xffffee30
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f7
+#------------------------------------------------------------------------------
+ a210: ffff803c \.word 0xffff803c
+#------------------------------------------------------------------------------
+#------ .got offset for f7
+#------------------------------------------------------------------------------
+ a214: 00000044 \.word 0x00000044
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f7
+#------------------------------------------------------------------------------
+ a218: 00006e2c \.word 0x00006e2c
+ a21c: f7fe ef1c blx 9058 <f8>
+#------------------------------------------------------------------------------
+#------ thumb entry to f8
+#------------------------------------------------------------------------------
+ a220: f7fe bf18 b\.w 9054 <f5\+0xc>
+#------------------------------------------------------------------------------
+#------ thumb entry to f8
+#------------------------------------------------------------------------------
+ a224: f43e af16 beq\.w 9054 <f5\+0xc>
+ a228: 4c04 ldr r4, \[pc, #16\] ; \(a23c <_thumb\+0xf0>\)
+ a22a: f8df 4014 ldr\.w r4, \[pc, #20\] ; a240 <_thumb\+0xf4>
+ a22e: 4c05 ldr r4, \[pc, #20\] ; \(a244 <_thumb\+0xf8>\)
+ a230: 4c05 ldr r4, \[pc, #20\] ; \(a248 <_thumb\+0xfc>\)
+ a232: 4d06 ldr r5, \[pc, #24\] ; \(a24c <_thumb\+0x100>\)
+ a234: f249 0458 movw r4, #36952 ; 0x9058
+ a238: f2c0 0400 movt r4, #0
+#------------------------------------------------------------------------------
+#------ f8
+#------------------------------------------------------------------------------
+ a23c: 00009058 \.word 0x00009058
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f8
+#------------------------------------------------------------------------------
+ a240: ffffee18 \.word 0xffffee18
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f8
+#------------------------------------------------------------------------------
+ a244: ffff8058 \.word 0xffff8058
+#------------------------------------------------------------------------------
+#------ .got offset for f8
+#------------------------------------------------------------------------------
+ a248: 0000004c \.word 0x0000004c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f8
+#------------------------------------------------------------------------------
+ a24c: 00006e00 \.word 0x00006e00
diff --git a/ld/testsuite/ld-arm/ifunc-2.gd b/ld/testsuite/ld-arm/ifunc-2.gd
new file mode 100644
index 0000000..0917a75
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-2.gd
@@ -0,0 +1,48 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11000 00000000 00000000 00000000 00a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f2's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011014: f3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011018: f4's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001101c: f7's .igot.plt pointer to 0xa018 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11010 05a00000 08a00000 0da00000 18a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: f5's .igot.plt pointer to 0xa010 [R_ARM_IRELATIVE]
+#------ 00011024: f8's .igot.plt pointer to 0xa01d [R_ARM_IRELATIVE]
+#------ 00011028: f6's .igot.plt pointer to 0xa015 [R_ARM_IRELATIVE]
+#------ 0001102c: .got entry for foo
+#------------------------------------------------------------------------------
+ 11020 10a00000 1da00000 15a00000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011030: .got entry for f1's .iplt entry
+#------ 00011034: .got entry for f2's .iplt entry
+#------ 00011038: .got entry for f3's .iplt entry
+#------ 0001103c: .got entry for f4's .iplt entry
+#------------------------------------------------------------------------------
+ 11030 00900000 0c900000 1c900000 2c900000 .*
+#------------------------------------------------------------------------------
+#------ 00011040: .got entry for foo
+#------ 00011044: .got entry for f7
+#------ 00011048: .got entry for f5
+#------ 0001104c: .got entry for f8
+#------------------------------------------------------------------------------
+ 11040 00000100 3c900000 48900000 58900000 .*
+#------------------------------------------------------------------------------
+#------ 00011050: .got entry for f6
+#------------------------------------------------------------------------------
+ 11050 64900000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-2.rd b/ld/testsuite/ld-arm/ifunc-2.rd
new file mode 100644
index 0000000..92b000a
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-2.rd
@@ -0,0 +1,13 @@
+
+There is no dynamic section in this file\.
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 8 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......a0 R_ARM_IRELATIVE
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011018 ......a0 R_ARM_IRELATIVE
+0001101c ......a0 R_ARM_IRELATIVE
+00011020 ......a0 R_ARM_IRELATIVE
+00011024 ......a0 R_ARM_IRELATIVE
+00011028 ......a0 R_ARM_IRELATIVE
diff --git a/ld/testsuite/ld-arm/ifunc-2.s b/ld/testsuite/ld-arm/ifunc-2.s
new file mode 100644
index 0000000..8834fbc
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-2.s
@@ -0,0 +1,74 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name,width
+ bl\width \name
+ b\width \name
+ beq\width \name
+ ldr r4,1f
+ ldr r4,2f
+ ldr r4,3f
+ ldr r4,4f
+ ldr r5,5f
+ movw r4,#:lower16:\name
+ movt r4,#:upper16:\name
+1:
+ .word \name
+2:
+ .word \name-.
+3:
+ .word \name(GOTOFF)
+4:
+ .word \name(GOT)
+5:
+ .word \name(GOT_PREL)
+ .endm
+
+ define f1,.arm
+ define f2,.thumb_func
+ define f3,.arm
+ define f4,.thumb_func
+
+ .globl f5
+ .globl f6
+ .globl f7
+ .globl f8
+
+ define f5,.arm
+ define f6,.thumb_func
+ define f7,.arm
+ define f8,.thumb_func
+
+ .globl _start
+ .type _start,%function
+ .arm
+_start:
+ test_relocs foo
+ test_relocs f1,
+ test_relocs f2,
+ test_relocs f5,
+ test_relocs f6,
+ .size _start,.-_start
+
+ .globl _thumb
+ .type _thumb,%function
+ .thumb_func
+_thumb:
+ test_relocs foo
+ test_relocs f3,.w
+ test_relocs f4,.w
+ test_relocs f7,.w
+ test_relocs f8,.w
+ .size _thumb,.-_thumb
+
+ .data
+foo:
+ .word 0x11223344
diff --git a/ld/testsuite/ld-arm/ifunc-3.dd b/ld/testsuite/ld-arm/ifunc-3.dd
new file mode 100644
index 0000000..1a4f52c
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-3.dd
@@ -0,0 +1,126 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <f1-0xff0>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ 9014: e28fc600 add ip, pc, #0
+ 9018: e28cca07 add ip, ip, #28672 ; 0x7000
+ 901c: e5bcfff0 ldr pc, \[ip, #4080\]! ; 0xff0
+
+Disassembly of section \.iplt:
+
+00009020 <\.iplt>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 9020: e28fc600 add ip, pc, #0
+ 9024: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9028: e5bcffe8 ldr pc, \[ip, #4072\]! ; 0xfe8
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ 902c: e28fc600 add ip, pc, #0
+ 9030: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9034: e5bcffe0 ldr pc, \[ip, #4064\]! ; 0xfe0
+#------------------------------------------------------------------------------
+#------ f4's .iplt entry
+#------------------------------------------------------------------------------
+ 9038: e28fc600 add ip, pc, #0
+ 903c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9040: e5bcffd8 ldr pc, \[ip, #4056\]! ; 0xfd8
+
+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 <f4>:
+ a00c: e1a0f00e mov pc, lr
+
+0000a010 <arm>:
+ a010: eb0017fa bl 10000 <foo>
+ a014: e59f4000 ldr r4, \[pc, #0\] ; a01c <arm\+0xc>
+ a018: e59f4000 ldr r4, \[pc, #0\] ; a020 <arm\+0x10>
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a01c: 00000020 \.word 0x00000020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a020: 00006ffc \.word 0x00006ffc
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a024: ebfffbfd bl 9020 <f1-0xfe0>
+ a028: e59f4000 ldr r4, \[pc, #0\] ; a030 <arm\+0x20>
+ a02c: e59f4000 ldr r4, \[pc, #0\] ; a034 <arm\+0x24>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a030: 00000010 \.word 0x00000010
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a034: 00006fdc \.word 0x00006fdc
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ a038: ebfffbf5 bl 9014 <f1-0xfec>
+ a03c: e59f4000 ldr r4, \[pc, #0\] ; a044 <arm\+0x34>
+ a040: e59f4000 ldr r4, \[pc, #0\] ; a048 <arm\+0x38>
+#------------------------------------------------------------------------------
+#------ .got offset for f2
+#------------------------------------------------------------------------------
+ a044: 00000024 \.word 0x00000024
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f2
+#------------------------------------------------------------------------------
+ a048: 00006fdc \.word 0x00006fdc
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ a04c: ebfffbf6 bl 902c <f1-0xfd4>
+ a050: e59f4000 ldr r4, \[pc, #0\] ; a058 <arm\+0x48>
+ a054: e59f4000 ldr r4, \[pc, #0\] ; a05c <arm\+0x4c>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a058: 00000014 \.word 0x00000014
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a05c: 00006fb8 \.word 0x00006fb8
+#------------------------------------------------------------------------------
+#------ f4's .iplt entry
+#------------------------------------------------------------------------------
+ a060: ebfffbf4 bl 9038 <f1-0xfc8>
+ a064: e59f4000 ldr r4, \[pc, #0\] ; a06c <arm\+0x5c>
+ a068: e59f4000 ldr r4, \[pc, #0\] ; a070 <arm\+0x60>
+#------------------------------------------------------------------------------
+#------ .got offset for f4
+#------------------------------------------------------------------------------
+ a06c: 00000028 \.word 0x00000028
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f4
+#------------------------------------------------------------------------------
+ a070: 00006fb8 \.word 0x00006fb8
diff --git a/ld/testsuite/ld-arm/ifunc-3.gd b/ld/testsuite/ld-arm/ifunc-3.gd
new file mode 100644
index 0000000..db7fd42
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-3.gd
@@ -0,0 +1,45 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------ 00010004: contains foo [R_ARM_RELATIVE]
+#------ 00010008: contains PC-relative offset of foo
+#------ 0001000c: contains f1 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 10000 44332211 00000100 f8ffffff 00a00000 .*
+#------------------------------------------------------------------------------
+#------ 00010010: contains PC-relative offset of f1's .iplt entry
+#------ 00010014: f2 [R_ARM_ABS32]
+#------ 00010018: f2 [R_ARM_REL32]
+#------ 0001001c: contains f3 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 10010 1090ffff 00000000 00000000 08a00000 .*
+#------------------------------------------------------------------------------
+#------ 00010020: contains PC-relative offset of f3's .iplt entry
+#------ 00010024: f4 [R_ARM_ABS32]
+#------ 00010028: contains PC-relative offset of f4's .iplt entry
+#------------------------------------------------------------------------------
+ 10020 0c90ffff 00000000 1090ffff .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00900000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011014: f3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011018: f4's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001101c: .got entry for foo [R_ARM_RELATIVE]
+#------------------------------------------------------------------------------
+ 11010 00a00000 08a00000 0ca00000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for foo [R_ARM_RELATIVE]
+#------ 00011024: .got entry for f2 [R_ARM_GLOB_DAT]
+#------ 00011028: .got entry for f4 [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 11020 00000100 00000000 00000000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-3.rd b/ld/testsuite/ld-arm/ifunc-3.rd
new file mode 100644
index 0000000..4acb314
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-3.rd
@@ -0,0 +1,20 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 13 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00010004 ......17 R_ARM_RELATIVE
+0001101c ......17 R_ARM_RELATIVE
+00011020 ......17 R_ARM_RELATIVE
+0001000c ......a0 R_ARM_IRELATIVE
+0001001c ......a0 R_ARM_IRELATIVE
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011018 ......a0 R_ARM_IRELATIVE
+00010014 ......02 R_ARM_ABS32 f2\(\) f2
+00010018 ......03 R_ARM_REL32 f2\(\) f2
+00011024 ......15 R_ARM_GLOB_DAT f2\(\) f2
+00010024 ......02 R_ARM_ABS32 f4\(\) f4
+00011028 ......15 R_ARM_GLOB_DAT f4\(\) f4
+
+Relocation section '\.rel\.plt' at offset 0x8068 contains 1 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT f2\(\) f2
diff --git a/ld/testsuite/ld-arm/ifunc-3.s b/ld/testsuite/ld-arm/ifunc-3.s
new file mode 100644
index 0000000..ace3598
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-3.s
@@ -0,0 +1,49 @@
+ .macro define,name
+ .text
+ .type \name,%gnu_indirect_function
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ bl \name(PLT)
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+
+ .data
+ .word \name
+ .word \name - .
+ .text
+ .endm
+
+ .globl f2
+
+ .globl f3
+ .hidden f3
+
+ .globl f4
+ .protected f4
+
+ define f1
+ define f2
+ define f3
+ define f4
+
+ .data
+foo:
+ .word 0x11223344
+
+ .text
+ .globl arm
+arm:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f4
+ .size arm,.-arm
diff --git a/ld/testsuite/ld-arm/ifunc-4.dd b/ld/testsuite/ld-arm/ifunc-4.dd
new file mode 100644
index 0000000..f000835
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-4.dd
@@ -0,0 +1,1055 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <aaf1-0xff0>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ 9014: 4778 bx pc
+ 9016: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf2's .plt entry
+#------------------------------------------------------------------------------
+ 9018: e28fc600 add ip, pc, #0
+ 901c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9020: e5bcffec ldr pc, \[ip, #4076\]! ; 0xfec
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ 9024: 4778 bx pc
+ 9026: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf2's .plt entry
+#------------------------------------------------------------------------------
+ 9028: e28fc600 add ip, pc, #0
+ 902c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9030: e5bcffe0 ldr pc, \[ip, #4064\]! ; 0xfe0
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ 9034: 4778 bx pc
+ 9036: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ 9038: e28fc600 add ip, pc, #0
+ 903c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9040: e5bcffd4 ldr pc, \[ip, #4052\]! ; 0xfd4
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ 9044: e28fc600 add ip, pc, #0
+ 9048: e28cca07 add ip, ip, #28672 ; 0x7000
+ 904c: e5bcffcc ldr pc, \[ip, #4044\]! ; 0xfcc
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ 9050: e28fc600 add ip, pc, #0
+ 9054: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9058: e5bcffc4 ldr pc, \[ip, #4036\]! ; 0xfc4
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ 905c: 4778 bx pc
+ 905e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ 9060: e28fc600 add ip, pc, #0
+ 9064: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9068: e5bcffb8 ldr pc, \[ip, #4024\]! ; 0xfb8
+
+Disassembly of section \.iplt:
+
+0000906c <\.iplt>:
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ 906c: e28fc600 add ip, pc, #0
+ 9070: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9074: e5bcffb0 ldr pc, \[ip, #4016\]! ; 0xfb0
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ 9078: 4778 bx pc
+ 907a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf1's .iplt entry
+#------------------------------------------------------------------------------
+ 907c: e28fc600 add ip, pc, #0
+ 9080: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9084: e5bcffa4 ldr pc, \[ip, #4004\]! ; 0xfa4
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ 9088: 4778 bx pc
+ 908a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ 908c: e28fc600 add ip, pc, #0
+ 9090: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9094: e5bcff98 ldr pc, \[ip, #3992\]! ; 0xf98
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ 9098: e28fc600 add ip, pc, #0
+ 909c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90a0: e5bcff90 ldr pc, \[ip, #3984\]! ; 0xf90
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90a4: 4778 bx pc
+ 90a6: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90a8: e28fc600 add ip, pc, #0
+ 90ac: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90b0: e5bcff84 ldr pc, \[ip, #3972\]! ; 0xf84
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90b4: 4778 bx pc
+ 90b6: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90b8: e28fc600 add ip, pc, #0
+ 90bc: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90c0: e5bcff78 ldr pc, \[ip, #3960\]! ; 0xf78
+#------------------------------------------------------------------------------
+#------ aaf4's .iplt entry
+#------------------------------------------------------------------------------
+ 90c4: e28fc600 add ip, pc, #0
+ 90c8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90cc: e5bcff70 ldr pc, \[ip, #3952\]! ; 0xf70
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3's .iplt entry
+#------------------------------------------------------------------------------
+ 90d0: 4778 bx pc
+ 90d2: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf3's .iplt entry
+#------------------------------------------------------------------------------
+ 90d4: e28fc600 add ip, pc, #0
+ 90d8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90dc: e5bcff64 ldr pc, \[ip, #3940\]! ; 0xf64
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3's .iplt entry
+#------------------------------------------------------------------------------
+ 90e0: 4778 bx pc
+ 90e2: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ 90e4: e28fc600 add ip, pc, #0
+ 90e8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90ec: e5bcff58 ldr pc, \[ip, #3928\]! ; 0xf58
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ 90f0: 4778 bx pc
+ 90f2: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ 90f4: e28fc600 add ip, pc, #0
+ 90f8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90fc: e5bcff4c ldr pc, \[ip, #3916\]! ; 0xf4c
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9100: 4778 bx pc
+ 9102: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9104: e28fc600 add ip, pc, #0
+ 9108: e28cca07 add ip, ip, #28672 ; 0x7000
+ 910c: e5bcff40 ldr pc, \[ip, #3904\]! ; 0xf40
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9110: e28fc600 add ip, pc, #0
+ 9114: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9118: e5bcff38 ldr pc, \[ip, #3896\]! ; 0xf38
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .iplt entry
+#------------------------------------------------------------------------------
+ 911c: 4778 bx pc
+ 911e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf4's .iplt entry
+#------------------------------------------------------------------------------
+ 9120: e28fc600 add ip, pc, #0
+ 9124: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9128: e5bcff2c ldr pc, \[ip, #3884\]! ; 0xf2c
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ 912c: 4778 bx pc
+ 912e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ 9130: e28fc600 add ip, pc, #0
+ 9134: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9138: e5bcff20 ldr pc, \[ip, #3872\]! ; 0xf20
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .iplt entry
+#------------------------------------------------------------------------------
+ 913c: 4778 bx pc
+ 913e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf4's .iplt entry
+#------------------------------------------------------------------------------
+ 9140: e28fc600 add ip, pc, #0
+ 9144: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9148: e5bcff14 ldr pc, \[ip, #3860\]! ; 0xf14
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ 914c: e28fc600 add ip, pc, #0
+ 9150: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9154: e5bcff0c ldr pc, \[ip, #3852\]! ; 0xf0c
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .iplt entry
+#------------------------------------------------------------------------------
+ 9158: 4778 bx pc
+ 915a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf4's .iplt entry
+#------------------------------------------------------------------------------
+ 915c: e28fc600 add ip, pc, #0
+ 9160: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9164: e5bcff00 ldr pc, \[ip, #3840\]! ; 0xf00
+#------------------------------------------------------------------------------
+#------ taf4's .iplt entry
+#------------------------------------------------------------------------------
+ 9168: e28fc600 add ip, pc, #0
+ 916c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9170: e5bcfef8 ldr pc, \[ip, #3832\]! ; 0xef8
+
+Disassembly of section \.text:
+
+0000a000 <aaf1>:
+ a000: e1a0f00e mov pc, lr
+
+0000a004 <atf1>:
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <abf1>:
+ a008: e1a0f00e mov pc, lr
+
+0000a00c <taf1>:
+ a00c: 46f7 mov pc, lr
+
+0000a00e <ttf1>:
+ a00e: 46f7 mov pc, lr
+
+0000a010 <tbf1>:
+ a010: 46f7 mov pc, lr
+ \.\.\.
+
+0000a014 <aaf2>:
+ a014: e1a0f00e mov pc, lr
+
+0000a018 <atf2>:
+ a018: e1a0f00e mov pc, lr
+
+0000a01c <abf2>:
+ a01c: e1a0f00e mov pc, lr
+
+0000a020 <taf2>:
+ a020: 46f7 mov pc, lr
+
+0000a022 <ttf2>:
+ a022: 46f7 mov pc, lr
+
+0000a024 <tbf2>:
+ a024: 46f7 mov pc, lr
+ \.\.\.
+
+0000a028 <aaf3>:
+ a028: e1a0f00e mov pc, lr
+
+0000a02c <atf3>:
+ a02c: e1a0f00e mov pc, lr
+
+0000a030 <abf3>:
+ a030: e1a0f00e mov pc, lr
+
+0000a034 <taf3>:
+ a034: 46f7 mov pc, lr
+
+0000a036 <ttf3>:
+ a036: 46f7 mov pc, lr
+
+0000a038 <tbf3>:
+ a038: 46f7 mov pc, lr
+ \.\.\.
+
+0000a03c <aaf4>:
+ a03c: e1a0f00e mov pc, lr
+
+0000a040 <atf4>:
+ a040: e1a0f00e mov pc, lr
+
+0000a044 <abf4>:
+ a044: e1a0f00e mov pc, lr
+
+0000a048 <taf4>:
+ a048: 46f7 mov pc, lr
+
+0000a04a <ttf4>:
+ a04a: 46f7 mov pc, lr
+
+0000a04c <tbf4>:
+ a04c: 46f7 mov pc, lr
+ \.\.\.
+
+0000a050 <arm>:
+ a050: eb0017ea bl 10000 <foo>
+ a054: ea0017e9 b 10000 <foo>
+ a058: 0a0017e8 beq 10000 <foo>
+ a05c: e59f4000 ldr r4, \[pc, #0\] ; a064 <arm\+0x14>
+ a060: e59f4000 ldr r4, \[pc, #0\] ; a068 <arm\+0x18>
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a064: 00000070 \.word 0x00000070
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a068: 00007004 \.word 0x00007004
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a06c: ebfffbfe bl 906c <aaf1-0xf94>
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a070: eafffbfd b 906c <aaf1-0xf94>
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a074: 0afffbfc beq 906c <aaf1-0xf94>
+ a078: e59f4000 ldr r4, \[pc, #0\] ; a080 <arm\+0x30>
+ a07c: e59f4000 ldr r4, \[pc, #0\] ; a084 <arm\+0x34>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of aaf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a080: 00000024 \.word 0x00000024
+#------------------------------------------------------------------------------
+#------ PC-relative offset of aaf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a084: 00006fa0 \.word 0x00006fa0
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a088: ebfffc02 bl 9098 <aaf1-0xf68>
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a08c: eafffc01 b 9098 <aaf1-0xf68>
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a090: 0afffc00 beq 9098 <aaf1-0xf68>
+ a094: e59f4000 ldr r4, \[pc, #0\] ; a09c <arm\+0x4c>
+ a098: e59f4000 ldr r4, \[pc, #0\] ; a0a0 <arm\+0x50>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of taf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a09c: 00000030 \.word 0x00000030
+#------------------------------------------------------------------------------
+#------ PC-relative offset of taf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0a0: 00006f90 \.word 0x00006f90
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0a4: ebfffbf8 bl 908c <aaf1-0xf74>
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0a8: eafffbf7 b 908c <aaf1-0xf74>
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0ac: 0afffbf6 beq 908c <aaf1-0xf74>
+ a0b0: e59f4000 ldr r4, \[pc, #0\] ; a0b8 <arm\+0x68>
+ a0b4: e59f4000 ldr r4, \[pc, #0\] ; a0bc <arm\+0x6c>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0b8: 0000002c \.word 0x0000002c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0bc: 00006f70 \.word 0x00006f70
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0c0: ebfffbfc bl 90b8 <aaf1-0xf48>
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0c4: eafffbfb b 90b8 <aaf1-0xf48>
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0c8: 0afffbfa beq 90b8 <aaf1-0xf48>
+ a0cc: e59f4000 ldr r4, \[pc, #0\] ; a0d4 <arm\+0x84>
+ a0d0: e59f4000 ldr r4, \[pc, #0\] ; a0d8 <arm\+0x88>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0d4: 00000038 \.word 0x00000038
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0d8: 00006f60 \.word 0x00006f60
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0dc: ebfffbdb bl 9050 <aaf1-0xfb0>
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0e0: eafffbda b 9050 <aaf1-0xfb0>
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0e4: 0afffbd9 beq 9050 <aaf1-0xfb0>
+ a0e8: e59f4000 ldr r4, \[pc, #0\] ; a0f0 <arm\+0xa0>
+ a0ec: e59f4000 ldr r4, \[pc, #0\] ; a0f4 <arm\+0xa4>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf2
+#------------------------------------------------------------------------------
+ a0f0: 00000088 \.word 0x00000088
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf2
+#------------------------------------------------------------------------------
+ a0f4: 00006f94 \.word 0x00006f94
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0f8: ebfffbd1 bl 9044 <aaf1-0xfbc>
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0fc: eafffbd0 b 9044 <aaf1-0xfbc>
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a100: 0afffbcf beq 9044 <aaf1-0xfbc>
+ a104: e59f4000 ldr r4, \[pc, #0\] ; a10c <arm\+0xbc>
+ a108: e59f4000 ldr r4, \[pc, #0\] ; a110 <arm\+0xc0>
+#------------------------------------------------------------------------------
+#------ .got offset for taf2
+#------------------------------------------------------------------------------
+ a10c: 00000084 \.word 0x00000084
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf2
+#------------------------------------------------------------------------------
+ a110: 00006f74 \.word 0x00006f74
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a114: ebfffbd1 bl 9060 <aaf1-0xfa0>
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a118: eafffbd0 b 9060 <aaf1-0xfa0>
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a11c: 0afffbcf beq 9060 <aaf1-0xfa0>
+ a120: e59f4000 ldr r4, \[pc, #0\] ; a128 <arm\+0xd8>
+ a124: e59f4000 ldr r4, \[pc, #0\] ; a12c <arm\+0xdc>
+#------------------------------------------------------------------------------
+#------ .got offset for abf2
+#------------------------------------------------------------------------------
+ a128: 000000a0 \.word 0x000000a0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf2
+#------------------------------------------------------------------------------
+ a12c: 00006f74 \.word 0x00006f74
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a130: ebfffbc0 bl 9038 <aaf1-0xfc8>
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a134: eafffbbf b 9038 <aaf1-0xfc8>
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a138: 0afffbbe beq 9038 <aaf1-0xfc8>
+ a13c: e59f4000 ldr r4, \[pc, #0\] ; a144 <arm\+0xf4>
+ a140: e59f4000 ldr r4, \[pc, #0\] ; a148 <arm\+0xf8>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf2
+#------------------------------------------------------------------------------
+ a144: 00000080 \.word 0x00000080
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf2
+#------------------------------------------------------------------------------
+ a148: 00006f38 \.word 0x00006f38
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ a14c: ebfffbfe bl 914c <aaf1-0xeb4>
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ a150: eafffbfd b 914c <aaf1-0xeb4>
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ a154: 0afffbfc beq 914c <aaf1-0xeb4>
+ a158: e59f4000 ldr r4, \[pc, #0\] ; a160 <arm\+0x110>
+ a15c: e59f4000 ldr r4, \[pc, #0\] ; a164 <arm\+0x114>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of aaf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a160: 00000060 \.word 0x00000060
+#------------------------------------------------------------------------------
+#------ PC-relative offset of aaf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a164: 00006efc \.word 0x00006efc
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ a168: ebfffbe8 bl 9110 <aaf1-0xef0>
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ a16c: eafffbe7 b 9110 <aaf1-0xef0>
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ a170: 0afffbe6 beq 9110 <aaf1-0xef0>
+ a174: e59f4000 ldr r4, \[pc, #0\] ; a17c <arm\+0x12c>
+ a178: e59f4000 ldr r4, \[pc, #0\] ; a180 <arm\+0x130>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of taf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a17c: 00000050 \.word 0x00000050
+#------------------------------------------------------------------------------
+#------ PC-relative offset of taf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a180: 00006ed0 \.word 0x00006ed0
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a184: ebfffbd6 bl 90e4 <aaf1-0xf1c>
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a188: eafffbd5 b 90e4 <aaf1-0xf1c>
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a18c: 0afffbd4 beq 90e4 <aaf1-0xf1c>
+ a190: e59f4000 ldr r4, \[pc, #0\] ; a198 <arm\+0x148>
+ a194: e59f4000 ldr r4, \[pc, #0\] ; a19c <arm\+0x14c>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a198: 00000044 \.word 0x00000044
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a19c: 00006ea8 \.word 0x00006ea8
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a1a0: ebfffbd7 bl 9104 <aaf1-0xefc>
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a1a4: eafffbd6 b 9104 <aaf1-0xefc>
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a1a8: 0afffbd5 beq 9104 <aaf1-0xefc>
+ a1ac: e59f4000 ldr r4, \[pc, #0\] ; a1b4 <arm\+0x164>
+ a1b0: e59f4000 ldr r4, \[pc, #0\] ; a1b8 <arm\+0x168>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a1b4: 0000004c \.word 0x0000004c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a1b8: 00006e94 \.word 0x00006e94
+#------------------------------------------------------------------------------
+#------ aaf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1bc: ebfffbc0 bl 90c4 <aaf1-0xf3c>
+#------------------------------------------------------------------------------
+#------ aaf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1c0: eafffbbf b 90c4 <aaf1-0xf3c>
+#------------------------------------------------------------------------------
+#------ aaf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1c4: 0afffbbe beq 90c4 <aaf1-0xf3c>
+ a1c8: e59f4000 ldr r4, \[pc, #0\] ; a1d0 <arm\+0x180>
+ a1cc: e59f4000 ldr r4, \[pc, #0\] ; a1d4 <arm\+0x184>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf4
+#------------------------------------------------------------------------------
+ a1d0: 00000078 \.word 0x00000078
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf4
+#------------------------------------------------------------------------------
+ a1d4: 00006ea4 \.word 0x00006ea4
+#------------------------------------------------------------------------------
+#------ taf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1d8: ebfffbe2 bl 9168 <aaf1-0xe98>
+#------------------------------------------------------------------------------
+#------ taf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1dc: eafffbe1 b 9168 <aaf1-0xe98>
+#------------------------------------------------------------------------------
+#------ taf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1e0: 0afffbe0 beq 9168 <aaf1-0xe98>
+ a1e4: e59f4000 ldr r4, \[pc, #0\] ; a1ec <arm\+0x19c>
+ a1e8: e59f4000 ldr r4, \[pc, #0\] ; a1f0 <arm\+0x1a0>
+#------------------------------------------------------------------------------
+#------ .got offset for taf4
+#------------------------------------------------------------------------------
+ a1ec: 0000009c \.word 0x0000009c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf4
+#------------------------------------------------------------------------------
+ a1f0: 00006eac \.word 0x00006eac
+#------------------------------------------------------------------------------
+#------ abf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1f4: ebfffbc9 bl 9120 <aaf1-0xee0>
+#------------------------------------------------------------------------------
+#------ abf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1f8: eafffbc8 b 9120 <aaf1-0xee0>
+#------------------------------------------------------------------------------
+#------ abf4's .iplt entry
+#------------------------------------------------------------------------------
+ a1fc: 0afffbc7 beq 9120 <aaf1-0xee0>
+ a200: e59f4000 ldr r4, \[pc, #0\] ; a208 <arm\+0x1b8>
+ a204: e59f4000 ldr r4, \[pc, #0\] ; a20c <arm\+0x1bc>
+#------------------------------------------------------------------------------
+#------ .got offset for abf4
+#------------------------------------------------------------------------------
+ a208: 0000008c \.word 0x0000008c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf4
+#------------------------------------------------------------------------------
+ a20c: 00006e80 \.word 0x00006e80
+#------------------------------------------------------------------------------
+#------ tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ a210: ebfffbc6 bl 9130 <aaf1-0xed0>
+#------------------------------------------------------------------------------
+#------ tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ a214: eafffbc5 b 9130 <aaf1-0xed0>
+#------------------------------------------------------------------------------
+#------ tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ a218: 0afffbc4 beq 9130 <aaf1-0xed0>
+ a21c: e59f4000 ldr r4, \[pc, #0\] ; a224 <arm\+0x1d4>
+ a220: e59f4000 ldr r4, \[pc, #0\] ; a228 <arm\+0x1d8>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf4
+#------------------------------------------------------------------------------
+ a224: 00000090 \.word 0x00000090
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf4
+#------------------------------------------------------------------------------
+ a228: 00006e68 \.word 0x00006e68
+
+0000a22c <_thumb>:
+ a22c: f005 fee8 bl 10000 <foo>
+ a230: f005 bee6 b\.w 10000 <foo>
+ a234: f005 86e4 beq\.w 10000 <foo>
+ a238: 4c00 ldr r4, \[pc, #0\] ; \(a23c <_thumb\+0x10>\)
+ a23a: 4c01 ldr r4, \[pc, #4\] ; \(a240 <_thumb\+0x14>\)
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a23c: 00000070 \.word 0x00000070
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a240: 00006e2c \.word 0x00006e2c
+#------------------------------------------------------------------------------
+#------ atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a244: f7fe ef1a blx 907c <aaf1-0xf84>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a248: f7fe bf16 b\.w 9078 <aaf1-0xf88>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a24c: f43e af14 beq\.w 9078 <aaf1-0xf88>
+ a250: 4c00 ldr r4, \[pc, #0\] ; \(a254 <_thumb\+0x28>\)
+ a252: 4c01 ldr r4, \[pc, #4\] ; \(a258 <_thumb\+0x2c>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of atf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a254: 00000028 \.word 0x00000028
+#------------------------------------------------------------------------------
+#------ PC-relative offset of atf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a258: 00006dd0 \.word 0x00006dd0
+#------------------------------------------------------------------------------
+#------ ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a25c: f7fe ef24 blx 90a8 <aaf1-0xf58>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a260: f7fe bf20 b\.w 90a4 <aaf1-0xf5c>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a264: f43e af1e beq\.w 90a4 <aaf1-0xf5c>
+ a268: 4c00 ldr r4, \[pc, #0\] ; \(a26c <_thumb\+0x40>\)
+ a26a: 4c01 ldr r4, \[pc, #4\] ; \(a270 <_thumb\+0x44>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of ttf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a26c: 00000034 \.word 0x00000034
+#------------------------------------------------------------------------------
+#------ PC-relative offset of ttf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a270: 00006dc4 \.word 0x00006dc4
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a274: f7fe ef0a blx 908c <aaf1-0xf74>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a278: f7fe bf06 b\.w 9088 <aaf1-0xf78>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a27c: f43e af04 beq\.w 9088 <aaf1-0xf78>
+ a280: 4c00 ldr r4, \[pc, #0\] ; \(a284 <_thumb\+0x58>\)
+ a282: 4c01 ldr r4, \[pc, #4\] ; \(a288 <_thumb\+0x5c>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a284: 0000002c \.word 0x0000002c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a288: 00006da4 \.word 0x00006da4
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a28c: f7fe ef14 blx 90b8 <aaf1-0xf48>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a290: f7fe bf10 b\.w 90b4 <aaf1-0xf4c>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a294: f43e af0e beq\.w 90b4 <aaf1-0xf4c>
+ a298: 4c00 ldr r4, \[pc, #0\] ; \(a29c <_thumb\+0x70>\)
+ a29a: 4c01 ldr r4, \[pc, #4\] ; \(a2a0 <_thumb\+0x74>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a29c: 00000038 \.word 0x00000038
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a2a0: 00006d98 \.word 0x00006d98
+#------------------------------------------------------------------------------
+#------ atf2's .plt entry
+#------------------------------------------------------------------------------
+ a2a4: f7fe eeb8 blx 9018 <aaf1-0xfe8>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ a2a8: f7fe beb4 b\.w 9014 <aaf1-0xfec>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ a2ac: f43e aeb2 beq\.w 9014 <aaf1-0xfec>
+ a2b0: 4c00 ldr r4, \[pc, #0\] ; \(a2b4 <_thumb\+0x88>\)
+ a2b2: 4c01 ldr r4, \[pc, #4\] ; \(a2b8 <_thumb\+0x8c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf2
+#------------------------------------------------------------------------------
+ a2b4: 00000074 \.word 0x00000074
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf2
+#------------------------------------------------------------------------------
+ a2b8: 00006dbc \.word 0x00006dbc
+#------------------------------------------------------------------------------
+#------ ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a2bc: f7fe eeb4 blx 9028 <aaf1-0xfd8>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a2c0: f7fe beb0 b\.w 9024 <aaf1-0xfdc>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a2c4: f43e aeae beq\.w 9024 <aaf1-0xfdc>
+ a2c8: 4c00 ldr r4, \[pc, #0\] ; \(a2cc <_thumb\+0xa0>\)
+ a2ca: 4c01 ldr r4, \[pc, #4\] ; \(a2d0 <_thumb\+0xa4>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf2
+#------------------------------------------------------------------------------
+ a2cc: 0000007c \.word 0x0000007c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf2
+#------------------------------------------------------------------------------
+ a2d0: 00006dac \.word 0x00006dac
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2d4: f7fe eec4 blx 9060 <aaf1-0xfa0>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2d8: f7fe bec0 b\.w 905c <aaf1-0xfa4>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2dc: f43e aebe beq\.w 905c <aaf1-0xfa4>
+ a2e0: 4c00 ldr r4, \[pc, #0\] ; \(a2e4 <_thumb\+0xb8>\)
+ a2e2: 4c01 ldr r4, \[pc, #4\] ; \(a2e8 <_thumb\+0xbc>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf2
+#------------------------------------------------------------------------------
+ a2e4: 000000a0 \.word 0x000000a0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf2
+#------------------------------------------------------------------------------
+ a2e8: 00006db8 \.word 0x00006db8
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2ec: f7fe eea4 blx 9038 <aaf1-0xfc8>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2f0: f7fe bea0 b\.w 9034 <aaf1-0xfcc>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2f4: f43e ae9e beq\.w 9034 <aaf1-0xfcc>
+ a2f8: 4c00 ldr r4, \[pc, #0\] ; \(a2fc <_thumb\+0xd0>\)
+ a2fa: 4c01 ldr r4, \[pc, #4\] ; \(a300 <_thumb\+0xd4>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf2
+#------------------------------------------------------------------------------
+ a2fc: 00000080 \.word 0x00000080
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf2
+#------------------------------------------------------------------------------
+ a300: 00006d80 \.word 0x00006d80
+#------------------------------------------------------------------------------
+#------ atf3's .iplt entry
+#------------------------------------------------------------------------------
+ a304: f7fe eee6 blx 90d4 <aaf1-0xf2c>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3's .iplt entry
+#------------------------------------------------------------------------------
+ a308: f7fe bee2 b\.w 90d0 <aaf1-0xf30>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3's .iplt entry
+#------------------------------------------------------------------------------
+ a30c: f43e aee0 beq\.w 90d0 <aaf1-0xf30>
+ a310: 4c00 ldr r4, \[pc, #0\] ; \(a314 <_thumb\+0xe8>\)
+ a312: 4c01 ldr r4, \[pc, #4\] ; \(a318 <_thumb\+0xec>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of atf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a314: 00000040 \.word 0x00000040
+#------------------------------------------------------------------------------
+#------ PC-relative offset of atf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a318: 00006d28 \.word 0x00006d28
+#------------------------------------------------------------------------------
+#------ ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ a31c: f7fe eeea blx 90f4 <aaf1-0xf0c>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ a320: f7fe bee6 b\.w 90f0 <aaf1-0xf10>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ a324: f43e aee4 beq\.w 90f0 <aaf1-0xf10>
+ a328: 4c00 ldr r4, \[pc, #0\] ; \(a32c <_thumb\+0x100>\)
+ a32a: 4c01 ldr r4, \[pc, #4\] ; \(a330 <_thumb\+0x104>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of ttf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a32c: 00000048 \.word 0x00000048
+#------------------------------------------------------------------------------
+#------ PC-relative offset of ttf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a330: 00006d18 \.word 0x00006d18
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a334: f7fe eed6 blx 90e4 <aaf1-0xf1c>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a338: f7fe bed2 b\.w 90e0 <aaf1-0xf20>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a33c: f43e aed0 beq\.w 90e0 <aaf1-0xf20>
+ a340: 4c00 ldr r4, \[pc, #0\] ; \(a344 <_thumb\+0x118>\)
+ a342: 4c01 ldr r4, \[pc, #4\] ; \(a348 <_thumb\+0x11c>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a344: 00000044 \.word 0x00000044
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a348: 00006cfc \.word 0x00006cfc
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a34c: f7fe eeda blx 9104 <aaf1-0xefc>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a350: f7fe bed6 b\.w 9100 <aaf1-0xf00>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a354: f43e aed4 beq\.w 9100 <aaf1-0xf00>
+ a358: 4c00 ldr r4, \[pc, #0\] ; \(a35c <_thumb\+0x130>\)
+ a35a: 4c01 ldr r4, \[pc, #4\] ; \(a360 <_thumb\+0x134>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a35c: 0000004c \.word 0x0000004c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a360: 00006cec \.word 0x00006cec
+#------------------------------------------------------------------------------
+#------ atf4's .iplt entry
+#------------------------------------------------------------------------------
+ a364: f7fe eefa blx 915c <aaf1-0xea4>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .iplt entry
+#------------------------------------------------------------------------------
+ a368: f7fe bef6 b\.w 9158 <aaf1-0xea8>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .iplt entry
+#------------------------------------------------------------------------------
+ a36c: f43e aef4 beq\.w 9158 <aaf1-0xea8>
+ a370: 4c00 ldr r4, \[pc, #0\] ; \(a374 <_thumb\+0x148>\)
+ a372: 4c01 ldr r4, \[pc, #4\] ; \(a378 <_thumb\+0x14c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf4
+#------------------------------------------------------------------------------
+ a374: 00000098 \.word 0x00000098
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf4
+#------------------------------------------------------------------------------
+ a378: 00006d20 \.word 0x00006d20
+#------------------------------------------------------------------------------
+#------ ttf4's .iplt entry
+#------------------------------------------------------------------------------
+ a37c: f7fe eee0 blx 9140 <aaf1-0xec0>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .iplt entry
+#------------------------------------------------------------------------------
+ a380: f7fe bedc b\.w 913c <aaf1-0xec4>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .iplt entry
+#------------------------------------------------------------------------------
+ a384: f43e aeda beq\.w 913c <aaf1-0xec4>
+ a388: 4c00 ldr r4, \[pc, #0\] ; \(a38c <_thumb\+0x160>\)
+ a38a: 4c01 ldr r4, \[pc, #4\] ; \(a390 <_thumb\+0x164>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf4
+#------------------------------------------------------------------------------
+ a38c: 00000094 \.word 0x00000094
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf4
+#------------------------------------------------------------------------------
+ a390: 00006d04 \.word 0x00006d04
+#------------------------------------------------------------------------------
+#------ abf4's .iplt entry
+#------------------------------------------------------------------------------
+ a394: f7fe eec4 blx 9120 <aaf1-0xee0>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .iplt entry
+#------------------------------------------------------------------------------
+ a398: f7fe bec0 b\.w 911c <aaf1-0xee4>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .iplt entry
+#------------------------------------------------------------------------------
+ a39c: f43e aebe beq\.w 911c <aaf1-0xee4>
+ a3a0: 4c00 ldr r4, \[pc, #0\] ; \(a3a4 <_thumb\+0x178>\)
+ a3a2: 4c01 ldr r4, \[pc, #4\] ; \(a3a8 <_thumb\+0x17c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf4
+#------------------------------------------------------------------------------
+ a3a4: 0000008c \.word 0x0000008c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf4
+#------------------------------------------------------------------------------
+ a3a8: 00006ce4 \.word 0x00006ce4
+#------------------------------------------------------------------------------
+#------ tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ a3ac: f7fe eec0 blx 9130 <aaf1-0xed0>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ a3b0: f7fe bebc b\.w 912c <aaf1-0xed4>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ a3b4: f43e aeba beq\.w 912c <aaf1-0xed4>
+ a3b8: 4c00 ldr r4, \[pc, #0\] ; \(a3bc <_thumb\+0x190>\)
+ a3ba: 4c01 ldr r4, \[pc, #4\] ; \(a3c0 <_thumb\+0x194>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf4
+#------------------------------------------------------------------------------
+ a3bc: 00000090 \.word 0x00000090
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf4
+#------------------------------------------------------------------------------
+ a3c0: 00006cd0 \.word 0x00006cd0
diff --git a/ld/testsuite/ld-arm/ifunc-4.gd b/ld/testsuite/ld-arm/ifunc-4.gd
new file mode 100644
index 0000000..f768c68
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-4.gd
@@ -0,0 +1,167 @@
+
+.*
+
+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 6490ffff 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 6c90ffff 08a00000 7490ffff 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 7890ffff 0fa00000 8090ffff 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 8890ffff 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 28a00000 e490ffff 2ca00000 .*
+#------------------------------------------------------------------------------
+#------ 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 6490ffff 30a00000 6c90ffff 35a00000 .*
+#------------------------------------------------------------------------------
+#------ 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 9090ffff 37a00000 6c90ffff 39a00000 .*
+#------------------------------------------------------------------------------
+#------ 00010090: contains PC-relative offset of tbf3's .iplt entry
+#------ 00010094: aaf4 [R_ARM_ABS32]
+#------ 00010098: contains PC-relative offset of aaf4's .iplt entry
+#------ 0001009c: atf4 [R_ARM_ABS32]
+#------------------------------------------------------------------------------
+ 10090 7490ffff 00000000 2c90ffff 00000000 .*
+#------------------------------------------------------------------------------
+#------ 000100a0: contains PC-relative offset of atf4's .iplt entry
+#------ 000100a4: abf4 [R_ARM_ABS32]
+#------ 000100a8: contains PC-relative offset of abf4's .iplt entry
+#------ 000100ac: taf4 [R_ARM_ABS32]
+#------------------------------------------------------------------------------
+ 100a0 bc90ffff 00000000 7890ffff 00000000 .*
+#------------------------------------------------------------------------------
+#------ 000100b0: contains PC-relative offset of taf4's .iplt entry
+#------ 000100b4: ttf4 [R_ARM_ABS32]
+#------ 000100b8: contains PC-relative offset of ttf4's .iplt entry
+#------ 000100bc: tbf4 [R_ARM_ABS32]
+#------------------------------------------------------------------------------
+ 100b0 b890ffff 00000000 8890ffff 00000000 .*
+#------------------------------------------------------------------------------
+#------ 000100c0: contains PC-relative offset of tbf4's .iplt entry
+#------------------------------------------------------------------------------
+ 100c0 7090ffff .*
+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: ttf2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------ 00011014: tbf2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------ 00011018: taf2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------ 0001101c: aaf2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------------------------------------------------------------------------------
+ 11010 00900000 00900000 00900000 00900000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: abf2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------ 00011024: aaf1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011028: atf1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001102c: abf1's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11020 00900000 00a00000 04a00000 08a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011030: taf1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011034: ttf1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011038: tbf1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001103c: aaf4's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11030 0da00000 0fa00000 11a00000 3ca00000 .*
+#------------------------------------------------------------------------------
+#------ 00011040: atf3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011044: abf3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011048: ttf3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001104c: tbf3's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11040 2ca00000 30a00000 37a00000 39a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011050: taf3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011054: abf4's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011058: tbf4's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001105c: ttf4's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11050 35a00000 44a00000 4da00000 4ba00000 .*
+#------------------------------------------------------------------------------
+#------ 00011060: aaf3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011064: atf4's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011068: taf4's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001106c: .got entry for foo [R_ARM_RELATIVE]
+#------------------------------------------------------------------------------
+ 11060 28a00000 40a00000 49a00000 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 .*
diff --git a/ld/testsuite/ld-arm/ifunc-4.rd b/ld/testsuite/ld-arm/ifunc-4.rd
new file mode 100644
index 0000000..b8079d5
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-4.rd
@@ -0,0 +1,74 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 62 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001106c ......17 R_ARM_RELATIVE
+00011070 ......17 R_ARM_RELATIVE
+00010004 ......a0 R_ARM_IRELATIVE
+0001000c ......a0 R_ARM_IRELATIVE
+00010014 ......a0 R_ARM_IRELATIVE
+0001001c ......a0 R_ARM_IRELATIVE
+00010024 ......a0 R_ARM_IRELATIVE
+0001002c ......a0 R_ARM_IRELATIVE
+00010064 ......a0 R_ARM_IRELATIVE
+0001006c ......a0 R_ARM_IRELATIVE
+00010074 ......a0 R_ARM_IRELATIVE
+0001007c ......a0 R_ARM_IRELATIVE
+00010084 ......a0 R_ARM_IRELATIVE
+0001008c ......a0 R_ARM_IRELATIVE
+00011024 ......a0 R_ARM_IRELATIVE
+00011028 ......a0 R_ARM_IRELATIVE
+0001102c ......a0 R_ARM_IRELATIVE
+00011030 ......a0 R_ARM_IRELATIVE
+00011034 ......a0 R_ARM_IRELATIVE
+00011038 ......a0 R_ARM_IRELATIVE
+0001103c ......a0 R_ARM_IRELATIVE
+00011040 ......a0 R_ARM_IRELATIVE
+00011044 ......a0 R_ARM_IRELATIVE
+00011048 ......a0 R_ARM_IRELATIVE
+0001104c ......a0 R_ARM_IRELATIVE
+00011050 ......a0 R_ARM_IRELATIVE
+00011054 ......a0 R_ARM_IRELATIVE
+00011058 ......a0 R_ARM_IRELATIVE
+0001105c ......a0 R_ARM_IRELATIVE
+00011060 ......a0 R_ARM_IRELATIVE
+00011064 ......a0 R_ARM_IRELATIVE
+00011068 ......a0 R_ARM_IRELATIVE
+00010034 ......02 R_ARM_ABS32 aaf2\(\) aaf2
+00010038 ......03 R_ARM_REL32 aaf2\(\) aaf2
+00011088 ......15 R_ARM_GLOB_DAT aaf2\(\) aaf2
+0001003c ......02 R_ARM_ABS32 atf2\(\) atf2
+00010040 ......03 R_ARM_REL32 atf2\(\) atf2
+00011074 ......15 R_ARM_GLOB_DAT atf2\(\) atf2
+00010044 ......02 R_ARM_ABS32 abf2\(\) abf2
+00010048 ......03 R_ARM_REL32 abf2\(\) abf2
+000110a0 ......15 R_ARM_GLOB_DAT abf2\(\) abf2
+0001004c ......02 R_ARM_ABS32 taf2\(\) taf2
+00010050 ......03 R_ARM_REL32 taf2\(\) taf2
+00011084 ......15 R_ARM_GLOB_DAT taf2\(\) taf2
+00010054 ......02 R_ARM_ABS32 ttf2\(\) ttf2
+00010058 ......03 R_ARM_REL32 ttf2\(\) ttf2
+0001107c ......15 R_ARM_GLOB_DAT ttf2\(\) ttf2
+0001005c ......02 R_ARM_ABS32 tbf2\(\) tbf2
+00010060 ......03 R_ARM_REL32 tbf2\(\) tbf2
+00011080 ......15 R_ARM_GLOB_DAT tbf2\(\) tbf2
+00010094 ......02 R_ARM_ABS32 aaf4\(\) aaf4
+00011078 ......15 R_ARM_GLOB_DAT aaf4\(\) aaf4
+0001009c ......02 R_ARM_ABS32 atf4\(\) atf4
+00011098 ......15 R_ARM_GLOB_DAT atf4\(\) atf4
+000100a4 ......02 R_ARM_ABS32 abf4\(\) abf4
+0001108c ......15 R_ARM_GLOB_DAT abf4\(\) abf4
+000100ac ......02 R_ARM_ABS32 taf4\(\) taf4
+0001109c ......15 R_ARM_GLOB_DAT taf4\(\) taf4
+000100b4 ......02 R_ARM_ABS32 ttf4\(\) ttf4
+00011094 ......15 R_ARM_GLOB_DAT ttf4\(\) ttf4
+000100bc ......02 R_ARM_ABS32 tbf4\(\) tbf4
+00011090 ......15 R_ARM_GLOB_DAT tbf4\(\) tbf4
+
+Relocation section '\.rel\.plt' at offset 0x81f0 contains 6 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT atf2\(\) atf2
+00011010 ......16 R_ARM_JUMP_SLOT ttf2\(\) ttf2
+00011014 ......16 R_ARM_JUMP_SLOT tbf2\(\) tbf2
+00011018 ......16 R_ARM_JUMP_SLOT taf2\(\) taf2
+0001101c ......16 R_ARM_JUMP_SLOT aaf2\(\) aaf2
+00011020 ......16 R_ARM_JUMP_SLOT abf2\(\) abf2
diff --git a/ld/testsuite/ld-arm/ifunc-4.s b/ld/testsuite/ld-arm/ifunc-4.s
new file mode 100644
index 0000000..7f72c8c
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-4.s
@@ -0,0 +1,95 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro define2,name
+ define aa\name,.arm
+ define at\name,.arm
+ define ab\name,.arm
+ define ta\name,.thumb_func
+ define tt\name,.thumb_func
+ define tb\name,.thumb_func
+ .endm
+
+ .macro test_relocs,name,width
+ bl \name(PLT)
+ b\width \name
+ beq\width \name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .macro test_relocs2,name,type,width
+ test_relocs a\type\name,\width
+ test_relocs t\type\name,\width
+ test_relocs ab\name,\width
+ test_relocs tb\name,\width
+ .endm
+
+ .macro diff,name
+ .word \name
+ .word \name-.
+ .endm
+
+ .macro alldirs,doit,name
+ \doit aa\name
+ \doit at\name
+ \doit ab\name
+ \doit ta\name
+ \doit tt\name
+ \doit tb\name
+ .endm
+
+ define2 f1
+ define2 f2
+ define2 f3
+ define2 f4
+
+ alldirs .globl,f2
+
+ alldirs .globl,f3
+ alldirs .hidden,f3
+
+ alldirs .globl,f4
+ alldirs .protected,f4
+
+ .globl arm
+ .type arm,%function
+ .arm
+arm:
+ test_relocs foo
+ test_relocs2 f1,a,
+ test_relocs2 f2,a,
+ test_relocs2 f3,a,
+ test_relocs2 f4,a,
+ .size arm,.-arm
+
+ .globl _thumb
+ .type _thumb,%function
+ .thumb_func
+_thumb:
+ test_relocs foo
+ test_relocs2 f1,t,.w
+ test_relocs2 f2,t,.w
+ test_relocs2 f3,t,.w
+ test_relocs2 f4,t,.w
+ .size _thumb,.-_thumb
+
+ .data
+foo:
+ .word 0x11223344
+ alldirs diff,f1
+ alldirs diff,f2
+ alldirs diff,f3
+ alldirs diff,f4
diff --git a/ld/testsuite/ld-arm/ifunc-5.dd b/ld/testsuite/ld-arm/ifunc-5.dd
new file mode 100644
index 0000000..90d7b21
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-5.dd
@@ -0,0 +1,91 @@
+
+.*
+
+
+Disassembly of section \.iplt:
+
+00009000 <\.iplt>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 9000: e28fc600 add ip, pc, #0
+ 9004: e28cca08 add ip, ip, #32768 ; 0x8000
+ 9008: e5bcf004 ldr pc, \[ip, #4\]!
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ 900c: e28fc600 add ip, pc, #0
+ 9010: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9014: e5bcfffc ldr pc, \[ip, #4092\]! ; 0xffc
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ 9018: e28fc600 add ip, pc, #0
+ 901c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9020: e5bcfff4 ldr pc, \[ip, #4084\]! ; 0xff4
+
+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 <_start>:
+ a00c: eb0017fb bl 10000 <foo>
+ a010: e59f4000 ldr r4, \[pc, #0\] ; a018 <_start\+0xc>
+ a014: e59f4000 ldr r4, \[pc, #0\] ; a01c <_start\+0x10>
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a018: 0000001c \.word 0x0000001c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a01c: 00006ffc \.word 0x00006ffc
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a020: ebfffbf6 bl 9000 <__irel_end\+0xfe8>
+ a024: e59f4000 ldr r4, \[pc, #0\] ; a02c <_start\+0x20>
+ a028: e59f4000 ldr r4, \[pc, #0\] ; a030 <_start\+0x24>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a02c: 0000000c \.word 0x0000000c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a030: 00006fdc \.word 0x00006fdc
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a034: ebfffbf7 bl 9018 <__irel_end\+0x1000>
+ a038: e59f4000 ldr r4, \[pc, #0\] ; a040 <_start\+0x34>
+ a03c: e59f4000 ldr r4, \[pc, #0\] ; a044 <_start\+0x38>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f2's .igot.plt entry
+#------------------------------------------------------------------------------
+ a040: 00000014 \.word 0x00000014
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f2's .igot.plt entry
+#------------------------------------------------------------------------------
+ a044: 00006fd0 \.word 0x00006fd0
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ a048: ebfffbef bl 900c <__irel_end\+0xff4>
+ a04c: e59f4000 ldr r4, \[pc, #0\] ; a054 <_start\+0x48>
+ a050: e59f4000 ldr r4, \[pc, #0\] ; a058 <_start\+0x4c>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a054: 00000010 \.word 0x00000010
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a058: 00006fb8 \.word 0x00006fb8
diff --git a/ld/testsuite/ld-arm/ifunc-5.gd b/ld/testsuite/ld-arm/ifunc-5.gd
new file mode 100644
index 0000000..8cd69df
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-5.gd
@@ -0,0 +1,23 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 00800000 18800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11000 00000000 00000000 00000000 00a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011014: f2's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011018: .got entry for foo
+#------ 0001101c: .got entry for foo
+#------------------------------------------------------------------------------
+ 11010 08a00000 04a00000 00000100 00000100 .*
diff --git a/ld/testsuite/ld-arm/ifunc-5.rd b/ld/testsuite/ld-arm/ifunc-5.rd
new file mode 100644
index 0000000..75e6d70
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-5.rd
@@ -0,0 +1,8 @@
+
+There is no dynamic section in this file\.
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 3 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......a0 R_ARM_IRELATIVE
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
diff --git a/ld/testsuite/ld-arm/ifunc-5.s b/ld/testsuite/ld-arm/ifunc-5.s
new file mode 100644
index 0000000..9074c92
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-5.s
@@ -0,0 +1,39 @@
+ .macro define,name
+ .type \name,%gnu_indirect_function
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ bl \name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .global f2
+
+ .global f3
+ .hidden f3
+
+ define f1
+ define f2
+ define f3
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-6.dd b/ld/testsuite/ld-arm/ifunc-6.dd
new file mode 100644
index 0000000..6715dce
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-6.dd
@@ -0,0 +1,175 @@
+
+.*
+
+
+Disassembly of section \.iplt:
+
+00009000 <\.iplt>:
+#------------------------------------------------------------------------------
+#------ thumb entry to f3's .iplt entry
+#------------------------------------------------------------------------------
+ 9000: 4778 bx pc
+ 9002: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ 9004: e28fc600 add ip, pc, #0
+ 9008: e28cca08 add ip, ip, #32768 ; 0x8000
+ 900c: e5bcf000 ldr pc, \[ip\]!
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ 9010: e28fc600 add ip, pc, #0
+ 9014: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9018: e5bcfff8 ldr pc, \[ip, #4088\]! ; 0xff8
+#------------------------------------------------------------------------------
+#------ thumb entry to f4's .iplt entry
+#------------------------------------------------------------------------------
+ 901c: 4778 bx pc
+ 901e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ f4's .iplt entry
+#------------------------------------------------------------------------------
+ 9020: e28fc600 add ip, pc, #0
+ 9024: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9028: e5bcffec ldr pc, \[ip, #4076\]! ; 0xfec
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 902c: e28fc600 add ip, pc, #0
+ 9030: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9034: e5bcffe4 ldr pc, \[ip, #4068\]! ; 0xfe4
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+
+0000a004 <f2>:
+ a004: 46f7 mov pc, lr
+ \.\.\.
+
+0000a008 <f3>:
+ a008: e1a0f00e mov pc, lr
+
+0000a00c <f4>:
+ a00c: 46f7 mov pc, lr
+ \.\.\.
+
+0000a010 <_start>:
+ a010: eb0017fa bl 10000 <foo>
+ a014: ea0017f9 b 10000 <foo>
+ a018: 0a0017f8 beq 10000 <foo>
+ a01c: e59f4000 ldr r4, \[pc, #0\] ; a024 <_start\+0x14>
+ a020: e59f4000 ldr r4, \[pc, #0\] ; a028 <_start\+0x18>
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a024: 00000020 \.word 0x00000020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a028: 00006ff4 \.word 0x00006ff4
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a02c: ebfffbfe bl 902c <__irel_end\+0x100c>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a030: eafffbfd b 902c <__irel_end\+0x100c>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a034: 0afffbfc beq 902c <__irel_end\+0x100c>
+ a038: e59f4000 ldr r4, \[pc, #0\] ; a040 <_start\+0x30>
+ a03c: e59f4000 ldr r4, \[pc, #0\] ; a044 <_start\+0x34>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a040: 00000018 \.word 0x00000018
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a044: 00006fd4 \.word 0x00006fd4
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a048: ebfffbf0 bl 9010 <__irel_end\+0xff0>
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a04c: eafffbef b 9010 <__irel_end\+0xff0>
+#------------------------------------------------------------------------------
+#------ f2's .iplt entry
+#------------------------------------------------------------------------------
+ a050: 0afffbee beq 9010 <__irel_end\+0xff0>
+ a054: e59f4000 ldr r4, \[pc, #0\] ; a05c <_start\+0x4c>
+ a058: e59f4000 ldr r4, \[pc, #0\] ; a060 <_start\+0x50>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f2's .igot.plt entry
+#------------------------------------------------------------------------------
+ a05c: 00000010 \.word 0x00000010
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f2's .igot.plt entry
+#------------------------------------------------------------------------------
+ a060: 00006fb0 \.word 0x00006fb0
+
+0000a064 <_thumb>:
+ a064: f005 ffcc bl 10000 <foo>
+ a068: f005 bfca b\.w 10000 <foo>
+ a06c: f005 87c8 beq\.w 10000 <foo>
+ a070: 4c00 ldr r4, \[pc, #0\] ; \(a074 <_thumb\+0x10>\)
+ a072: 4c01 ldr r4, \[pc, #4\] ; \(a078 <_thumb\+0x14>\)
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a074: 00000020 \.word 0x00000020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a078: 00006fa4 \.word 0x00006fa4
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ a07c: f7fe efc2 blx 9004 <__irel_end\+0xfe4>
+#------------------------------------------------------------------------------
+#------ thumb entry to f3's .iplt entry
+#------------------------------------------------------------------------------
+ a080: f7fe bfbe b\.w 9000 <__irel_end\+0xfe0>
+#------------------------------------------------------------------------------
+#------ thumb entry to f3's .iplt entry
+#------------------------------------------------------------------------------
+ a084: f43e afbc beq\.w 9000 <__irel_end\+0xfe0>
+ a088: 4c00 ldr r4, \[pc, #0\] ; \(a08c <_thumb\+0x28>\)
+ a08a: 4c01 ldr r4, \[pc, #4\] ; \(a090 <_thumb\+0x2c>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a08c: 0000000c \.word 0x0000000c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a090: 00006f7c \.word 0x00006f7c
+#------------------------------------------------------------------------------
+#------ f4's .iplt entry
+#------------------------------------------------------------------------------
+ a094: f7fe efc4 blx 9020 <__irel_end\+0x1000>
+#------------------------------------------------------------------------------
+#------ thumb entry to f4's .iplt entry
+#------------------------------------------------------------------------------
+ a098: f7fe bfc0 b\.w 901c <__irel_end\+0xffc>
+#------------------------------------------------------------------------------
+#------ thumb entry to f4's .iplt entry
+#------------------------------------------------------------------------------
+ a09c: f43e afbe beq\.w 901c <__irel_end\+0xffc>
+ a0a0: 4c00 ldr r4, \[pc, #0\] ; \(a0a4 <_thumb\+0x40>\)
+ a0a2: 4c01 ldr r4, \[pc, #4\] ; \(a0a8 <_thumb\+0x44>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f4's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0a4: 00000014 \.word 0x00000014
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f4's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0a8: 00006f6c \.word 0x00006f6c
diff --git a/ld/testsuite/ld-arm/ifunc-6.gd b/ld/testsuite/ld-arm/ifunc-6.gd
new file mode 100644
index 0000000..45fd914
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-6.gd
@@ -0,0 +1,27 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 00800000 20800000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f3's .igot.plt entry [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 11000 00000000 00000000 00000000 08a00000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f2's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011014: f4's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011018: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001101c: .got entry for foo
+#------------------------------------------------------------------------------
+ 11010 05a00000 0da00000 00a00000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for foo
+#------------------------------------------------------------------------------
+ 11020 00000100 .*
diff --git a/ld/testsuite/ld-arm/ifunc-6.rd b/ld/testsuite/ld-arm/ifunc-6.rd
new file mode 100644
index 0000000..0fbfec5
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-6.rd
@@ -0,0 +1,9 @@
+
+There is no dynamic section in this file\.
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 4 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......a0 R_ARM_IRELATIVE
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011018 ......a0 R_ARM_IRELATIVE
diff --git a/ld/testsuite/ld-arm/ifunc-6.s b/ld/testsuite/ld-arm/ifunc-6.s
new file mode 100644
index 0000000..4596fa3
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-6.s
@@ -0,0 +1,59 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name,width
+ bl\width \name
+ b\width \name
+ beq\width \name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .global f1
+ .global f2
+
+ .global f3
+ .global f4
+ .hidden f3
+ .hidden f4
+
+ define f1,.arm
+ define f2,.thumb_func
+ define f3,.arm
+ define f4,.thumb_func
+
+ .globl _start
+ .type _start,%function
+ .arm
+_start:
+ test_relocs foo
+ test_relocs f1,
+ test_relocs f2,
+ .size _start,.-_start
+
+ .globl _thumb
+ .type _thumb,%function
+ .thumb_func
+_thumb:
+ test_relocs foo
+ test_relocs f3,.w
+ test_relocs f4,.w
+ .size _thumb,.-_thumb
+
+ .data
+foo:
+ .word 0x11223344
+ .word __irel_start
+ .word __irel_end
diff --git a/ld/testsuite/ld-arm/ifunc-7.dd b/ld/testsuite/ld-arm/ifunc-7.dd
new file mode 100644
index 0000000..c64e748
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-7.dd
@@ -0,0 +1,120 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <f1-0xff0>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ 9014: e28fc600 add ip, pc, #0
+ 9018: e28cca07 add ip, ip, #28672 ; 0x7000
+ 901c: e5bcfff0 ldr pc, \[ip, #4080\]! ; 0xff0
+#------------------------------------------------------------------------------
+#------ f4's .plt entry
+#------------------------------------------------------------------------------
+ 9020: e28fc600 add ip, pc, #0
+ 9024: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9028: e5bcffe8 ldr pc, \[ip, #4072\]! ; 0xfe8
+
+Disassembly of section \.iplt:
+
+0000902c <\.iplt>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 902c: e28fc600 add ip, pc, #0
+ 9030: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9034: e5bcffe0 ldr pc, \[ip, #4064\]! ; 0xfe0
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ 9038: e28fc600 add ip, pc, #0
+ 903c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9040: e5bcffd8 ldr pc, \[ip, #4056\]! ; 0xfd8
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+
+0000a004 <f3>:
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <arm>:
+ a008: eb0017fc bl 10000 <foo>
+ a00c: e59f4000 ldr r4, \[pc, #0\] ; a014 <arm\+0xc>
+ a010: e59f4000 ldr r4, \[pc, #0\] ; a018 <arm\+0x10>
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a014: 00000020 \.word 0x00000020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a018: 00007004 \.word 0x00007004
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a01c: ebfffc02 bl 902c <f1-0xfd4>
+ a020: e59f4000 ldr r4, \[pc, #0\] ; a028 <arm\+0x20>
+ a024: e59f4000 ldr r4, \[pc, #0\] ; a02c <arm\+0x24>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a028: 00000014 \.word 0x00000014
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a02c: 00006fe8 \.word 0x00006fe8
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ a030: ebfffbf7 bl 9014 <f1-0xfec>
+ a034: e59f4000 ldr r4, \[pc, #0\] ; a03c <arm\+0x34>
+ a038: e59f4000 ldr r4, \[pc, #0\] ; a040 <arm\+0x38>
+#------------------------------------------------------------------------------
+#------ .got offset for f2
+#------------------------------------------------------------------------------
+ a03c: 00000024 \.word 0x00000024
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f2
+#------------------------------------------------------------------------------
+ a040: 00006fe4 \.word 0x00006fe4
+#------------------------------------------------------------------------------
+#------ f3's .iplt entry
+#------------------------------------------------------------------------------
+ a044: ebfffbfb bl 9038 <f1-0xfc8>
+ a048: e59f4000 ldr r4, \[pc, #0\] ; a050 <arm\+0x48>
+ a04c: e59f4000 ldr r4, \[pc, #0\] ; a054 <arm\+0x4c>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a050: 00000018 \.word 0x00000018
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a054: 00006fc4 \.word 0x00006fc4
+#------------------------------------------------------------------------------
+#------ f4's .plt entry
+#------------------------------------------------------------------------------
+ a058: ebfffbf0 bl 9020 <f1-0xfe0>
+ a05c: e59f4000 ldr r4, \[pc, #0\] ; a064 <arm\+0x5c>
+ a060: e59f4000 ldr r4, \[pc, #0\] ; a068 <arm\+0x60>
+#------------------------------------------------------------------------------
+#------ .got offset for f4
+#------------------------------------------------------------------------------
+ a064: 00000028 \.word 0x00000028
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f4
+#------------------------------------------------------------------------------
+ a068: 00006fc0 \.word 0x00006fc0
diff --git a/ld/testsuite/ld-arm/ifunc-7.gd b/ld/testsuite/ld-arm/ifunc-7.gd
new file mode 100644
index 0000000..a116aaf
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-7.gd
@@ -0,0 +1,45 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------ 00010004: contains foo [R_ARM_RELATIVE]
+#------ 00010008: contains PC-relative offset of foo
+#------ 0001000c: contains f1 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 10000 44332211 00000100 f8ffffff 00a00000 .*
+#------------------------------------------------------------------------------
+#------ 00010010: contains PC-relative offset of f1's .iplt entry
+#------ 00010014: f2 [R_ARM_ABS32]
+#------ 00010018: f2 [R_ARM_REL32]
+#------ 0001001c: contains f3 [R_ARM_IRELATIVE]
+#------------------------------------------------------------------------------
+ 10010 1c90ffff 00000000 00000000 04a00000 .*
+#------------------------------------------------------------------------------
+#------ 00010020: contains PC-relative offset of f3's .iplt entry
+#------ 00010024: f4 [R_ARM_ABS32]
+#------ 00010028: f4 [R_ARM_REL32]
+#------------------------------------------------------------------------------
+ 10020 1890ffff 00000000 00000000 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00900000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f4's .got.plt entry [R_ARM_JUMP_SLOT]
+#------ 00011014: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011018: f3's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 0001101c: .got entry for foo [R_ARM_RELATIVE]
+#------------------------------------------------------------------------------
+ 11010 00900000 00a00000 04a00000 00000100 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for foo [R_ARM_RELATIVE]
+#------ 00011024: .got entry for f2 [R_ARM_GLOB_DAT]
+#------ 00011028: .got entry for f4 [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 11020 00000100 00000000 00000000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-7.rd b/ld/testsuite/ld-arm/ifunc-7.rd
new file mode 100644
index 0000000..a29b184
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-7.rd
@@ -0,0 +1,21 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 13 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00010004 ......17 R_ARM_RELATIVE
+0001101c ......17 R_ARM_RELATIVE
+00011020 ......17 R_ARM_RELATIVE
+0001000c ......a0 R_ARM_IRELATIVE
+0001001c ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011018 ......a0 R_ARM_IRELATIVE
+00010014 ......02 R_ARM_ABS32 00000000 f2
+00010018 ......03 R_ARM_REL32 00000000 f2
+00011024 ......15 R_ARM_GLOB_DAT 00000000 f2
+00010024 ......02 R_ARM_ABS32 00000000 f4
+00010028 ......03 R_ARM_REL32 00000000 f4
+00011028 ......15 R_ARM_GLOB_DAT 00000000 f4
+
+Relocation section '\.rel\.plt' at offset 0x8068 contains 2 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT 00000000 f2
+00011010 ......16 R_ARM_JUMP_SLOT 00000000 f4
diff --git a/ld/testsuite/ld-arm/ifunc-7.s b/ld/testsuite/ld-arm/ifunc-7.s
new file mode 100644
index 0000000..85ffb68
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-7.s
@@ -0,0 +1,42 @@
+ .macro define,name
+ .text
+ .type \name,%gnu_indirect_function
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ bl \name(PLT)
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+
+ .data
+ .word \name
+ .word \name - .
+ .text
+ .endm
+
+ .globl f3
+ .hidden f3
+
+ define f1
+ define f3
+
+ .data
+foo:
+ .word 0x11223344
+
+ .text
+ .globl arm
+arm:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ test_relocs f4
+ .size arm,.-arm
diff --git a/ld/testsuite/ld-arm/ifunc-8.dd b/ld/testsuite/ld-arm/ifunc-8.dd
new file mode 100644
index 0000000..67978bb
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-8.dd
@@ -0,0 +1,1017 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <aaf1-0xff0>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ 9014: 4778 bx pc
+ 9016: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf2's .plt entry
+#------------------------------------------------------------------------------
+ 9018: e28fc600 add ip, pc, #0
+ 901c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9020: e5bcffec ldr pc, \[ip, #4076\]! ; 0xfec
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ 9024: e28fc600 add ip, pc, #0
+ 9028: e28cca07 add ip, ip, #28672 ; 0x7000
+ 902c: e5bcffe4 ldr pc, \[ip, #4068\]! ; 0xfe4
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ 9030: 4778 bx pc
+ 9032: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf2's .plt entry
+#------------------------------------------------------------------------------
+ 9034: e28fc600 add ip, pc, #0
+ 9038: e28cca07 add ip, ip, #28672 ; 0x7000
+ 903c: e5bcffd8 ldr pc, \[ip, #4056\]! ; 0xfd8
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ 9040: 4778 bx pc
+ 9042: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ 9044: e28fc600 add ip, pc, #0
+ 9048: e28cca07 add ip, ip, #28672 ; 0x7000
+ 904c: e5bcffcc ldr pc, \[ip, #4044\]! ; 0xfcc
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ 9050: e28fc600 add ip, pc, #0
+ 9054: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9058: e5bcffc4 ldr pc, \[ip, #4036\]! ; 0xfc4
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ 905c: e28fc600 add ip, pc, #0
+ 9060: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9064: e5bcffbc ldr pc, \[ip, #4028\]! ; 0xfbc
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .plt entry
+#------------------------------------------------------------------------------
+ 9068: 4778 bx pc
+ 906a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ 906c: e28fc600 add ip, pc, #0
+ 9070: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9074: e5bcffb0 ldr pc, \[ip, #4016\]! ; 0xfb0
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .plt entry
+#------------------------------------------------------------------------------
+ 9078: 4778 bx pc
+ 907a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ 907c: e28fc600 add ip, pc, #0
+ 9080: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9084: e5bcffa4 ldr pc, \[ip, #4004\]! ; 0xfa4
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .plt entry
+#------------------------------------------------------------------------------
+ 9088: 4778 bx pc
+ 908a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf4's .plt entry
+#------------------------------------------------------------------------------
+ 908c: e28fc600 add ip, pc, #0
+ 9090: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9094: e5bcff98 ldr pc, \[ip, #3992\]! ; 0xf98
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .plt entry
+#------------------------------------------------------------------------------
+ 9098: 4778 bx pc
+ 909a: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf4's .plt entry
+#------------------------------------------------------------------------------
+ 909c: e28fc600 add ip, pc, #0
+ 90a0: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90a4: e5bcff8c ldr pc, \[ip, #3980\]! ; 0xf8c
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ 90a8: e28fc600 add ip, pc, #0
+ 90ac: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90b0: e5bcff84 ldr pc, \[ip, #3972\]! ; 0xf84
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ 90b4: 4778 bx pc
+ 90b6: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ 90b8: e28fc600 add ip, pc, #0
+ 90bc: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90c0: e5bcff78 ldr pc, \[ip, #3960\]! ; 0xf78
+
+Disassembly of section \.iplt:
+
+000090c4 <\.iplt>:
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90c4: e28fc600 add ip, pc, #0
+ 90c8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90cc: e5bcff70 ldr pc, \[ip, #3952\]! ; 0xf70
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90d0: 4778 bx pc
+ 90d2: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90d4: e28fc600 add ip, pc, #0
+ 90d8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90dc: e5bcff64 ldr pc, \[ip, #3940\]! ; 0xf64
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90e0: 4778 bx pc
+ 90e2: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90e4: e28fc600 add ip, pc, #0
+ 90e8: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90ec: e5bcff58 ldr pc, \[ip, #3928\]! ; 0xf58
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90f0: e28fc600 add ip, pc, #0
+ 90f4: e28cca07 add ip, ip, #28672 ; 0x7000
+ 90f8: e5bcff50 ldr pc, \[ip, #3920\]! ; 0xf50
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ 90fc: 4778 bx pc
+ 90fe: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ 9100: e28fc600 add ip, pc, #0
+ 9104: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9108: e5bcff44 ldr pc, \[ip, #3908\]! ; 0xf44
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ 910c: 4778 bx pc
+ 910e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ 9110: e28fc600 add ip, pc, #0
+ 9114: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9118: e5bcff38 ldr pc, \[ip, #3896\]! ; 0xf38
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3's .iplt entry
+#------------------------------------------------------------------------------
+ 911c: 4778 bx pc
+ 911e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ atf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9120: e28fc600 add ip, pc, #0
+ 9124: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9128: e5bcff2c ldr pc, \[ip, #3884\]! ; 0xf2c
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3's .iplt entry
+#------------------------------------------------------------------------------
+ 912c: 4778 bx pc
+ 912e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9130: e28fc600 add ip, pc, #0
+ 9134: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9138: e5bcff20 ldr pc, \[ip, #3872\]! ; 0xf20
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ 913c: 4778 bx pc
+ 913e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9140: e28fc600 add ip, pc, #0
+ 9144: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9148: e5bcff14 ldr pc, \[ip, #3860\]! ; 0xf14
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ 914c: 4778 bx pc
+ 914e: 46c0 nop ; \(mov r8, r8\)
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9150: e28fc600 add ip, pc, #0
+ 9154: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9158: e5bcff08 ldr pc, \[ip, #3848\]! ; 0xf08
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ 915c: e28fc600 add ip, pc, #0
+ 9160: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9164: e5bcff00 ldr pc, \[ip, #3840\]! ; 0xf00
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ 9168: e28fc600 add ip, pc, #0
+ 916c: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9170: e5bcfef8 ldr pc, \[ip, #3832\]! ; 0xef8
+
+Disassembly of section \.text:
+
+0000a000 <aaf1>:
+ a000: e1a0f00e mov pc, lr
+
+0000a004 <atf1>:
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <abf1>:
+ a008: e1a0f00e mov pc, lr
+
+0000a00c <taf1>:
+ a00c: 46f7 mov pc, lr
+
+0000a00e <ttf1>:
+ a00e: 46f7 mov pc, lr
+
+0000a010 <tbf1>:
+ a010: 46f7 mov pc, lr
+ \.\.\.
+
+0000a014 <aaf3>:
+ a014: e1a0f00e mov pc, lr
+
+0000a018 <atf3>:
+ a018: e1a0f00e mov pc, lr
+
+0000a01c <abf3>:
+ a01c: e1a0f00e mov pc, lr
+
+0000a020 <taf3>:
+ a020: 46f7 mov pc, lr
+
+0000a022 <ttf3>:
+ a022: 46f7 mov pc, lr
+
+0000a024 <tbf3>:
+ a024: 46f7 mov pc, lr
+ \.\.\.
+
+0000a028 <arm>:
+ a028: eb0017f4 bl 10000 <foo>
+ a02c: ea0017f3 b 10000 <foo>
+ a030: 0a0017f2 beq 10000 <foo>
+ a034: e59f4000 ldr r4, \[pc, #0\] ; a03c <arm\+0x14>
+ a038: e59f4000 ldr r4, \[pc, #0\] ; a040 <arm\+0x18>
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a03c: 00000070 \.word 0x00000070
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a040: 0000702c \.word 0x0000702c
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a044: ebfffc1e bl 90c4 <aaf1-0xf3c>
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a048: eafffc1d b 90c4 <aaf1-0xf3c>
+#------------------------------------------------------------------------------
+#------ aaf1's .iplt entry
+#------------------------------------------------------------------------------
+ a04c: 0afffc1c beq 90c4 <aaf1-0xf3c>
+ a050: e59f4000 ldr r4, \[pc, #0\] ; a058 <arm\+0x30>
+ a054: e59f4000 ldr r4, \[pc, #0\] ; a05c <arm\+0x34>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of aaf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a058: 0000003c \.word 0x0000003c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of aaf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a05c: 00006fe0 \.word 0x00006fe0
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a060: ebfffc22 bl 90f0 <aaf1-0xf10>
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a064: eafffc21 b 90f0 <aaf1-0xf10>
+#------------------------------------------------------------------------------
+#------ taf1's .iplt entry
+#------------------------------------------------------------------------------
+ a068: 0afffc20 beq 90f0 <aaf1-0xf10>
+ a06c: e59f4000 ldr r4, \[pc, #0\] ; a074 <arm\+0x4c>
+ a070: e59f4000 ldr r4, \[pc, #0\] ; a078 <arm\+0x50>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of taf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a074: 00000048 \.word 0x00000048
+#------------------------------------------------------------------------------
+#------ PC-relative offset of taf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a078: 00006fd0 \.word 0x00006fd0
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a07c: ebfffc18 bl 90e4 <aaf1-0xf1c>
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a080: eafffc17 b 90e4 <aaf1-0xf1c>
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a084: 0afffc16 beq 90e4 <aaf1-0xf1c>
+ a088: e59f4000 ldr r4, \[pc, #0\] ; a090 <arm\+0x68>
+ a08c: e59f4000 ldr r4, \[pc, #0\] ; a094 <arm\+0x6c>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a090: 00000044 \.word 0x00000044
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a094: 00006fb0 \.word 0x00006fb0
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a098: ebfffc1c bl 9110 <aaf1-0xef0>
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a09c: eafffc1b b 9110 <aaf1-0xef0>
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a0a0: 0afffc1a beq 9110 <aaf1-0xef0>
+ a0a4: e59f4000 ldr r4, \[pc, #0\] ; a0ac <arm\+0x84>
+ a0a8: e59f4000 ldr r4, \[pc, #0\] ; a0b0 <arm\+0x88>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0ac: 00000050 \.word 0x00000050
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a0b0: 00006fa0 \.word 0x00006fa0
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0b4: ebfffbe8 bl 905c <aaf1-0xfa4>
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0b8: eafffbe7 b 905c <aaf1-0xfa4>
+#------------------------------------------------------------------------------
+#------ aaf2's .plt entry
+#------------------------------------------------------------------------------
+ a0bc: 0afffbe6 beq 905c <aaf1-0xfa4>
+ a0c0: e59f4000 ldr r4, \[pc, #0\] ; a0c8 <arm\+0xa0>
+ a0c4: e59f4000 ldr r4, \[pc, #0\] ; a0cc <arm\+0xa4>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf2
+#------------------------------------------------------------------------------
+ a0c8: 00000088 \.word 0x00000088
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf2
+#------------------------------------------------------------------------------
+ a0cc: 00006fbc \.word 0x00006fbc
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0d0: ebfffbde bl 9050 <aaf1-0xfb0>
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0d4: eafffbdd b 9050 <aaf1-0xfb0>
+#------------------------------------------------------------------------------
+#------ taf2's .plt entry
+#------------------------------------------------------------------------------
+ a0d8: 0afffbdc beq 9050 <aaf1-0xfb0>
+ a0dc: e59f4000 ldr r4, \[pc, #0\] ; a0e4 <arm\+0xbc>
+ a0e0: e59f4000 ldr r4, \[pc, #0\] ; a0e8 <arm\+0xc0>
+#------------------------------------------------------------------------------
+#------ .got offset for taf2
+#------------------------------------------------------------------------------
+ a0e4: 00000084 \.word 0x00000084
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf2
+#------------------------------------------------------------------------------
+ a0e8: 00006f9c \.word 0x00006f9c
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a0ec: ebfffbf1 bl 90b8 <aaf1-0xf48>
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a0f0: eafffbf0 b 90b8 <aaf1-0xf48>
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a0f4: 0afffbef beq 90b8 <aaf1-0xf48>
+ a0f8: e59f4000 ldr r4, \[pc, #0\] ; a100 <arm\+0xd8>
+ a0fc: e59f4000 ldr r4, \[pc, #0\] ; a104 <arm\+0xdc>
+#------------------------------------------------------------------------------
+#------ .got offset for abf2
+#------------------------------------------------------------------------------
+ a100: 000000a0 \.word 0x000000a0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf2
+#------------------------------------------------------------------------------
+ a104: 00006f9c \.word 0x00006f9c
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a108: ebfffbcd bl 9044 <aaf1-0xfbc>
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a10c: eafffbcc b 9044 <aaf1-0xfbc>
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a110: 0afffbcb beq 9044 <aaf1-0xfbc>
+ a114: e59f4000 ldr r4, \[pc, #0\] ; a11c <arm\+0xf4>
+ a118: e59f4000 ldr r4, \[pc, #0\] ; a120 <arm\+0xf8>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf2
+#------------------------------------------------------------------------------
+ a11c: 00000080 \.word 0x00000080
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf2
+#------------------------------------------------------------------------------
+ a120: 00006f60 \.word 0x00006f60
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ a124: ebfffc0f bl 9168 <aaf1-0xe98>
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ a128: eafffc0e b 9168 <aaf1-0xe98>
+#------------------------------------------------------------------------------
+#------ aaf3's .iplt entry
+#------------------------------------------------------------------------------
+ a12c: 0afffc0d beq 9168 <aaf1-0xe98>
+ a130: e59f4000 ldr r4, \[pc, #0\] ; a138 <arm\+0x110>
+ a134: e59f4000 ldr r4, \[pc, #0\] ; a13c <arm\+0x114>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of aaf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a138: 00000068 \.word 0x00000068
+#------------------------------------------------------------------------------
+#------ PC-relative offset of aaf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a13c: 00006f2c \.word 0x00006f2c
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ a140: ebfffc05 bl 915c <aaf1-0xea4>
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ a144: eafffc04 b 915c <aaf1-0xea4>
+#------------------------------------------------------------------------------
+#------ taf3's .iplt entry
+#------------------------------------------------------------------------------
+ a148: 0afffc03 beq 915c <aaf1-0xea4>
+ a14c: e59f4000 ldr r4, \[pc, #0\] ; a154 <arm\+0x12c>
+ a150: e59f4000 ldr r4, \[pc, #0\] ; a158 <arm\+0x130>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of taf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a154: 00000064 \.word 0x00000064
+#------------------------------------------------------------------------------
+#------ PC-relative offset of taf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a158: 00006f0c \.word 0x00006f0c
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a15c: ebfffbf3 bl 9130 <aaf1-0xed0>
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a160: eafffbf2 b 9130 <aaf1-0xed0>
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a164: 0afffbf1 beq 9130 <aaf1-0xed0>
+ a168: e59f4000 ldr r4, \[pc, #0\] ; a170 <arm\+0x148>
+ a16c: e59f4000 ldr r4, \[pc, #0\] ; a174 <arm\+0x14c>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a170: 00000058 \.word 0x00000058
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a174: 00006ee4 \.word 0x00006ee4
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a178: ebfffbf4 bl 9150 <aaf1-0xeb0>
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a17c: eafffbf3 b 9150 <aaf1-0xeb0>
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a180: 0afffbf2 beq 9150 <aaf1-0xeb0>
+ a184: e59f4000 ldr r4, \[pc, #0\] ; a18c <arm\+0x164>
+ a188: e59f4000 ldr r4, \[pc, #0\] ; a190 <arm\+0x168>
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a18c: 00000060 \.word 0x00000060
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a190: 00006ed0 \.word 0x00006ed0
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ a194: ebfffba2 bl 9024 <aaf1-0xfdc>
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ a198: eafffba1 b 9024 <aaf1-0xfdc>
+#------------------------------------------------------------------------------
+#------ aaf4's .plt entry
+#------------------------------------------------------------------------------
+ a19c: 0afffba0 beq 9024 <aaf1-0xfdc>
+ a1a0: e59f4000 ldr r4, \[pc, #0\] ; a1a8 <arm\+0x180>
+ a1a4: e59f4000 ldr r4, \[pc, #0\] ; a1ac <arm\+0x184>
+#------------------------------------------------------------------------------
+#------ .got offset for aaf4
+#------------------------------------------------------------------------------
+ a1a8: 00000078 \.word 0x00000078
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for aaf4
+#------------------------------------------------------------------------------
+ a1ac: 00006ecc \.word 0x00006ecc
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ a1b0: ebfffbbc bl 90a8 <aaf1-0xf58>
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ a1b4: eafffbbb b 90a8 <aaf1-0xf58>
+#------------------------------------------------------------------------------
+#------ taf4's .plt entry
+#------------------------------------------------------------------------------
+ a1b8: 0afffbba beq 90a8 <aaf1-0xf58>
+ a1bc: e59f4000 ldr r4, \[pc, #0\] ; a1c4 <arm\+0x19c>
+ a1c0: e59f4000 ldr r4, \[pc, #0\] ; a1c8 <arm\+0x1a0>
+#------------------------------------------------------------------------------
+#------ .got offset for taf4
+#------------------------------------------------------------------------------
+ a1c4: 0000009c \.word 0x0000009c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for taf4
+#------------------------------------------------------------------------------
+ a1c8: 00006ed4 \.word 0x00006ed4
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a1cc: ebfffba6 bl 906c <aaf1-0xf94>
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a1d0: eafffba5 b 906c <aaf1-0xf94>
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a1d4: 0afffba4 beq 906c <aaf1-0xf94>
+ a1d8: e59f4000 ldr r4, \[pc, #0\] ; a1e0 <arm\+0x1b8>
+ a1dc: e59f4000 ldr r4, \[pc, #0\] ; a1e4 <arm\+0x1bc>
+#------------------------------------------------------------------------------
+#------ .got offset for abf4
+#------------------------------------------------------------------------------
+ a1e0: 0000008c \.word 0x0000008c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf4
+#------------------------------------------------------------------------------
+ a1e4: 00006ea8 \.word 0x00006ea8
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a1e8: ebfffba3 bl 907c <aaf1-0xf84>
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a1ec: eafffba2 b 907c <aaf1-0xf84>
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a1f0: 0afffba1 beq 907c <aaf1-0xf84>
+ a1f4: e59f4000 ldr r4, \[pc, #0\] ; a1fc <arm\+0x1d4>
+ a1f8: e59f4000 ldr r4, \[pc, #0\] ; a200 <arm\+0x1d8>
+#------------------------------------------------------------------------------
+#------ .got offset for tbf4
+#------------------------------------------------------------------------------
+ a1fc: 00000090 \.word 0x00000090
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf4
+#------------------------------------------------------------------------------
+ a200: 00006e90 \.word 0x00006e90
+
+0000a204 <_thumb>:
+ a204: f005 fefc bl 10000 <foo>
+ a208: f005 befa b\.w 10000 <foo>
+ a20c: f005 86f8 beq\.w 10000 <foo>
+ a210: 4c00 ldr r4, \[pc, #0\] ; \(a214 <_thumb\+0x10>\)
+ a212: 4c01 ldr r4, \[pc, #4\] ; \(a218 <_thumb\+0x14>\)
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a214: 00000070 \.word 0x00000070
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a218: 00006e54 \.word 0x00006e54
+#------------------------------------------------------------------------------
+#------ atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a21c: f7fe ef5a blx 90d4 <aaf1-0xf2c>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a220: f7fe bf56 b\.w 90d0 <aaf1-0xf30>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf1's .iplt entry
+#------------------------------------------------------------------------------
+ a224: f43e af54 beq\.w 90d0 <aaf1-0xf30>
+ a228: 4c00 ldr r4, \[pc, #0\] ; \(a22c <_thumb\+0x28>\)
+ a22a: 4c01 ldr r4, \[pc, #4\] ; \(a230 <_thumb\+0x2c>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of atf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a22c: 00000040 \.word 0x00000040
+#------------------------------------------------------------------------------
+#------ PC-relative offset of atf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a230: 00006e10 \.word 0x00006e10
+#------------------------------------------------------------------------------
+#------ ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a234: f7fe ef64 blx 9100 <aaf1-0xf00>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a238: f7fe bf60 b\.w 90fc <aaf1-0xf04>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf1's .iplt entry
+#------------------------------------------------------------------------------
+ a23c: f43e af5e beq\.w 90fc <aaf1-0xf04>
+ a240: 4c00 ldr r4, \[pc, #0\] ; \(a244 <_thumb\+0x40>\)
+ a242: 4c01 ldr r4, \[pc, #4\] ; \(a248 <_thumb\+0x44>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of ttf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a244: 0000004c \.word 0x0000004c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of ttf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a248: 00006e04 \.word 0x00006e04
+#------------------------------------------------------------------------------
+#------ abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a24c: f7fe ef4a blx 90e4 <aaf1-0xf1c>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a250: f7fe bf46 b\.w 90e0 <aaf1-0xf20>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf1's .iplt entry
+#------------------------------------------------------------------------------
+ a254: f43e af44 beq\.w 90e0 <aaf1-0xf20>
+ a258: 4c00 ldr r4, \[pc, #0\] ; \(a25c <_thumb\+0x58>\)
+ a25a: 4c01 ldr r4, \[pc, #4\] ; \(a260 <_thumb\+0x5c>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a25c: 00000044 \.word 0x00000044
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a260: 00006de4 \.word 0x00006de4
+#------------------------------------------------------------------------------
+#------ tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a264: f7fe ef54 blx 9110 <aaf1-0xef0>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a268: f7fe bf50 b\.w 910c <aaf1-0xef4>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf1's .iplt entry
+#------------------------------------------------------------------------------
+ a26c: f43e af4e beq\.w 910c <aaf1-0xef4>
+ a270: 4c00 ldr r4, \[pc, #0\] ; \(a274 <_thumb\+0x70>\)
+ a272: 4c01 ldr r4, \[pc, #4\] ; \(a278 <_thumb\+0x74>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a274: 00000050 \.word 0x00000050
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf1's .igot.plt entry
+#------------------------------------------------------------------------------
+ a278: 00006dd8 \.word 0x00006dd8
+#------------------------------------------------------------------------------
+#------ atf2's .plt entry
+#------------------------------------------------------------------------------
+ a27c: f7fe eecc blx 9018 <aaf1-0xfe8>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ a280: f7fe bec8 b\.w 9014 <aaf1-0xfec>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf2's .plt entry
+#------------------------------------------------------------------------------
+ a284: f43e aec6 beq\.w 9014 <aaf1-0xfec>
+ a288: 4c00 ldr r4, \[pc, #0\] ; \(a28c <_thumb\+0x88>\)
+ a28a: 4c01 ldr r4, \[pc, #4\] ; \(a290 <_thumb\+0x8c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf2
+#------------------------------------------------------------------------------
+ a28c: 00000074 \.word 0x00000074
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf2
+#------------------------------------------------------------------------------
+ a290: 00006de4 \.word 0x00006de4
+#------------------------------------------------------------------------------
+#------ ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a294: f7fe eece blx 9034 <aaf1-0xfcc>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a298: f7fe beca b\.w 9030 <aaf1-0xfd0>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf2's .plt entry
+#------------------------------------------------------------------------------
+ a29c: f43e aec8 beq\.w 9030 <aaf1-0xfd0>
+ a2a0: 4c00 ldr r4, \[pc, #0\] ; \(a2a4 <_thumb\+0xa0>\)
+ a2a2: 4c01 ldr r4, \[pc, #4\] ; \(a2a8 <_thumb\+0xa4>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf2
+#------------------------------------------------------------------------------
+ a2a4: 0000007c \.word 0x0000007c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf2
+#------------------------------------------------------------------------------
+ a2a8: 00006dd4 \.word 0x00006dd4
+#------------------------------------------------------------------------------
+#------ abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2ac: f7fe ef04 blx 90b8 <aaf1-0xf48>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2b0: f7fe bf00 b\.w 90b4 <aaf1-0xf4c>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf2's .plt entry
+#------------------------------------------------------------------------------
+ a2b4: f43e aefe beq\.w 90b4 <aaf1-0xf4c>
+ a2b8: 4c00 ldr r4, \[pc, #0\] ; \(a2bc <_thumb\+0xb8>\)
+ a2ba: 4c01 ldr r4, \[pc, #4\] ; \(a2c0 <_thumb\+0xbc>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf2
+#------------------------------------------------------------------------------
+ a2bc: 000000a0 \.word 0x000000a0
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf2
+#------------------------------------------------------------------------------
+ a2c0: 00006de0 \.word 0x00006de0
+#------------------------------------------------------------------------------
+#------ tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2c4: f7fe eebe blx 9044 <aaf1-0xfbc>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2c8: f7fe beba b\.w 9040 <aaf1-0xfc0>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf2's .plt entry
+#------------------------------------------------------------------------------
+ a2cc: f43e aeb8 beq\.w 9040 <aaf1-0xfc0>
+ a2d0: 4c00 ldr r4, \[pc, #0\] ; \(a2d4 <_thumb\+0xd0>\)
+ a2d2: 4c01 ldr r4, \[pc, #4\] ; \(a2d8 <_thumb\+0xd4>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf2
+#------------------------------------------------------------------------------
+ a2d4: 00000080 \.word 0x00000080
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf2
+#------------------------------------------------------------------------------
+ a2d8: 00006da8 \.word 0x00006da8
+#------------------------------------------------------------------------------
+#------ atf3's .iplt entry
+#------------------------------------------------------------------------------
+ a2dc: f7fe ef20 blx 9120 <aaf1-0xee0>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3's .iplt entry
+#------------------------------------------------------------------------------
+ a2e0: f7fe bf1c b\.w 911c <aaf1-0xee4>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf3's .iplt entry
+#------------------------------------------------------------------------------
+ a2e4: f43e af1a beq\.w 911c <aaf1-0xee4>
+ a2e8: 4c00 ldr r4, \[pc, #0\] ; \(a2ec <_thumb\+0xe8>\)
+ a2ea: 4c01 ldr r4, \[pc, #4\] ; \(a2f0 <_thumb\+0xec>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of atf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a2ec: 00000054 \.word 0x00000054
+#------------------------------------------------------------------------------
+#------ PC-relative offset of atf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a2f0: 00006d64 \.word 0x00006d64
+#------------------------------------------------------------------------------
+#------ ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ a2f4: f7fe ef24 blx 9140 <aaf1-0xec0>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ a2f8: f7fe bf20 b\.w 913c <aaf1-0xec4>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf3's .iplt entry
+#------------------------------------------------------------------------------
+ a2fc: f43e af1e beq\.w 913c <aaf1-0xec4>
+ a300: 4c00 ldr r4, \[pc, #0\] ; \(a304 <_thumb\+0x100>\)
+ a302: 4c01 ldr r4, \[pc, #4\] ; \(a308 <_thumb\+0x104>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of ttf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a304: 0000005c \.word 0x0000005c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of ttf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a308: 00006d54 \.word 0x00006d54
+#------------------------------------------------------------------------------
+#------ abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a30c: f7fe ef10 blx 9130 <aaf1-0xed0>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a310: f7fe bf0c b\.w 912c <aaf1-0xed4>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf3's .iplt entry
+#------------------------------------------------------------------------------
+ a314: f43e af0a beq\.w 912c <aaf1-0xed4>
+ a318: 4c00 ldr r4, \[pc, #0\] ; \(a31c <_thumb\+0x118>\)
+ a31a: 4c01 ldr r4, \[pc, #4\] ; \(a320 <_thumb\+0x11c>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a31c: 00000058 \.word 0x00000058
+#------------------------------------------------------------------------------
+#------ PC-relative offset of abf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a320: 00006d38 \.word 0x00006d38
+#------------------------------------------------------------------------------
+#------ tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a324: f7fe ef14 blx 9150 <aaf1-0xeb0>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a328: f7fe bf10 b\.w 914c <aaf1-0xeb4>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf3's .iplt entry
+#------------------------------------------------------------------------------
+ a32c: f43e af0e beq\.w 914c <aaf1-0xeb4>
+ a330: 4c00 ldr r4, \[pc, #0\] ; \(a334 <_thumb\+0x130>\)
+ a332: 4c01 ldr r4, \[pc, #4\] ; \(a338 <_thumb\+0x134>\)
+#------------------------------------------------------------------------------
+#------ GP-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a334: 00000060 \.word 0x00000060
+#------------------------------------------------------------------------------
+#------ PC-relative offset of tbf3's .igot.plt entry
+#------------------------------------------------------------------------------
+ a338: 00006d28 \.word 0x00006d28
+#------------------------------------------------------------------------------
+#------ atf4's .plt entry
+#------------------------------------------------------------------------------
+ a33c: f7fe eeae blx 909c <aaf1-0xf64>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .plt entry
+#------------------------------------------------------------------------------
+ a340: f7fe beaa b\.w 9098 <aaf1-0xf68>
+#------------------------------------------------------------------------------
+#------ thumb entry to atf4's .plt entry
+#------------------------------------------------------------------------------
+ a344: f43e aea8 beq\.w 9098 <aaf1-0xf68>
+ a348: 4c00 ldr r4, \[pc, #0\] ; \(a34c <_thumb\+0x148>\)
+ a34a: 4c01 ldr r4, \[pc, #4\] ; \(a350 <_thumb\+0x14c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for atf4
+#------------------------------------------------------------------------------
+ a34c: 00000098 \.word 0x00000098
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for atf4
+#------------------------------------------------------------------------------
+ a350: 00006d48 \.word 0x00006d48
+#------------------------------------------------------------------------------
+#------ ttf4's .plt entry
+#------------------------------------------------------------------------------
+ a354: f7fe ee9a blx 908c <aaf1-0xf74>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .plt entry
+#------------------------------------------------------------------------------
+ a358: f7fe be96 b\.w 9088 <aaf1-0xf78>
+#------------------------------------------------------------------------------
+#------ thumb entry to ttf4's .plt entry
+#------------------------------------------------------------------------------
+ a35c: f43e ae94 beq\.w 9088 <aaf1-0xf78>
+ a360: 4c00 ldr r4, \[pc, #0\] ; \(a364 <_thumb\+0x160>\)
+ a362: 4c01 ldr r4, \[pc, #4\] ; \(a368 <_thumb\+0x164>\)
+#------------------------------------------------------------------------------
+#------ .got offset for ttf4
+#------------------------------------------------------------------------------
+ a364: 00000094 \.word 0x00000094
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for ttf4
+#------------------------------------------------------------------------------
+ a368: 00006d2c \.word 0x00006d2c
+#------------------------------------------------------------------------------
+#------ abf4's .plt entry
+#------------------------------------------------------------------------------
+ a36c: f7fe ee7e blx 906c <aaf1-0xf94>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .plt entry
+#------------------------------------------------------------------------------
+ a370: f7fe be7a b\.w 9068 <aaf1-0xf98>
+#------------------------------------------------------------------------------
+#------ thumb entry to abf4's .plt entry
+#------------------------------------------------------------------------------
+ a374: f43e ae78 beq\.w 9068 <aaf1-0xf98>
+ a378: 4c00 ldr r4, \[pc, #0\] ; \(a37c <_thumb\+0x178>\)
+ a37a: 4c01 ldr r4, \[pc, #4\] ; \(a380 <_thumb\+0x17c>\)
+#------------------------------------------------------------------------------
+#------ .got offset for abf4
+#------------------------------------------------------------------------------
+ a37c: 0000008c \.word 0x0000008c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for abf4
+#------------------------------------------------------------------------------
+ a380: 00006d0c \.word 0x00006d0c
+#------------------------------------------------------------------------------
+#------ tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a384: f7fe ee7a blx 907c <aaf1-0xf84>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a388: f7fe be76 b\.w 9078 <aaf1-0xf88>
+#------------------------------------------------------------------------------
+#------ thumb entry to tbf4's .plt entry
+#------------------------------------------------------------------------------
+ a38c: f43e ae74 beq\.w 9078 <aaf1-0xf88>
+ a390: 4c00 ldr r4, \[pc, #0\] ; \(a394 <_thumb\+0x190>\)
+ a392: 4c01 ldr r4, \[pc, #4\] ; \(a398 <_thumb\+0x194>\)
+#------------------------------------------------------------------------------
+#------ .got offset for tbf4
+#------------------------------------------------------------------------------
+ a394: 00000090 \.word 0x00000090
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for tbf4
+#------------------------------------------------------------------------------
+ a398: 00006cf8 \.word 0x00006cf8
diff --git a/ld/testsuite/ld-arm/ifunc-8.gd b/ld/testsuite/ld-arm/ifunc-8.gd
new file mode 100644
index 0000000..7efefa0
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-8.gd
@@ -0,0 +1,167 @@
+
+.*
+
+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 .*
diff --git a/ld/testsuite/ld-arm/ifunc-8.rd b/ld/testsuite/ld-arm/ifunc-8.rd
new file mode 100644
index 0000000..a8ad1f2
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-8.rd
@@ -0,0 +1,80 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 62 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001106c ......17 R_ARM_RELATIVE
+00011070 ......17 R_ARM_RELATIVE
+00010004 ......a0 R_ARM_IRELATIVE
+0001000c ......a0 R_ARM_IRELATIVE
+00010014 ......a0 R_ARM_IRELATIVE
+0001001c ......a0 R_ARM_IRELATIVE
+00010024 ......a0 R_ARM_IRELATIVE
+0001002c ......a0 R_ARM_IRELATIVE
+00010064 ......a0 R_ARM_IRELATIVE
+0001006c ......a0 R_ARM_IRELATIVE
+00010074 ......a0 R_ARM_IRELATIVE
+0001007c ......a0 R_ARM_IRELATIVE
+00010084 ......a0 R_ARM_IRELATIVE
+0001008c ......a0 R_ARM_IRELATIVE
+0001103c ......a0 R_ARM_IRELATIVE
+00011040 ......a0 R_ARM_IRELATIVE
+00011044 ......a0 R_ARM_IRELATIVE
+00011048 ......a0 R_ARM_IRELATIVE
+0001104c ......a0 R_ARM_IRELATIVE
+00011050 ......a0 R_ARM_IRELATIVE
+00011054 ......a0 R_ARM_IRELATIVE
+00011058 ......a0 R_ARM_IRELATIVE
+0001105c ......a0 R_ARM_IRELATIVE
+00011060 ......a0 R_ARM_IRELATIVE
+00011064 ......a0 R_ARM_IRELATIVE
+00011068 ......a0 R_ARM_IRELATIVE
+00010034 ......02 R_ARM_ABS32 00000000 aaf2
+00010038 ......03 R_ARM_REL32 00000000 aaf2
+00011088 ......15 R_ARM_GLOB_DAT 00000000 aaf2
+0001003c ......02 R_ARM_ABS32 00000000 atf2
+00010040 ......03 R_ARM_REL32 00000000 atf2
+00011074 ......15 R_ARM_GLOB_DAT 00000000 atf2
+00010044 ......02 R_ARM_ABS32 00000000 abf2
+00010048 ......03 R_ARM_REL32 00000000 abf2
+000110a0 ......15 R_ARM_GLOB_DAT 00000000 abf2
+0001004c ......02 R_ARM_ABS32 00000000 taf2
+00010050 ......03 R_ARM_REL32 00000000 taf2
+00011084 ......15 R_ARM_GLOB_DAT 00000000 taf2
+00010054 ......02 R_ARM_ABS32 00000000 ttf2
+00010058 ......03 R_ARM_REL32 00000000 ttf2
+0001107c ......15 R_ARM_GLOB_DAT 00000000 ttf2
+0001005c ......02 R_ARM_ABS32 00000000 tbf2
+00010060 ......03 R_ARM_REL32 00000000 tbf2
+00011080 ......15 R_ARM_GLOB_DAT 00000000 tbf2
+00010094 ......02 R_ARM_ABS32 00000000 aaf4
+00010098 ......03 R_ARM_REL32 00000000 aaf4
+00011078 ......15 R_ARM_GLOB_DAT 00000000 aaf4
+0001009c ......02 R_ARM_ABS32 00000000 atf4
+000100a0 ......03 R_ARM_REL32 00000000 atf4
+00011098 ......15 R_ARM_GLOB_DAT 00000000 atf4
+000100a4 ......02 R_ARM_ABS32 00000000 abf4
+000100a8 ......03 R_ARM_REL32 00000000 abf4
+0001108c ......15 R_ARM_GLOB_DAT 00000000 abf4
+000100ac ......02 R_ARM_ABS32 00000000 taf4
+000100b0 ......03 R_ARM_REL32 00000000 taf4
+0001109c ......15 R_ARM_GLOB_DAT 00000000 taf4
+000100b4 ......02 R_ARM_ABS32 00000000 ttf4
+000100b8 ......03 R_ARM_REL32 00000000 ttf4
+00011094 ......15 R_ARM_GLOB_DAT 00000000 ttf4
+000100bc ......02 R_ARM_ABS32 00000000 tbf4
+000100c0 ......03 R_ARM_REL32 00000000 tbf4
+00011090 ......15 R_ARM_GLOB_DAT 00000000 tbf4
+
+Relocation section '\.rel\.plt' at offset 0x81f0 contains 12 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT 00000000 atf2
+00011010 ......16 R_ARM_JUMP_SLOT 00000000 aaf4
+00011014 ......16 R_ARM_JUMP_SLOT 00000000 ttf2
+00011018 ......16 R_ARM_JUMP_SLOT 00000000 tbf2
+0001101c ......16 R_ARM_JUMP_SLOT 00000000 taf2
+00011020 ......16 R_ARM_JUMP_SLOT 00000000 aaf2
+00011024 ......16 R_ARM_JUMP_SLOT 00000000 abf4
+00011028 ......16 R_ARM_JUMP_SLOT 00000000 tbf4
+0001102c ......16 R_ARM_JUMP_SLOT 00000000 ttf4
+00011030 ......16 R_ARM_JUMP_SLOT 00000000 atf4
+00011034 ......16 R_ARM_JUMP_SLOT 00000000 taf4
+00011038 ......16 R_ARM_JUMP_SLOT 00000000 abf2
diff --git a/ld/testsuite/ld-arm/ifunc-8.s b/ld/testsuite/ld-arm/ifunc-8.s
new file mode 100644
index 0000000..3947f7f
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-8.s
@@ -0,0 +1,88 @@
+ .syntax unified
+ .arch armv6t2
+
+ .macro define,name,type
+ .type \name,%gnu_indirect_function
+ \type
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro define2,name
+ define aa\name,.arm
+ define at\name,.arm
+ define ab\name,.arm
+ define ta\name,.thumb_func
+ define tt\name,.thumb_func
+ define tb\name,.thumb_func
+ .endm
+
+ .macro test_relocs,name,width
+ bl \name(PLT)
+ b\width \name
+ beq\width \name
+ ldr r4,1f
+ ldr r4,2f
+1:
+ .word \name(GOT)
+2:
+ .word \name(GOT_PREL)
+ .endm
+
+ .macro test_relocs2,name,type,width
+ test_relocs a\type\name,\width
+ test_relocs t\type\name,\width
+ test_relocs ab\name,\width
+ test_relocs tb\name,\width
+ .endm
+
+ .macro diff,name
+ .word \name
+ .word \name-.
+ .endm
+
+ .macro alldirs,doit,name
+ \doit aa\name
+ \doit at\name
+ \doit ab\name
+ \doit ta\name
+ \doit tt\name
+ \doit tb\name
+ .endm
+
+ define2 f1
+ define2 f3
+
+ alldirs .globl,f3
+ alldirs .hidden,f3
+
+ .globl arm
+ .type arm,%function
+ .arm
+arm:
+ test_relocs foo
+ test_relocs2 f1,a,
+ test_relocs2 f2,a,
+ test_relocs2 f3,a,
+ test_relocs2 f4,a,
+ .size arm,.-arm
+
+ .globl _thumb
+ .type _thumb,%function
+ .thumb_func
+_thumb:
+ test_relocs foo
+ test_relocs2 f1,t,.w
+ test_relocs2 f2,t,.w
+ test_relocs2 f3,t,.w
+ test_relocs2 f4,t,.w
+ .size _thumb,.-_thumb
+
+ .data
+foo:
+ .word 0x11223344
+ alldirs diff,f1
+ alldirs diff,f2
+ alldirs diff,f3
+ alldirs diff,f4
diff --git a/ld/testsuite/ld-arm/ifunc-9.dd b/ld/testsuite/ld-arm/ifunc-9.dd
new file mode 100644
index 0000000..be8f3d0
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-9.dd
@@ -0,0 +1,154 @@
+
+.*
+
+
+Disassembly of section \.plt:
+
+00009000 <\.plt>:
+ 9000: e52de004 push {lr} ; \(str lr, \[sp, #-4\]!\)
+ 9004: e59fe004 ldr lr, \[pc, #4\] ; 9010 <f3-0x1c>
+ 9008: e08fe00e add lr, pc, lr
+ 900c: e5bef008 ldr pc, \[lr, #8\]!
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got.plt
+#------------------------------------------------------------------------------
+ 9010: 00007ff0 \.word 0x00007ff0
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ 9014: e28fc600 add ip, pc, #0
+ 9018: e28cca07 add ip, ip, #28672 ; 0x7000
+ 901c: e5bcfff0 ldr pc, \[ip, #4080\]! ; 0xff0
+
+Disassembly of section \.iplt:
+
+00009020 <f3-0xc>:
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ 9020: e28fc600 add ip, pc, #0
+ 9024: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9028: e5bcffe8 ldr pc, \[ip, #4072\]! ; 0xfe8
+
+0000902c <f3>:
+ 902c: e28fc600 add ip, pc, #0
+ 9030: e28cca07 add ip, ip, #28672 ; 0x7000
+ 9034: e5bcffe0 ldr pc, \[ip, #4064\]! ; 0xfe0
+
+Disassembly of section \.text:
+
+0000a000 <f1>:
+ a000: e1a0f00e mov pc, lr
+ a004: e1a0f00e mov pc, lr
+
+0000a008 <_start>:
+ a008: eb0017fc bl 10000 <foo>
+ a00c: e59f400c ldr r4, \[pc, #12\] ; a020 <_start\+0x18>
+ a010: e59f400c ldr r4, \[pc, #12\] ; a024 <_start\+0x1c>
+ a014: e59f400c ldr r4, \[pc, #12\] ; a028 <_start\+0x20>
+ a018: e59f400c ldr r4, \[pc, #12\] ; a02c <_start\+0x24>
+ a01c: e59f500c ldr r5, \[pc, #12\] ; a030 <_start\+0x28>
+#------------------------------------------------------------------------------
+#------ foo
+#------------------------------------------------------------------------------
+ a020: 00010000 \.word 0x00010000
+#------------------------------------------------------------------------------
+#------ PC-relative offset of foo
+#------------------------------------------------------------------------------
+ a024: 00005fdc \.word 0x00005fdc
+#------------------------------------------------------------------------------
+#------ GP-relative offset of foo
+#------------------------------------------------------------------------------
+ a028: fffff000 \.word 0xfffff000
+#------------------------------------------------------------------------------
+#------ .got offset for foo
+#------------------------------------------------------------------------------
+ a02c: 00000020 \.word 0x00000020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for foo
+#------------------------------------------------------------------------------
+ a030: 00006fe8 \.word 0x00006fe8
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a034: ebfffbf9 bl 9020 <f3-0xc>
+ a038: e59f400c ldr r4, \[pc, #12\] ; a04c <_start\+0x44>
+ a03c: e59f400c ldr r4, \[pc, #12\] ; a050 <_start\+0x48>
+ a040: e59f400c ldr r4, \[pc, #12\] ; a054 <_start\+0x4c>
+ a044: e59f400c ldr r4, \[pc, #12\] ; a058 <_start\+0x50>
+ a048: e59f500c ldr r5, \[pc, #12\] ; a05c <_start\+0x54>
+#------------------------------------------------------------------------------
+#------ f1's .iplt entry
+#------------------------------------------------------------------------------
+ a04c: 00009020 \.word 0x00009020
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f1's .iplt entry
+#------------------------------------------------------------------------------
+ a050: ffffefd0 \.word 0xffffefd0
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f1's .iplt entry
+#------------------------------------------------------------------------------
+ a054: ffff8020 \.word 0xffff8020
+#------------------------------------------------------------------------------
+#------ .got offset for f1's .iplt entry
+#------------------------------------------------------------------------------
+ a058: 0000001c \.word 0x0000001c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f1's .iplt entry
+#------------------------------------------------------------------------------
+ a05c: 00006fc0 \.word 0x00006fc0
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ a060: ebfffbeb bl 9014 <f3-0x18>
+ a064: e59f400c ldr r4, \[pc, #12\] ; a078 <_start\+0x70>
+ a068: e59f400c ldr r4, \[pc, #12\] ; a07c <_start\+0x74>
+ a06c: e59f400c ldr r4, \[pc, #12\] ; a080 <_start\+0x78>
+ a070: e59f400c ldr r4, \[pc, #12\] ; a084 <_start\+0x7c>
+ a074: e59f500c ldr r5, \[pc, #12\] ; a088 <_start\+0x80>
+#------------------------------------------------------------------------------
+#------ f2's .plt entry
+#------------------------------------------------------------------------------
+ a078: 00009014 \.word 0x00009014
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f2's .plt entry
+#------------------------------------------------------------------------------
+ a07c: ffffef98 \.word 0xffffef98
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f2's .plt entry
+#------------------------------------------------------------------------------
+ a080: ffff8014 \.word 0xffff8014
+#------------------------------------------------------------------------------
+#------ .got offset for f2
+#------------------------------------------------------------------------------
+ a084: 00000028 \.word 0x00000028
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f2
+#------------------------------------------------------------------------------
+ a088: 00006fa0 \.word 0x00006fa0
+ a08c: ebfffbe6 bl 902c <f3>
+ a090: e59f400c ldr r4, \[pc, #12\] ; a0a4 <_start\+0x9c>
+ a094: e59f400c ldr r4, \[pc, #12\] ; a0a8 <_start\+0xa0>
+ a098: e59f400c ldr r4, \[pc, #12\] ; a0ac <_start\+0xa4>
+ a09c: e59f400c ldr r4, \[pc, #12\] ; a0b0 <_start\+0xa8>
+ a0a0: e59f500c ldr r5, \[pc, #12\] ; a0b4 <_start\+0xac>
+#------------------------------------------------------------------------------
+#------ f3
+#------------------------------------------------------------------------------
+ a0a4: 0000902c \.word 0x0000902c
+#------------------------------------------------------------------------------
+#------ PC-relative offset of f3
+#------------------------------------------------------------------------------
+ a0a8: ffffef84 \.word 0xffffef84
+#------------------------------------------------------------------------------
+#------ GP-relative offset of f3
+#------------------------------------------------------------------------------
+ a0ac: ffff802c \.word 0xffff802c
+#------------------------------------------------------------------------------
+#------ .got offset for f3
+#------------------------------------------------------------------------------
+ a0b0: 00000024 \.word 0x00000024
+#------------------------------------------------------------------------------
+#------ PC-relative offset of .got entry for f3
+#------------------------------------------------------------------------------
+ a0b4: 00006f70 \.word 0x00006f70
diff --git a/ld/testsuite/ld-arm/ifunc-9.gd b/ld/testsuite/ld-arm/ifunc-9.gd
new file mode 100644
index 0000000..6f220d1
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-9.gd
@@ -0,0 +1,29 @@
+
+.*
+
+Contents of section \.data:
+#------------------------------------------------------------------------------
+#------ 00010000: foo
+#------------------------------------------------------------------------------
+ 10000 44332211 .*
+Contents of section \.got:
+#------------------------------------------------------------------------------
+#------ 00011000: .got.plt
+#------ 00011004: reserved .got.plt entry
+#------ 00011008: reserved .got.plt entry
+#------ 0001100c: f2's .got.plt entry [R_ARM_JUMP_SLOT]
+#------------------------------------------------------------------------------
+ 11000 00200100 00000000 00000000 00900000 .*
+#------------------------------------------------------------------------------
+#------ 00011010: f1's .igot.plt entry [R_ARM_IRELATIVE]
+#------ 00011014: f3's .igot.plt pointer to 0xa004 [R_ARM_IRELATIVE]
+#------ 00011018: .got entry for foo
+#------ 0001101c: .got entry for f1's .iplt entry
+#------------------------------------------------------------------------------
+ 11010 00a00000 04a00000 00000100 20900000 .*
+#------------------------------------------------------------------------------
+#------ 00011020: .got entry for foo
+#------ 00011024: .got entry for f3
+#------ 00011028: .got entry for f2 [R_ARM_GLOB_DAT]
+#------------------------------------------------------------------------------
+ 11020 00000100 2c900000 00000000 .*
diff --git a/ld/testsuite/ld-arm/ifunc-9.rd b/ld/testsuite/ld-arm/ifunc-9.rd
new file mode 100644
index 0000000..689f663
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-9.rd
@@ -0,0 +1,10 @@
+
+Relocation section '\.rel\.dyn' at offset 0x8000 contains 3 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+00011010 ......a0 R_ARM_IRELATIVE
+00011014 ......a0 R_ARM_IRELATIVE
+00011028 ......15 R_ARM_GLOB_DAT 00009014 f2
+
+Relocation section '\.rel\.plt' at offset 0x8018 contains 1 entries:
+ Offset Info Type Sym\.Value Sym\. Name
+0001100c ......16 R_ARM_JUMP_SLOT 00009014 f2
diff --git a/ld/testsuite/ld-arm/ifunc-9.s b/ld/testsuite/ld-arm/ifunc-9.s
new file mode 100644
index 0000000..25b682f
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-9.s
@@ -0,0 +1,44 @@
+ .macro define,name
+ .type \name,%gnu_indirect_function
+\name:
+ mov pc,lr
+ .size \name,.-\name
+ .endm
+
+ .macro test_relocs,name
+ bl \name
+ ldr r4,1f
+ ldr r4,2f
+ ldr r4,3f
+ ldr r4,4f
+ ldr r5,5f
+1:
+ .word \name
+2:
+ .word \name-.
+3:
+ .word \name(GOTOFF)
+4:
+ .word \name(GOT)
+5:
+ .word \name(GOT_PREL)
+ .endm
+
+ .global f3
+ .hidden f3
+
+ define f1
+ # f2 provided by ifunc-3.so
+ define f3
+
+ .globl _start
+_start:
+ test_relocs foo
+ test_relocs f1
+ test_relocs f2
+ test_relocs f3
+ .size _start,.-_start
+
+ .data
+foo:
+ .word 0x11223344
diff --git a/ld/testsuite/ld-arm/ifunc-dynamic.ld b/ld/testsuite/ld-arm/ifunc-dynamic.ld
new file mode 100644
index 0000000..1e030d8
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-dynamic.ld
@@ -0,0 +1,33 @@
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x07000;
+ .hash : { *(.hash) }
+ .gnu.hash : { *(.gnu.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ . = 0x08000;
+ .rel.dyn : {
+ *(.rel.dyn)
+ *(.rel.data)
+ *(.rel.got)
+ PROVIDE_HIDDEN (__irel_start = .);
+ *(.rel.iplt)
+ PROVIDE_HIDDEN (__irel_end = .);
+ }
+ .rel.plt : { *(.rel.plt) }
+ . = 0x09000;
+ .plt : { *(.plt) }
+ .iplt : { *(.iplt) }
+ . = 0x0A000;
+ .text : { *(.text) }
+ . = 0x10000;
+ .data : { *(.data) }
+ . = 0x11000;
+ .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
+ . = 0x12000;
+ .dynamic : { *(.dynamic) }
+ . = 0x13000;
+ .bss : { *(.bss) }
+}
diff --git a/ld/testsuite/ld-arm/ifunc-static.ld b/ld/testsuite/ld-arm/ifunc-static.ld
new file mode 100644
index 0000000..80cf6a2
--- /dev/null
+++ b/ld/testsuite/ld-arm/ifunc-static.ld
@@ -0,0 +1,21 @@
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x08000;
+ .rel.dyn : {
+ PROVIDE_HIDDEN (__irel_start = .);
+ *(.rel.iplt)
+ PROVIDE_HIDDEN (__irel_end = .);
+ }
+ . = 0x09000;
+ .iplt : { *(.iplt) }
+ . = 0x0A000;
+ .text : { *(.text) }
+ . = 0x10000;
+ .data : { *(.data) }
+ . = 0x11000;
+ .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
+ . = 0x12000;
+ .bss : { *(.bss) }
+}
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 2a6f02f..0300c26 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,9 @@
2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+ * arm-dis.c (get_sym_code_type): Treat STT_GNU_IFUNCs as code.
+
+2011-03-14 Richard Sandiford <richard.sandiford@linaro.org>
+
* arm-dis.c (get_sym_code_type): Don't check for STT_ARM_TFUNC.
Use branch types instead.
(print_insn): Likewise.
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 26e40ab..e8abbf5 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -4525,7 +4525,7 @@ get_sym_code_type (struct disassemble_info *info,
type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
/* If the symbol has function type then use that. */
- if (type == STT_FUNC)
+ if (type == STT_FUNC || type == STT_GNU_IFUNC)
{
if (ARM_SYM_BRANCH_TYPE (&es->internal_elf_sym) == ST_BRANCH_TO_THUMB)
*map_type = MAP_THUMB;