This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Your i960-elf failures notice
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Mon, 1 Dec 2003 16:59:37 +1030
- Subject: Re: Your i960-elf failures notice
- References: <20031105082443.GC2506@bubble.sa.bigpond.net.au> <Pine.BSF.4.44.0311301417440.11656-100000@dair.pair.com> <20031201003919.GD2529@bubble.sa.bigpond.net.au>
On Mon, Dec 01, 2003 at 11:09:19AM +1030, Alan Modra wrote:
> Checks all over the place in
> the elf linker just test that info->hash->creator->flavour is
> bfd_target_elf_flavour before accessing elf specific fields in link hash
> table entries. That's not a sufficient test. I think we should be
> testing that info->hash->root.type is bfd_link_elf_hash_table.
bfd/ChangeLog
* elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg.
* elf.c (_bfd_elf_merge_sections): Adjust to suit.
(_bfd_elf_link_just_syms): Likewise.
(bfd_elf_get_needed_list): Likewise.
(bfd_elf_get_runpath_list): Likewise.
(_bfd_elf_link_hash_copy_indirect): Remove unneeded parens.
* elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab
creator flavour.
(elf32_hppa_set_gp): Look up output sections rather than using htab.
* elf32-i960.c: Comment fix. Formatting.
* elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table
rather than testing creator flavour.
* elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
* elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for
is_elf_hash_table change. Remove redundant test.
(bfd_elf_record_link_assignment): Use is_elf_hash_table rather than
testing creator flavour.
(elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table.
(_bfd_elf_fix_symbol_flags): Likewise.
(_bfd_elf_adjust_dynamic_symbol): Likewise.
* elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant
checks. Use is_elf_hash_table rather than testing creator flavour.
Use hash_table throughout in place of info->hash.
(elf_add_dynamic_entry): Adjust for is_elf_hash_table change.
(NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant
check.
(elf_bfd_final_link): Adjust for is_elf_hash_table change.
(elf_link_check_versioned_symbol): Use is_elf_hash_table rather than
testing creator flavour.
(elf_gc_sections): Add is_elf_hash_table check.
(elf_gc_common_finalize_got_offsets): Likewise.
(elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove
redundant check.
* elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table
rather than testing creator flavour.
ld/ChangeLog
* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Test
hash table type rather than testing creator flavour.
* emultempl/hppaelf.em (hppaelf_create_output_section_statements):
Only create stub_file bfd if hash table creator is as expected.
(gld${EMULATION_NAME}_finish): Test stub_file.
Committed.
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.122
diff -u -p -r1.122 elf-bfd.h
--- bfd/elf-bfd.h 27 Nov 2003 18:49:37 -0000 1.122
+++ bfd/elf-bfd.h 1 Dec 2003 03:33:50 -0000
@@ -400,8 +400,8 @@ struct elf_link_hash_table
#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
-#define is_elf_hash_table(p) \
- ((p)->hash->type == bfd_link_elf_hash_table)
+#define is_elf_hash_table(htab) \
+ (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
/* Used by bfd_section_from_r_symndx to cache a small number of local
symbol to section mappings. */
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.213
diff -u -p -r1.213 elf.c
--- bfd/elf.c 27 Nov 2003 18:49:37 -0000 1.213
+++ bfd/elf.c 1 Dec 2003 03:33:54 -0000
@@ -894,7 +894,7 @@ merge_sections_remove_hook (bfd *abfd AT
bfd_boolean
_bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info)
{
- if (!is_elf_hash_table (info))
+ if (!is_elf_hash_table (info->hash))
return FALSE;
if (elf_hash_table (info)->merge_info)
_bfd_merge_sections (abfd, elf_hash_table (info)->merge_info,
@@ -907,7 +907,7 @@ _bfd_elf_link_just_syms (asection *sec,
{
sec->output_section = bfd_abs_section_ptr;
sec->output_offset = sec->vma;
- if (!is_elf_hash_table (info))
+ if (!is_elf_hash_table (info->hash))
return;
sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
@@ -1355,12 +1355,12 @@ _bfd_elf_link_hash_copy_indirect (const
symbol which just became indirect. */
dir->elf_link_hash_flags
- |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_NON_GOT_REF
- | ELF_LINK_HASH_NEEDS_PLT
- | ELF_LINK_POINTER_EQUALITY_NEEDED));
+ |= ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_NON_GOT_REF
+ | ELF_LINK_HASH_NEEDS_PLT
+ | ELF_LINK_POINTER_EQUALITY_NEEDED);
if (ind->root.type != bfd_link_hash_indirect)
return;
@@ -1504,7 +1504,7 @@ struct bfd_link_needed_list *
bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->needed;
}
@@ -1516,7 +1516,7 @@ struct bfd_link_needed_list *
bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->runpath;
}
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.110
diff -u -p -r1.110 elf32-hppa.c
--- bfd/elf32-hppa.c 17 Nov 2003 21:31:10 -0000 1.110
+++ bfd/elf32-hppa.c 1 Dec 2003 03:33:56 -0000
@@ -2305,9 +2305,6 @@ elf32_hppa_setup_section_lists (bfd *out
bfd_size_type amt;
struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
- if (htab->elf.root.creator->flavour != bfd_target_elf_flavour)
- return 0;
-
/* Count the number of input BFDs and find the top input section id. */
for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
input_bfd != NULL;
@@ -2911,21 +2908,8 @@ elf32_hppa_set_gp (bfd *abfd, struct bfd
}
else
{
- asection *splt;
- asection *sgot;
-
- if (htab->elf.root.creator->flavour == bfd_target_elf_flavour)
- {
- splt = htab->splt;
- sgot = htab->sgot;
- }
- else
- {
- /* If we're not elf, look up the output sections in the
- hope we may actually find them. */
- splt = bfd_get_section_by_name (abfd, ".plt");
- sgot = bfd_get_section_by_name (abfd, ".got");
- }
+ asection *splt = bfd_get_section_by_name (abfd, ".plt");
+ asection *sgot = bfd_get_section_by_name (abfd, ".got");
/* Choose to point our LTP at, in this order, one of .plt, .got,
or .data, if these sections exist. In the case of choosing
Index: bfd/elf32-i960.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i960.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf32-i960.c
--- bfd/elf32-i960.c 25 Jun 2003 06:40:22 -0000 1.10
+++ bfd/elf32-i960.c 1 Dec 2003 03:33:56 -0000
@@ -1,4 +1,4 @@
-/* Intel 860 specific support for 32-bit ELF
+/* Intel 960 specific support for 32-bit ELF
Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -107,13 +107,8 @@ elf32_i960_info_to_howto_rel (abfd, cach
relocatable output against an external symbol. */
bfd_reloc_status_type
-elf32_i960_relocate (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+elf32_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry;
asymbol *symbol;
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.36
diff -u -p -r1.36 elf32-m32r.c
--- bfd/elf32-m32r.c 5 Nov 2003 13:17:09 -0000 1.36
+++ bfd/elf32-m32r.c 1 Dec 2003 03:33:57 -0000
@@ -843,7 +843,7 @@ m32r_elf_add_symbol_hook (abfd, info, sy
if (! info->relocatable
&& (*namep)[0] == '_' && (*namep)[1] == 'S'
&& strcmp (*namep, "_SDA_BASE_") == 0
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && is_elf_hash_table (info->hash))
{
/* This is simpler than using _bfd_elf_create_linker_section
(our needs are simpler than ppc's needs). Also
Index: bfd/elf32-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh64.c,v
retrieving revision 1.20
diff -u -p -r1.20 elf32-sh64.c
--- bfd/elf32-sh64.c 15 Oct 2003 06:23:55 -0000 1.20
+++ bfd/elf32-sh64.c 1 Dec 2003 03:34:01 -0000
@@ -380,7 +380,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, str
{
/* We want to do this for relocatable as well as final linking. */
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && is_elf_hash_table (info->hash))
{
struct elf_link_hash_entry *h;
Index: bfd/elf64-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sh64.c,v
retrieving revision 1.40
diff -u -p -r1.40 elf64-sh64.c
--- bfd/elf64-sh64.c 5 Nov 2003 13:17:09 -0000 1.40
+++ bfd/elf64-sh64.c 1 Dec 2003 03:34:03 -0000
@@ -2892,7 +2892,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, s
{
/* We want to do this for relocatable as well as final linking. */
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && is_elf_hash_table (info->hash))
{
struct elf_link_hash_entry *h;
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.50
diff -u -p -r1.50 elflink.c
--- bfd/elflink.c 27 Nov 2003 18:49:38 -0000 1.50
+++ bfd/elflink.c 1 Dec 2003 04:14:49 -0000
@@ -117,7 +117,7 @@ _bfd_elf_link_create_dynamic_sections (b
struct bfd_link_hash_entry *bh;
const struct elf_backend_data *bed;
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return FALSE;
if (elf_hash_table (info)->dynamic_sections_created)
@@ -144,8 +144,7 @@ _bfd_elf_link_create_dynamic_sections (b
return FALSE;
}
- if (! info->traditional_format
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ if (! info->traditional_format)
{
s = bfd_make_section (abfd, ".eh_frame_hdr");
if (s == NULL
@@ -424,7 +423,7 @@ bfd_elf_record_link_assignment (bfd *out
{
struct elf_link_hash_entry *h;
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (!is_elf_hash_table (info->hash))
return TRUE;
h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE);
@@ -494,7 +493,7 @@ elf_link_record_local_dynamic_symbol (st
Elf_External_Sym_Shndx eshndx;
char esym[sizeof (Elf64_External_Sym)];
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return 0;
/* See if the entry exists already. */
@@ -2206,7 +2205,7 @@ _bfd_elf_fix_symbol_flags (struct elf_li
will force it local. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
&& eif->info->shared
- && is_elf_hash_table (eif->info)
+ && is_elf_hash_table (eif->info->hash)
&& (eif->info->symbolic
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
@@ -2276,7 +2275,7 @@ _bfd_elf_adjust_dynamic_symbol (struct e
bfd *dynobj;
const struct elf_backend_data *bed;
- if (! is_elf_hash_table (eif->info))
+ if (! is_elf_hash_table (eif->info->hash))
return FALSE;
if (h->root.type == bfd_link_hash_warning)
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.248
diff -u -p -r1.248 elflink.h
--- bfd/elflink.h 27 Nov 2003 18:49:38 -0000 1.248
+++ bfd/elflink.h 1 Dec 2003 03:34:09 -0000
@@ -437,7 +437,9 @@ elf_link_add_object_symbols (bfd *abfd,
/* You can't use -r against a dynamic object. Also, there's no
hope of using a dynamic object which does not exactly match
the format of the output file. */
- if (info->relocatable || info->hash->creator != abfd->xvec)
+ if (info->relocatable
+ || !is_elf_hash_table (hash_table)
+ || hash_table->root.creator != abfd->xvec)
{
bfd_set_error (bfd_error_invalid_operation);
goto error_return;
@@ -475,7 +477,7 @@ elf_link_add_object_symbols (bfd *abfd,
fix is to keep track of what warnings we are supposed
to emit, and then handle them all at the end of the
link. */
- if (dynamic && abfd->xvec == info->hash->creator)
+ if (dynamic)
{
struct elf_link_hash_entry *h;
@@ -531,15 +533,15 @@ elf_link_add_object_symbols (bfd *abfd,
format. FIXME: If there are no input BFD's of the same
format as the output, we can't make a shared library. */
if (info->shared
- && is_elf_hash_table (info)
- && ! hash_table->dynamic_sections_created
- && abfd->xvec == info->hash->creator)
+ && is_elf_hash_table (hash_table)
+ && hash_table->root.creator == abfd->xvec
+ && ! hash_table->dynamic_sections_created)
{
if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
goto error_return;
}
}
- else if (! is_elf_hash_table (info))
+ else if (!is_elf_hash_table (hash_table))
goto error_return;
else
{
@@ -723,9 +725,8 @@ elf_link_add_object_symbols (bfd *abfd,
/* If this is the first dynamic object found in the link, create
the special sections required for dynamic linking. */
- if (! hash_table->dynamic_sections_created)
- if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
- goto error_return;
+ if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
+ goto error_return;
if (add_needed)
{
@@ -968,7 +969,7 @@ elf_link_add_object_symbols (bfd *abfd,
old_alignment = 0;
old_bfd = NULL;
- if (info->hash->creator->flavour == bfd_target_elf_flavour)
+ if (is_elf_hash_table (hash_table))
{
Elf_Internal_Versym iver;
unsigned int vernum = 0;
@@ -1131,7 +1132,7 @@ elf_link_add_object_symbols (bfd *abfd,
&& definition
&& (flags & BSF_WEAK) != 0
&& ELF_ST_TYPE (isym->st_info) != STT_FUNC
- && info->hash->creator->flavour == bfd_target_elf_flavour
+ && is_elf_hash_table (hash_table)
&& h->weakdef == NULL)
{
/* Keep a list of all weak defined non function symbols from
@@ -1167,7 +1168,7 @@ elf_link_add_object_symbols (bfd *abfd,
h->root.u.c.p->alignment_power = old_alignment;
}
- if (info->hash->creator->flavour == bfd_target_elf_flavour)
+ if (is_elf_hash_table (hash_table))
{
int old_flags;
bfd_boolean dynsym;
@@ -1380,9 +1381,6 @@ elf_link_add_object_symbols (bfd *abfd,
bfd_size_type oldsize;
bfd_size_type strindex;
- if (! is_elf_hash_table (info))
- goto error_free_vers;
-
/* The symbol from a DT_NEEDED object is referenced from
the regular object to create a dynamic executable. We
have to make sure there is a DT_NEEDED entry for it. */
@@ -1446,7 +1444,7 @@ elf_link_add_object_symbols (bfd *abfd,
shortname[amt] = '\0';
hi = (struct elf_link_hash_entry *)
- bfd_link_hash_lookup (info->hash, shortname,
+ bfd_link_hash_lookup (&hash_table->root, shortname,
FALSE, FALSE, FALSE);
if (hi != NULL
&& hi->root.type == h->root.type
@@ -1573,7 +1571,8 @@ elf_link_add_object_symbols (bfd *abfd,
different format. It probably can't be done. */
check_relocs = get_elf_backend_data (abfd)->check_relocs;
if (! dynamic
- && abfd->xvec == info->hash->creator
+ && is_elf_hash_table (hash_table)
+ && hash_table->root.creator == abfd->xvec
&& check_relocs != NULL)
{
asection *o;
@@ -1609,8 +1608,7 @@ elf_link_add_object_symbols (bfd *abfd,
of the .stab/.stabstr sections. */
if (! dynamic
&& ! info->traditional_format
- && info->hash->creator->flavour == bfd_target_elf_flavour
- && is_elf_hash_table (info)
+ && is_elf_hash_table (hash_table)
&& (info->strip != strip_all && info->strip != strip_debugger))
{
asection *stabstr;
@@ -1643,8 +1641,9 @@ elf_link_add_object_symbols (bfd *abfd,
}
}
- if (! info->relocatable && ! dynamic
- && is_elf_hash_table (info))
+ if (! info->relocatable
+ && ! dynamic
+ && is_elf_hash_table (hash_table))
{
asection *s;
@@ -1664,7 +1663,7 @@ elf_link_add_object_symbols (bfd *abfd,
}
}
- if (is_elf_hash_table (info))
+ if (is_elf_hash_table (hash_table))
{
/* Add this bfd to the loaded list. */
struct elf_link_loaded_list *n;
@@ -1702,7 +1701,7 @@ elf_add_dynamic_entry (struct bfd_link_i
bfd_size_type newsize;
bfd_byte *newcontents;
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return FALSE;
dynobj = elf_hash_table (info)->dynobj;
@@ -1907,10 +1906,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd
soname_indx = (bfd_size_type) -1;
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
- return TRUE;
-
- if (! is_elf_hash_table (info))
+ if (!is_elf_hash_table (info->hash))
return TRUE;
if (info->execstack)
@@ -3112,7 +3108,7 @@ elf_bfd_final_link (bfd *abfd, struct bf
asection *reldyn = 0;
bfd_size_type amt;
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return FALSE;
if (info->shared)
@@ -4188,7 +4184,7 @@ elf_link_check_versioned_symbol (struct
bfd *abfd;
struct elf_link_loaded_list *loaded;
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (!is_elf_hash_table (info->hash))
return FALSE;
switch (h->root.type)
@@ -5797,7 +5793,9 @@ elf_gc_sections (bfd *abfd, struct bfd_l
struct elf_link_hash_entry *h, Elf_Internal_Sym *);
if (!get_elf_backend_data (abfd)->can_gc_sections
- || info->relocatable || info->emitrelocations
+ || info->relocatable
+ || info->emitrelocations
+ || !is_elf_hash_table (info->hash)
|| elf_hash_table (info)->dynamic_sections_created)
return TRUE;
@@ -5973,6 +5971,9 @@ elf_gc_common_finalize_got_offsets (bfd
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_vma gotoff;
+ if (! is_elf_hash_table (info->hash))
+ return FALSE;
+
/* The GOT offset is relative to the .got section, but the GOT header is
put into the .got.plt section, if the backend uses it. */
if (bed->want_got_plt)
@@ -6179,8 +6180,7 @@ elf_bfd_discard_info (bfd *output_bfd, s
bfd_boolean ret = FALSE;
if (info->traditional_format
- || info->hash->creator->flavour != bfd_target_elf_flavour
- || ! is_elf_hash_table (info))
+ || !is_elf_hash_table (info->hash))
return FALSE;
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.112
diff -u -p -r1.112 elfxx-ia64.c
--- bfd/elfxx-ia64.c 27 Nov 2003 18:49:39 -0000 1.112
+++ bfd/elfxx-ia64.c 1 Dec 2003 03:34:11 -0000
@@ -707,7 +707,7 @@ elfNN_ia64_relax_section (abfd, sec, lin
*again = FALSE;
/* Don't even try to relax for non-ELF outputs. */
- if (link_info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (!is_elf_hash_table (link_info->hash))
return FALSE;
/* Nothing to do if there are no relocations or there is no need for
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.105
diff -u -p -r1.105 elf32.em
--- ld/emultempl/elf32.em 4 Nov 2003 06:16:39 -0000 1.105
+++ ld/emultempl/elf32.em 1 Dec 2003 03:34:37 -0000
@@ -845,7 +845,7 @@ gld${EMULATION_NAME}_before_allocation (
const char *rpath;
asection *sinterp;
- if (link_info.hash->creator->flavour == bfd_target_elf_flavour)
+ if (link_info.hash->type == bfd_link_elf_hash_table)
_bfd_elf_tls_setup (output_bfd, &link_info);
/* If we are going to make any variable assignments, we need to let
Index: ld/emultempl/hppaelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/hppaelf.em,v
retrieving revision 1.30
diff -u -p -r1.30 hppaelf.em
--- ld/emultempl/hppaelf.em 27 Jun 2003 00:38:25 -0000 1.30
+++ ld/emultempl/hppaelf.em 1 Dec 2003 03:34:38 -0000
@@ -66,6 +66,13 @@ hppaelf_after_parse (void)
static void
hppaelf_create_output_section_statements (void)
{
+ extern const bfd_target bfd_elf32_hppa_linux_vec;
+ extern const bfd_target bfd_elf32_hppa_vec;
+
+ if (link_info.hash->creator != &bfd_elf32_hppa_linux_vec
+ && link_info.hash->creator != &bfd_elf32_hppa_vec)
+ return;
+
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
@@ -256,7 +263,7 @@ gld${EMULATION_NAME}_finish (void)
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (! link_info.relocatable)
+ if (stub_file != NULL && !link_info.relocatable)
{
int ret = elf32_hppa_setup_section_lists (output_bfd, &link_info);
@@ -298,7 +305,7 @@ gld${EMULATION_NAME}_finish (void)
}
/* Now build the linker stubs. */
- if (stub_file->the_bfd->sections != NULL)
+ if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
{
if (! elf32_hppa_build_stubs (&link_info))
einfo ("%X%P: can not build stubs: %E\n");
--
Alan Modra
IBM OzLabs - Linux Technology Centre