Skip to content

Commit

Permalink
Fix missing section
Browse files Browse the repository at this point in the history
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 #1.

This may be caused by rust-lang/rust#87570.
  • Loading branch information
nvzqz committed Jan 9, 2022
1 parent 0b50844 commit 1d6f2b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ The format is based on [Keep a Changelog] and this project adheres to

## [Unreleased]

### Fixed

- Property section was not being emitted due to a change in how `#[used]` works.
This seems to be caused by [rust#87570], which switches `#[used]` from
`llvm.used` to `llvm.compiler.used`.

[rust#87570]: https:/rust-lang/rust/pull/87570

## [1.2.0] - 2020-08-30

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ macro_rules! embed_info_plist_bytes {
// Prevents this from being optimized out of the binary.
#[used]
// Places this data in the correct location.
#[link_section = "__TEXT,__info_plist"]
#[link_section = "__TEXT,__info_plist,regular,no_dead_strip"]
// Prevents repeated use by creating a linker error.
#[no_mangle]
static _EMBED_INFO_PLIST: [u8; LEN] = *REF;
Expand Down Expand Up @@ -564,7 +564,7 @@ macro_rules! embed_launchd_plist_bytes {
// Prevents this from being optimized out of the binary.
#[used]
// Places this data in the correct location.
#[link_section = "__TEXT,__launchd_plist"]
#[link_section = "__TEXT,__launchd_plist,regular,no_dead_strip"]
// Prevents repeated use by creating a linker error.
#[no_mangle]
static _EMBED_LAUNCHD_PLIST: [u8; LEN] = *REF;
Expand Down

0 comments on commit 1d6f2b9

Please sign in to comment.