Skip to content

Commit 1d6f2b9

Browse files
committed
Fix missing section
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.
1 parent 0b50844 commit 1d6f2b9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ The format is based on [Keep a Changelog] and this project adheres to
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Property section was not being emitted due to a change in how `#[used]` works.
13+
This seems to be caused by [rust#87570], which switches `#[used]` from
14+
`llvm.used` to `llvm.compiler.used`.
15+
16+
[rust#87570]: https://github.com/rust-lang/rust/pull/87570
17+
1018
## [1.2.0] - 2020-08-30
1119

1220
### Added

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ macro_rules! embed_info_plist_bytes {
434434
// Prevents this from being optimized out of the binary.
435435
#[used]
436436
// Places this data in the correct location.
437-
#[link_section = "__TEXT,__info_plist"]
437+
#[link_section = "__TEXT,__info_plist,regular,no_dead_strip"]
438438
// Prevents repeated use by creating a linker error.
439439
#[no_mangle]
440440
static _EMBED_INFO_PLIST: [u8; LEN] = *REF;
@@ -564,7 +564,7 @@ macro_rules! embed_launchd_plist_bytes {
564564
// Prevents this from being optimized out of the binary.
565565
#[used]
566566
// Places this data in the correct location.
567-
#[link_section = "__TEXT,__launchd_plist"]
567+
#[link_section = "__TEXT,__launchd_plist,regular,no_dead_strip"]
568568
// Prevents repeated use by creating a linker error.
569569
#[no_mangle]
570570
static _EMBED_LAUNCHD_PLIST: [u8; LEN] = *REF;

0 commit comments

Comments
 (0)