aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDave Korn <dave.korn.cygwin@gmail.com>2009-01-31 18:52:00 +0000
committerDave Korn <davek@gcc.gnu.org>2009-01-31 18:52:00 +0000
commit3cbfaf984602e3b1eabba8ec279a1aceb0379224 (patch)
tree3b59fc8984e5b0cc68ebb79362688651ec1eeadc /gcc
parent8d0b6068b550226ed80e62af3bb5b3da171d7802 (diff)
downloadgcc-3cbfaf984602e3b1eabba8ec279a1aceb0379224.zip
gcc-3cbfaf984602e3b1eabba8ec279a1aceb0379224.tar.gz
gcc-3cbfaf984602e3b1eabba8ec279a1aceb0379224.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog27
-rw-r--r--gcc/config.gcc16
-rw-r--r--gcc/config/i386/cygming.h2
-rw-r--r--gcc/config/i386/cygwin.h8
-rw-r--r--gcc/config/i386/mingw32.h8
-rw-r--r--gcc/config/i386/t-cygming12
-rw-r--r--gcc/config/i386/t-cygwin12
-rw-r--r--gcc/config/i386/t-dw2-eh3
-rw-r--r--gcc/config/i386/t-sjlj-eh3
-rw-r--r--gcc/mkmap-flat.awk3
10 files changed, 84 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 194b0f0..148b993 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,32 @@
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
* config/i386/i386.c (ix86_builtin_setjmp_frame_value): New.
(TARGET_BUILTIN_SETJMP_FRAME_VALUE): Override default to point
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 84670d0..c0a5282 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -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"
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 062b50a..e9250bb 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -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
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 9b2fd7f..0f73f00 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -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"
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 571277e..43f5a05 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -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"
diff --git a/gcc/config/i386/t-cygming b/gcc/config/i386/t-cygming
index 5efd82e..e26462f 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/i386/t-cygming
@@ -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
diff --git a/gcc/config/i386/t-cygwin b/gcc/config/i386/t-cygwin
index 7433138..d58d84f 100644
--- a/gcc/config/i386/t-cygwin
+++ b/gcc/config/i386/t-cygwin
@@ -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
index 0000000..ffcc39a
--- /dev/null
+++ b/gcc/config/i386/t-dw2-eh
@@ -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
index 0000000..c9085f4
--- /dev/null
+++ b/gcc/config/i386/t-sjlj-eh
@@ -0,0 +1,3 @@
+
+# We are using SjLj EH.
+EH_MODEL = sjlj
diff --git a/gcc/mkmap-flat.awk b/gcc/mkmap-flat.awk
index 4a9a993..f99fd50 100644
--- a/gcc/mkmap-flat.awk
+++ b/gcc/mkmap-flat.awk
@@ -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";
}