bfd_boolean flags_init;
};
+/* Indicate if the bfd contains symbols that have the STT_GNU_IFUNC
+ symbol type or STB_GNU_UNIQUE binding. Used to set the osabi
+ field in the ELF header structure. */
+enum elf_gnu_symbols
+ {
+ elf_gnu_symbol_none = 0,
+ elf_gnu_symbol_any = 1 << 0,
+ elf_gnu_symbol_ifunc = (elf_gnu_symbol_any | 1 << 1),
+ elf_gnu_symbol_unique = (elf_gnu_symbol_any | 1 << 2),
+ elf_gnu_symbol_all = (elf_gnu_symbol_ifunc | elf_gnu_symbol_unique)
+ };
+
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
symbols. */
bfd_boolean bad_symtab;
- /* True if the bfd contains symbols that have the STT_GNU_IFUNC
- symbol type or STB_GNU_UNIQUE binding. Used to set the osabi
- field in the ELF header structure. */
- bfd_boolean has_gnu_symbols;
+ enum elf_gnu_symbols has_gnu_symbols;
/* Information grabbed from an elf core file. */
struct core_elf_obj_tdata *core;
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
return TRUE;
}
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
if (elf32_arm_hash_table (info) == NULL)
return FALSE;
/* It is referenced by a non-shared object. */
h->ref_regular = 1;
h->root.non_ir_ref = 1;
+
+ if (h->type == STT_GNU_IFUNC)
+ elf_tdata (info->output_bfd)->has_gnu_symbols
+ |= elf_gnu_symbol_ifunc;
}
if (! elf_i386_tls_transition (info, abfd, sec, NULL,
asection ** secp ATTRIBUTE_UNUSED,
bfd_vma * valp ATTRIBUTE_UNUSED)
{
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols
+ |= elf_gnu_symbol_unique;
return TRUE;
}
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
return TRUE;
}
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
return TRUE;
}
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
return TRUE;
}
|| ELF_ST_BIND (isym->st_info) == STB_GNU_UNIQUE)
&& (ibfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
if (*sec != NULL
&& strcmp ((*sec)->name, ".opd") == 0)
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER)
{
/* It is referenced by a non-shared object. */
h->ref_regular = 1;
h->root.non_ir_ref = 1;
+
+ if (h->type == STT_GNU_IFUNC)
+ elf_tdata (info->output_bfd)->has_gnu_symbols
+ |= elf_gnu_symbol_ifunc;
}
if (! elf_x86_64_tls_transition (info, abfd, sec, NULL,
return TRUE;
}
- if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
- || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ if (ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols
+ |= elf_gnu_symbol_unique;
return TRUE;
}
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
- elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+ elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
return TRUE;
}
run_dump_test "pr17057"
run_dump_test "pr17935-1"
run_dump_test "pr17935-2"
+run_dump_test "pr18815"
# Add $PLT_CFLAGS if PLT is expected.
global PLT_CFLAGS
--- /dev/null
+#name: PR ld/18815
+#as: --32
+#ld: -melf_i386
+#readelf: -h
+
+ELF Header:
+#...
+ OS/ABI: UNIX - GNU
+#pass
--- /dev/null
+ .text
+ .type selector, %function
+foo:
+ movl $0, %eax
+ ret
+selector:
+ mov $foo, %eax
+ ret
+ .type selector, %gnu_indirect_function
+ .globl _start
+_start:
+ mov $selector, %eax
+ call *%eax
+ ret
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#name: PR ld/18815
+#as: --64
+#ld: -melf_x86_64
+#readelf: -h
+
+ELF Header:
+#...
+ OS/ABI: UNIX - GNU
+#pass
--- /dev/null
+ .text
+ .type selector, %function
+foo:
+ movl $0, %eax
+ ret
+selector:
+ mov $foo, %eax
+ ret
+ .type selector, %gnu_indirect_function
+ .globl _start
+_start:
+ mov $selector, %rax
+ call *%rax
+ ret
+ .section .note.GNU-stack,"",@progbits
run_dump_test "pr17935-2"
run_dump_test "pr18160"
run_dump_test "pr18176"
+run_dump_test "pr18815"
# Add $PLT_CFLAGS if PLT is expected.
global PLT_CFLAGS