Skip to content

Commit c9983e6

Browse files
committed
Auto merge of #27938 - DiamondLovesYou:run-make-cc-arg, r=alexcrichton
For example, I configure with CC="ccache /usr/lib/icecc/bin/gcc".
2 parents 656c3ac + 5e322bf commit c9983e6

File tree

25 files changed

+179
-10
lines changed

25 files changed

+179
-10
lines changed

mk/tests.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -1056,15 +1056,16 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10561056
$$(MAKE) \
10571057
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
10581058
$(3)/test/run-make/$$* \
1059-
$$(CC_$(3)) \
1059+
'$$(CC_$(3))' \
10601060
"$$(CFG_GCCISH_CFLAGS_$(3))" \
10611061
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
10621062
"$$(TESTNAME)" \
10631063
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \
10641064
"$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \
10651065
"$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
10661066
$(1) \
1067-
$$(S)
1067+
$$(S) \
1068+
$(3)
10681069
@touch -r $$@.start_time $$@ && rm $$@.start_time
10691070
else
10701071
# FIXME #11094 - The above rule doesn't work right for multiple targets

src/etc/maketest.py

+16-8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import os
1313
import sys
1414

15+
target_triple = sys.argv[14]
1516

1617
def normalize_path(v):
1718
"""msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
@@ -22,8 +23,11 @@ def normalize_path(v):
2223
windows paths so it is really error-prone. revert it for peace."""
2324
v = v.replace('\\', '/')
2425
# c:/path -> /c/path
25-
if ':/' in v:
26-
v = '/' + v.replace(':/', '/')
26+
# "c:/path" -> "/c/path"
27+
start = v.find(':/')
28+
while start != -1:
29+
v = v[:start - 1] + '/' + v[start - 1:start] + v[start + 1:]
30+
start = v.find(':/')
2731
return v
2832

2933

@@ -39,17 +43,21 @@ def convert_path_spec(name, value):
3943
return value
4044

4145
make = sys.argv[2]
42-
putenv('RUSTC', os.path.abspath(sys.argv[3]))
43-
putenv('TMPDIR', os.path.abspath(sys.argv[4]))
44-
putenv('CC', sys.argv[5] + ' ' + sys.argv[6])
45-
putenv('RUSTDOC', os.path.abspath(sys.argv[7]))
46+
os.putenv('RUSTC', os.path.abspath(sys.argv[3]))
47+
os.putenv('TMPDIR', os.path.abspath(sys.argv[4]))
48+
os.putenv('CC', sys.argv[5] + ' ' + sys.argv[6])
49+
os.putenv('RUSTDOC', os.path.abspath(sys.argv[7]))
4650
filt = sys.argv[8]
4751
putenv('LD_LIB_PATH_ENVVAR', sys.argv[9])
4852
putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[10]))
4953
putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[11]))
5054
putenv('RUST_BUILD_STAGE', sys.argv[12])
51-
putenv('S', os.path.abspath(sys.argv[13]))
52-
putenv('PYTHON', sys.executable)
55+
os.putenv('S', os.path.abspath(sys.argv[13]))
56+
os.putenv('PYTHON', sys.executable)
57+
os.putenv('TARGET', target_triple)
58+
59+
if 'msvc' in target_triple:
60+
os.putenv('IS_MSVC', '1')
5361

5462
if filt not in sys.argv[1]:
5563
sys.exit(0)

src/test/run-make/archive-duplicate-names/Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all:
49
mkdir $(TMPDIR)/a
510
mkdir $(TMPDIR)/b
@@ -9,3 +14,4 @@ all:
914
$(RUSTC) foo.rs
1015
$(RUSTC) bar.rs
1116
$(call RUN,bar)
17+
endif

src/test/run-make/c-dynamic-dylib/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
8+
39
# This hits an assertion in the linker on older versions of osx apparently
410
ifeq ($(shell uname),Darwin)
511
all:
@@ -12,3 +18,4 @@ all: $(call DYLIB,cfoo)
1218
$(call REMOVE_DYLIBS,cfoo)
1319
$(call FAIL,bar)
1420
endif
21+
endif

