diff options
author | Jason Tishler <jason@tishler.net> | 2003-04-14 12:51:26 (GMT) |
---|---|---|
committer | Jason Tishler <jason@tishler.net> | 2003-04-14 12:51:26 (GMT) |
commit | 21664d854fe60005e3a8094e2f4f54f0b805e366 (patch) | |
tree | d12be6e939985ed584c0003187d0520e469fc37e /Lib/distutils | |
parent | 42a8aedb2977379c08e5afc000e8bb0b8befdc11 (diff) | |
download | cpython-21664d854fe60005e3a8094e2f4f54f0b805e366.zip cpython-21664d854fe60005e3a8094e2f4f54f0b805e366.tar.gz cpython-21664d854fe60005e3a8094e2f4f54f0b805e366.tar.bz2 |
Patch #709178: remove -static option from cygwinccompiler
After some more reflection (and no negative feedback), I am reverting the
original patch and applying my version, cygwinccompiler.py-shared.diff,
instead.
My reasons are the following:
1. support for older toolchains is retained
2. support for new toolchains (i.e., ld -shared) is added
The goal of my approach is to avoid breaking older toolchains while adding
better support for newer ones.
Diffstat (limited to 'Lib/distutils')
-rw-r--r-- | Lib/distutils/cygwinccompiler.py | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 794dcdb..94b8b86 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -33,7 +33,17 @@ cygwin in no-cygwin mode). # * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now # - its dllwrap doesn't work, there is a bug in binutils 2.10.90 # see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html +# - using gcc -mdll instead dllwrap doesn't work without -static because +# it tries to link against dlls instead their import libraries. (If +# it finds the dll first.) +# By specifying -static we force ld to link against the import libraries, +# this is windows standard and there are normally not the necessary symbols +# in the dlls. # *** only the version of June 2000 shows these problems +# * cygwin gcc 3.2/ld 2.13.90 works +# (ld supports -shared) +# * mingw gcc 3.2/ld 2.13 works +# (ld supports -shared) # This module should be kept compatible with Python 1.5.2. @@ -77,7 +87,7 @@ class CygwinCCompiler (UnixCCompiler): self.ld_version, self.dllwrap_version) ) - # ld_version >= "2.10.90" should also be able to use + # ld_version >= "2.10.90" and < "2.13" should also be able to use # gcc -mdll instead of dllwrap # Older dllwraps had own version numbers, newer ones use the # same as the rest of binutils ( also ld ) @@ -87,13 +97,20 @@ class CygwinCCompiler (UnixCCompiler): else: self.linker_dll = "dllwrap" + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static + if self.ld_version >= "2.13": + shared_option = "-shared" + else: + shared_option = "-mdll -static" + # Hard-code GCC because that's what this is all about. # XXX optimization, warnings etc. should be customizable. self.set_executables(compiler='gcc -mcygwin -O -Wall', compiler_so='gcc -mcygwin -mdll -O -Wall', linker_exe='gcc -mcygwin', - linker_so=('%s -mcygwin -mdll' % - self.linker_dll)) + linker_so=('%s -mcygwin %s' % + (self.linker_dll, shared_option))) # cygwin and mingw32 need different sets of libraries if self.gcc_version == "2.91.57": @@ -262,6 +279,13 @@ class Mingw32CCompiler (CygwinCCompiler): CygwinCCompiler.__init__ (self, verbose, dry_run, force) + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static + if self.ld_version >= "2.13": + shared_option = "-shared" + else: + shared_option = "-mdll -static" + # A real mingw32 doesn't need to specify a different entry point, # but cygwin 2.91.57 in no-cygwin-mode needs it. if self.gcc_version <= "2.91.57": @@ -272,8 +296,9 @@ class Mingw32CCompiler (CygwinCCompiler): self.set_executables(compiler='gcc -mno-cygwin -O -Wall', compiler_so='gcc -mno-cygwin -mdll -O -Wall', linker_exe='gcc -mno-cygwin', - linker_so='%s -mno-cygwin -mdll %s' - % (self.linker_dll, entry_point)) + linker_so='%s -mno-cygwin %s %s' + % (self.linker_dll, shared_option, + entry_point)) # Maybe we should also append -mthreads, but then the finished # dlls need another dll (mingwm10.dll see Mingw32 docs) # (-mthreads: Support thread-safe exception handling on `Mingw32') |