Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try __libc_ section prefix #45

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,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'}}
# https://github.com/dtolnay/linkme/issues/25
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
Expand All @@ -59,8 +58,6 @@ jobs:
sudo apt-get install -y qemu-system-arm
- run: cargo run --release
working-directory: tests/cortex
# https://github.com/dtolnay/linkme/issues/40
continue-on-error: true

clippy:
name: Clippy
Expand Down
14 changes: 8 additions & 6 deletions impl/src/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,33 @@ pub mod linux {
use syn::Ident;

pub fn section(ident: &Ident) -> String {
format!("linkme_{}", ident)
format!("__libc_{}", ident)
}

pub fn section_start(ident: &Ident) -> String {
format!("__start_linkme_{}", ident)
format!("__start___libc_{}", ident)
}

pub fn section_stop(ident: &Ident) -> String {
format!("__stop_linkme_{}", ident)
format!("__stop___libc_{}", ident)
}
}

pub mod macos {
use syn::Ident;

// __libc_ prefix: see https://github.com/dtolnay/linkme/issues/41. This
// makes recent versions of lld recognize the symbol as retained.
pub fn section(ident: &Ident) -> String {
format!("__DATA,__linkme{}", crate::hash(ident))
format!("__DATA,__libc_{}", crate::hash(ident))
}

pub fn section_start(ident: &Ident) -> String {
format!("\x01section$start$__DATA$__linkme{}", crate::hash(ident))
format!("\x01section$start$__DATA$__libc_{}", crate::hash(ident))
}

pub fn section_stop(ident: &Ident) -> String {
format!("\x01section$end$__DATA$__linkme{}", crate::hash(ident))
format!("\x01section$end$__DATA$__libc_{}", crate::hash(ident))
}
}

Expand Down