From: Ian Lance Taylor Date: Fri, 27 Oct 1995 03:36:17 +0000 (+0000) Subject: more XCOFF linker tweaks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aad2c618d3e074fe49d42bf79d7f9375c85567ec;p=binutils-gdb.git more XCOFF linker tweaks --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 963176aef03..b22e5e5d3a0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -14,6 +14,8 @@ Thu Oct 26 14:16:47 1995 Ian Lance Taylor based on sections stored in xcoff_data. * coff-rs6000.c (xcoff_copy_private_bfd_data): Copy new xcoff_data fields. + (xcoff_reloc_type_lookup): Handle BFD_RELOC_CTOR. + (rs6000coff_vec): Set symbol_leading_char to '.'. * coffgen.c (coff_get_symbol_info): If fix_value is set, fix the value stored in ret rather than returning a pointer value. diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index f837a08414a..39ad311b0e4 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -506,6 +506,7 @@ xcoff_reloc_type_lookup (abfd, code) case BFD_RELOC_PPC_TOC16: return &xcoff_howto_table[3]; case BFD_RELOC_32: + case BFD_RELOC_CTOR: return &xcoff_howto_table[0]; default: return NULL; @@ -1352,7 +1353,8 @@ const bfd_target rs6000coff_vec = HAS_SYMS | HAS_LOCALS | WP_TEXT), (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading char */ + /* Making the leading_char a period should make for nicer messages. */ + '.', /* leading char */ '/', /* ar_pad_char */ 15, /* ar_max_namelen??? FIXMEmgo */ diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 8dedde0c762..843dc0676e3 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -603,7 +603,8 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs, if (enclosing != NULL && (coff_section_data (abfd, enclosing) == NULL || coff_section_data (abfd, enclosing)->relocs == NULL) - && cache) + && cache + && enclosing->reloc_count > 0) { if (_bfd_coff_read_internal_relocs (abfd, enclosing, true, external_relocs, false, @@ -1478,6 +1479,7 @@ xcoff_link_add_symbols (abfd, info) if (sym.n_sclass == C_EXT) { csect->flags |= SEC_IS_COMMON; + csect->_raw_size = 0; section = csect; value = aux.x_csect.x_scnlen.l; } @@ -1533,7 +1535,7 @@ xcoff_link_add_symbols (abfd, info) if (! (_bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, - (const char *) NULL, copy, false, + (const char *) NULL, copy, true, (struct bfd_link_hash_entry **) sym_hash))) goto error_return; @@ -1640,7 +1642,7 @@ xcoff_link_add_symbols (abfd, info) (info, abfd, hds->root.root.string, (flagword) 0, bfd_und_section_ptr, (bfd_vma) 0, (const char *) NULL, false, - false, + true, (struct bfd_link_hash_entry **) NULL))) goto error_return; } @@ -2578,6 +2580,18 @@ xcoff_build_ldsyms (h, p) } } + /* If this is still a common symbol, and it wasn't garbage + collected, we need to actually allocate space for it in the .bss + section. */ + if (h->root.type == bfd_link_hash_common + && (! xcoff_hash_table (ldinfo->info)->gc + || (h->flags & XCOFF_MARK) != 0) + && h->root.u.c.p->section->_raw_size == 0) + { + BFD_ASSERT (bfd_is_com_section (h->root.u.c.p->section)); + h->root.u.c.p->section->_raw_size = h->root.u.c.size; + } + /* We need to add a symbol to the .loader section if it is mentioned in a reloc which we are copying to the .loader section and it was not defined or common, or if it is the entry point. */ @@ -4792,6 +4806,14 @@ _bfd_ppc_xcoff_relocate_section (output_bfd, info, input_bfd, + sec->output_section->vma + sec->output_offset); } + else if (h->root.type == bfd_link_hash_common) + { + asection *sec; + + sec = h->root.u.c.p->section; + val = (sec->output_section->vma + + sec->output_offset); + } else if ((h->flags & XCOFF_REF_DYNAMIC) != 0 || (h->flags & XCOFF_IMPORT) != 0) {