src/test/run-make/c-dynamic-rlib/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
# This overrides the LD_LIBRARY_PATH for RUN
44
TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)
55

6+
ifdef IS_MSVC
7+
# FIXME #27979
8+
all:
9+
10+
else
11+
612
# This hits an assertion in the linker on older versions of osx apparently
713
ifeq ($(shell uname),Darwin)
814
all:
@@ -15,3 +21,4 @@ all: $(call DYLIB,cfoo)
1521
$(call REMOVE_DYLIBS,cfoo)
1622
$(call FAIL,bar)
1723
endif
24+
endif

src/test/run-make/c-link-to-rust-dylib/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
HOST_LIB_DIR=$(TMPDIR)/../../../stage$(RUST_BUILD_STAGE)/lib
44

5+
ifdef IS_MSVC
6+
# FIXME #27979
7+
all:
8+
9+
else
510
all:
611
$(RUSTC) foo.rs
712
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(call RPATH_LINK_SEARCH,$(HOST_LIB_DIR)) -Wl,-rpath,$(TMPDIR) $(EXTRACFLAGS)
813
$(call RUN,bar)
914
$(call REMOVE_DYLIBS,foo)
1015
$(call FAIL,bar)
16+
17+
endif

src/test/run-make/c-link-to-rust-staticlib/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
EXTRAFLAGS := $(EXTRACFLAGS)
44

5+
ifdef IS_MSVC
6+
# FIXME #27979
7+
all:
8+
9+
else
10+
511
# FIXME: ignore freebsd
612
ifneq ($(shell uname),FreeBSD)
713
all:
@@ -15,3 +21,5 @@ else
1521
all:
1622

1723
endif
24+
25+
endif
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all: $(call STATICLIB,cfoo)
49
$(RUSTC) foo.rs -C prefer-dynamic
510
$(RUSTC) bar.rs
611
rm $(TMPDIR)/$(call STATICLIB_GLOB,cfoo)
712
$(call RUN,bar)
813
$(call REMOVE_DYLIBS,foo)
914
$(call FAIL,bar)
15+
endif
+7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all: $(call STATICLIB,cfoo)
49
$(RUSTC) foo.rs
510
$(RUSTC) bar.rs
611
$(call REMOVE_RLIBS,foo)
712
rm $(TMPDIR)/$(call STATICLIB_GLOB,cfoo)
813
$(call RUN,bar)
14+
15+
endif

