* xcofflink.c (xcoff_link_add_symbols): Don't check an XMC_TD

symbol for a magic name.
	(xcoff_link_input_bfd): Don't change the reloc symbol for an
	XMC_TD symbol.
	(_bfd_ppc_xcoff_relocate_section): Don't get the TOC offset for an
	XMC_TD symbol.
This commit is contained in:
Ian Lance Taylor 1996-07-18 19:41:35 +00:00
parent b576c7b3d2
commit a8a3d83af0
2 changed files with 109 additions and 76 deletions

View File

@ -1,3 +1,12 @@
Thu Jul 18 15:39:10 1996 Ian Lance Taylor <ian@cygnus.com>
* xcofflink.c (xcoff_link_add_symbols): Don't check an XMC_TD
symbol for a magic name.
(xcoff_link_input_bfd): Don't change the reloc symbol for an
XMC_TD symbol.
(_bfd_ppc_xcoff_relocate_section): Don't get the TOC offset for an
XMC_TD symbol.
Thu Jul 18 11:36:31 1996 Stan Shebs <shebs@andros.cygnus.com>
* mpw-config.in: Add ELF support to mips config, create the

View File

@ -256,7 +256,7 @@ struct xcoff_link_hash_entry
set), this is the offset in toc_section. */
bfd_vma toc_offset;
/* If the TOC entry comes from an input file, this is set to the
symbo lindex of the C_HIDEXT XMC_TC symbol. */
symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */
long toc_indx;
} u;
@ -1202,7 +1202,10 @@ xcoff_link_check_ar_symbols (abfd, info, pneeded)
defines it. We also don't bring in symbols to satisfy
undefined references in shared objects. */
if (h != (struct bfd_link_hash_entry *) NULL
&& h->type == bfd_link_hash_undefined)
&& h->type == bfd_link_hash_undefined
&& (info->hash->creator != abfd->xvec
|| (((struct xcoff_link_hash_entry *) h)->flags
& XCOFF_DEF_DYNAMIC) == 0))
{
if (! (*info->callbacks->add_archive_element) (info, abfd, name))
return false;
@ -1278,8 +1281,12 @@ xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded)
h = bfd_link_hash_lookup (info->hash, name, false, false, true);
/* We are only interested in symbols that are currently
undefined. */
if (h != NULL && h->type == bfd_link_hash_undefined)
undefined. At this point we know that we are using an XCOFF
hash table. */
if (h != NULL
&& h->type == bfd_link_hash_undefined
&& (((struct xcoff_link_hash_entry *) h)->flags
& XCOFF_DEF_DYNAMIC) == 0)
{
if (! (*info->callbacks->add_archive_element) (info, abfd, name))
return false;
@ -1402,9 +1409,11 @@ xcoff_link_add_symbols (abfd, info)
return false;
}
/* We need to build a .loader section, so we do it here. This won't
work if we're producing an XCOFF output file with no XCOFF input
files. FIXME. */
if (info->hash->creator == abfd->xvec)
{
/* We need to build a .loader section, so we do it here. This
won't work if we're producing an XCOFF output file with no
XCOFF input files. FIXME. */
if (xcoff_hash_table (info)->loader_section == NULL)
{
asection *lsec;
@ -1424,7 +1433,8 @@ xcoff_link_add_symbols (abfd, info)
if (lsec == NULL)
goto error_return;
xcoff_hash_table (info)->linkage_section = lsec;
lsec->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
lsec->alignment_power = 2;
}
/* Likewise for the TOC section. */
@ -1436,7 +1446,8 @@ xcoff_link_add_symbols (abfd, info)
if (tsec == NULL)
goto error_return;
xcoff_hash_table (info)->toc_section = tsec;
tsec->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
tsec->alignment_power = 2;
}
/* Likewise for the descriptor section. */
@ -1448,7 +1459,8 @@ xcoff_link_add_symbols (abfd, info)
if (dsec == NULL)
goto error_return;
xcoff_hash_table (info)->descriptor_section = dsec;
dsec->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
dsec->alignment_power = 2;
}
/* Likewise for the .debug section. */
@ -1462,6 +1474,7 @@ xcoff_link_add_symbols (abfd, info)
xcoff_hash_table (info)->debug_section = dsec;
dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
}
if ((abfd->flags & DYNAMIC) != 0
&& ! info->static_link)
@ -2069,7 +2082,8 @@ xcoff_link_add_symbols (abfd, info)
/* Check for magic symbol names. */
if ((smtyp == XTY_SD || smtyp == XTY_CM)
&& aux.x_csect.x_smclas != XMC_TC)
&& aux.x_csect.x_smclas != XMC_TC
&& aux.x_csect.x_smclas != XMC_TD)
{
int i;
@ -2130,7 +2144,14 @@ xcoff_link_add_symbols (abfd, info)
&& ! bfd_is_und_section (section)
&& ! bfd_is_com_section (section))
{
if ((abfd->flags & DYNAMIC) != 0)
/* If the existing symbol is to global linkage code,
and this symbol is not global linkage code, then
replace the existing symbol. */
if ((abfd->flags & DYNAMIC) != 0
&& ((*sym_hash)->smclas != XMC_GL
|| aux.x_csect.x_smclas == XMC_GL
|| ((*sym_hash)->root.u.def.section->owner->flags
& DYNAMIC) == 0))
{
section = bfd_und_section_ptr;
value = 0;
@ -2207,7 +2228,7 @@ xcoff_link_add_symbols (abfd, info)
/* Make sure that we have seen all the relocs. */
for (o = abfd->sections; o != first_csect; o = o->next)
{
/* Reset the section size and the line numebr count, since the
/* Reset the section size and the line number count, since the
data is now attached to the csects. Don't reset the size of
the .debug section, since we need to read it below in
bfd_xcoff_size_dynamic_sections. */
@ -5113,6 +5134,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
{
h = obj_xcoff_sym_hashes (input_bfd)[r_symndx];
if (h != NULL
&& h->smclas != XMC_TD
&& (irel->r_type == R_TOC
|| irel->r_type == R_GL
|| irel->r_type == R_TCL
@ -6128,7 +6150,9 @@ _bfd_ppc_xcoff_relocate_section (output_bfd, info, input_bfd,
address instruction which may be changed to a load
instruction. FIXME: I don't know if this is the correct
implementation. */
if (h != NULL && h->toc_section == NULL)
if (h != NULL && h->smclas != XMC_TD)
{
if (h->toc_section == NULL)
{
(*_bfd_error_handler)
("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry",
@ -6137,12 +6161,12 @@ _bfd_ppc_xcoff_relocate_section (output_bfd, info, input_bfd,
bfd_set_error (bfd_error_bad_value);
return false;
}
if (h != NULL)
{
BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0);
val = (h->toc_section->output_section->vma
+ h->toc_section->output_offset);
}
val = ((val - xcoff_data (output_bfd)->toc)
- (sym->n_value - xcoff_data (input_bfd)->toc));
addend = 0;