From 3ef39d3cb6e480aafefef083fa656cb592d56e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Marie?= Date: Sun, 26 Nov 2017 10:08:25 +0100 Subject: [PATCH] make OpenBSD to use libc++ instead of (e)stdc++ --- src/librustc_back/target/openbsd_base.rs | 1 + src/librustc_llvm/build.rs | 4 ++-- src/libunwind/build.rs | 2 +- src/test/run-make/tools.mk | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc_back/target/openbsd_base.rs b/src/librustc_back/target/openbsd_base.rs index a5f8e7ae5f9..ab421dec780 100644 --- a/src/librustc_back/target/openbsd_base.rs +++ b/src/librustc_back/target/openbsd_base.rs @@ -34,6 +34,7 @@ pub fn opts() -> TargetOptions { is_like_openbsd: true, pre_link_args: args, position_independent_executables: true, + eliminate_frame_pointer: false, // FIXME 43575 relro_level: RelroLevel::Full, .. Default::default() } diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 75efe135f65..141a9a8d704 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -252,8 +252,8 @@ fn main() { let llvm_static_stdcpp = env::var_os("LLVM_STATIC_STDCPP"); let stdcppname = if target.contains("openbsd") { - // OpenBSD has a particular C++ runtime library name - "estdc++" + // llvm-config on OpenBSD doesn't mention stdlib=libc++ + "c++" } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() { // NetBSD uses a separate library when relocation is required "stdc++_pic" diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index dc1464b905b..d8457dab51b 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -27,7 +27,7 @@ fn main() { } else if target.contains("netbsd") { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("openbsd") { - println!("cargo:rustc-link-lib=gcc"); + println!("cargo:rustc-link-lib=c++abi"); } else if target.contains("solaris") { println!("cargo:rustc-link-lib=gcc_s"); } else if target.contains("bitrig") { diff --git a/src/test/run-make/tools.mk b/src/test/run-make/tools.mk index c5d5626bf72..a882ef448b9 100644 --- a/src/test/run-make/tools.mk +++ b/src/test/run-make/tools.mk @@ -92,7 +92,7 @@ ifeq ($(UNAME),SunOS) EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv else ifeq ($(UNAME),OpenBSD) - EXTRACFLAGS := -lm -lpthread + EXTRACFLAGS := -lm -lpthread -lc++abi RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))" else EXTRACFLAGS := -lm -lrt -ldl -lpthread