* xcofflink.c (xcoff_link_input_bfd): Fix scan for C_BINCL/C_EINCL

symbols.
This commit is contained in:
Ian Lance Taylor 1996-03-22 19:59:20 +00:00
parent 3998d526b9
commit c3dffbd7cd
2 changed files with 49 additions and 28 deletions

View File

@ -1,5 +1,8 @@
Fri Mar 22 12:17:00 1996 Ian Lance Taylor <ian@cygnus.com> Fri Mar 22 12:17:00 1996 Ian Lance Taylor <ian@cygnus.com>
* xcofflink.c (xcoff_link_input_bfd): Fix scan for C_BINCL/C_EINCL
symbols.
* config.bfd: Add ieee_vec to targ_selvecs for i960 targets and * config.bfd: Add ieee_vec to targ_selvecs for i960 targets and
m68k-aout, m68k-coff, and m68k-elf targets. m68k-aout, m68k-coff, and m68k-elf targets.

View File

@ -1672,8 +1672,13 @@ xcoff_link_add_symbols (abfd, info)
OK for symbol redefinitions to occur. I can't figure OK for symbol redefinitions to occur. I can't figure
out just what the XCOFF linker is doing, but out just what the XCOFF linker is doing, but
something like this is required for -bnso to work. */ something like this is required for -bnso to work. */
*sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info), if (! bfd_is_und_section (section))
name, true, copy, false); *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info),
name, true, copy, false);
else
*sym_hash = ((struct xcoff_link_hash_entry *)
bfd_wrapped_link_hash_lookup (abfd, info, name,
true, copy, false));
if (*sym_hash == NULL) if (*sym_hash == NULL)
goto error_return; goto error_return;
if (((*sym_hash)->root.type == bfd_link_hash_defined if (((*sym_hash)->root.type == bfd_link_hash_defined
@ -1982,7 +1987,7 @@ xcoff_link_add_dynamic_symbols (abfd, info)
name = nambuf; name = nambuf;
} }
/* Normally we could not xcoff_link_hash_lookup in an add /* Normally we could not call xcoff_link_hash_lookup in an add
symbols routine, since we might not be using an XCOFF hash symbols routine, since we might not be using an XCOFF hash
table. However, we verified above that we are using an XCOFF table. However, we verified above that we are using an XCOFF
hash table. */ hash table. */
@ -2214,7 +2219,10 @@ xcoff_mark (info, sec)
&& h->root.root.string[0] == '.' && h->root.root.string[0] == '.'
&& h->descriptor != NULL && h->descriptor != NULL
&& ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0
|| info->shared))) || info->shared
|| ((h->descriptor->flags & XCOFF_IMPORT) != 0
&& (h->descriptor->flags
& XCOFF_DEF_REGULAR) == 0))))
break; break;
/* Fall through. */ /* Fall through. */
case R_POS: case R_POS:
@ -2488,8 +2496,9 @@ bfd_xcoff_link_count_reloc (output_bfd, info, name)
if (! XCOFF_XVECP (output_bfd->xvec)) if (! XCOFF_XVECP (output_bfd->xvec))
return true; return true;
h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, false, false, h = ((struct xcoff_link_hash_entry *)
false); bfd_wrapped_link_hash_lookup (output_bfd, info, name, false, false,
false));
if (h == NULL) if (h == NULL)
{ {
(*_bfd_error_handler) ("%s: no such symbol", name); (*_bfd_error_handler) ("%s: no such symbol", name);
@ -2629,13 +2638,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry,
hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry, hentry = xcoff_link_hash_lookup (xcoff_hash_table (info), entry,
false, false, true); false, false, true);
if (hentry != NULL) if (hentry != NULL)
{ hentry->flags |= XCOFF_ENTRY;
hentry->flags |= XCOFF_ENTRY;
if (hentry->root.type == bfd_link_hash_defined
|| hentry->root.type == bfd_link_hash_defweak)
xcoff_data (output_bfd)->entry_section =
hentry->root.u.def.section->output_section;
}
/* Garbage collect unused sections. */ /* Garbage collect unused sections. */
if (info->relocateable if (info->relocateable
@ -2941,16 +2944,18 @@ xcoff_build_ldsyms (h, p)
h->flags |= XCOFF_MARK; h->flags |= XCOFF_MARK;
/* If this symbol is called and defined in a dynamic object, or not /* If this symbol is called and defined in a dynamic object, or not
defined at all when building a shared object, then we need to set defined at all when building a shared object, or imported, then
up global linkage code for it. (Unless we did garbage collection we need to set up global linkage code for it. (Unless we did
and we didn't need this symbol.) */ garbage collection and we didn't need this symbol.) */
if ((h->flags & XCOFF_CALLED) != 0 if ((h->flags & XCOFF_CALLED) != 0
&& (h->root.type == bfd_link_hash_undefined && (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak) || h->root.type == bfd_link_hash_undefweak)
&& h->root.root.string[0] == '.' && h->root.root.string[0] == '.'
&& h->descriptor != NULL && h->descriptor != NULL
&& ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0
|| ldinfo->info->shared) || ldinfo->info->shared
|| ((h->descriptor->flags & XCOFF_IMPORT) != 0
&& (h->descriptor->flags & XCOFF_DEF_REGULAR) == 0))
&& (! xcoff_hash_table (ldinfo->info)->gc && (! xcoff_hash_table (ldinfo->info)->gc
|| (h->flags & XCOFF_MARK) != 0)) || (h->flags & XCOFF_MARK) != 0))
{ {
@ -3926,6 +3931,13 @@ xcoff_link_input_bfd (finfo, input_bfd)
xcoff_swap_ldsym_out (finfo->output_bfd, ldsym, xcoff_swap_ldsym_out (finfo->output_bfd, ldsym,
finfo->ldsym + h->ldindx - 3); finfo->ldsym + h->ldindx - 3);
h->ldsym = NULL; h->ldsym = NULL;
/* Fill in snentry now that we know the target_index. */
if ((h->flags & XCOFF_ENTRY) != 0
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
xcoff_data (output_bfd)->snentry =
h->root.u.def.section->output_section->target_index;
} }
*indexp = -1; *indexp = -1;
@ -3987,8 +3999,8 @@ xcoff_link_input_bfd (finfo, input_bfd)
finfo->toc_symindx = output_index; finfo->toc_symindx = output_index;
xcoff_data (finfo->output_bfd)->toc = tocval; xcoff_data (finfo->output_bfd)->toc = tocval;
xcoff_data (finfo->output_bfd)->toc_section = xcoff_data (finfo->output_bfd)->sntoc =
(*csectpp)->output_section; (*csectpp)->output_section->target_index;
require = true; require = true;
} }
} }
@ -4457,6 +4469,7 @@ xcoff_link_input_bfd (finfo, input_bfd)
struct internal_syment *iisp, *iispend; struct internal_syment *iisp, *iispend;
long *iindp; long *iindp;
bfd_byte *oos; bfd_byte *oos;
int iiadd;
/* Update any C_BINCL or C_EINCL symbols /* Update any C_BINCL or C_EINCL symbols
that refer to a line number in the that refer to a line number in the
@ -4468,8 +4481,9 @@ xcoff_link_input_bfd (finfo, input_bfd)
oos = finfo->outsyms; oos = finfo->outsyms;
while (iisp < iispend) while (iisp < iispend)
{ {
if ((iisp->n_sclass == C_BINCL if (*iindp >= 0
|| iisp->n_sclass == C_EINCL) && (iisp->n_sclass == C_BINCL
|| iisp->n_sclass == C_EINCL)
&& ((bfd_size_type) iisp->n_value && ((bfd_size_type) iisp->n_value
>= enclosing->line_filepos + linoff) >= enclosing->line_filepos + linoff)
&& ((bfd_size_type) iisp->n_value && ((bfd_size_type) iisp->n_value
@ -4492,9 +4506,11 @@ xcoff_link_input_bfd (finfo, input_bfd)
--incls; --incls;
} }
iisp += iisp->n_numaux + 1; iiadd = 1 + iisp->n_numaux;
iindp += iisp->n_numaux + 1; if (*iindp >= 0)
oos += (iisp->n_numaux + 1) * osymesz; oos += iiadd * osymesz;
iisp += iiadd;
iindp += iiadd;
} }
} }
} }
@ -5073,7 +5089,8 @@ xcoff_write_global_symbol (h, p)
bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4); bfd_put_32 (output_bfd, xcoff_data (output_bfd)->toc, p + 4);
tsec = xcoff_data (output_bfd)->toc_section; tsec = coff_section_from_bfd_index (output_bfd,
xcoff_data (output_bfd)->sntoc);
++irel; ++irel;
irel->r_vaddr = (osec->vma irel->r_vaddr = (osec->vma
@ -5272,9 +5289,10 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order)
return false; return false;
} }
h = xcoff_link_hash_lookup (xcoff_hash_table (finfo->info), h = ((struct xcoff_link_hash_entry *)
link_order->u.reloc.p->u.name, bfd_wrapped_link_hash_lookup (output_bfd, finfo->info,
false, false, true); link_order->u.reloc.p->u.name,
false, false, true));
if (h == NULL) if (h == NULL)
{ {
if (! ((*finfo->info->callbacks->unattached_reloc) if (! ((*finfo->info->callbacks->unattached_reloc)