]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/38904 (Shared libgcc DLL violates Cygwin platform conventions.)
authorDave Korn <dave.korn.cygwin@gmail.com>
Sat, 31 Jan 2009 18:52:00 +0000 (18:52 +0000)
committerDave Korn <davek@gcc.gnu.org>
Sat, 31 Jan 2009 18:52:00 +0000 (18:52 +0000)
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

gcc/ChangeLog
gcc/config.gcc
gcc/config/i386/cygming.h
gcc/config/i386/cygwin.h
gcc/config/i386/mingw32.h
gcc/config/i386/t-cygming
gcc/config/i386/t-cygwin
gcc/config/i386/t-dw2-eh [new file with mode: 0644]
gcc/config/i386/t-sjlj-eh [new file with mode: 0644]
gcc/mkmap-flat.awk

index 194b0f03405400f6fde4f984f5db6f037ca89ed5..148b99309492db7e43997cc3e6d500fdef277d91 100644 (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
index 84670d08867672098e4d42401f3fdde0d3632a7d..c0a528221318005a69551d66de08efb974a6400d 100644 (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"
index 062b50a405eb2c9d3bb7bb5d80b80b701629164b..e9250bb49a4debd2f423cb754d8a2aacab4c5963 100644 (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
index 9b2fd7f2b7dfcd5b703ef34e39370096d85d2d43..0f73f000707cb9ed6e53a8218fab5255613c293e 100644 (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"
index 571277edb998835d3e3aade50c1e7505a717fc4e..43f5a056a28c525b60f5a5ced60d2a2475ef8eaa 100644 (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"
index 5efd82e488d098d182ee72b74c4ccfaaf12dfba6..e26462fb623e8f328ad8cb15b2b2b2d768711855 100644 (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
index 7433138d692142059966df1323a8c673c29123a1..d58d84fcd6fa8f8796b6c8f008d292cd9a2a7c7c 100644 (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)
+
diff --git a/gcc/config/i386/t-dw2-eh b/gcc/config/i386/t-dw2-eh
new file mode 100644 (file)
index 0000000..ffcc39a
--- /dev/null
@@ -0,0 +1,3 @@
+
+# We are using Dwarf-2 EH.
+EH_MODEL = dw2
diff --git a/gcc/config/i386/t-sjlj-eh b/gcc/config/i386/t-sjlj-eh
new file mode 100644 (file)
index 0000000..c9085f4
--- /dev/null
@@ -0,0 +1,3 @@
+
+# We are using SjLj EH.
+EH_MODEL = sjlj
index 4a9a99356d8d7c12e6b225436b8ab6e14146ea00..f99fd502fdfbebc3735c92326015e16934dfe0fc 100644 (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";
   }