Skip to content

test #[naked] with #[link_section = "..."] on windows#154598

Open
folkertdev wants to merge 1 commit intorust-lang:mainfrom
folkertdev:windows-naked-link-section
Open

test #[naked] with #[link_section = "..."] on windows#154598
folkertdev wants to merge 1 commit intorust-lang:mainfrom
folkertdev:windows-naked-link-section

Conversation

@folkertdev
Copy link
Copy Markdown
Contributor

As a part of #147811 I ran into that we actually don't match (current) LLVM output.

r? @mati865

@rustbot rustbot added 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 Mar 30, 2026
Comment on lines -270 to +284
let section = link_section.unwrap_or_else(|| format!(".text.{asm_name}"));
writeln!(begin, ".pushsection {},\"xr\"", section).unwrap();
writeln!(begin, ".balign {align_bytes}").unwrap();
write_linkage(&mut begin).unwrap();
writeln!(begin, ".def {asm_name}").unwrap();
writeln!(begin, ".scl 2").unwrap();
writeln!(begin, ".type 32").unwrap();
writeln!(begin, ".endef").unwrap();

let section = link_section.unwrap_or_else(|| format!(".text.{asm_name}"));
writeln!(begin, ".pushsection {},\"xr\"", section).unwrap();
write_linkage(&mut begin).unwrap();
writeln!(begin, ".balign {align_bytes}").unwrap();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just got moved up so that .def comes before the .pushsection.

Comment on lines -281 to -282
writeln!(end, ".Lfunc_end_{asm_name}:").unwrap();
writeln!(end, ".popsection").unwrap();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LLVM does not emit these, so then we should not need to either

Comment on lines +144 to +151
// Pick a default alignment when the alignment is not explicitly specified.
let align_bytes = match attrs.alignment {
Some(align) => align.bytes(),
None => match asm_binary_format {
BinaryFormat::Coff => 16,
_ => 4,
},
};
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this really matters but we may as well match LLVM

@folkertdev
Copy link
Copy Markdown
Contributor Author

@bors try jobs=x86_64-mingw-1

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 30, 2026
test `#[naked]` with `#[link_section = "..."]` on windows


try-job: x86_64-mingw-1
@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the windows-naked-link-section branch from f445a7c to b1287a8 Compare March 30, 2026 17:08
@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 30, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 30, 2026

💔 Test for e60d030 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@folkertdev folkertdev force-pushed the windows-naked-link-section branch from b1287a8 to 984fb02 Compare March 30, 2026 18:38
@folkertdev
Copy link
Copy Markdown
Contributor Author

@bors try jobs=x86_64-mingw-1

rust-bors bot pushed a commit that referenced this pull request Mar 30, 2026
test `#[naked]` with `#[link_section = "..."]` on windows


try-job: x86_64-mingw-1
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 30, 2026

⌛ Trying commit 984fb02 with merge d4f9c71

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/23765423894

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants