Skip to content

Commit b7f07b7

Browse files
committed
Fix atomic shim for macOS and fix warning
1 parent ee4bed1 commit b7f07b7

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

config.sh

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ fi
1313
TARGET_TRIPLE=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
1414

1515
export RUSTFLAGS='-Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend='$(pwd)'/target/'$CHANNEL'/librustc_codegen_cranelift.'$dylib_ext' --sysroot '$(pwd)'/build_sysroot/sysroot'
16+
17+
# FIXME remove once the atomic shim is gone
18+
if [[ `uname` == 'Darwin' ]]; then
19+
export RUSTFLAGS="$RUSTFLAGS -Clink-arg=-undefined -Clink-arg=dynamic_lookup"
20+
fi
21+
1622
RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
1723
export RUSTC_LOG=warn # display metadata load errors
1824

src/atomic_shim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::prelude::*;
88
#[no_mangle]
99
pub static mut __cg_clif_global_atomic_mutex: libc::pthread_mutex_t = libc::PTHREAD_MUTEX_INITIALIZER;
1010

11-
pub fn init_global_lock(sess: &Session, module: &mut Module<impl Backend>, bcx: &mut FunctionBuilder<'_>) {
11+
pub fn init_global_lock(module: &mut Module<impl Backend>, bcx: &mut FunctionBuilder<'_>) {
1212
if std::env::var("SHOULD_RUN").is_ok () {
1313
// When using JIT, dylibs won't find the __cg_clif_global_atomic_mutex data object defined here,
1414
// so instead define it in the cg_clif dylib.

src/main_shim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn maybe_create_entry_wrapper(tcx: TyCtxt<'_>, module: &mut Module<impl Back
6767
let arg_argc = bcx.append_ebb_param(ebb, m.target_config().pointer_type());
6868
let arg_argv = bcx.append_ebb_param(ebb, m.target_config().pointer_type());
6969

70-
crate::atomic_shim::init_global_lock(tcx.sess, m, &mut bcx);
70+
crate::atomic_shim::init_global_lock(m, &mut bcx);
7171

7272
let main_func_ref = m.declare_func_in_func(main_func_id, &mut bcx.func);
7373

0 commit comments

Comments
 (0)