Skip to content

Support -Z merge-functions with gcc and add stack-protector asm tests - #163274

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
arielb1:stack-protector-tests-gcc
Sep 26, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
arielb1:stack-protector-tests-gcc

Conversation

@arielb1

@arielb1 arielb1 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

This is a part of the stack-protector work.

Adding support for merge-functions is not strictly needed, but it does prevent breakage if the GCC function merging logic changes.

Not adding tests for -Z merge-functions since I don't see any such tests for the LLVM side of it.

No lines in this PR were written by LLM, though I did use it for help in reviewing and reading documentation.

@rustbot

rustbot commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 24, 2026
@arielb1
arielb1 force-pushed the stack-protector-tests-gcc branch from ea4b38c to 6ea4c5d Compare September 24, 2026 15:22
Comment thread tests/assembly-gcc/stack-protector/stack-protector-heuristics-effect.rs Outdated
@arielb1
arielb1 force-pushed the stack-protector-tests-gcc branch from 6ea4c5d to 2e0497b Compare September 24, 2026 16:09
@GuillaumeGomez

Copy link
Copy Markdown
Member

Looks good to me, thanks! Let's wait for @antoyo's confirmation too.

@antoyo antoyo left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I forgot to send that comment.

View changes since this review

Comment thread tests/assembly-gcc/stack-protector/stack-protector-heuristics-effect.rs Outdated
@arielb1

arielb1 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@antoyo

Do you care enough about investigating the exact reason for the split in local_large_var_cloned behavior? I don't feel its important enough to be in scope, though maybe worth further investigation later on since we may be missing an attribute on the argument.

@arielb1
arielb1 force-pushed the stack-protector-tests-gcc branch from 2e0497b to 374d72a Compare September 24, 2026 16:35
@antoyo

antoyo commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Do you care enough about investigating the exact reason for the split in local_large_var_cloned behavior?

No, I think we're good here.

though maybe worth further investigation later on since we may be missing an attribute on the argument.

I'm not sure I understand: do you mean cg_gcc has the correct behavior while g++ does not?

@arielb1
arielb1 force-pushed the stack-protector-tests-gcc branch from 374d72a to 9c5b3e1 Compare September 24, 2026 16:39
@arielb1

arielb1 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure I understand: do you mean cg_gcc has the correct behavior while g++ does not?

There are 2 behaviors, both are basically fine. cg_gcc, cg_llvm, clang++ do one thing, g++ does the other.

Pushed a version with the comment slightly edited.

Comment thread compiler/rustc_codegen_gcc/src/gcc_util.rs
Comment thread tests/assembly-gcc/stack-protector/stack-protector-heuristics-effect.rs Outdated
@arielb1
arielb1 force-pushed the stack-protector-tests-gcc branch 2 times, most recently from 0217cc1 to 14e759e Compare September 24, 2026 22:51
@arielb1

arielb1 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

@GuillaumeGomez so bjorn approved, can you r+ this?

@GuillaumeGomez

Copy link
Copy Markdown
Member

I don't see a Bjorn's approval. Gonna let them do the r+ to ensure it's all good for everyone.

@bjorn3 bjorn3 Sep 25, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What caused this change by the way?

View changes since the review

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 know, I run x.py test --bless and the change happened

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we just don't check it in CI?

@arielb1 arielb1 Sep 25, 2026 •

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 have no idea, removed the test change since it doesn't have anything to do with the PR. Maybe its gcc-related? (though why?)

@bjorn3

bjorn3 commented Sep 25, 2026

Copy link
Copy Markdown
Member

LGTM, though the above test change is a bit weird.

This is a part of the stack-protector work.

Adding support for merge-functions is not strictly needed, but it does
prevent breakage if the GCC function merging logic changes.

Not adding tests for -Z merge-functions since I don't see any such tests for the
LLVM side of it.
@arielb1

arielb1 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Lets see what happens without the snap change + after a rebase

@arielb1
arielb1 force-pushed the stack-protector-tests-gcc branch from 14e759e to c6dc511 Compare September 25, 2026 12:18
@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@arielb1

arielb1 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

@bjorn3

You OK with the version without the incidental snapshot change if it passes CI?

@bjorn3

bjorn3 commented Sep 25, 2026

Copy link
Copy Markdown
Member

@bors r=GuillaumeGomez,bjorn3

@rust-bors

rust-bors Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c6dc511 has been tentatively approved by GuillaumeGomez,bjorn3

It will be put into the queue for this repository once PR CI succeeds.

@arielb1

arielb1 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks!

@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 Sep 25, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 25, 2026
… r=GuillaumeGomez,bjorn3

Support -Z merge-functions with gcc and add stack-protector asm tests

This is a part of the stack-protector work.

Adding support for merge-functions is not strictly needed, but it does prevent breakage if the GCC function merging logic changes.

Not adding tests for -Z merge-functions since I don't see any such tests for the LLVM side of it.

No lines in this PR were written by LLM, though I did use it for help in reviewing and reading documentation.
rust-bors Bot pushed a commit that referenced this pull request Sep 25, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #162493 (Add support for -Zsanitizer-cfi-minimal-runtime)
 - #163133 ([rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved)
 - #163215 (Fix suggestion for Option to bool with proper precedence handling)
 - #163266 (More deferred liveness cleanups)
 - #163274 (Support -Z merge-functions with gcc and add stack-protector asm tests)
 - #163312 (Add rustdoc regression test for glob import of a crate that re-exports)
 - #163332 (Add some docs to `Global`)
rust-bors Bot pushed a commit that referenced this pull request Sep 26, 2026
Rollup of 13 pull requests

Successful merges:

 - #160695 (Detect bad number of generics caused by bad derive)
 - #162883 (No longer auto-inline `f16` and `f128` on well-supported platforms)
 - #163133 ([rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved)
 - #163215 (Fix suggestion for Option to bool with proper precedence handling)
 - #163266 (More deferred liveness cleanups)
 - #163274 (Support -Z merge-functions with gcc and add stack-protector asm tests)
 - #163290 (Merge `ForceWarning`/`Allow`/`Expect` into `Warning`)
 - #163298 (Don't emit sugg for pub-reexport extern std)
 - #163312 (Add rustdoc regression test for glob import of a crate that re-exports)
 - #163357 (Borrowck cleanups part trois)
 - #161710 (Stabilize `mem::conjure_zst`)
 - #163332 (Add some docs to `Global`)
 - #163362 (simplify ndk compiler test)
@rust-bors
rust-bors Bot merged commit 727dc4a into rust-lang:main Sep 26, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 26, 2026
rust-bors Bot pushed a commit that referenced this pull request Sep 26, 2026
Rollup merge of #163274 - arielb1:stack-protector-tests-gcc, r=GuillaumeGomez,bjorn3

Support -Z merge-functions with gcc and add stack-protector asm tests

This is a part of the stack-protector work.

Adding support for merge-functions is not strictly needed, but it does prevent breakage if the GCC function merging logic changes.

Not adding tests for -Z merge-functions since I don't see any such tests for the LLVM side of it.

No lines in this PR were written by LLM, though I did use it for help in reviewing and reading documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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