about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-21 04:15:28 +0000
committerbors <bors@rust-lang.org>2015-12-21 04:15:28 +0000
commit29e60aba7d87d890bc401f57834c06a2b888258b (patch)
treef29742e3e7e17fff9a112cfcd90c23e189a8df96
parentc6079d05860e9d69c867007305e7c15ce4d8c389 (diff)
parentb74359a0a0c88893d37a2057a955773f399b6508 (diff)
downloadrust-29e60aba7d87d890bc401f57834c06a2b888258b.tar.gz
rust-29e60aba7d87d890bc401f57834c06a2b888258b.zip
Auto merge of #30493 - semarie:openbsd-cc, r=alexcrichton
this PR reverts previous ones, that tried to make `cc` to found `estdc++` in `/usr/local/lib`. It causes more trouble than it resolvs things: rustc become unbuildable if another version already exists in `/usr/local` (for example, `libstd-xxxx.so` is found in `/usr/local/lib` and in builddir).

so this PR tries another way to achieve build, but using the good linker for building. By default, rustc use `cc` for linking. But under OpenBSD, `cc` is gcc 4.2.1 from base, whereas we build with gcc 4.9 from ports. By linking using the compiler found at compile-time, we ensure that the compiler will found his own stdc++ library without trouble.

r? @alexcrichton
-rw-r--r--mk/cfg/x86_64-unknown-openbsd.mk1
-rw-r--r--mk/platform.mk10
-rw-r--r--mk/target.mk2
-rw-r--r--mk/tests.mk7
-rw-r--r--src/test/run-make/tools.mk6
5 files changed, 5 insertions, 21 deletions
diff --git a/mk/cfg/x86_64-unknown-openbsd.mk b/mk/cfg/x86_64-unknown-openbsd.mk
index 261616ecf1f..e6f28482284 100644
--- a/mk/cfg/x86_64-unknown-openbsd.mk
+++ b/mk/cfg/x86_64-unknown-openbsd.mk
@@ -20,3 +20,4 @@ CFG_LDPATH_x86_64-unknown-openbsd :=
 CFG_RUN_x86_64-unknown-openbsd=$(2)
 CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2))
 CFG_GNU_TRIPLE_x86_64-unknown-openbsd := x86_64-unknown-openbsd
+RUSTC_FLAGS_x86_64-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC))
diff --git a/mk/platform.mk b/mk/platform.mk
index fd8416e8a6e..04cab379de3 100644
--- a/mk/platform.mk
+++ b/mk/platform.mk
@@ -215,16 +215,6 @@ define CFG_MAKE_TOOLCHAIN
 
   ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
 
-  # On OpenBSD, we need to pass the path of libstdc++.so to the linker
-  # (use path of libstdc++.a which is a known name for the same path)
-  ifeq ($(OSTYPE_$(1)),unknown-openbsd)
-    STDCPP_LIBDIR_RUSTFLAGS_$(1)= \
-        -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
-        -print-file-name=lib$(CFG_STDCPP_NAME).a))"
-  else
-    STDCPP_LIBDIR_RUSTFLAGS_$(1)=
-  endif
-
   # On Bitrig, we need the relocation model to be PIC for everything
   ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
     LLVM_MC_RELOCATION_MODEL="pic"
diff --git a/mk/target.mk b/mk/target.mk
index 9d5e633c3c6..f90b09479c9 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -95,7 +95,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
 		$$(RUSTFLAGS_$(4)) \
 		$$(RUSTFLAGS$(1)_$(4)) \
 		$$(RUSTFLAGS$(1)_$(4)_T_$(2)) \
-		$$(STDCPP_LIBDIR_RUSTFLAGS_$(2)) \
 		--out-dir $$(@D) \
 		-C extra-filename=-$$(CFG_FILENAME_EXTRA) \
 		$$<
@@ -130,7 +129,6 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
 		| $$(TBIN$(1)_T_$(2)_H_$(3))/
 	@$$(call E, rustc: $$@)
 	$$(STAGE$(1)_T_$(2)_H_$(3)) \
-		$$(STDCPP_LIBDIR_RUSTFLAGS_$(2)) \
 		$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
 		-o $$@ $$< --cfg $(4)
 
diff --git a/mk/tests.mk b/mk/tests.mk
index bd7414a3bb6..0f30ff8711e 100644
--- a/mk/tests.mk
+++ b/mk/tests.mk
@@ -393,8 +393,7 @@ $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
 	    $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
 		-L "$$(RT_OUTPUT_DIR_$(2))" \
 		$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
-		$$(RUSTFLAGS_$(4)) \
-		$$(STDCPP_LIBDIR_RUSTFLAGS_$(2))
+		$$(RUSTFLAGS_$(4))
 
 endef
 
@@ -664,9 +663,9 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
         --android-cross-path=$(CFG_ANDROID_CROSS_PATH) \
         --adb-path=$(CFG_ADB) \
         --adb-test-dir=$(CFG_ADB_TEST_DIR) \
-        --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3)) $$(STDCPP_LIBDIR_RUSTFLAGS_$(3))" \
+        --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
         --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
-        --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2)) $$(STDCPP_LIBDIR_RUSTFLAGS_$(2))" \
+        --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
         $$(CTEST_TESTARGS)
 
 ifdef CFG_VALGRIND_RPASS
diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk
index 88cf2a2b031..efaf1197fbd 100644
--- a/src/test/run-make/tools.mk
+++ b/src/test/run-make/tools.mk
@@ -85,11 +85,7 @@ ifeq ($(UNAME),Bitrig)
 else
 ifeq ($(UNAME),OpenBSD)
 	EXTRACFLAGS := -lm -lpthread
-	# extend search lib for found estdc++ if build using gcc from
-	# ports under OpenBSD. This is needed for:
-	#  - run-make/execution-engine
-	#  - run-make/issue-19371
-	RUSTC := $(RUSTC) -L/usr/local/lib
+	RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))"
 else
 	EXTRACFLAGS := -lm -lrt -ldl -lpthread
 	EXTRACXXFLAGS := -lstdc++