Skip to content

Commit 21eadbe

Browse files
crabtwbrson
authored andcommitted
add missing library, enable segmented stacks for freebsd
1 parent d4884b6 commit 21eadbe

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

mk/platform.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ifneq ($(findstring freebsd,$(CFG_OSTYPE)),)
2525
CFG_LIB_NAME=lib$(1).so
2626
CFG_LIB_GLOB=lib$(1)-*.so
2727
CFG_GCCISH_CFLAGS += -fPIC -I/usr/local/include
28-
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -lpthread -lrt
28+
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -lpthread -lrt -L/usr/local/lib -lexecinfo
2929
CFG_GCCISH_DEF_FLAG := -Wl,--export-dynamic,--dynamic-list=
3030
CFG_GCCISH_PRE_LIB_FLAGS := -Wl,-whole-archive
3131
CFG_GCCISH_POST_LIB_FLAGS := -Wl,-no-whole-archive

src/comp/back/link.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ mod write {
220220
} else { FileType = LLVMAssemblyFile; }
221221
// Write optimized bitcode if --save-temps was on.
222222

223-
let seg_stack = sess.get_targ_cfg().os != session::os_freebsd;
224223
if opts.save_temps {
225224
// Always output the bitcode file with --save-temps
226225

@@ -245,7 +244,7 @@ mod write {
245244
buf_o,
246245
LLVMAssemblyFile,
247246
CodeGenOptLevel,
248-
seg_stack)})});
247+
true)})});
249248
}
250249

251250

@@ -265,7 +264,7 @@ mod write {
265264
buf_o,
266265
LLVMObjectFile,
267266
CodeGenOptLevel,
268-
seg_stack)})});
267+
true)})});
269268
}
270269
} else {
271270
// If we aren't saving temps then just output the file
@@ -283,7 +282,7 @@ mod write {
283282
buf_o,
284283
FileType,
285284
CodeGenOptLevel,
286-
seg_stack)})});
285+
true)})});
287286
}
288287
// Clean up and return
289288

@@ -661,7 +660,7 @@ fn link_binary(sess: session::session,
661660
}
662661

663662
if sess.get_targ_cfg().os == session::os_freebsd {
664-
gcc_args += ["-lrt"];
663+
gcc_args += ["-lrt", "-L/usr/local/lib", "-lexecinfo"];
665664
}
666665

667666
// OS X 10.6 introduced 'compact unwind info', which is produced by the

src/rt/arch/x86_64/record_sp.S

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@
1414
.globl GET_SP
1515
.globl CHECK_STACK
1616

17-
#if defined(__linux__) || defined(__FreeBSD__)
17+
#if defined(__linux__)
1818
RECORD_SP:
1919
movq %rdi, %fs:112
2020
ret
21-
#else
22-
#if defined(__APPLE__)
21+
#elif defined(__APPLE__)
2322
RECORD_SP:
2423
movq $0x60+90*8, %rsi
2524
movq %rdi, %gs:(%rsi)
2625
ret
26+
#elif defined(__FreeBSD__)
27+
RECORD_SP:
28+
movq %rdi, %fs:24
29+
ret
2730
#else
2831
RECORD_SP:
2932
ret
3033
#endif
31-
#endif
3234

3335
GET_SP:
3436
movq %rsp, %rax

0 commit comments

Comments
 (0)