Skip to content

Commit 843d046

Browse files
committed
Rollup merge of rust-lang#22088 - semarie:openbsd-rmake, r=alexcrichton
- c-link-to-rust-staticlib: use `EXTRACFLAGS` defined by tools.mk for choose the good libraries to link to. tools.mk define a variable `EXTRACFLAGS` that contains the needed library per target. So it is better to use it, instead of duplicate the code here. I keep the `ifndef IS_WINDOWS` has tools.mk define something for WINDOWS... so I don't change things that I couldn't test. - no-stack-check: disabled for openbsd (no segmented stacks here) - symbols-are-reasonable: use portable grep pattern - target-specs: use POSIX form for options when invoking grep - use-extern-for-plugins: disable as OpenBSD only support x86_64 for now
2 parents 81f5e33 + 8fb4264 commit 843d046

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
-include ../tools.mk
22

33
ifndef IS_WINDOWS
4-
ifneq ($(shell uname),Darwin)
5-
EXTRAFLAGS := -lm -lrt -ldl -lpthread
6-
endif
4+
EXTRAFLAGS := $(EXTRACFLAGS)
75
endif
86

97
# FIXME: ignore freebsd

src/test/run-make/no-stack-check/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-include ../tools.mk
22

33
ifndef IS_WINDOWS
4+
ifneq ($(UNAME),OpenBSD)
45
all:
56
$(RUSTC) -O --emit asm attr.rs
67
! grep -q morestack $(TMPDIR)/attr.s
@@ -9,6 +10,10 @@ all:
910
$(RUSTC) -O --emit asm -C no-stack-check flag.rs
1011
! grep -q morestack $(TMPDIR)/flag.s
1112
else
13+
# On OpenBSD, morestack isn't used as the segmented stacks are disabled
14+
all:
15+
endif
16+
else
1217
# On Windows we use __chkstk and it only appears in functions with large allocations,
1318
# so this test wouldn't be reliable.
1419
all:

src/test/run-make/symbols-are-reasonable/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ OUT=$(TMPDIR)/lib.s
1010
all:
1111
$(RUSTC) lib.rs --emit=asm --crate-type=staticlib
1212
# just check for symbol declarations with the names we're expecting.
13-
grep 'str[0-9]\+:' $(OUT)
14-
grep 'binary[0-9]\+:' $(OUT)
15-
grep 'vtable[0-9]\+' $(OUT)
13+
grep 'str[0-9][0-9]*:' $(OUT)
14+
grep 'binary[0-9][0-9]*:' $(OUT)
15+
grep 'vtable[0-9][0-9]*' $(OUT)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-include ../tools.mk
22
all:
33
$(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm
4-
grep --quiet --invert-match morestack < $(TMPDIR)/foo.s
4+
grep -q -v morestack < $(TMPDIR)/foo.s
55
$(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | grep --quiet "Error loading target specification"
66
$(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | grep 'Field llvm-target'
77
RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm
88
RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=x86_64-unknown-linux-gnu --crate-type=lib --emit=asm
99
# The built-in target *should* override the one we have here, and thus we
1010
# should have morestack
11-
grep --quiet morestack < $(TMPDIR)/foo.s
11+
grep -q morestack < $(TMPDIR)/foo.s

src/test/run-make/use-extern-for-plugins/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-include ../tools.mk
22

3+
ifneq ($(UNAME),OpenBSD)
34
HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //')
45
ifeq ($(findstring i686,$(HOST)),i686)
56
TARGET := $(subst i686,x86_64,$(HOST))
@@ -11,3 +12,7 @@ all:
1112
$(RUSTC) foo.rs -C extra-filename=-host
1213
$(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET)
1314
$(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET)
15+
else
16+
# OpenBSD support only x86_64 architecture for now
17+
all:
18+
endif

0 commit comments

Comments
 (0)