Skip to content

Commit 425f232

Browse files
committed
rollup merge of #21754: semarie/openbsd-rebased
Hi. Here a commit in order to add OpenBSD support to rust. - tests status: run-pass: test result: ok. 1879 passed; 0 failed; 24 ignored; 0 measured run-fail: test result: ok. 81 passed; 0 failed; 5 ignored; 0 measured compile-fail: test result: ok. 1634 passed; 0 failed; 22 ignored; 0 measured run-pass-fulldeps: test result: ok. 22 passed; 0 failed; 1 ignored; 0 measured compile-fail-fulldeps: test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured - The current implementation of load_self function (src/libstd/sys/unix/os.rs) isn't optimal as under OpenBSD I haven't found a reliable method to get the filename of a running process. The current implementation is enought for bootstrapping purpose. - I have disable `run-pass/tcp-stress.rs` test under openbsd. When run manually, the test pass, but when run under `compiletest`, it timeout and echo continuoulsy `Too many open files`. - For building with jemalloc, a more recent version of jemalloc would be mandatory. See jemalloc/jemalloc#188 for more details.
2 parents 9529ab0 + f6414b0 commit 425f232

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1074
-133
lines changed

configure

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ case $CFG_OSTYPE in
374374
CFG_OSTYPE=unknown-dragonfly
375375
;;
376376

377+
OpenBSD)
378+
CFG_OSTYPE=unknown-openbsd
379+
;;
380+
377381
Darwin)
378382
CFG_OSTYPE=apple-darwin
379383
;;

mk/cfg/x86_64-unknown-openbsd.mk

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# x86_64-pc-openbsd-elf configuration
2+
CC_x86_64-unknown-openbsd=$(CC)
3+
CXX_x86_64-unknown-openbsd=$(CXX)
4+
CPP_x86_64-unknown-openbsd=$(CPP)
5+
AR_x86_64-unknown-openbsd=$(AR)
6+
CFG_LIB_NAME_x86_64-unknown-openbsd=lib$(1).so
7+
CFG_STATIC_LIB_NAME_x86_64-unknown-openbsd=lib$(1).a
8+
CFG_LIB_GLOB_x86_64-unknown-openbsd=lib$(1)-*.so
9+
CFG_LIB_DSYM_GLOB_x86_64-unknown-openbsd=$(1)-*.dylib.dSYM
10+
CFG_JEMALLOC_CFLAGS_x86_64-unknown-openbsd := -m64 -I/usr/include $(CFLAGS)
11+
CFG_GCCISH_CFLAGS_x86_64-unknown-openbsd := -Wall -Werror -g -fPIC -m64 -I/usr/include $(CFLAGS)
12+
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-openbsd := -shared -fPIC -g -pthread -m64
13+
CFG_GCCISH_DEF_FLAG_x86_64-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list=
14+
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-openbsd := -Wl,-whole-archive
15+
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-openbsd := -Wl,-no-whole-archive
16+
CFG_DEF_SUFFIX_x86_64-unknown-openbsd := .bsd.def
17+
CFG_LLC_FLAGS_x86_64-unknown-openbsd :=
18+
CFG_INSTALL_NAME_x86_64-unknown-openbsd =
19+
CFG_EXE_SUFFIX_x86_64-unknown-openbsd :=
20+
CFG_WINDOWSY_x86_64-unknown-openbsd :=
21+
CFG_UNIXY_x86_64-unknown-openbsd := 1
22+
CFG_PATH_MUNGE_x86_64-unknown-openbsd :=
23+
CFG_LDPATH_x86_64-unknown-openbsd :=
24+
CFG_RUN_x86_64-unknown-openbsd=$(2)
25+
CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2))
26+
CFG_GNU_TRIPLE_x86_64-unknown-openbsd := x86_64-unknown-openbsd

src/compiletest/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -23,6 +23,7 @@ static OS_TABLE: &'static [(&'static str, &'static str)] = &[
2323
("linux", "linux"),
2424
("freebsd", "freebsd"),
2525
("dragonfly", "dragonfly"),
26+
("openbsd", "openbsd"),
2627
];
2728

2829
pub fn get_os(triple: &str) -> &'static str {

src/doc/reference.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,8 @@ The following configurations must be defined by the implementation:
21972197
`"unix"` or `"windows"`. The value of this configuration option is defined
21982198
as a configuration itself, like `unix` or `windows`.
21992199
* `target_os = "..."`. Operating system of the target, examples include
2200-
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"` or `"dragonfly"`.
2200+
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"` or
2201+
`"openbsd"`.
22012202
* `target_word_size = "..."`. Target word size in bits. This is set to `"32"`
22022203
for targets with 32-bit pointers, and likewise set to `"64"` for 64-bit
22032204
pointers.

src/etc/local_stage0.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
# Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
33
# file at the top-level directory of this distribution and at
44
# http://rust-lang.org/COPYRIGHT.
55
#
@@ -18,7 +18,7 @@ LIB_PREFIX=lib
1818

1919
OS=`uname -s`
2020
case $OS in
21-
("Linux"|"FreeBSD"|"DragonFly")
21+
("Linux"|"FreeBSD"|"DragonFly"|"OpenBSD")
2222
BIN_SUF=
2323
LIB_SUF=.so
2424
;;

src/etc/snapshot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2011-2014 The Rust Project Developers. See the COPYRIGHT
1+
# Copyright 2011-2015 The Rust Project Developers. See the COPYRIGHT
22
# file at the top-level directory of this distribution and at
33
# http://rust-lang.org/COPYRIGHT.
44
#
@@ -46,6 +46,7 @@ def scrub(b):
4646
"winnt": ["bin/rustc.exe"],
4747
"freebsd": ["bin/rustc"],
4848
"dragonfly": ["bin/rustc"],
49+
"openbsd": ["bin/rustc"],
4950
}
5051

5152
winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll", "libstdc++-6.dll"]
@@ -100,6 +101,8 @@ def get_kernel(triple):
100101
return "freebsd"
101102
if os_name == "dragonfly":
102103
return "dragonfly"
104+
if os_name == "openbsd":
105+
return "openbsd"
103106
return "linux"
104107

105108

src/libbacktrace/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9332,7 +9332,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
93329332
;;
93339333
93349334
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
9335-
freebsd* | dragonfly*)
9335+
freebsd* | dragonfly* | openbsd*)
93369336
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
93379337
hardcode_libdir_flag_spec='-R$libdir'
93389338
hardcode_direct=yes

0 commit comments

Comments
 (0)