re PR target/38904 (Shared libgcc DLL violates Cygwin platform conventions.)

PR target/38904
	* mkmap-flat.awk (END):  Use pe_dll command-line arg to pass
	LIBRARY name in, instead of hard-coding it.
	* config.gcc (i[34567]86-*-pe | i[34567]86-*-cygwin*):  Add an
	extra target make frag to tmake_files according to EH model.
	(i[34567]86-*-mingw* | x86_64-*-mingw*):  Likewise.
	* config/i386/t-dw2-eh, config/i386/t-sjlj-eh:  Add new target
	frags that define makefile variable EH_MODEL appropriately.
	* config/i386/cygming.h (DWARF2_UNWIND_INFO):  Add comment.
	* config/i386/cygwin.h (LIBGCC_EH_EXTN):  Define to nothing or
	to "-sjlj" according to type of EH configured.
	(LIBGCC_SONAME):  Concatenate it to shared library base name.
	* config/i386/mingw32.h (LIBGCC_EH_EXTN):  Define to "_dw2" or
	to "_sjlj" according to type of EH configured.
	(LIBGCC_SONAME):  Concatenate it to shared library base name.
	* config/i386/t-cygming (SHLIB_SONAME):  Use EH_MODEL.
	(SHLIB_LINK):  Add missing semicolon to if-else construct.
	(SHLIB_MKMAP_OPTS):  Pass library name to mkmap-flat.awk as
	string value of "pe_dll" command-line option.
	* config/i386/t-cygwin (SHLIB_EH_EXTENSION):  New helper.
	(SHLIB_SONAME):  Use it when overriding t-cygming default.
	(SHLIB_IMPLIB):  Override t-cygming default.
	(SHLIB_MKMAP_OPTS):  Pass library name to mkmap-flat.awk as
	string value of "pe_dll" command-line option.

From-SVN: r143829
This commit is contained in:
Dave Korn 2009-01-31 18:52:00 +00:00 committed by Dave Korn
parent 8d0b6068b5
commit 3cbfaf9846
10 changed files with 84 additions and 10 deletions

View File

@ -1,3 +1,30 @@
2009-01-31 Dave Korn <dave.korn.cygwin@gmail.com>
PR target/38904
* mkmap-flat.awk (END): Use pe_dll command-line arg to pass
LIBRARY name in, instead of hard-coding it.
* config.gcc (i[34567]86-*-pe | i[34567]86-*-cygwin*): Add an
extra target make frag to tmake_files according to EH model.
(i[34567]86-*-mingw* | x86_64-*-mingw*): Likewise.
* config/i386/t-dw2-eh, config/i386/t-sjlj-eh: Add new target
frags that define makefile variable EH_MODEL appropriately.
* config/i386/cygming.h (DWARF2_UNWIND_INFO): Add comment.
* config/i386/cygwin.h (LIBGCC_EH_EXTN): Define to nothing or
to "-sjlj" according to type of EH configured.
(LIBGCC_SONAME): Concatenate it to shared library base name.
* config/i386/mingw32.h (LIBGCC_EH_EXTN): Define to "_dw2" or
to "_sjlj" according to type of EH configured.
(LIBGCC_SONAME): Concatenate it to shared library base name.
* config/i386/t-cygming (SHLIB_SONAME): Use EH_MODEL.
(SHLIB_LINK): Add missing semicolon to if-else construct.
(SHLIB_MKMAP_OPTS): Pass library name to mkmap-flat.awk as
string value of "pe_dll" command-line option.
* config/i386/t-cygwin (SHLIB_EH_EXTENSION): New helper.
(SHLIB_SONAME): Use it when overriding t-cygming default.
(SHLIB_IMPLIB): Override t-cygming default.
(SHLIB_MKMAP_OPTS): Pass library name to mkmap-flat.awk as
string value of "pe_dll" command-line option.
2009-01-31 Dave Korn <dave.korn.cygwin@gmail.com>
PR target/38952

View File

@ -1241,7 +1241,13 @@ i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
i[34567]86-*-pe | i[34567]86-*-cygwin*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h"
xm_file=i386/xm-cygwin.h
tmake_file="${tmake_file} i386/t-cygwin i386/t-cygming"
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$sjlj = x0; then
tmake_eh_file="i386/t-dw2-eh"
else
tmake_eh_file="i386/t-sjlj-eh"
fi
tmake_file="${tmake_file} ${tmake_eh_file} i386/t-cygming i386/t-cygwin"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
extra_options="${extra_options} i386/cygming.opt"
extra_objs="winnt.o winnt-stubs.o"
@ -1255,7 +1261,13 @@ i[34567]86-*-pe | i[34567]86-*-cygwin*)
i[34567]86-*-mingw* | x86_64-*-mingw*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h"
xm_file=i386/xm-mingw32.h
tmake_file="${tmake_file} i386/t-cygming i386/t-mingw32"
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$sjlj = x0; then
tmake_eh_file="i386/t-dw2-eh"
else
tmake_eh_file="i386/t-sjlj-eh"
fi
tmake_file="${tmake_file} ${tmake_eh_file} i386/t-cygming i386/t-mingw32"
target_gtfiles="\$(srcdir)/config/i386/winnt.c"
extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
extra_objs="winnt.o winnt-stubs.o"

