summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-07-22 01:39:23 +0000
committerIan Lance Taylor <ian@airs.com>1999-07-22 01:39:23 +0000
commit242eabea02320aecd550be46e84c2d27d4395770 (patch)
treedf7c78a8fd9dc97a663e439d409171d9cc3a705f /bfd
parentb4089fdd75a051bffc729255e2e383779abbb4ca (diff)
downloadbinutils-gdb-242eabea02320aecd550be46e84c2d27d4395770.tar.gz
1999-07-21 Mark Elbrecht <snowball3@bigfoot.com>
* coffcode.h (styp_to_sec_flags): If COFF_LONG_SECTION_NAMES and COFF_SUPPORT_GNU_LINKONCE, mark sections whose names begin with .gnu.linkonce with SEC_LINKONCE and SEC_LINK_DUPLICATES_DISCARD. * coff-go32.c: (COFF_LONG_SECTION_NAMES): Define. (COFF_SUPPORT_GNU_LINKONCE): Define. * coff-stgo32.c: (COFF_LONG_SECTION_NAMES): Define. (COFF_SUPPORT_GNU_LINKONCE): Define.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/coff-go32.c2
-rw-r--r--bfd/coff-stgo32.c2
-rw-r--r--bfd/coffcode.h11
4 files changed, 25 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9448475b81a..2535b9e9da2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+1999-07-21 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * coffcode.h (styp_to_sec_flags): If COFF_LONG_SECTION_NAMES and
+ COFF_SUPPORT_GNU_LINKONCE, mark sections whose names begin with
+ .gnu.linkonce with SEC_LINKONCE and SEC_LINK_DUPLICATES_DISCARD.
+ * coff-go32.c: (COFF_LONG_SECTION_NAMES): Define.
+ (COFF_SUPPORT_GNU_LINKONCE): Define.
+ * coff-stgo32.c: (COFF_LONG_SECTION_NAMES): Define.
+ (COFF_SUPPORT_GNU_LINKONCE): Define.
+
1999-07-21 Ian Lance Taylor <ian@zembu.com>
From Mark Elbrecht:
diff --git a/bfd/coff-go32.c b/bfd/coff-go32.c
index be4adb24f52..0b783a07a7d 100644
--- a/bfd/coff-go32.c
+++ b/bfd/coff-go32.c
@@ -21,5 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGET_SYM go32coff_vec
#define TARGET_NAME "coff-go32"
#define TARGET_UNDERSCORE '_'
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
#include "coff-i386.c"
diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c
index f1d38ba801a..1868f673c56 100644
--- a/bfd/coff-stgo32.c
+++ b/bfd/coff-stgo32.c
@@ -39,6 +39,8 @@
#define TARGET_NAME "coff-go32-exe"
#define TARGET_UNDERSCORE '_'
#define COFF_GO32_EXE
+#define COFF_LONG_SECTION_NAMES
+#define COFF_SUPPORT_GNU_LINKONCE
#include "bfd.h"
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index f905c940a26..185cbcf17de 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -687,6 +687,17 @@ styp_to_sec_flags (abfd, hdr, name)
}
#endif
+#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
+ /* As a GNU extension, if the name begins with .gnu.linkonce, we
+ only link a single copy of the section. This is used to support
+ g++. g++ will emit each template expansion in its own section.
+ The symbols will be defined as weak, so that multiple definitions
+ are permitted. The GNU linker extension is to actually discard
+ all but one of the sections. */
+ if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+ sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
+#endif
+
return (sec_flags);
}