/* BFD back-end data structures for ELF files.
- Copyright (C) 1992-2015 Free Software Foundation, Inc.
+ Copyright (C) 1992-2016 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
struct elf_link_hash_entry *parent;
};
+/* ELF symbol version. */
+enum elf_symbol_version
+ {
+ unknown = 0,
+ unversioned,
+ versioned,
+ versioned_hidden
+ };
+
/* ELF linker hash table entries. */
struct elf_link_hash_entry
unsigned int needs_plt : 1;
/* Symbol appears in a non-ELF input file. */
unsigned int non_elf : 1;
- /* Symbol should be marked as hidden in the version information. */
- unsigned int hidden : 1;
+ /* Symbol version information. */
+ ENUM_BITFIELD (elf_symbol_version) versioned : 2;
/* Symbol was forced to local scope due to a version script file. */
unsigned int forced_local : 1;
/* Symbol was forced to be dynamic due to a version script file. */
asection *iplt;
asection *irelplt;
asection *irelifunc;
+ asection *dynsym;
};
/* Look up an entry in an ELF linker hash table. */
struct bfd_elf_special_section
{
const char *prefix;
- int prefix_length;
+ unsigned int prefix_length;
/* 0 means name must match PREFIX exactly.
-1 means name must start with PREFIX followed by an arbitrary string.
-2 means name must match PREFIX exactly or consist of PREFIX followed
by a dot then anything.
> 0 means name must start with the first PREFIX_LENGTH chars of
PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX. */
- int suffix_length;
- int type;
+ signed int suffix_length;
+ unsigned int type;
bfd_vma attr;
};
unsigned int (*elf_backend_count_relocs)
(struct bfd_link_info *, asection *);
+ /* Count additionals relocations. Called for relocatable links if
+ additional relocations needs to be created. */
+ unsigned int (*elf_backend_count_additional_relocs)
+ (asection *);
+
/* Say whether to sort relocs output by ld -r and ld --emit-relocs,
by r_offset. If NULL, default to true. */
bfd_boolean (*sort_relocs_p)
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)
+ };
+
+typedef struct elf_section_list
+{
+ Elf_Internal_Shdr hdr;
+ unsigned int ndx;
+ struct elf_section_list * next;
+} elf_section_list;
+
+
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
Elf_Internal_Shdr dynversym_hdr;
Elf_Internal_Shdr dynverref_hdr;
Elf_Internal_Shdr dynverdef_hdr;
- Elf_Internal_Shdr symtab_shndx_hdr;
+ elf_section_list * symtab_shndx_list;
bfd_vma gp; /* The gp value */
unsigned int gp_size; /* The gp size */
unsigned int num_elf_sections; /* elf_sect_ptr size */
Elf_Internal_Shdr **group_sect_ptr;
int num_group;
- unsigned int symtab_section, symtab_shndx_section, dynsymtab_section;
+ unsigned int symtab_section, dynsymtab_section;
unsigned int dynversym_section, dynverdef_section, dynverref_section;
/* An identifier used to distinguish different target
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;
#define elf_stack_flags(bfd) (elf_tdata(bfd) -> o->stack_flags)
#define elf_shstrtab(bfd) (elf_tdata(bfd) -> o->strtab_ptr)
#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
-#define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section)
+#define elf_symtab_shndx_list(bfd) (elf_tdata(bfd) -> symtab_shndx_list)
#define elf_strtab_sec(bfd) (elf_tdata(bfd) -> o->strtab_section)
#define elf_shstrtab_sec(bfd) (elf_tdata(bfd) -> o->shstrtab_section)
#define elf_symtab_hdr(bfd) (elf_tdata(bfd) -> symtab_hdr)
(bfd *, asymbol **, asymbol *, const char **, unsigned int *);
extern bfd_boolean _bfd_elf_find_inliner_info
(bfd *, const char **, const char **, unsigned int *);
-extern bfd_boolean _bfd_elf_find_function
+extern asymbol *_bfd_elf_find_function
(bfd *, asymbol **, asection *, bfd_vma, const char **, const char **);
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
extern asection *_bfd_elf_gc_mark_rsec
(struct bfd_link_info *, asection *, elf_gc_mark_hook_fn,
- struct elf_reloc_cookie *);
+ struct elf_reloc_cookie *, bfd_boolean *);
extern bfd_boolean _bfd_elf_gc_mark_reloc
(struct bfd_link_info *, asection *, elf_gc_mark_hook_fn,
else if (info->unresolved_syms_in_objects == RM_IGNORE \
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
ignored = TRUE; \
- else if (!info->relocatable) \
+ else if (!bfd_link_relocatable (info)) \
{ \
bfd_boolean err; \
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
_bfd_clear_contents (howto, input_bfd, input_section, \
contents + rel[index].r_offset); \
\
- if (info->relocatable \
+ if (bfd_link_relocatable (info) \
&& (input_section->flags & SEC_DEBUGGING)) \
{ \
/* Only remove relocations in debug sections since other \