(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-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.
(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
(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
int attr;
};
+enum action_discarded
+ {
+ COMPLAIN = 1,
+ PRETEND = 2
+ };
+
struct elf_backend_data
{
/* The architecture for this backend. */
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. */
/* 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.
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
#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
_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);
+}
\f
/* Fill in the address for a pointer generated in a linker section. */
#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"
#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"
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
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;
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;
}
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;
#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
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,