/* BFD back-end data structures for ELF files.
- Copyright 1992-2013 Free Software Foundation, Inc.
+ Copyright (C) 1992-2014 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
If REMOVED == 0, this is the CIE that we have chosen to use for
the output FDE. The CIE's REMOVED field is also 0, but the CIE
- might belong to a different .eh_frame input section from the FDE. */
+ might belong to a different .eh_frame input section from the FDE.
+
+ May be NULL to signify that the FDE should be discarded. */
struct eh_cie_fde *cie_inf;
struct eh_cie_fde *next_for_section;
} fde;
struct eh_frame_array_ent
{
bfd_vma initial_loc;
+ bfd_size_type range;
bfd_vma fde;
};
asection *hdr_sec;
unsigned int fde_count, array_count;
struct eh_frame_array_ent *array;
- /* TRUE if we should try to merge CIEs between input sections. */
- bfd_boolean merge_cies;
- /* TRUE if all .eh_frames have been parsd. */
- bfd_boolean parsed_eh_frames;
/* TRUE if .eh_frame_hdr should contain the sorted search table.
We build it if we successfully read all .eh_frame input sections
and recognize them. */
MICROBLAZE_ELF_DATA,
MIPS_ELF_DATA,
MN10300_ELF_DATA,
+ NDS32_ELF_DATA,
NIOS2_ELF_DATA,
+ OR1K_ELF_DATA,
PPC32_ELF_DATA,
PPC64_ELF_DATA,
S390_ELF_DATA,
reloc_class_normal,
reloc_class_relative,
reloc_class_plt,
- reloc_class_copy
+ reloc_class_copy,
+ reloc_class_ifunc
};
struct elf_reloc_cookie
bfd_boolean (*check_directives)
(bfd *abfd, struct bfd_link_info *info);
- /* The AS_NEEDED_CLEANUP function is called once per --as-needed
- input file that was not needed by the add_symbols phase of the
- ELF backend linker. The function must undo any target specific
- changes in the symbol hash table. */
- bfd_boolean (*as_needed_cleanup)
- (bfd *abfd, struct bfd_link_info *info);
+ /* The NOTICE_AS_NEEDED function is called as the linker is about to
+ handle an as-needed lib (ACT = notice_as_needed), and after the
+ linker has decided to keep the lib (ACT = notice_needed) or when
+ the lib is not needed (ACT = notice_not_needed). */
+ bfd_boolean (*notice_as_needed)
+ (bfd *abfd, struct bfd_link_info *info, enum notice_asneeded_action act);
/* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
linker for every symbol which is defined by a dynamic object and
/* This function returns class of a reloc type. */
enum elf_reloc_type_class (*elf_backend_reloc_type_class)
- (const Elf_Internal_Rela *);
+ (const struct bfd_link_info *, const asection *, const Elf_Internal_Rela *);
/* This function, if defined, removes information about discarded functions
from other sections which mention them. */
/* This function implements `bfd_elf_bfd_from_remote_memory';
see elf.c, elfcode.h. */
bfd *(*elf_backend_bfd_from_remote_memory)
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
- int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
- bfd_size_type len));
+ (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
+ bfd_size_type len));
/* This function is used by `_bfd_elf_get_synthetic_symtab';
see elf.c. */
asection *(*common_section) (asection *);
/* Return TRUE if we can merge 2 definitions. */
- bfd_boolean (*merge_symbol) (struct bfd_link_info *,
- struct elf_link_hash_entry **,
- struct elf_link_hash_entry *,
- Elf_Internal_Sym *, asection **,
- bfd_vma *, unsigned int *,
- bfd_boolean *, bfd_boolean *,
- bfd_boolean *, bfd_boolean *,
- bfd_boolean *, bfd_boolean *,
- bfd_boolean *, bfd_boolean *,
- bfd *, asection **,
- bfd_boolean *, bfd_boolean *,
- bfd_boolean *, bfd_boolean *,
- bfd *, asection **);
+ bfd_boolean (*merge_symbol) (struct elf_link_hash_entry *,
+ const Elf_Internal_Sym *, asection **,
+ bfd_boolean, bfd_boolean,
+ bfd *, const asection *);
/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */
bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *);
other file in the link needs to have a .note.GNU-stack section
for a PT_GNU_STACK segment to be created. */
unsigned default_execstack : 1;
+
+ /* True if elf_section_data(sec)->this_hdr.contents is sec->rawsize
+ in length rather than sec->size in length, if sec->rawsize is
+ non-zero and smaller than sec->size. */
+ unsigned caches_rawsize : 1;
};
/* Information about reloc sections associated with a bfd_elf_section_data
(bfd *input_bfd, struct bfd_link_info *info, asection *eh_frame_section);
extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
- (const Elf_Internal_Rela *);
+ (const struct bfd_link_info *, const asection *,
+ const Elf_Internal_Rela *);
extern bfd_vma _bfd_elf_rela_local_sym
(bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *);
extern bfd_vma _bfd_elf_rel_local_sym
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
(bfd *);
extern void _bfd_elf_link_hash_table_free
- (struct bfd_link_hash_table *);
+ (bfd *);
extern void _bfd_elf_link_hash_copy_indirect
(struct bfd_link_info *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
extern bfd_boolean _bfd_elf_set_arch_mach
(bfd *, enum bfd_architecture, unsigned long);
extern bfd_boolean _bfd_elf_find_nearest_line
- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
- unsigned int *);
-extern bfd_boolean _bfd_elf_find_nearest_line_discriminator
- (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
- unsigned int *, unsigned int *);
+ (bfd *, asymbol **, asection *, bfd_vma,
+ const char **, const char **, unsigned int *, unsigned int *);
extern bfd_boolean _bfd_elf_find_line
(bfd *, asymbol **, asymbol *, const char **, unsigned int *);
-extern bfd_boolean _bfd_elf_find_line_discriminator
- (bfd *, asymbol **, asymbol *, const char **, unsigned int *, unsigned int *);
-#define _bfd_generic_find_line _bfd_elf_find_line
-#define _bfd_generic_find_nearest_line_discriminator \
- _bfd_elf_find_nearest_line_discriminator
extern bfd_boolean _bfd_elf_find_inliner_info
(bfd *, const char **, const char **, unsigned int *);
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_elf_new_section_hook
(bfd *, asection *);
-extern bfd_boolean _bfd_elf_init_reloc_shdr
- (bfd *, struct bfd_elf_section_reloc_data *, asection *, bfd_boolean);
extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
(const char *, const struct bfd_elf_special_section *, unsigned int);
extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
extern void _bfd_elf_strtab_finalize
(struct elf_strtab_hash *);
-extern void _bfd_elf_begin_eh_frame_parsing
- (struct bfd_link_info *info);
extern void _bfd_elf_parse_eh_frame
(bfd *, struct bfd_link_info *, asection *, struct elf_reloc_cookie *);
-extern void _bfd_elf_end_eh_frame_parsing
- (struct bfd_link_info *info);
-
extern bfd_boolean _bfd_elf_discard_section_eh_frame
(bfd *, struct bfd_link_info *, asection *,
bfd_boolean (*) (bfd_vma, void *), struct elf_reloc_cookie *);
extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
(struct bfd_link_info *);
-extern bfd_boolean _bfd_elf_merge_symbol
- (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
- asection **, bfd_vma *, bfd_boolean *, unsigned int *,
- struct elf_link_hash_entry **, bfd_boolean *,
- bfd_boolean *, bfd_boolean *, bfd_boolean *);
-
extern bfd_boolean _bfd_elf_hash_symbol (struct elf_link_hash_entry *);
extern long _bfd_elf_link_lookup_local_dynindx
(struct bfd_link_info *, bfd *, long);
extern bfd_boolean _bfd_elf_compute_section_file_positions
(bfd *, struct bfd_link_info *);
-extern void _bfd_elf_assign_file_positions_for_relocs
- (bfd *);
extern file_ptr _bfd_elf_assign_file_position_for_section
(Elf_Internal_Shdr *, file_ptr, bfd_boolean);
extern bfd_boolean _bfd_elf_setup_sections
(bfd *);
-extern void _bfd_elf_set_osabi (bfd * , struct bfd_link_info *);
+extern void _bfd_elf_post_process_headers (bfd * , struct bfd_link_info *);
extern const bfd_target *bfd_elf32_object_p
(bfd *);
extern bfd_boolean _bfd_elf_relocs_compatible
(const bfd_target *, const bfd_target *);
+extern bfd_boolean _bfd_elf_notice_as_needed
+ (bfd *, struct bfd_link_info *, enum notice_asneeded_action);
extern struct elf_link_hash_entry *_bfd_elf_archive_symbol_lookup
(bfd *, struct bfd_link_info *, const char *);
(bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
extern bfd *_bfd_elf32_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type));
extern bfd *_bfd_elf64_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type));
extern bfd_vma bfd_elf_obj_attr_size (bfd *);
extern bfd_boolean _bfd_elf_create_ifunc_sections
(bfd *, struct bfd_link_info *);
-extern asection * _bfd_elf_create_ifunc_dyn_reloc
- (bfd *, struct bfd_link_info *, asection *sec, asection *sreloc,
- struct elf_dyn_relocs **);
extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
(struct bfd_link_info *, struct elf_link_hash_entry *,
- struct elf_dyn_relocs **, unsigned int, unsigned int);
+ struct elf_dyn_relocs **, unsigned int, unsigned int, unsigned int);
extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *);
extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *);
#define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, \
r_symndx, symtab_hdr, sym_hashes, \
h, sec, relocation, \
- unresolved_reloc, warned) \
+ unresolved_reloc, warned, ignored) \
do \
{ \
/* It seems this can happen with erroneous or unsupported \
\
h = sym_hashes[r_symndx - symtab_hdr->sh_info]; \
\
+ if (info->wrap_hash != NULL \
+ && (input_section->flags & SEC_DEBUGGING) != 0) \
+ h = ((struct elf_link_hash_entry *) \
+ unwrap_hash_lookup (info, input_bfd, &h->root)); \
+ \
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; \
\
warned = FALSE; \
+ ignored = FALSE; \
unresolved_reloc = FALSE; \
relocation = 0; \
if (h->root.type == bfd_link_hash_defined \
; \
else if (info->unresolved_syms_in_objects == RM_IGNORE \
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
- ; \
+ ignored = TRUE; \
else if (!info->relocatable) \
{ \
bfd_boolean err; \
} \
(void) unresolved_reloc; \
(void) warned; \
+ (void) ignored; \
} \
while (0)
rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \
\
/* Avoid empty output section. */ \
- if (rel_hdr->sh_size > count * rel_hdr->sh_entsize) \
+ if (rel_hdr->sh_size > rel_hdr->sh_entsize) \
{ \
- rel_hdr->sh_size -= count * rel_hdr->sh_entsize; \
+ rel_hdr->sh_size -= rel_hdr->sh_entsize; \
rel_hdr = _bfd_elf_single_rel_hdr (input_section); \
- rel_hdr->sh_size -= count * rel_hdr->sh_entsize; \
+ rel_hdr->sh_size -= rel_hdr->sh_entsize; \
\
memmove (rel, rel + count, \
(relend - rel - count) * sizeof (*rel)); \
\
- input_section->reloc_count -= count; \
+ input_section->reloc_count--; \
relend -= count; \
rel--; \
continue; \