From 11cf38a20edb7d07eb0098c9e7db982db5546623 Mon Sep 17 00:00:00 2001 From: Nikolai Vazquez Date: Sun, 9 Jan 2022 17:20:10 -0500 Subject: [PATCH 1/2] Fix missing macOS slice This adds the `S_ATTR_NO_DEAD_STRIP` section attribute, which forces "unused" code to remain in the binary. This is paired with `S_REGULAR` to provide a required section type. This fixes #41. --- impl/src/linker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/impl/src/linker.rs b/impl/src/linker.rs index 23d4ba9..a428112 100644 --- a/impl/src/linker.rs +++ b/impl/src/linker.rs @@ -34,7 +34,7 @@ pub mod macos { use syn::Ident; pub fn section(ident: &Ident) -> String { - format!("__DATA,__linkme{}", crate::hash(ident)) + format!("__DATA,__linkme{},regular,no_dead_strip", crate::hash(ident)) } pub fn section_start(ident: &Ident) -> String { From e6f6d1c7c5816c45cfbdd424a592abaea04ad260 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 9 Jan 2022 17:27:28 -0800 Subject: [PATCH 2/2] Re-enable macOS CI --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a27f5a4..9a01b22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,11 +34,10 @@ jobs: toolchain: ${{matrix.rust}} - run: cargo check --manifest-path tests/crate/Cargo.toml - run: cargo test - # macos: https://github.com/dtolnay/linkme/issues/41 # windows-gnu: https://github.com/dtolnay/linkme/issues/25 - continue-on-error: ${{matrix.os == 'macos' || matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} + continue-on-error: ${{matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} - run: cargo test --release - continue-on-error: ${{matrix.os == 'macos' || matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} + continue-on-error: ${{matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} msrv: name: Rust 1.31.0