Skip to content

Commit 6602b2f

Browse files
committed
Auto merge of #28501 - semarie:stdcpp-path, r=alexcrichton
By default, the linker in use under OpenBSD is the linker of base, which don't include /usr/local/lib where libstdc++ of gcc-4.9 lives. We need to add this directory to linker-path-search (using -L). Search the path of libstdc++.a, which is a known name (libstdc++.so has SO_VERSION) in the same directory. r? @alexcrichton this commit needs #28495 to be commited first. It should be the last piece for building rustc under OpenBSD from scratch.
2 parents f5a64a6 + 049d76b commit 6602b2f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mk/platform.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ define CFG_MAKE_TOOLCHAIN
208208

209209
ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
210210

211+
# On OpenBSD, we need to pass the path of libstdc++.so to the linker
212+
# (use path of libstdc++.a which is a known name for the same path)
213+
ifeq ($(OSTYPE_$(1)),unknown-openbsd)
214+
RUSTC_FLAGS_$(1)=-L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
215+
-print-file-name=lib$(CFG_STDCPP_NAME).a))" \
216+
$(RUSTC_FLAGS_$(1))
217+
endif
218+
211219
# On Bitrig, we need the relocation model to be PIC for everything
212220
ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
213221
LLVM_MC_RELOCATION_MODEL="pic"

0 commit comments

Comments
 (0)