src/test/run-make/compiler-lookup-paths/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all: $(TMPDIR)/libnative.a
49
mkdir -p $(TMPDIR)/crate
510
mkdir -p $(TMPDIR)/native
@@ -28,3 +33,5 @@ all: $(TMPDIR)/libnative.a
2833
$(RUSTC) f.rs -L native=$(TMPDIR)/e1 -L $(TMPDIR)/e2
2934
$(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L $(TMPDIR)/e2
3035
$(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2
36+
37+
endif
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all:
49
$(CC) -std=c99 test.c -c -o $(TMPDIR)/test.o
510
$(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o
611
$(RUSTC) testcrate.rs -L $(TMPDIR)
712
$(RUSTC) test.rs -L $(TMPDIR)
813
$(call RUN,test) || exit 1
14+
15+
endif
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all:
49
$(CC) -std=c99 test.c -c -o $(TMPDIR)/test.o
510
$(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o
611
$(RUSTC) test.rs -L $(TMPDIR)
712
$(call RUN,test) || exit 1
13+
14+
endif
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all:
49
$(CC) -std=c99 test.c -c -o $(TMPDIR)/test.o
510
$(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o
611
$(RUSTC) test.rs -L $(TMPDIR)
712
$(call RUN,test) || exit 1
13+
14+
endif
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all:
49
$(CC) -std=c99 test.c -c -o $(TMPDIR)/test.o
510
$(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o
611
$(RUSTC) testcrate.rs -L $(TMPDIR)
712
$(RUSTC) test.rs -L $(TMPDIR)
813
$(call RUN,test) || exit 1
14+
15+
endif

src/test/run-make/interdependent-c-libraries/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
# correct to complete the linkage. If passed as "-lfoo -lbar", then the 'foo'
99
# library will be stripped out, and the linkage will fail.
1010

11+
ifdef IS_MSVC
12+
# FIXME #27979
13+
all:
14+
15+
else
1116
all: $(call STATICLIB,foo) $(call STATICLIB,bar)
1217
$(RUSTC) foo.rs
1318
$(RUSTC) bar.rs
1419
$(RUSTC) main.rs -Z print-link-args
20+
21+
endif
+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all: $(call STATICLIB,foo)
49
$(RUSTC) foo.rs
510
$(RUSTC) bar.rs
611
$(call RUN,bar)
12+
13+
endif

src/test/run-make/issue-14500/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ ifeq ($(UNAME),Bitrig)
1010
EXTRACFLAGS := -lc $(EXTRACFLAGS) $(EXTRACXXFLAGS)
1111
endif
1212

13+
ifdef IS_MSVC
14+
# FIXME #27979
15+
all:
16+
17+
else
1318
all:
1419
$(RUSTC) foo.rs --crate-type=rlib
1520
$(RUSTC) bar.rs --crate-type=staticlib -C lto -L. -o $(TMPDIR)/libbar.a
1621
$(CC) foo.c -lbar -o $(call RUN_BINFILE,foo) $(EXTRACFLAGS)
1722
$(call RUN,foo)
23+
24+
endif
+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all: $(TMPDIR)/libfoo.a
49
$(RUSTC) foo.rs -C extra-filename=-383hf8 -C prefer-dynamic
510
$(RUSTC) bar.rs
611
$(call RUN,bar)
12+
13+
endif
+7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all:
49
$(CC) -std=c99 test.c -c -o $(TMPDIR)/test.o
510
$(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o
611
$(RUSTC) test.rs -L $(TMPDIR)
712
$(call RUN,test) || exit 1
13+
14+
endif

src/test/run-make/link-path-order/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
CORRECT_DIR=$(TMPDIR)/correct
77
WRONG_DIR=$(TMPDIR)/wrong
88

9+
ifdef IS_MSVC
10+
# FIXME #27979
11+
all:
12+
13+
else
914
all: $(TMPDIR)/libcorrect.a $(TMPDIR)/libwrong.a
1015
mkdir -p $(CORRECT_DIR) $(WRONG_DIR)
1116
mv $(TMPDIR)/libcorrect.a $(CORRECT_DIR)/libfoo.a
@@ -14,3 +19,5 @@ all: $(TMPDIR)/libcorrect.a $(TMPDIR)/libwrong.a
1419
$(call RUN,should_succeed)
1520
$(RUSTC) main.rs -o $(TMPDIR)/should_fail -L $(WRONG_DIR) -L $(CORRECT_DIR)
1621
$(call FAIL,should_fail)
22+
23+
endif
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
-include ../tools.mk
22

3+
ifdef IS_MSVC
4+
# FIXME #27979
5+
all:
6+
7+
else
38
all:
49
$(CC) foo.c -c -o $(TMPDIR)/foo.o
510
$(AR) rcs $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o
611
$(RUSTC) bar.rs -lfoo -L $(TMPDIR)
712
$(call RUN,bar) || exit 1
13+
14+
endif

src/test/run-make/lto-smoke-c/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
# Apparently older versions of GCC segfault if -g is passed...
44
CC := $(CC:-g=)
55

6+
ifdef IS_MSVC
7+
# FIXME #27979
8+
all:
9+
10+
else
611
all:
712
$(RUSTC) foo.rs -C lto
813
$(CC) bar.c -lfoo -o $(call RUN_BINFILE,bar) $(EXTRACFLAGS) $(EXTRACXXFLAGS)
914
$(call RUN,bar)
15+
16+
endif

0 commit comments

Comments
 (0)