Skip to content

Conversation

usamoi
Copy link
Contributor

@usamoi usamoi commented Jul 12, 2025

Exported symbols are added as GC roots in linking, so --gc-sections won't hurt -Zexport-executable-symbols.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc #84161

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs 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. labels Jul 12, 2025
}
cmd.gc_sections(keep_metadata);
} else {
cmd.no_gc_sections();
Copy link
Contributor Author

@usamoi usamoi Jul 12, 2025

Choose a reason for hiding this comment

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

The removed line is the only place in rustc where no_gc_sections is called, so I had to call it here to suppress the unused warning.

Copy link
Member

@bjorn3 bjorn3 Jul 14, 2025

Choose a reason for hiding this comment

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

Removing the no_gc_sections method entirely would also work, right? Your current change would change the behavior of -Clink-dead-code=yes, not just the behavior of -Zexport-executable-symbols.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no_gc_sections is removed now.

@usamoi usamoi marked this pull request as ready for review July 12, 2025 17:53
@rustbot
Copy link
Collaborator

rustbot commented Jul 12, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 12, 2025

This PR modifies run-make tests.

cc @jieyouxu

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@jieyouxu
Copy link
Member

Maybe r? @bjorn3 (or reroll)

@rustbot rustbot assigned bjorn3 and unassigned jieyouxu Jul 13, 2025
.invalid_stdout_utf8();
assert_contains(&output, "exported_symbol");
} else {
let output = llvm_readobj().symbols().input(bin_name("main")).run().invalid_stdout_utf8();
Copy link
Member

Choose a reason for hiding this comment

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

Discussion: Hm, this might not be quite right for windows msvc, cc @ChrisDenton ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

llvm-readobj indeed cannot read symbols from MSVC-generated artifacts. I just switched to using the object crate to read the exports.

@bjorn3
Copy link
Member

bjorn3 commented Jul 14, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 14, 2025

📌 Commit 5e1c387 has been approved by bjorn3

It is now in the queue for this repository.

@bors bors 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 Jul 14, 2025
fmease added a commit to fmease/rust that referenced this pull request Jul 16, 2025
pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests

Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc rust-lang#84161
bors added a commit that referenced this pull request Jul 17, 2025
Rollup of 15 pull requests

Successful merges:

 - #142304 (tests: Add `RUST_BACKTRACE` and `-Cpanic` revisions to `panic-main.rs` test)
 - #143388 (Various refactors to the LTO handling code)
 - #143409 (Enable xgot feature for mips64 musl targets)
 - #143592 (UWP: link ntdll functions using raw-dylib)
 - #143595 (add `const_make_global`; err for `const_allocate` ptrs if didn't call)
 - #143678 (Added error for invalid char cast)
 - #143820 (Fixed a core crate compilation failure when enabling the `optimize_for_size` feature on some targets)
 - #143829 (Trim `BorrowedCursor` API)
 - #143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - #143851 (ci cleanup: rustdoc-gui-test now installs browser-ui-test)
 - #143856 (Linting public reexport of private dependencies)
 - #143895 (Dont collect assoc ty item bounds from trait where clause for host effect predicates)
 - #143922 (Improve path segment joining)
 - #143964 (Fix handling of SCRIPT_ARG in docker images)
 - #144016 (trait_sel: `MetaSized` always holds temporarily)

r? `@ghost`
`@rustbot` modify labels: rollup
@fmease
Copy link
Member

fmease commented Jul 17, 2025

#144041 (comment)
@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 17, 2025
@jieyouxu
Copy link
Member

You may need something like //@ needs-target-std or //@ ignore-cross-compile if test is host-only.

@usamoi
Copy link
Contributor Author

usamoi commented Jul 17, 2025

//@ ignore-cross-compile is added to two tests now.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 17, 2025
@bjorn3
Copy link
Member

bjorn3 commented Jul 17, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 17, 2025

📌 Commit 5bb6b9d has been approved by bjorn3

It is now in the queue for this repository.

@bors bors 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 Jul 17, 2025
fmease added a commit to fmease/rust that referenced this pull request Jul 17, 2025
pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests

Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc rust-lang#84161
fmease added a commit to fmease/rust that referenced this pull request Jul 17, 2025
pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests

Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc rust-lang#84161
bors added a commit that referenced this pull request Jul 17, 2025
Rollup of 15 pull requests

Successful merges:

 - #142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - #143271 (Store the type of each GVN value)
 - #143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - #143719 (Emit warning when there is no space between `-o` and arg)
 - #143833 (Ban projecting into SIMD types [MCP838])
 - #143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - #143879 (parse `const trait Trait`)
 - #143891 (Port `#[coverage]` to the new attribute system)
 - #143967 (constify `Option` methods)
 - #143985 (rustc_public: de-StableMIR-ize)
 - #144008 (Fix false positive double negations with macro invocation)
 - #144010 (Boostrap: add warning on `optimize = false`)
 - #144034 (tests: Test line number in debuginfo for diverging function calls)
 - #144049 (rustc-dev-guide subtree update)
 - #144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 17, 2025
pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests

Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc rust-lang#84161
bors added a commit that referenced this pull request Jul 17, 2025
Rollup of 12 pull requests

Successful merges:

 - #142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - #143271 (Store the type of each GVN value)
 - #143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - #143719 (Emit warning when there is no space between `-o` and arg)
 - #143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - #143891 (Port `#[coverage]` to the new attribute system)
 - #143967 (constify `Option` methods)
 - #144008 (Fix false positive double negations with macro invocation)
 - #144010 (Boostrap: add warning on `optimize = false`)
 - #144034 (tests: Test line number in debuginfo for diverging function calls)
 - #144049 (rustc-dev-guide subtree update)
 - #144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 17, 2025
Rollup of 12 pull requests

Successful merges:

 - #142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - #143271 (Store the type of each GVN value)
 - #143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - #143719 (Emit warning when there is no space between `-o` and arg)
 - #143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - #143891 (Port `#[coverage]` to the new attribute system)
 - #143967 (constify `Option` methods)
 - #144008 (Fix false positive double negations with macro invocation)
 - #144010 (Boostrap: add warning on `optimize = false`)
 - #144034 (tests: Test line number in debuginfo for diverging function calls)
 - #144049 (rustc-dev-guide subtree update)
 - #144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 18, 2025
Rollup of 11 pull requests

Successful merges:

 - #142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - #143271 (Store the type of each GVN value)
 - #143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - #143719 (Emit warning when there is no space between `-o` and arg)
 - #143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - #143891 (Port `#[coverage]` to the new attribute system)
 - #143967 (constify `Option` methods)
 - #144008 (Fix false positive double negations with macro invocation)
 - #144010 (Boostrap: add warning on `optimize = false`)
 - #144049 (rustc-dev-guide subtree update)
 - #144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 79c8f90 into rust-lang:master Jul 18, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 18, 2025
rust-timer added a commit that referenced this pull request Jul 18, 2025
Rollup merge of #143846 - usamoi:gc, r=bjorn3

pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests

Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc #84161
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jul 19, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - rust-lang/rust#143271 (Store the type of each GVN value)
 - rust-lang/rust#143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - rust-lang/rust#143719 (Emit warning when there is no space between `-o` and arg)
 - rust-lang/rust#143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - rust-lang/rust#143891 (Port `#[coverage]` to the new attribute system)
 - rust-lang/rust#143967 (constify `Option` methods)
 - rust-lang/rust#144008 (Fix false positive double negations with macro invocation)
 - rust-lang/rust#144010 (Boostrap: add warning on `optimize = false`)
 - rust-lang/rust#144049 (rustc-dev-guide subtree update)
 - rust-lang/rust#144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jul 21, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - rust-lang/rust#143271 (Store the type of each GVN value)
 - rust-lang/rust#143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - rust-lang/rust#143719 (Emit warning when there is no space between `-o` and arg)
 - rust-lang/rust#143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - rust-lang/rust#143891 (Port `#[coverage]` to the new attribute system)
 - rust-lang/rust#143967 (constify `Option` methods)
 - rust-lang/rust#144008 (Fix false positive double negations with macro invocation)
 - rust-lang/rust#144010 (Boostrap: add warning on `optimize = false`)
 - rust-lang/rust#144049 (rustc-dev-guide subtree update)
 - rust-lang/rust#144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests

Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc rust-lang#84161
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - rust-lang#143271 (Store the type of each GVN value)
 - rust-lang#143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - rust-lang#143719 (Emit warning when there is no space between `-o` and arg)
 - rust-lang#143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - rust-lang#143891 (Port `#[coverage]` to the new attribute system)
 - rust-lang#143967 (constify `Option` methods)
 - rust-lang#144008 (Fix false positive double negations with macro invocation)
 - rust-lang#144010 (Boostrap: add warning on `optimize = false`)
 - rust-lang#144049 (rustc-dev-guide subtree update)
 - rust-lang#144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs 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.

6 participants