aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-07-02 07:45:31 +0000
committerIan Lance Taylor <ian@airs.com>1999-07-02 07:45:31 +0000
commite361c369df7f7afbaaf3eb0ec2f683f8d09893d0 (patch)
tree026aa867f552152705261101acfd68814280913b
parent85f7047147246283f33959470b7ca16bf7109b40 (diff)
downloadgdb-e361c369df7f7afbaaf3eb0ec2f683f8d09893d0.zip
gdb-e361c369df7f7afbaaf3eb0ec2f683f8d09893d0.tar.gz
gdb-e361c369df7f7afbaaf3eb0ec2f683f8d09893d0.tar.bz2
* ldlang.c: Revert change of 1999-06-23.
-rw-r--r--ld/ldlang.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index d4c431c..d290391 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -890,16 +890,28 @@ section_already_linked (abfd, sec, data)
return;
}
- /* If we aren't building constructors, don't discard link once
- sections. Otherwise we can get confused when generating relocs. */
- if (! config.build_constructors)
- return;
-
flags = bfd_get_section_flags (abfd, sec);
if ((flags & SEC_LINK_ONCE) == 0)
return;
+ /* FIXME: When doing a relocateable link, we may have trouble
+ copying relocations in other sections that refer to local symbols
+ in the section being discarded. Those relocations will have to
+ be converted somehow; as of this writing I'm not sure that any of
+ the backends handle that correctly.
+
+ It is tempting to instead not discard link once sections when
+ doing a relocateable link (technically, they should be discarded
+ whenever we are building constructors). However, that fails,
+ because the linker winds up combining all the link once sections
+ into a single large link once section, which defeats the purpose
+ of having link once sections in the first place.
+
+ Also, not merging link once sections in a relocateable link
+ causes trouble for MIPS ELF, which relies in link once semantics
+ to handle the .reginfo section correctly. */
+
name = bfd_get_section_name (abfd, sec);
for (l = sec_link_once_list; l != NULL; l = l->next)