diff options
Diffstat (limited to 'bfd/elfxx-x86.c')
-rw-r--r-- | bfd/elfxx-x86.c | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 81c1e5c..62d516a 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -31,7 +31,7 @@ #define ELF64_DYNAMIC_INTERPRETER "/lib/ld64.so.1" #define ELFX32_DYNAMIC_INTERPRETER "/lib/ldx32.so.1" -bfd_boolean +bool _bfd_x86_elf_mkobject (bfd *abfd) { return bfd_elf_allocate_object (abfd, @@ -82,7 +82,7 @@ _bfd_x86_elf_dtpoff_base (struct bfd_link_info *info) /* Allocate space in .plt, .got and associated reloc sections for dynamic relocs. */ -static bfd_boolean +static bool elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct bfd_link_info *info; @@ -90,11 +90,11 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) struct elf_x86_link_hash_entry *eh; struct elf_dyn_relocs *p; unsigned int plt_entry_size; - bfd_boolean resolved_to_zero; + bool resolved_to_zero; const struct elf_backend_data *bed; if (h->root.type == bfd_link_hash_indirect) - return TRUE; + return true; eh = (struct elf_x86_link_hash_entry *) h; @@ -102,7 +102,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) bed = get_elf_backend_data (info->output_bfd); htab = elf_x86_hash_table (info, bed->target_id); if (htab == NULL) - return FALSE; + return false; plt_entry_size = htab->plt.plt_entry_size; @@ -136,7 +136,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) (htab->plt.has_plt0 * plt_entry_size), htab->got_entry_size, - TRUE)) + true)) { asection *s = htab->plt_second; if (h->plt.offset != (bfd_vma) -1 && s != NULL) @@ -148,10 +148,10 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) s->size += htab->non_lazy_plt->plt_entry_size; } - return TRUE; + return true; } else - return FALSE; + return false; } /* Don't create the PLT entry if there are only function pointer relocations which can be resolved at run-time. */ @@ -159,7 +159,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) && (h->plt.refcount > 0 || eh->plt_got.refcount > 0)) { - bfd_boolean use_plt_got = eh->plt_got.refcount > 0; + bool use_plt_got = eh->plt_got.refcount > 0; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ @@ -169,7 +169,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) && h->root.type == bfd_link_hash_undefweak) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; + return false; } if (bfd_link_pic (info) @@ -178,7 +178,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) asection *s = htab->elf.splt; asection *second_s = htab->plt_second; asection *got_s = htab->plt_got; - bfd_boolean use_plt; + bool use_plt; /* If this is the first .plt entry, make room for the special first entry. The .plt section is used by prelink to undo @@ -203,7 +203,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) NB: If PLT is PC-relative, we can use the .plt in PIE for function address. */ if (h->def_regular) - use_plt = FALSE; + use_plt = false; else if (htab->pcrel_plt) use_plt = ! bfd_link_dll (info); else @@ -308,7 +308,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else if (h->got.refcount > 0) { asection *s; - bfd_boolean dyn; + bool dyn; int tls_type = elf_x86_hash_entry (h)->tls_type; /* Make sure this symbol is output as a dynamic symbol. @@ -319,7 +319,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) && h->root.type == bfd_link_hash_undefweak) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; + return false; } s = htab->elf.sgot; @@ -375,7 +375,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) h->got.offset = (bfd_vma) -1; if (h->dyn_relocs == NULL) - return TRUE; + return true; /* In the shared -Bsymbolic case, discard space allocated for dynamic pc-relative relocs against symbols which turn out to be @@ -451,7 +451,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) non-PLT reloations. */ if (h->dyn_relocs != NULL && !bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; + return false; } else h->dyn_relocs = NULL; @@ -459,7 +459,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else if (h->dynindx == -1 && !h->forced_local && !bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; + return false; } else if (bfd_link_executable (info) && (h->needs_copy || eh->needs_copy) @@ -504,7 +504,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) && !resolved_to_zero && h->root.type == bfd_link_hash_undefweak && ! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; + return false; /* If that succeeded, we know we'll be keeping all the relocs. */ @@ -528,7 +528,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) sreloc->size += p->count * htab->sizeof_reloc; } - return TRUE; + return true; } /* Allocate space in .plt, .got and associated reloc sections for @@ -555,7 +555,7 @@ elf_x86_allocate_local_dynreloc (void **slot, void *inf) struct elf_link_hash_entry * _bfd_elf_x86_get_local_sym_hash (struct elf_x86_link_hash_table *htab, bfd *abfd, const Elf_Internal_Rela *rel, - bfd_boolean create) + bool create) { struct elf_x86_link_hash_entry e, *ret; asection *sec = abfd->sections; @@ -683,13 +683,13 @@ elf_x86_link_hash_table_free (bfd *obfd) _bfd_elf_link_hash_table_free (obfd); } -static bfd_boolean +static bool elf_i386_is_reloc_section (const char *secname) { return startswith (secname, ".rel"); } -static bfd_boolean +static bool elf_x86_64_is_reloc_section (const char *secname) { return startswith (secname, ".rela"); @@ -722,7 +722,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd) { ret->is_reloc_section = elf_x86_64_is_reloc_section; ret->got_entry_size = 8; - ret->pcrel_plt = TRUE; + ret->pcrel_plt = true; ret->tls_get_addr = "__tls_get_addr"; } if (ABI_64_P (abfd)) @@ -747,7 +747,7 @@ _bfd_x86_elf_link_hash_table_create (bfd *abfd) ret->is_reloc_section = elf_i386_is_reloc_section; ret->sizeof_reloc = sizeof (Elf32_External_Rel); ret->got_entry_size = 4; - ret->pcrel_plt = FALSE; + ret->pcrel_plt = false; ret->pointer_r_type = R_386_32; ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER; ret->dynamic_interpreter_size @@ -796,7 +796,7 @@ elf_x86_linker_defined (struct bfd_link_info *info, const char *name) struct elf_link_hash_entry *h; h = elf_link_hash_lookup (elf_hash_table (info), name, - FALSE, FALSE, FALSE); + false, false, false); if (h == NULL) return; @@ -823,7 +823,7 @@ elf_x86_hide_linker_defined (struct bfd_link_info *info, struct elf_link_hash_entry *h; h = elf_link_hash_lookup (elf_hash_table (info), name, - FALSE, FALSE, FALSE); + false, false, false); if (h == NULL) return; @@ -832,10 +832,10 @@ elf_x86_hide_linker_defined (struct bfd_link_info *info, if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) - _bfd_elf_link_hash_hide_symbol (info, h, TRUE); + _bfd_elf_link_hash_hide_symbol (info, h, true); } -bfd_boolean +bool _bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info) { if (!bfd_link_relocatable (info)) @@ -850,7 +850,7 @@ _bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info) h = elf_link_hash_lookup (elf_hash_table (info), htab->tls_get_addr, - FALSE, FALSE, FALSE); + false, false, false); if (h != NULL) { elf_x86_hash_entry (h)->tls_get_addr = 1; @@ -890,7 +890,7 @@ _bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info) return _bfd_elf_link_check_relocs (abfd, info); } -bfd_boolean +bool _bfd_elf_x86_valid_reloc_p (asection *input_section, struct bfd_link_info *info, struct elf_x86_link_hash_table *htab, @@ -898,11 +898,11 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym, Elf_Internal_Shdr *symtab_hdr, - bfd_boolean *no_dynreloc_p) + bool *no_dynreloc_p) { - bfd_boolean valid_p = TRUE; + bool valid_p = true; - *no_dynreloc_p = FALSE; + *no_dynreloc_p = false; /* Check If relocation against non-preemptible absolute symbol is valid in PIC. FIXME: Can't use SYMBOL_REFERENCES_LOCAL_P since @@ -955,7 +955,7 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, || r_type == R_386_8); if (valid_p) - *no_dynreloc_p = TRUE; + *no_dynreloc_p = true; else { const char *name; @@ -986,21 +986,21 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, /* Set the sizes of the dynamic sections. */ -bfd_boolean +bool _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) { struct elf_x86_link_hash_table *htab; bfd *dynobj; asection *s; - bfd_boolean relocs; + bool relocs; bfd *ibfd; const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); htab = elf_x86_hash_table (info, bed->target_id); if (htab == NULL) - return FALSE; + return false; dynobj = htab->elf.dynobj; if (dynobj == NULL) abort (); @@ -1237,10 +1237,10 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, /* We now have determined the sizes of the various dynamic sections. Allocate memory for them. */ - relocs = FALSE; + relocs = false; for (s = dynobj->sections; s != NULL; s = s->next) { - bfd_boolean strip_section = TRUE; + bool strip_section = true; if ((s->flags & SEC_LINKER_CREATED) == 0) continue; @@ -1255,7 +1255,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, It's too late to tell BFD to get rid of the symbols. */ if (htab->elf.hplt != NULL) - strip_section = FALSE; + strip_section = false; } else if (s == htab->elf.sgotplt || s == htab->elf.iplt @@ -1275,7 +1275,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, if (s->size != 0 && s != htab->elf.srelplt && s != htab->srelplt2) - relocs = TRUE; + relocs = true; /* We use the reloc_count field as a counter if we need to copy relocs into the output file. */ @@ -1321,7 +1321,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, reloc instead of garbage. */ s->contents = (unsigned char *) bfd_zalloc (dynobj, s->size); if (s->contents == NULL) - return FALSE; + return false; } if (htab->plt_eh_frame != NULL @@ -1578,7 +1578,7 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, } -bfd_boolean +bool _bfd_x86_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) { @@ -1590,7 +1590,7 @@ _bfd_x86_elf_always_size_sections (bfd *output_bfd, tlsbase = elf_link_hash_lookup (elf_hash_table (info), "_TLS_MODULE_BASE_", - FALSE, FALSE, FALSE); + false, false, false); if (tlsbase && tlsbase->type == STT_TLS) { @@ -1601,13 +1601,13 @@ _bfd_x86_elf_always_size_sections (bfd *output_bfd, htab = elf_x86_hash_table (info, bed->target_id); if (htab == NULL) - return FALSE; + return false; if (!(_bfd_generic_link_add_one_symbol (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL, - tls_sec, 0, NULL, FALSE, + tls_sec, 0, NULL, false, bed->collect, &bh))) - return FALSE; + return false; htab->tls_module_base = bh; @@ -1615,18 +1615,18 @@ _bfd_x86_elf_always_size_sections (bfd *output_bfd, tlsbase->def_regular = 1; tlsbase->other = STV_HIDDEN; tlsbase->root.linker_def = 1; - (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE); + (*bed->elf_backend_hide_symbol) (info, tlsbase, true); } } - return TRUE; + return true; } void _bfd_x86_elf_merge_symbol_attribute (struct elf_link_hash_entry *h, unsigned int st_other, - bfd_boolean definition, - bfd_boolean dynamic ATTRIBUTE_UNUSED) + bool definition, + bool dynamic ATTRIBUTE_UNUSED) { if (definition) { @@ -1682,7 +1682,7 @@ _bfd_x86_elf_copy_indirect_symbol (struct bfd_link_info *info, /* Remove undefined weak symbol from the dynamic symbol table if it is resolved to 0. */ -bfd_boolean +bool _bfd_x86_elf_fixup_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h) { @@ -1693,7 +1693,7 @@ _bfd_x86_elf_fixup_symbol (struct bfd_link_info *info, _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, h->dynstr_index); } - return TRUE; + return true; } /* Change the STT_GNU_IFUNC symbol defined in position-dependent @@ -1790,13 +1790,13 @@ _bfd_x86_elf_link_report_relative_reloc /* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ -bfd_boolean +bool _bfd_x86_elf_hash_symbol (struct elf_link_hash_entry *h) { if (h->plt.offset != (bfd_vma) -1 && !h->def_regular && !h->pointer_equality_needed) - return FALSE; + return false; return _bfd_elf_hash_symbol (h); } @@ -1807,7 +1807,7 @@ _bfd_x86_elf_hash_symbol (struct elf_link_hash_entry *h) change the definition to something the rest of the link can understand. */ -bfd_boolean +bool _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h) { @@ -1863,7 +1863,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->plt.offset = (bfd_vma) -1; h->needs_plt = 0; } - return TRUE; + return true; } /* If this is a function, put it in the procedure linkage table. We @@ -1886,7 +1886,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->needs_plt = 0; } - return TRUE; + return true; } else /* It's possible that we incorrectly decided a .plt reloc was needed @@ -1915,7 +1915,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->non_got_ref = def->non_got_ref; eh->needs_copy = def->needs_copy; } - return TRUE; + return true; } /* This is a reference to a symbol defined by a dynamic object which @@ -1926,24 +1926,24 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, For such cases we need not do anything here; the relocations will be handled correctly by relocate_section. */ if (!bfd_link_executable (info)) - return TRUE; + return true; /* If there are no references to this symbol that do not use the GOT nor R_386_GOTOFF relocation, we don't need to generate a copy reloc. NB: gotoff_ref is always 0 for x86-64. */ if (!h->non_got_ref && !eh->gotoff_ref) - return TRUE; + return true; /* If -z nocopyreloc was given, we won't generate them either. */ if (info->nocopyreloc || SYMBOL_NO_COPYRELOC (info, eh)) { h->non_got_ref = 0; - return TRUE; + return true; } htab = elf_x86_hash_table (info, bed->target_id); if (htab == NULL) - return FALSE; + return false; /* If there aren't any dynamic relocs in read-only sections nor R_386_GOTOFF relocation, then we can keep the dynamic relocs and @@ -1961,7 +1961,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (!_bfd_elf_readonly_dynrelocs (h)) { h->non_got_ref = 0; - return TRUE; + return true; } } @@ -2000,7 +2000,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, void _bfd_x86_elf_hide_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, - bfd_boolean force_local) + bool force_local) { if (h->root.type == bfd_link_hash_undefweak && info->nointerp @@ -2022,7 +2022,7 @@ _bfd_x86_elf_hide_symbol (struct bfd_link_info *info, SYMBOL_REFERENCES_LOCAL, but it also checks version script. It works in check_relocs. */ -bfd_boolean +bool _bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info, struct elf_link_hash_entry *h) { @@ -2031,10 +2031,10 @@ _bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info, = (struct elf_x86_link_hash_table *) info->hash; if (eh->local_ref > 1) - return TRUE; + return true; if (eh->local_ref == 1) - return FALSE; + return false; /* Unversioned symbols defined in regular objects can be forced local by linker version script. A weak undefined symbol is forced local @@ -2054,11 +2054,11 @@ _bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info, && _bfd_elf_link_hide_sym_by_version (info, h))) { eh->local_ref = 2; - return TRUE; + return true; } eh->local_ref = 1; - return FALSE; + return false; } /* Return the section that should be marked against GC for a given @@ -2107,7 +2107,7 @@ elf_x86_64_get_plt_got_vma (struct elf_x86_plt *plt_p, return plt_p->sec->vma + offset + off + plt_p->plt_got_insn_size; } -static bfd_boolean +static bool elf_i386_valid_plt_reloc_p (unsigned int type) { return (type == R_386_JUMP_SLOT @@ -2115,7 +2115,7 @@ elf_i386_valid_plt_reloc_p (unsigned int type) || type == R_386_IRELATIVE); } -static bfd_boolean +static bool elf_x86_64_valid_plt_reloc_p (unsigned int type) { return (type == R_X86_64_JUMP_SLOT @@ -2143,7 +2143,7 @@ _bfd_x86_elf_get_synthetic_symtab (bfd *abfd, const struct elf_backend_data *bed; bfd_vma (*get_plt_got_vma) (struct elf_x86_plt *, bfd_vma, bfd_vma, bfd_vma); - bfd_boolean (*valid_plt_reloc_p) (unsigned int); + bool (*valid_plt_reloc_p) (unsigned int); dynrelbuf = NULL; if (count == 0) @@ -2373,7 +2373,7 @@ _bfd_x86_elf_parse_gnu_properties (bfd *abfd, unsigned int type, return TRUE if APROP is updated. Otherwise, return TRUE if BPROP should be merged with ABFD. */ -bfd_boolean +bool _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd ATTRIBUTE_UNUSED, bfd *bbfd ATTRIBUTE_UNUSED, @@ -2381,7 +2381,7 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, elf_property *bprop) { unsigned int number, features; - bfd_boolean updated = FALSE; + bool updated = false; const struct elf_backend_data *bed; struct elf_x86_link_hash_table *htab; unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type; @@ -2398,7 +2398,7 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, /* Remove this property since the other input file doesn't have it. */ aprop->pr_kind = property_remove; - updated = TRUE; + updated = true; } } else @@ -2443,7 +2443,7 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, if (aprop->u.number == 0) { aprop->pr_kind = property_remove; - updated = TRUE; + updated = true; } else updated = number != (unsigned int) aprop->u.number; @@ -2458,7 +2458,7 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, { /* Remove APROP if all bits are empty. */ aprop->pr_kind = property_remove; - updated = TRUE; + updated = true; } } else @@ -2538,14 +2538,14 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info, } else { - updated = TRUE; + updated = true; bprop->u.number = features; } } else if (aprop != NULL) { aprop->pr_kind = property_remove; - updated = TRUE; + updated = true; } } return updated; @@ -2566,11 +2566,11 @@ bfd * _bfd_x86_elf_link_setup_gnu_properties (struct bfd_link_info *info, struct elf_x86_init_table *init_table) { - bfd_boolean normal_target; - bfd_boolean lazy_plt; + bool normal_target; + bool lazy_plt; asection *sec, *pltsec; bfd *dynobj; - bfd_boolean use_ibt_plt; + bool use_ibt_plt; unsigned int plt_alignment, features, isa_level; struct elf_x86_link_hash_table *htab; bfd *pbfd; @@ -2710,12 +2710,12 @@ _bfd_x86_elf_link_setup_gnu_properties const char *lam_u57_msg = NULL; const char *missing; elf_property_list *p; - bfd_boolean missing_ibt, missing_shstk; - bfd_boolean missing_lam_u48, missing_lam_u57; - bfd_boolean check_ibt + bool missing_ibt, missing_shstk; + bool missing_lam_u48, missing_lam_u57; + bool check_ibt = (htab->params->cet_report && (htab->params->cet_report & prop_report_ibt)); - bfd_boolean check_shstk + bool check_shstk = (htab->params->cet_report && (htab->params->cet_report & prop_report_shstk)); @@ -2886,7 +2886,7 @@ _bfd_x86_elf_link_setup_gnu_properties if (htab->non_lazy_plt != NULL && (!htab->plt.has_plt0 || pltsec == NULL)) { - lazy_plt = FALSE; + lazy_plt = false; if (bfd_link_pic (info)) htab->plt.plt_entry = htab->non_lazy_plt->pic_plt_entry; else @@ -2901,7 +2901,7 @@ _bfd_x86_elf_link_setup_gnu_properties } else { - lazy_plt = TRUE; + lazy_plt = true; if (bfd_link_pic (info)) { htab->plt.plt0_entry = htab->lazy_plt->pic_plt0_entry; |