diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-11 17:52:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-11 17:52:10 +0200 |
| commit | 5ecc18f3ece1124a56ff76a74c3eb4153be5b3b8 (patch) | |
| tree | 81b2b4627905a1c327f1014489ad4367f35dbf26 | |
| parent | f9c0ea2862280102bf33e9df81f33b1b7b464e19 (diff) | |
| parent | b9d9689e78160c5d09ea627bb1a93468e4872ead (diff) | |
| download | rust-5ecc18f3ece1124a56ff76a74c3eb4153be5b3b8.tar.gz rust-5ecc18f3ece1124a56ff76a74c3eb4153be5b3b8.zip | |
Rollup merge of #70937 - mati865:mingw-staticlib-suffix, r=petrochenkov
Fix staticlib name for *-pc-windows-gnu targets Fix https://github.com/rust-lang/rust/issues/69904 Guess this will need FCP but opened PR anyway to bring the attention. In short Rust has been using wrong `foo.lib` format for static libraries when building for `*-pc-windows-gnu` since version [1.8.0](https://github.com/rust-lang/rust/commit/34b4e66736a0fb65235feadbb5178d42bd09ed67). [LD](https://github.com/bminor/binutils-gdb/blob/f4a220077b03af3a1f905b7dc6dc84c0a06d582f/ld/emultempl/pe.em#L2224-L2227) and [LLD](https://github.com/llvm/llvm-project/blob/0605f5fbe755326e3dbc8daa4fc34453b8c5ac0e/lld/MinGW/Driver.cpp#L140-L141) agree in that regard and only accept static libraries with `libfoo.a` format. So the only thing to break here is when somebody added a hack to rename created library to proper format (like [here](https://gitlab.gnome.org/GNOME/librsvg/-/commit/ad86ab8580c8779fc3eb2bee2422bb116919844e#d5b4de16d947214ec306bd57bed1bd23a939b5f9_197_194)).
| -rw-r--r-- | src/librustc_target/spec/windows_base.rs | 4 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/output-type-permutations/Makefile | 2 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/tools.mk | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/librustc_target/spec/windows_base.rs b/src/librustc_target/spec/windows_base.rs index 34fcdf251b8..39350c1618a 100644 --- a/src/librustc_target/spec/windows_base.rs +++ b/src/librustc_target/spec/windows_base.rs @@ -75,8 +75,8 @@ pub fn opts() -> TargetOptions { dll_prefix: String::new(), dll_suffix: ".dll".to_string(), exe_suffix: ".exe".to_string(), - staticlib_prefix: String::new(), - staticlib_suffix: ".lib".to_string(), + staticlib_prefix: "lib".to_string(), + staticlib_suffix: ".a".to_string(), target_family: Some("windows".to_string()), is_like_windows: true, allows_weak_linkage: false, diff --git a/src/test/run-make-fulldeps/output-type-permutations/Makefile b/src/test/run-make-fulldeps/output-type-permutations/Makefile index ffd3e6da256..b6e0cbaf5dd 100644 --- a/src/test/run-make-fulldeps/output-type-permutations/Makefile +++ b/src/test/run-make-fulldeps/output-type-permutations/Makefile @@ -78,7 +78,7 @@ all: rm $(TMPDIR)/$(call BIN,foo) $(RUSTC) foo.rs --crate-type=dylib --emit=link=$(TMPDIR)/$(call BIN,foo) rm $(TMPDIR)/$(call BIN,foo) - rm -f $(TMPDIR)/{lib,}foo.{dll.exp,dll.lib,pdb,dll.a,exe.lib} + rm -f $(TMPDIR)/{lib,}foo.{dll.exp,dll.lib,pdb,dll.a,exe.a} [ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ] || (ls -1 $(TMPDIR) && exit 1) $(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo diff --git a/src/test/run-make-fulldeps/tools.mk b/src/test/run-make-fulldeps/tools.mk index 48fd3ff7246..04bf78ed210 100644 --- a/src/test/run-make-fulldeps/tools.mk +++ b/src/test/run-make-fulldeps/tools.mk @@ -44,8 +44,13 @@ RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(RUN_BINFILE) FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(RUN_BINFILE) && exit 1 || exit 0 DYLIB_GLOB = $(1)*.dll DYLIB = $(TMPDIR)/$(1).dll +ifdef IS_MSVC STATICLIB = $(TMPDIR)/$(1).lib STATICLIB_GLOB = $(1)*.lib +else +STATICLIB = $(TMPDIR)/lib$(1).a +STATICLIB_GLOB = lib$(1)*.a +endif BIN = $(1).exe LLVM_FILECHECK := $(shell cygpath -u "$(LLVM_FILECHECK)") else |
