rust icon indicating copy to clipboard operation
rust copied to clipboard

link.exe: Don't embed full path to PDB file in binary.

Open michaelwoerister opened this issue 1 year ago • 10 comments

This PR makes rustc unconditionally pass /PDBALTPATH:%_PDB% to MSVC-style linkers, causing the linker to only embed the filename of the PDB in the binary instead of the full path. This will help implement the trim-paths RFC for *-msvc targets.

Passing /PDBALTPATH:%_PDB% to the linker is already done by many projects that need reproducible builds and debugger's should still be able to find the PDB if it is in the same directory as the binary.

r? @ghost

Fixes https://github.com/rust-lang/rust/issues/87825

michaelwoerister avatar Feb 19 '24 13:02 michaelwoerister

https://github.com/rust-lang/rust/pull/122306 updated backtrace-rs to a version that includes https://github.com/rust-lang/backtrace-rs/pull/584, so this is unblocked now.

@rustbot ping windows

r? compiler

michaelwoerister avatar Mar 12 '24 13:03 michaelwoerister

Hey Windows Group! This bug has been identified as a good "Windows candidate". In case it's useful, here are some instructions for tackling these sorts of bugs. Maybe take a look? Thanks! <3

cc @albertlarsan68 @arlosi @ChrisDenton @danielframpton @gdr-at-ms @kennykerr @luqmana @lzybkr @nico-abram @retep998 @sivadeilra @wesleywiser

rustbot avatar Mar 12 '24 13:03 rustbot

@bors rollup=never since this touching an *-msvc-only run-make test.

michaelwoerister avatar Mar 12 '24 13:03 michaelwoerister

Looks good!

kennykerr avatar Mar 12 '24 13:03 kennykerr

r? compiler

lcnr avatar Mar 12 '24 13:03 lcnr

Thanks @michaelwoerister for fixing this and landing that fix to backtrace-rs to unblock it!

@bors r+

wesleywiser avatar Mar 12 '24 18:03 wesleywiser

:pushpin: Commit c37a8244d966f78843d9afddcf8897f9eccfb159 has been approved by wesleywiser

It is now in the queue for this repository.

bors avatar Mar 12 '24 18:03 bors

However, backtrace-rs currently does not find the PDB. Consequently, this PR is blocked until https://github.com/rust-lang/backtrace-rs/pull/584 is merged.

Merged and backtrace has been updated, so this can land, yep.

workingjubilee avatar Mar 12 '24 19:03 workingjubilee

:hourglass: Testing commit c37a8244d966f78843d9afddcf8897f9eccfb159 with merge 4026a87f9559aa6ebd3f1fd9bfaf13457f3149e3...

bors avatar Mar 12 '24 21:03 bors

:broken_heart: Test failed - checks-actions

bors avatar Mar 12 '24 23:03 bors

r? @wesleywiser

Let's see if this is the same i686 backtracing issue already encountered in https://github.com/rust-lang/backtrace-rs/pull/584, where backtracing was pretty flaky without frame pointers enabled.

michaelwoerister avatar Mar 13 '24 10:03 michaelwoerister

@bors r=wesleywiser

michaelwoerister avatar Mar 13 '24 10:03 michaelwoerister

:pushpin: Commit d3af77c678bf45b5c84bad66407b77564073ead3 has been approved by wesleywiser

It is now in the queue for this repository.

bors avatar Mar 13 '24 10:03 bors

:hourglass: Testing commit d3af77c678bf45b5c84bad66407b77564073ead3 with merge 3f79023fe0d39556d8eab36a3349104167f39d25...

bors avatar Mar 13 '24 11:03 bors

:broken_heart: Test failed - checks-actions

bors avatar Mar 13 '24 13:03 bors

I modified the test code in https://github.com/rust-lang/rust/pull/121297/commits/0a094bae28a00117b99262621ff22876796d2885, so that unwinding will more reliably produce a stack trace that actually contains frames from the test. Unwinding not always working is a pre-existing issue on i686-pc-windows-msvc and unrelated to the change in this PR.

michaelwoerister avatar Mar 14 '24 12:03 michaelwoerister

@bors r+

wesleywiser avatar Mar 14 '24 16:03 wesleywiser

:pushpin: Commit 0a094bae28a00117b99262621ff22876796d2885 has been approved by wesleywiser

It is now in the queue for this repository.

bors avatar Mar 14 '24 16:03 bors

:hourglass: Testing commit 0a094bae28a00117b99262621ff22876796d2885 with merge c5b571310dc60c6a58c6505cce2fb7e2f3f9aa68...

bors avatar Mar 15 '24 14:03 bors

:sunny: Test successful - checks-actions Approved by: wesleywiser Pushing c5b571310dc60c6a58c6505cce2fb7e2f3f9aa68 to master...

bors avatar Mar 15 '24 16:03 bors

Finished benchmarking commit (c5b571310dc60c6a58c6505cce2fb7e2f3f9aa68): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.2% [2.2%, 2.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.8% [-4.8%, -1.0%] 14
Improvements ✅
(secondary)
-2.5% [-5.7%, -0.5%] 52
All ❌✅ (primary) -2.5% [-4.8%, 2.2%] 15

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 671.321s -> 670.605s (-0.11%) Artifact size: 311.51 MiB -> 311.47 MiB (-0.01%)

rust-timer avatar Mar 15 '24 17:03 rust-timer