Skip to content

Commit b74359a

Browse files
committed
openbsd: use specific linker for building
By default, rustc use `cc` as linker. Under OpenBSD, `cc` is gcc version 4.2.1. So use the compiler found at configure-time for linking: it will be gcc 4.9. It permits to resolv problem of finding -lestdc++ or -lgcc. For base gcc (4.2), there are in not standard path, whereas for ports gcc (4.9) there are in standard path.
1 parent e641896 commit b74359a

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

mk/cfg/x86_64-unknown-openbsd.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ CFG_LDPATH_x86_64-unknown-openbsd :=
2020
CFG_RUN_x86_64-unknown-openbsd=$(2)
2121
CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2))
2222
CFG_GNU_TRIPLE_x86_64-unknown-openbsd := x86_64-unknown-openbsd
23+
RUSTC_FLAGS_x86_64-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC))

src/test/run-make/tools.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ ifeq ($(UNAME),Bitrig)
8585
else
8686
ifeq ($(UNAME),OpenBSD)
8787
EXTRACFLAGS := -lm -lpthread
88+
RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))"
8889
else
8990
EXTRACFLAGS := -lm -lrt -ldl -lpthread
9091
EXTRACXXFLAGS := -lstdc++

0 commit comments

Comments
 (0)