aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog18
-rw-r--r--bfd/bfd-in.h2
-rw-r--r--bfd/bfd-in2.h2
-rw-r--r--bfd/elf-bfd.h11
-rw-r--r--bfd/elf-hppa.h14
-rw-r--r--bfd/elf32-hppa.c1
-rw-r--r--bfd/elf32-ppc.c16
-rw-r--r--bfd/elf64-hppa.c1
-rw-r--r--bfd/elflink.c18
-rw-r--r--bfd/elfxx-target.h4
10 files changed, 71 insertions, 16 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 21ab9cc..5c7d2f9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 33e19ea..10b4c13 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -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
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 519dce8..a936176 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -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
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 5aa62eb..e238a95 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -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. */
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index bc9c2e8..92f13e6 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -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
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 9318e6a..e3c45ec 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -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
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 58afcda..6239438 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -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"
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 8236ef3..08421b5 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -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"
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 62f80c9..092119a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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;
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 0268e62..624b31c 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -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,