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.
This commit is contained in:
Ian Lance Taylor 1999-07-22 01:39:23 +00:00
parent b4089fdd75
commit 242eabea02
4 changed files with 25 additions and 0 deletions

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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);
}