* elf-bfd.h (struct elf_backend_data): Add action_discarded.

(enum action_discarded): Move from..
	* elflink.c (enum action_discarded): ..here.
	(_bfd_elf_default_action_discarded): Rename from elf_action_discarded.
	Remove target specific section checks.
	(elf_link_input_bfd): Adjust.
	* elfxx-target.h (elf_backend_action_discarded): Define.
	(elfNN_bed): Init new field.
	* bfd-in.h (_bfd_elf_default_action_discarded): Declare.
	* bfd-in2.h: Regenerate.
	* elf-hppa.h (elf_hppa_action_discarded): New function.
	* elf32-hppa.c (elf_backend_action_discarded): Define.
	* elf64-hppa.c (elf_backend_action_discarded): Define.
	* elf32-ppc.c (ppc_elf_action_discarded): New function.
	(elf_backend_action_discarded): Define.
This commit is contained in:
Alan Modra 2005-07-29 02:46:04 +00:00
parent 8655b342bf
commit 8a69675106
10 changed files with 71 additions and 16 deletions

View File

@ -1,3 +1,21 @@
2005-07-29 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (struct elf_backend_data): Add action_discarded.
(enum action_discarded): Move from..
* elflink.c (enum action_discarded): ..here.
(_bfd_elf_default_action_discarded): Rename from elf_action_discarded.
Remove target specific section checks.
(elf_link_input_bfd): Adjust.
* elfxx-target.h (elf_backend_action_discarded): Define.
(elfNN_bed): Init new field.
* bfd-in.h (_bfd_elf_default_action_discarded): Declare.
* bfd-in2.h: Regenerate.
* elf-hppa.h (elf_hppa_action_discarded): New function.
* elf32-hppa.c (elf_backend_action_discarded): Define.
* elf64-hppa.c (elf_backend_action_discarded): Define.
* elf32-ppc.c (ppc_elf_action_discarded): New function.
(elf_backend_action_discarded): Define.
2005-07-27 Alan Modra <amodra@bigpond.net.au>
* elflink.c (fix_syms): Handle symbols defined in input sections.

View File

@ -656,6 +656,8 @@ extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_discard_info
(bfd *, struct bfd_link_info *);
extern unsigned int _bfd_elf_default_action_discarded
(struct bfd_section *);
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error

View File

@ -663,6 +663,8 @@ extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_discard_info
(bfd *, struct bfd_link_info *);
extern unsigned int _bfd_elf_default_action_discarded
(struct bfd_section *);
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error

View File

@ -546,6 +546,12 @@ struct bfd_elf_special_section
int attr;
};
enum action_discarded
{
COMPLAIN = 1,
PRETEND = 2
};
struct elf_backend_data
{
/* The architecture for this backend. */
@ -918,6 +924,11 @@ struct elf_backend_data
bfd_boolean (*elf_backend_ignore_discarded_relocs)
(asection *);
/* What to do when ld finds relocations against symbols defined in
discarded sections. */
unsigned int (*action_discarded)
(asection *);
/* This function returns the width of FDE pointers in bytes, or 0 if
that can't be determined for some reason. The default definition
goes by the bfd's EI_CLASS. */

View File

@ -1,5 +1,5 @@
/* Common code for PA ELF implementations.
Copyright 1999, 2000, 2001, 2002, 2003, 2004
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -1057,6 +1057,18 @@ static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
return TRUE;
}
/* What to do when ld finds relocations against symbols defined in
discarded sections. */
static unsigned int
elf_hppa_action_discarded (asection *sec)
{
if (strcmp (".PARISC.unwind", sec->name) == 0)
return 0;
return _bfd_elf_default_action_discarded (sec);
}
#if ARCH_SIZE == 64
/* Hook called by the linker routine which adds symbols from an object
file. HP's libraries define symbols with HP specific section

View File

@ -4251,6 +4251,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
#define elf_backend_post_process_headers elf32_hppa_post_process_headers
#define elf_backend_get_symbol_type elf32_hppa_elf_get_symbol_type
#define elf_backend_reloc_type_class elf32_hppa_reloc_type_class
#define elf_backend_action_discarded elf_hppa_action_discarded
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1

View File

@ -5303,6 +5303,21 @@ ppc_elf_set_sdata_syms (bfd *obfd, struct bfd_link_info *info)
_bfd_elf_provide_symbol (info, lsect->sym_name, val, s);
}
}
/* What to do when ld finds relocations against symbols defined in
discarded sections. */
static unsigned int
ppc_elf_action_discarded (asection *sec)
{
if (strcmp (".fixup", sec->name) == 0)
return 0;
if (strcmp (".got2", sec->name) == 0)
return 0;
return _bfd_elf_default_action_discarded (sec);
}
/* Fill in the address for a pointer generated in a linker section. */
@ -7360,6 +7375,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
#define elf_backend_write_section ppc_elf_write_section
#define elf_backend_get_sec_type_attr ppc_elf_get_sec_type_attr
#define elf_backend_plt_sym_val ppc_elf_plt_sym_val
#define elf_backend_action_discarded ppc_elf_action_discarded
#include "elf32-target.h"

View File

@ -2745,6 +2745,7 @@ const struct elf_size_info hppa64_elf_size_info =
#define elf_backend_reloc_type_class elf64_hppa_reloc_type_class
#define elf_backend_rela_normal 1
#define elf_backend_special_sections elf64_hppa_special_sections
#define elf_backend_action_discarded elf_hppa_action_discarded
#include "elf64-target.h"

View File

@ -6690,12 +6690,6 @@ elf_section_ignore_discarded_relocs (asection *sec)
return FALSE;
}
enum action_discarded
{
COMPLAIN = 1,
PRETEND = 2
};
/* Return a mask saying how ld should treat relocations in SEC against
symbols defined in discarded sections. If this function returns
COMPLAIN set, ld will issue a warning message. If this function
@ -6705,8 +6699,8 @@ enum action_discarded
zero the reloc (at least that is the intent, but some cooperation by
the target dependent code is needed, particularly for REL targets). */
static unsigned int
elf_action_discarded (asection *sec)
unsigned int
_bfd_elf_default_action_discarded (asection *sec)
{
if (sec->flags & SEC_DEBUGGING)
return PRETEND;
@ -6717,12 +6711,6 @@ elf_action_discarded (asection *sec)
if (strcmp (".gcc_except_table", sec->name) == 0)
return 0;
if (strcmp (".PARISC.unwind", sec->name) == 0)
return 0;
if (strcmp (".fixup", sec->name) == 0)
return 0;
return COMPLAIN | PRETEND;
}
@ -7042,7 +7030,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
if (!elf_section_ignore_discarded_relocs (o))
{
Elf_Internal_Rela *rel, *relend;
unsigned int action = elf_action_discarded (o);
unsigned int action = (*bed->action_discarded) (o);
rel = internal_relocs;
relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;

View File

@ -445,6 +445,9 @@
#ifndef elf_backend_ignore_discarded_relocs
#define elf_backend_ignore_discarded_relocs NULL
#endif
#ifndef elf_backend_action_discarded
#define elf_backend_action_discarded _bfd_elf_default_action_discarded
#endif
#ifndef elf_backend_eh_frame_address_size
#define elf_backend_eh_frame_address_size _bfd_elf_eh_frame_address_size
#endif
@ -596,6 +599,7 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_reloc_type_class,
elf_backend_discard_info,
elf_backend_ignore_discarded_relocs,
elf_backend_action_discarded,
elf_backend_eh_frame_address_size,
elf_backend_can_make_relative_eh_frame,
elf_backend_can_make_lsda_relative_eh_frame,