aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/bfd-in.h2
-rw-r--r--bfd/bfd-in2.h2
-rw-r--r--bfd/elflink.c33
-rw-r--r--bfd/linker.c33
-rw-r--r--ld/ChangeLog25
-rw-r--r--ld/emultempl/aix.em5
-rw-r--r--ld/emultempl/armcoff.em5
-rw-r--r--ld/emultempl/beos.em5
-rw-r--r--ld/emultempl/elf32.em5
-rw-r--r--ld/emultempl/generic.em2
-rw-r--r--ld/emultempl/gld960.em2
-rw-r--r--ld/emultempl/gld960c.em2
-rw-r--r--ld/emultempl/hppaelf.em2
-rw-r--r--ld/emultempl/linux.em4
-rw-r--r--ld/emultempl/lnk960.em2
-rw-r--r--ld/emultempl/m68kcoff.em2
-rw-r--r--ld/emultempl/mmo.em1
-rw-r--r--ld/emultempl/pe.em5
-rw-r--r--ld/emultempl/ppc64elf.em2
-rw-r--r--ld/emultempl/sunos.em6
-rw-r--r--ld/emultempl/ticoff.em2
-rw-r--r--ld/emultempl/vanilla.em2
-rw-r--r--ld/ldemul.c10
-rw-r--r--ld/ldemul.h2
25 files changed, 104 insertions, 64 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1f82cdc..98fb936 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (fix_syms, _bfd_elf_fix_excluded_sec_syms): Move to..
+ * linker.c (fix_syms, _bfd_fix_excluded_sec_syms): ..here.
+ * bfd-in.h (_bfd_fix_excluded_sec_syms): Rename.
+ * bfd-in2.h: Regenerate.
+
2005-08-03 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_relax_section): Resize .rela.got
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 10b4c13..39a82cb 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -708,7 +708,7 @@ extern void _bfd_elf_provide_symbol
extern void _bfd_elf_provide_section_bound_symbols
(struct bfd_link_info *, struct bfd_section *, const char *, const char *);
-extern void _bfd_elf_fix_excluded_sec_syms
+extern void _bfd_fix_excluded_sec_syms
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index e8c5972..50ac263 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -715,7 +715,7 @@ extern void _bfd_elf_provide_symbol
extern void _bfd_elf_provide_section_bound_symbols
(struct bfd_link_info *, struct bfd_section *, const char *, const char *);
-extern void _bfd_elf_fix_excluded_sec_syms
+extern void _bfd_fix_excluded_sec_syms
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 082b530..457ba8e 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -9890,39 +9890,6 @@ _bfd_elf_provide_section_bound_symbols (struct bfd_link_info *info,
_bfd_elf_provide_symbol (info, end, val, sec);
}
-/* Convert symbols in excluded output sections to absolute. */
-
-static bfd_boolean
-fix_syms (struct bfd_link_hash_entry *h, void *data)
-{
- bfd *obfd = (bfd *) data;
-
- if (h->type == bfd_link_hash_warning)
- h = h->u.i.link;
-
- if (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_defweak)
- {
- asection *s = h->u.def.section;
- if (s != NULL
- && s->output_section != NULL
- && (s->output_section->flags & SEC_EXCLUDE) != 0
- && bfd_section_removed_from_list (obfd, s->output_section))
- {
- h->u.def.value += s->output_offset + s->output_section->vma;
- h->u.def.section = bfd_abs_section_ptr;
- }
- }
-
- return TRUE;
-}
-
-void
-_bfd_elf_fix_excluded_sec_syms (bfd *obfd, struct bfd_link_info *info)
-{
- bfd_link_hash_traverse (info->hash, fix_syms, obfd);
-}
-
bfd_boolean
_bfd_elf_common_definition (Elf_Internal_Sym *sym)
{
diff --git a/bfd/linker.c b/bfd/linker.c
index 426d545..0bfdfb2 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -3071,3 +3071,36 @@ _bfd_generic_section_already_linked (bfd *abfd, asection *sec)
/* This is the first section with this name. Record it. */
bfd_section_already_linked_table_insert (already_linked_list, sec);
}
+
+/* Convert symbols in excluded output sections to absolute. */
+
+static bfd_boolean
+fix_syms (struct bfd_link_hash_entry *h, void *data)
+{
+ bfd *obfd = (bfd *) data;
+
+ if (h->type == bfd_link_hash_warning)
+ h = h->u.i.link;
+
+ if (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak)
+ {
+ asection *s = h->u.def.section;
+ if (s != NULL
+ && s->output_section != NULL
+ && (s->output_section->flags & SEC_EXCLUDE) != 0
+ && bfd_section_removed_from_list (obfd, s->output_section))
+ {
+ h->u.def.value += s->output_offset + s->output_section->vma;
+ h->u.def.section = bfd_abs_section_ptr;
+ }
+ }
+
+ return TRUE;
+}
+
+void
+_bfd_fix_excluded_sec_syms (bfd *obfd, struct bfd_link_info *info)
+{
+ bfd_link_hash_traverse (info->hash, fix_syms, obfd);
+}
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 14f2bf4..b21834e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,28 @@
+2005-08-04 Alan Modra <amodra@bigpond.net.au>
+
+ * ldemul.c (ldemul_finish): Call ld_emulation->finish unconditionally.
+ (finish_default): New function.
+ * ldemul.h (finish_default): Declare.
+ * emultempl/aix.em (gld*_before_allocation): Call
+ before_allocation_default rather than strip_excluded_output_sections.
+ (ld_*_emulation): Init finish field to finish_default.
+ * emultempl/armcoff.em: Likewise.
+ * emultempl/beos.em: Likewise.
+ * emultempl/elf32.em: Likewise.
+ * emultempl/generic.em: Likewise.
+ * emultempl/gld960.em: Likewise.
+ * emultempl/gld960c.em: Likewise.
+ * emultempl/hppaelf.em: Likewise.
+ * emultempl/linux.em: Likewise.
+ * emultempl/lnk960.em: Likewise.
+ * emultempl/m68kcoff.em: Likewise.
+ * emultempl/mmo.em: Likewise.
+ * emultempl/pe.em: Likewise.
+ * emultempl/ppc64elf.em: Likewise.
+ * emultempl/sunos.em: Likewise.
+ * emultempl/ticoff.em: Likewise.
+ * emultempl/vanilla.em: Likewise.
+
2005-08-03 Alan Modra <amodra@bigpond.net.au>
* ldlang.c (exp_init_os): Handle etree_provide.
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 8030b47..8763155 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -788,8 +788,7 @@ gld${EMULATION_NAME}_before_allocation (void)
}
}
- if (!link_info.relocatable)
- strip_excluded_output_sections ();
+ before_allocation_default ();
}
static char *
@@ -1344,7 +1343,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- 0, /* finish */
+ finish_default,
gld${EMULATION_NAME}_create_output_section_statements,
0, /* open_dynamic_archive */
0, /* place_orphan */
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index 64a2b32..acf117c 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -126,8 +126,7 @@ gld${EMULATION_NAME}_before_allocation (void)
/* We have seen it all. Allocate it, and carry on */
bfd_arm_allocate_interworking_sections (& link_info);
- if (!link_info.relocatable)
- strip_excluded_output_sections ();
+ before_allocation_default ();
}
static void
@@ -194,6 +193,8 @@ gld${EMULATION_NAME}_finish (void)
}
else
einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
+
+ finish_default ();
}
static char *
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index 7a014ce..e07677b 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -647,8 +647,7 @@ gld_${EMULATION_NAME}_before_allocation (void)
sort_sections (stat_ptr->head);
- if (!link_info.relocatable)
- strip_excluded_output_sections ();
+ before_allocation_default ();
}
/* Place an orphan section. We use this to put sections with a '\$' in them
@@ -771,7 +770,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld_${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
gld${EMULATION_NAME}_place_orphan,
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index b04d624..e43c8c5 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1169,8 +1169,7 @@ ${ELF_INTERPRETER_SET_DEFAULT}
}
}
- if (!link_info.relocatable)
- strip_excluded_output_sections ();
+ before_allocation_default ();
if (!bfd_elf_size_dynsym_hash_dynstr (output_bfd, &link_info))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
@@ -1511,7 +1510,7 @@ gld${EMULATION_NAME}_finish (void)
if (bfd_elf_discard_info (output_bfd, &link_info))
gld${EMULATION_NAME}_layout_sections_again ();
- _bfd_elf_fix_excluded_sec_syms (output_bfd, &link_info);
+ finish_default ();
}
EOF
fi
diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
index a37bdc6..f7153b6 100644
--- a/ld/emultempl/generic.em
+++ b/ld/emultempl/generic.em
@@ -132,7 +132,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- ${LDEMUL_FINISH-NULL},
+ ${LDEMUL_FINISH-finish_default},
${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
${LDEMUL_PLACE_ORPHAN-NULL},
diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em
index acacac7..f407622 100644
--- a/ld/emultempl/gld960.em
+++ b/ld/emultempl/gld960.em
@@ -138,7 +138,7 @@ struct ld_emulation_xfer_struct ld_gld960_emulation =
gld960_get_script,
"960",
"",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */
diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em
index 452c194..5de01e6 100644
--- a/ld/emultempl/gld960c.em
+++ b/ld/emultempl/gld960c.em
@@ -153,7 +153,7 @@ struct ld_emulation_xfer_struct ld_gld960coff_emulation =
gld960_get_script,
"960coff",
"",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 4303274..fc81e76 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -305,7 +305,7 @@ hppaelf_finish (void)
}
}
- _bfd_elf_fix_excluded_sec_syms (output_bfd, &link_info);
+ finish_default ();
}
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index 277d1e9..071af80 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -122,7 +122,7 @@ gld${EMULATION_NAME}_before_allocation (void)
if (! bfd_${EMULATION_NAME}_size_dynamic_sections (output_bfd, &link_info))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
- strip_excluded_output_sections ();
+ before_allocation_default ();
}
static char *
@@ -193,7 +193,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL, /* finish */
+ finish_default,
gld${EMULATION_NAME}_create_output_section_statements,
gld${EMULATION_NAME}_open_dynamic_archive,
NULL, /* place orphan */
diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em
index 1c82065..1483983 100644
--- a/ld/emultempl/lnk960.em
+++ b/ld/emultempl/lnk960.em
@@ -273,7 +273,7 @@ struct ld_emulation_xfer_struct ld_lnk960_emulation =
lnk960_get_script,
"lnk960",
"",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */
diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em
index 9b011d3..31f98a0 100644
--- a/ld/emultempl/m68kcoff.em
+++ b/ld/emultempl/m68kcoff.em
@@ -226,7 +226,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */
diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em
index a737b50..bfc9c5a 100644
--- a/ld/emultempl/mmo.em
+++ b/ld/emultempl/mmo.em
@@ -112,6 +112,7 @@ static void
mmo_finish (void)
{
bfd_map_over_sections (output_bfd, mmo_wipe_sec_reloc_flag, NULL);
+ finish_default ();
}
/* To get on-demand global register allocation right, we need to parse the
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index aefe3aa..6e14330 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1288,8 +1288,7 @@ gld_${EMULATION_NAME}_before_allocation (void)
bfd_arm_pe_allocate_interworking_sections (& link_info);
#endif /* TARGET_IS_armpe */
- if (!link_info.relocatable)
- strip_excluded_output_sections ();
+ before_allocation_default ();
}
#ifdef DLL_SUPPORT
@@ -1464,6 +1463,8 @@ gld_${EMULATION_NAME}_finish (void)
}
#endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) */
+ finish_default ();
+
#ifdef DLL_SUPPORT
if (link_info.shared
#if !defined(TARGET_IS_shpe) && !defined(TARGET_IS_mipspe)
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index a9ced5f..f64a3d2 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -379,7 +379,7 @@ ppc_finish (void)
}
ppc64_elf_restore_symbols (&link_info);
- _bfd_elf_fix_excluded_sec_syms (output_bfd, &link_info);
+ finish_default ();
}
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index b114737..19f1893 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -809,9 +809,9 @@ gld${EMULATION_NAME}_before_allocation (void)
hdyn->u.def.section = sdyn;
else
hdyn->u.def.section = bfd_abs_section_ptr;
-
- strip_excluded_output_sections ();
}
+
+ before_allocation_default ();
}
/* This is called by the before_allocation routine via
@@ -1017,7 +1017,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL, /* finish */
+ finish_default,
gld${EMULATION_NAME}_create_output_section_statements,
NULL, /* open dynamic archive */
NULL, /* place orphan */
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 9c4ec2b..5938ba4 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -166,7 +166,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld_${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */
diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em
index 769fb30..ad11f41 100644
--- a/ld/emultempl/vanilla.em
+++ b/ld/emultempl/vanilla.em
@@ -69,7 +69,7 @@ struct ld_emulation_xfer_struct ld_vanilla_emulation =
vanilla_get_script,
"vanilla",
"a.out-sunos-big",
- NULL, /* finish */
+ finish_default,
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */
diff --git a/ld/ldemul.c b/ld/ldemul.c
index fbe3e1d..5b4796a 100644
--- a/ld/ldemul.c
+++ b/ld/ldemul.c
@@ -94,8 +94,7 @@ ldemul_set_output_arch (void)
void
ldemul_finish (void)
{
- if (ld_emulation->finish)
- ld_emulation->finish ();
+ ld_emulation->finish ();
}
void
@@ -228,6 +227,13 @@ do_assignments_default (void)
}
void
+finish_default (void)
+{
+ if (!link_info.relocatable)
+ _bfd_fix_excluded_sec_syms (output_bfd, &link_info);
+}
+
+void
set_output_arch_default (void)
{
/* Set the output architecture and machine if possible. */
diff --git a/ld/ldemul.h b/ld/ldemul.h
index 1a42cb6..c3ba033 100644
--- a/ld/ldemul.h
+++ b/ld/ldemul.h
@@ -81,6 +81,8 @@ extern void before_allocation_default
(void);
extern void do_assignments_default
(void);
+extern void finish_default
+ (void);
extern void set_output_arch_default
(void);
extern void syslib_default