diff options
author | Maciej W. Rozycki <macro@mips.com> | 2018-07-17 20:04:53 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@mips.com> | 2018-07-17 20:04:53 +0100 |
commit | c691de6a16a87adc686ce5cd6c9be54ee0b1a8c1 (patch) | |
tree | 758decbdd8755cbfe0f9d42d60131f9698978cf4 /bfd/xcofflink.c | |
parent | d5c928c05356b22af08450bf43b262ccc1b1d8ee (diff) | |
download | binutils-c691de6a16a87adc686ce5cd6c9be54ee0b1a8c1.zip binutils-c691de6a16a87adc686ce5cd6c9be54ee0b1a8c1.tar.gz binutils-c691de6a16a87adc686ce5cd6c9be54ee0b1a8c1.tar.bz2 |
BFD: Use `bfd_is_abs_symbol' to determine whether a symbol is absolute
Use `bfd_is_abs_symbol' to determine whether a symbol is absolute,
avoiding a problem with ordinary symbols defined in a linker script
outside an output section definition. Such symbols have its owning
section set to the absolute section up to the final link phase. A flag
has been added to the link hash to identify such symbols. Rather than
checking the flag by hand, use the macro that does it uniformly for all
users.
bfd/
* elf32-nds32.c (nds32_elf_relax_loadstore): Use
`bfd_is_abs_symbol' rather than `bfd_is_abs_section' in checking
whether the symbol is absolute.
(nds32_elf_relax_lo12): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
(elfNN_aarch64_check_relocs): Likewise.
* xcofflink.c (xcoff_need_ldrel_p): Likewise.
(bfd_xcoff_import_symbol): Likewise.
(xcoff_write_global_symbol): Likewise.
Diffstat (limited to 'bfd/xcofflink.c')
-rw-r--r-- | bfd/xcofflink.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index ac95390..b7a50de 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -2687,10 +2687,7 @@ xcoff_need_ldrel_p (struct bfd_link_info *info, struct internal_reloc *rel, case R_RLA: /* Absolute relocations against absolute symbols can be resolved statically. */ - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && bfd_is_abs_section (h->root.u.def.section)) + if (h != NULL && bfd_is_abs_symbol (&h->root)) return FALSE; return TRUE; @@ -3125,7 +3122,7 @@ bfd_xcoff_import_symbol (bfd *output_bfd, if (val != (bfd_vma) -1) { if (h->root.type == bfd_link_hash_defined - && (! bfd_is_abs_section (h->root.u.def.section) + && (!bfd_is_abs_symbol (&h->root) || h->root.u.def.value != val)) (*info->callbacks->multiple_definition) (info, &h->root, output_bfd, bfd_abs_section_ptr, val); @@ -5589,7 +5586,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf) || h->root.type == bfd_link_hash_defweak) && h->smclas == XMC_XO) { - BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section)); + BFD_ASSERT (bfd_is_abs_symbol (&h->root)); isym.n_value = h->root.u.def.value; isym.n_scnum = N_UNDEF; if (h->root.type == bfd_link_hash_undefweak |