View File

@ -283,6 +283,8 @@ do { \
/* If configured with --disable-sjlj-exceptions, use DWARF2, else
default to SJLJ. */
#if (defined (CONFIG_SJLJ_EXCEPTIONS) && !CONFIG_SJLJ_EXCEPTIONS)
/* The logic of this #if must be kept synchronised with the logic
for selecting the tmake_eh_file fragment in config.gcc. */
#define DWARF2_UNWIND_INFO 1
#else
#define DWARF2_UNWIND_INFO 0

View File

@ -259,3 +259,11 @@ while (0)
and the -pthread flag is not recognized. */
#undef GOMP_SELF_SPECS
#define GOMP_SELF_SPECS ""
/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
#if DWARF2_UNWIND_INFO
#define LIBGCC_EH_EXTN ""
#else
#define LIBGCC_EH_EXTN "-sjlj"
#endif
#define LIBGCC_SONAME "cyggcc_s" LIBGCC_EH_EXTN "-1.dll"

View File

@ -212,4 +212,10 @@ __enable_execute_stack (void *addr) \
#endif
/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */
#define LIBGCC_SONAME "libgcc_s_1.dll"
/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
#if DWARF2_UNWIND_INFO
#define LIBGCC_EH_EXTN "_dw2"
#else
#define LIBGCC_EH_EXTN "_sjlj"
#endif
#define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll"

View File

@ -43,13 +43,13 @@ STMP_FIXINC=stmp-fixinc
# mkmap-flat.awk is used with the pe_dll option to produce a DEF instead
# of an ELF map file.
#
# Warning: If SHLIB_SOVERSION or SHLIB_SONAME is updated, LIBGCC_SONAME
# in mingw32.h must be updated also.
# Warning: If SHLIB_SOVERSION or SHLIB_SONAME are updated, LIBGCC_SONAME
# in mingw32.h and SHLIB_MKMAP_OPTS below must be updated also.
SHLIB_EXT = .dll
SHLIB_IMPLIB = @shlib_base_name@.a
SHLIB_SOVERSION = 1
SHLIB_SONAME = @shlib_base_name@_$(SHLIB_SOVERSION)$(SHLIB_EXT)
SHLIB_SONAME = @shlib_base_name@_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
SHLIB_MAP = @shlib_map_file@
SHLIB_OBJS = @shlib_objs@
SHLIB_DIR = @multilib_dir@/shlib
@ -57,7 +57,7 @@ SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
if [ ! -d $(SHLIB_DIR) ]; then \
mkdir $(SHLIB_DIR) \
mkdir $(SHLIB_DIR); \
else true; fi && \
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
$(SHLIB_MAP).def \
@ -79,5 +79,7 @@ SHLIB_INSTALL = \
$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \
$$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB)
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
SHLIB_MKMAP_OPTS = -v pe_dll=1
# We'd like to use SHLIB_SONAME here too, but shlib_base_name
# does not get substituted before mkmap-flat.awk is run.
SHLIB_MKMAP_OPTS = -v pe_dll=libgcc_s_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver

View File

@ -16,3 +16,15 @@ cygwin2.o: $(srcdir)/config/i386/cygwin2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
# Cygwin-specific parts of LIB_SPEC
SHLIB_LC = -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32
# We have already included one of the t-{dw2,sjlj}-eh fragments for EH_MODEL
SHLIB_EH_EXTENSION = $(subst -dw2,,-$(EH_MODEL))
# Cygwin uses different conventions than MinGW; override generic SHLIB_ def'ns here.
SHLIB_IMPLIB = @shlib_base_name@$(SHLIB_EXT).a
SHLIB_SONAME = cyggcc_s$(SHLIB_EH_EXTENSION)-$(SHLIB_SOVERSION)$(SHLIB_EXT)
# This must match the definitions of SHLIB_SONAME/SHLIB_SOVERSION and LIBGCC_SONAME.
# We'd like to use SHLIB_SONAME here too, and we can, since
# we don't rely on shlib_base_name substitution for it.
SHLIB_MKMAP_OPTS = -v pe_dll=$(SHLIB_SONAME)

3
gcc/config/i386/t-dw2-eh Normal file
View File

@ -0,0 +1,3 @@
# We are using Dwarf-2 EH.
EH_MODEL = dw2

View File

@ -0,0 +1,3 @@
# We are using SjLj EH.
EH_MODEL = sjlj

View File

@ -93,8 +93,7 @@ $1 == "}" {
END {
if (pe_dll) {
# This matches SHLIB_SONAME in config/i386/t-cygming.
print "LIBRARY libgcc_s_1.dll";
print "LIBRARY " pe_dll;
print "EXPORTS";
}