Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add a test for Mach-O #[link_section] API inherited from LLVM#155517

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainrust-lang/rust:mainfrom
madsmtm:test-macho-link-section-attrsmadsmtm/rust:test-macho-link-section-attrsCopy head branch name to clipboard
Apr 20, 2026
Merged

Add a test for Mach-O #[link_section] API inherited from LLVM#155517
rust-bors[bot] merged 1 commit into
rust-lang:mainrust-lang/rust:mainfrom
madsmtm:test-macho-link-section-attrsmadsmtm/rust:test-macho-link-section-attrsCopy head branch name to clipboard

Conversation

@madsmtm

@madsmtm madsmtm commented Apr 19, 2026

Copy link
Copy Markdown
Contributor

The format of the #[link_section] attribute is under-documented, but on Mach-O, I think it's roughly the following BNF (I've opened rust-lang/reference#2236 to document it):

LinkSection -> Segment `,` Section (`,` (SectionType (`,` (SectionAttributes)?)?)?)?
Segment -> <0 to 16 bytes>
Section -> <0 to 16 bytes>
SectionType -> `regular` | `zerofill` | `cstring_literals` | `4byte_literals` | `8byte_literals` | `literal_pointers` | `non_lazy_symbol_pointers` | `lazy_symbol_pointers` | `symbol_stubs` | `mod_init_funcs` | `mod_term_funcs` | `coalesced` | `interposing` | `16byte_literals` | `thread_local_regular` | `thread_local_zerofill` | `thread_local_variables` | `thread_local_variable_pointers` | `thread_local_init_function_pointers`
SectionAttributes -> SectionAttribute (`+` SectionAttribute)*
SectionAttribute -> `pure_instructions` | `no_toc` | `strip_static_syms` | `no_dead_strip` | `live_support`, `self_modifying_code` | `debug`

This PR adds a small test for a little part of this.

Once #154429 is resolved, this should make it possible to test rust-lang/rustc_codegen_cranelift#1648 end-to-end.

r? bjorn3

@madsmtm madsmtm added A-linkage Area: linking into static, shared libraries and binaries O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) labels Apr 19, 2026
@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 19, 2026
@rust-log-analyzer

This comment has been minimized.

@madsmtm
madsmtm force-pushed the test-macho-link-section-attrs branch from 7691a07 to 709530e Compare April 19, 2026 14:32
Comment thread tests/run-make/macho-link-section/foo.rs Outdated
@madsmtm
madsmtm force-pushed the test-macho-link-section-attrs branch from 709530e to eae9611 Compare April 19, 2026 21:36
@rust-log-analyzer

This comment has been minimized.

@madsmtm
madsmtm force-pushed the test-macho-link-section-attrs branch from eae9611 to 3695fef Compare April 19, 2026 21:49
@bjorn3

bjorn3 commented Apr 20, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 3695fef has been approved by bjorn3

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 20, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 20, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #154654 (Move `std::io::ErrorKind` to `core::io`)
 - #145270 (Fix an ICE observed with an explicit tail-call in a default trait method)
 - #154895 (borrowck: Apply `user_arg_index` nomenclature more broadly)
 - #155213 (resolve: Make sure visibilities of import declarations make sense)
 - #155346 (`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`)
 - #155517 (Add a test for Mach-O `#[link_section]` API inherited from LLVM)
 - #155549 (Remove some unnecessary lifetimes.)
 - #154248 (resolve :  mark repr_simd as internal)
 - #154772 (slightly optimize the `non-camel-case-types` lint)
 - #155541 (Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`)
 - #155544 (bootstrap: Make "detected modifications" for download-rustc less verbose)
@rust-bors
rust-bors Bot merged commit 356fdf0 into rust-lang:main Apr 20, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 20, 2026
rust-timer added a commit that referenced this pull request Apr 20, 2026
Rollup merge of #155517 - madsmtm:test-macho-link-section-attrs, r=bjorn3

Add a test for Mach-O `#[link_section]` API inherited from LLVM

The format of the `#[link_section]` attribute is under-documented, but on Mach-O, I think it's roughly the following BNF:
```
LinkSection -> Segment `,` Section (`,` (SectionType (`,` (SectionAttributes)?)?)?)?
Segment -> <0 to 16 bytes>
Section -> <0 to 16 bytes>
SectionType -> `regular` | `zerofill` | `cstring_literals` | `4byte_literals` | `8byte_literals` | `literal_pointers` | `non_lazy_symbol_pointers` | `lazy_symbol_pointers` | `symbol_stubs` | `mod_init_funcs` | `mod_term_funcs` | `coalesced` | `interposing` | `16byte_literals` | `thread_local_regular` | `thread_local_zerofill` | `thread_local_variables` | `thread_local_variable_pointers` | `thread_local_init_function_pointers`
SectionAttributes -> SectionAttribute (`+` SectionAttribute)*
SectionAttribute -> `pure_instructions` | `no_toc` | `strip_static_syms` | `no_dead_strip` | `live_support`, `self_modifying_code` | `debug`
```

This PR adds a small test for a little part of this.

Once #154429 is resolved, this should make it possible to test rust-lang/rustc_codegen_cranelift#1648 end-to-end.

r? bjorn3
@madsmtm
madsmtm deleted the test-macho-link-section-attrs branch April 20, 2026 19:44
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 21, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#154654 (Move `std::io::ErrorKind` to `core::io`)
 - rust-lang/rust#145270 (Fix an ICE observed with an explicit tail-call in a default trait method)
 - rust-lang/rust#154895 (borrowck: Apply `user_arg_index` nomenclature more broadly)
 - rust-lang/rust#155213 (resolve: Make sure visibilities of import declarations make sense)
 - rust-lang/rust#155346 (`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`)
 - rust-lang/rust#155517 (Add a test for Mach-O `#[link_section]` API inherited from LLVM)
 - rust-lang/rust#155549 (Remove some unnecessary lifetimes.)
 - rust-lang/rust#154248 (resolve :  mark repr_simd as internal)
 - rust-lang/rust#154772 (slightly optimize the `non-camel-case-types` lint)
 - rust-lang/rust#155541 (Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`)
 - rust-lang/rust#155544 (bootstrap: Make "detected modifications" for download-rustc less verbose)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linkage Area: linking into static, shared libraries and binaries A-run-make Area: port run-make Makefiles to rmake.rs O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.