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

Remove no_dead_strip marks #670

Merged
merged 2 commits into from
Nov 16, 2024
Merged
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
15 changes: 8 additions & 7 deletions crates/objc2/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,15 @@ macro_rules! __statics_sel {
/// info on "life before main".
#[cfg_attr(
not(all(target_os = "macos", target_arch = "x86")),
// Clang uses `no_dead_strip` in the link section for some reason,
// which other tools (notably some LLVM tools) now assume is
// present, so we have to add it as well.
link_section = "__DATA,__objc_selrefs,literal_pointers,no_dead_strip",
// Clang uses `no_dead_strip` in the link section for some unknown reason,
// but it makes LTO fail to trim the unused symbols.
// https://github.com/madsmtm/objc2/issues/667
// https://github.com/llvm/llvm-project/issues/114111
link_section = "__DATA,__objc_selrefs,literal_pointers",
)]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_section = "__OBJC,__message_refs,literal_pointers,no_dead_strip",
link_section = "__OBJC,__message_refs,literal_pointers",
)]
#[export_name = $crate::__macro_helpers::concat!("\x01L_OBJC_SELECTOR_REFERENCES_", $hash)]
static REF: $crate::__macro_helpers::SyncUnsafeCell<$crate::runtime::Sel> = unsafe {
Expand Down Expand Up @@ -504,7 +505,7 @@ macro_rules! __statics_class {
}

/// SAFETY: Same as `REF` above in `__statics_sel!`.
#[link_section = "__DATA,__objc_classrefs,regular,no_dead_strip"]
#[link_section = "__DATA,__objc_classrefs,regular"]
#[export_name = $crate::__macro_helpers::concat!(
"\x01L_OBJC_CLASSLIST_REFERENCES_$_",
$hash,
Expand Down Expand Up @@ -536,7 +537,7 @@ macro_rules! __statics_class {
static NAME_DATA: [$crate::__macro_helpers::u8; X.len()] = $crate::__statics_string_to_known_length_bytes!(X);

/// SAFETY: Same as `REF` above in `__statics_sel!`.
#[link_section = "__OBJC,__cls_refs,literal_pointers,no_dead_strip"]
#[link_section = "__OBJC,__cls_refs,literal_pointers"]
#[export_name = $crate::__macro_helpers::concat!(
"\x01L_OBJC_CLASS_REFERENCES_",
$hash,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading