+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
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"
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"
/* 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
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"
#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"
# 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
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 \
$(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
# 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)
+
--- /dev/null
+
+# We are using Dwarf-2 EH.
+EH_MODEL = dw2
--- /dev/null
+
+# We are using SjLj EH.
+EH_MODEL = sjlj
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";
}