Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hash of source files in debug info #69718

Merged
merged 1 commit into from
Apr 4, 2020
Merged

Conversation

arlosi
Copy link
Contributor

@arlosi arlosi commented Mar 4, 2020

LLVM supports placing the hash of source files inside the debug info.
This information can be used by a debugger to verify that the source code matches
the executable.

This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option.

  • DWARF only supports MD5
  • LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11).
  • CodeView (.PDB) supports MD5, SHA1, and SHA256.

Fixes #68980.

Tracking issue: #70401

rustc dev guide PR with further details: rust-lang/rustc-dev-guide#623

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 4, 2020
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-04T22:42:11.0015940Z ========================== Starting Command Output ===========================
2020-03-04T22:42:11.0019900Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/97a346ad-b12d-426f-b158-1976690e7c01.sh
2020-03-04T22:42:11.0020285Z 
2020-03-04T22:42:11.0029128Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-04T22:42:11.0060763Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69718/merge to s
2020-03-04T22:42:11.0063562Z Task         : Get sources
2020-03-04T22:42:11.0063788Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-04T22:42:11.0064003Z Version      : 1.0.0
2020-03-04T22:42:11.0064150Z Author       : Microsoft
---
2020-03-04T22:42:12.0033993Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-04T22:42:12.0042265Z ##[command]git config gc.auto 0
2020-03-04T22:42:12.0047421Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-04T22:42:12.0051855Z ##[command]git config --get-all http.proxy
2020-03-04T22:42:12.0059057Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69718/merge:refs/remotes/pull/69718/merge

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-04T23:12:46.5658145Z ========================== Starting Command Output ===========================
2020-03-04T23:12:46.5661601Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/4b0fcbe7-51f6-4a7d-972b-8b1ccf40408d.sh
2020-03-04T23:12:46.5662020Z 
2020-03-04T23:12:46.5665831Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-04T23:12:46.5684604Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69718/merge to s
2020-03-04T23:12:46.5687664Z Task         : Get sources
2020-03-04T23:12:46.5687971Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-04T23:12:46.5688254Z Version      : 1.0.0
2020-03-04T23:12:46.5688442Z Author       : Microsoft
---
2020-03-04T23:12:47.8219429Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-04T23:12:47.8229059Z ##[command]git config gc.auto 0
2020-03-04T23:12:47.8235424Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-04T23:12:47.8241362Z ##[command]git config --get-all http.proxy
2020-03-04T23:12:47.8252896Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69718/merge:refs/remotes/pull/69718/merge
---
2020-03-04T23:19:15.2142554Z    Compiling serde_json v1.0.40
2020-03-04T23:19:16.5418764Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2020-03-04T23:19:25.0938143Z     Finished release [optimized] target(s) in 1m 07s
2020-03-04T23:19:25.0942376Z tidy check
2020-03-04T23:19:25.5104497Z tidy error: /checkout/src/test/codegen/src-file-checksum/src-file-checksum-md5.rs: missing trailing newline
2020-03-04T23:19:27.2614091Z * block-buffer 
2020-03-04T23:19:27.2614660Z * block-padding 
2020-03-04T23:19:27.2615198Z * byte-tools 
2020-03-04T23:19:27.2615937Z * digest 
---
2020-03-04T23:19:27.5012872Z Done!
2020-03-04T23:19:27.5013037Z some tidy checks failed
2020-03-04T23:19:27.5013221Z 
2020-03-04T23:19:27.5013323Z 
2020-03-04T23:19:27.5014585Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2020-03-04T23:19:27.5015352Z 
2020-03-04T23:19:27.5015648Z 
2020-03-04T23:19:27.5015988Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2020-03-04T23:19:27.5016359Z Build completed unsuccessfully in 0:01:17
2020-03-04T23:19:27.5016359Z Build completed unsuccessfully in 0:01:17
2020-03-04T23:19:27.5016611Z == clock drift check ==
2020-03-04T23:19:27.5023520Z   local time: Wed Mar  4 23:19:27 UTC 2020
2020-03-04T23:19:27.7695975Z   network time: Wed, 04 Mar 2020 23:19:27 GMT
2020-03-04T23:19:27.7703897Z == end clock drift check ==
2020-03-04T23:19:28.5774808Z 
2020-03-04T23:19:28.5848004Z ##[error]Bash exited with code '1'.
2020-03-04T23:19:28.5881347Z ##[section]Finishing: Run build
2020-03-04T23:19:28.5925271Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69718/merge to s
2020-03-04T23:19:28.5929949Z Task         : Get sources
2020-03-04T23:19:28.5930413Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-04T23:19:28.5930708Z Version      : 1.0.0
2020-03-04T23:19:28.5930914Z Author       : Microsoft
2020-03-04T23:19:28.5930914Z Author       : Microsoft
2020-03-04T23:19:28.5931265Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-04T23:19:28.5931643Z ==============================================================================
2020-03-04T23:19:28.9059937Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-04T23:19:28.9099929Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69718/merge to s
2020-03-04T23:19:28.9216370Z Cleaning up task key
2020-03-04T23:19:28.9217581Z Start cleaning up orphan processes.
2020-03-04T23:19:28.9477324Z Terminate orphan process: pid (20886) (python)
2020-03-04T23:19:28.9503704Z ##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-06T21:14:47.1030287Z ========================== Starting Command Output ===========================
2020-03-06T21:14:47.1034007Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/dc2ec7c1-b68e-4399-82d4-f09b2f6e0a5b.sh
2020-03-06T21:14:47.1034273Z 
2020-03-06T21:14:47.1038636Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-06T21:14:47.1061085Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69718/merge to s
2020-03-06T21:14:47.1064476Z Task         : Get sources
2020-03-06T21:14:47.1064766Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-06T21:14:47.1065367Z Version      : 1.0.0
2020-03-06T21:14:47.1065570Z Author       : Microsoft
---
2020-03-06T21:14:48.0933119Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-06T21:14:48.0947737Z ##[command]git config gc.auto 0
2020-03-06T21:14:48.0951785Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-06T21:14:48.0954810Z ##[command]git config --get-all http.proxy
2020-03-06T21:14:48.0960535Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69718/merge:refs/remotes/pull/69718/merge
---
2020-03-06T22:18:25.9429527Z .................................................................................................... 1700/9732
2020-03-06T22:18:30.8496777Z .................................................................................................... 1800/9732
2020-03-06T22:18:43.3949048Z ..........................................................i......................................... 1900/9732
2020-03-06T22:18:51.5703253Z .................................................................................................... 2000/9732
2020-03-06T22:19:06.3415268Z ................................................iiiii............................................... 2100/9732
2020-03-06T22:19:17.7064341Z .................................................................................................... 2300/9732
2020-03-06T22:19:20.1971058Z .................................................................................................... 2400/9732
2020-03-06T22:19:24.0302280Z .................................................................................................... 2500/9732
2020-03-06T22:19:47.1616475Z .................................................................................................... 2600/9732
---
2020-03-06T22:22:35.7960338Z .........i...............i.......................................................................... 5000/9732
2020-03-06T22:22:46.4733205Z .................................................................................................... 5100/9732
2020-03-06T22:22:51.7418544Z ....................................................i............................................... 5200/9732
2020-03-06T22:23:00.7763271Z .................................................................................................... 5300/9732
2020-03-06T22:23:08.5528067Z ................................ii.ii........i...i.................................................. 5400/9732
2020-03-06T22:23:17.2660602Z .................................................................................................... 5600/9732
2020-03-06T22:23:27.0832610Z .................................................................................................... 5700/9732
2020-03-06T22:23:34.3629596Z .......................i............................................................................ 5800/9732
2020-03-06T22:23:40.1302046Z .................................................................................................... 5900/9732
2020-03-06T22:23:40.1302046Z .................................................................................................... 5900/9732
2020-03-06T22:23:51.7220746Z .................................................................................................... 6000/9732
2020-03-06T22:24:02.6481290Z ...............ii...i..ii...........i............................................................... 6100/9732
2020-03-06T22:24:20.2438390Z .................................................................................................... 6300/9732
2020-03-06T22:24:27.7276347Z .................................................................................................... 6400/9732
2020-03-06T22:24:27.7276347Z .................................................................................................... 6400/9732
2020-03-06T22:24:44.5661670Z ..............................................i..ii................................................. 6500/9732
2020-03-06T22:25:09.3348966Z .................................................................................................... 6700/9732
2020-03-06T22:25:11.7735259Z ......................................i............................................................. 6800/9732
2020-03-06T22:25:14.2214723Z .................................................................................................... 6900/9732
2020-03-06T22:25:16.6301920Z ....................................................................i............................... 7000/9732
---
2020-03-06T22:27:06.9359323Z .................................................................................................... 7700/9732
2020-03-06T22:27:12.4812415Z .................................................................................................... 7800/9732
2020-03-06T22:27:17.7469088Z .................................................................................................... 7900/9732
2020-03-06T22:27:26.6477406Z ..............i..................................................................................... 8000/9732
2020-03-06T22:27:35.6658315Z ...............................................................iiiiiiiii.i.......................... 8100/9732
2020-03-06T22:27:51.7596424Z ......i......i...................................................................................... 8300/9732
2020-03-06T22:27:57.4638965Z .................................................................................................... 8400/9732
2020-03-06T22:28:12.2422918Z .................................................................................................... 8500/9732
2020-03-06T22:28:22.2725397Z .................................................................................................... 8600/9732
---
2020-03-06T22:30:52.4890452Z  finished in 8.022
2020-03-06T22:30:52.5075597Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-06T22:30:52.7191433Z 
2020-03-06T22:30:52.7192107Z running 180 tests
2020-03-06T22:30:55.9654026Z iiii......i...........ii..iiii...i....i...........i............i..i..................i....i......... 100/180
2020-03-06T22:30:58.4000574Z ...i.i.i.FFiii..iiiiiiiiiiiiiiii.......................iii..............ii......
2020-03-06T22:30:58.4003034Z 
2020-03-06T22:30:58.4003587Z ---- [codegen] codegen/remap_path_prefix/main.rs stdout ----
2020-03-06T22:30:58.4003787Z 
2020-03-06T22:30:58.4003787Z 
2020-03-06T22:30:58.4004367Z error: verification with 'FileCheck' failed
2020-03-06T22:30:58.4004738Z status: exit code: 1
2020-03-06T22:30:58.4005642Z command: "/usr/lib/llvm-7/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/remap_path_prefix/main/main.ll" "/checkout/src/test/codegen/remap_path_prefix/main.rs"
2020-03-06T22:30:58.4006465Z ------------------------------------------
2020-03-06T22:30:58.4006783Z 
2020-03-06T22:30:58.4007195Z ------------------------------------------
2020-03-06T22:30:58.4007389Z stderr:
2020-03-06T22:30:58.4007389Z stderr:
2020-03-06T22:30:58.4007918Z ------------------------------------------
2020-03-06T22:30:58.4008425Z /checkout/src/test/codegen/remap_path_prefix/main.rs:28:11: error: CHECK: expected string not found in input
2020-03-06T22:30:58.4009460Z // CHECK: !DIFile(filename: "/the/aux-src/remap_path_prefix_aux.rs", directory: "")
2020-03-06T22:30:58.4010119Z           ^
2020-03-06T22:30:58.4010754Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/remap_path_prefix/main/main.ll:292:1: note: scanning from here
2020-03-06T22:30:58.4011244Z !31 = !{!0, !14}
2020-03-06T22:30:58.4011736Z ^
2020-03-06T22:30:58.4012572Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/remap_path_prefix/main/main.ll:294:7: note: possible intended match here
2020-03-06T22:30:58.4013748Z !33 = !DIFile(filename: "/the/aux-src/remap_path_prefix_aux.rs", directory: "", checksumkind: CSK_MD5, checksum: "dc542ec503a403f5f76478f17ed0322a")
2020-03-06T22:30:58.4015082Z 
2020-03-06T22:30:58.4015550Z ------------------------------------------
2020-03-06T22:30:58.4015715Z 
2020-03-06T22:30:58.4016294Z 
2020-03-06T22:30:58.4016294Z 
2020-03-06T22:30:58.4017301Z ---- [codegen] codegen/remap_path_prefix/xcrate-generic.rs stdout ----
2020-03-06T22:30:58.4017548Z 
2020-03-06T22:30:58.4018159Z error: verification with 'FileCheck' failed
2020-03-06T22:30:58.4018461Z status: exit code: 1
2020-03-06T22:30:58.4019485Z command: "/usr/lib/llvm-7/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/remap_path_prefix/xcrate-generic/xcrate-generic.ll" "/checkout/src/test/codegen/remap_path_prefix/xcrate-generic.rs"
2020-03-06T22:30:58.4020916Z ------------------------------------------
2020-03-06T22:30:58.4021080Z 
2020-03-06T22:30:58.4021613Z ------------------------------------------
2020-03-06T22:30:58.4021961Z stderr:
2020-03-06T22:30:58.4021961Z stderr:
2020-03-06T22:30:58.4022377Z ------------------------------------------
2020-03-06T22:30:58.4023154Z /checkout/src/test/codegen/remap_path_prefix/xcrate-generic.rs:14:11: error: CHECK: expected string not found in input
2020-03-06T22:30:58.4024045Z // CHECK: !DIFile(filename: "/the/aux-src/xcrate-generic.rs", directory: "")
2020-03-06T22:30:58.4024668Z           ^
2020-03-06T22:30:58.4029969Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/remap_path_prefix/xcrate-generic/xcrate-generic.ll:1:1: note: scanning from here
2020-03-06T22:30:58.4030797Z ; ModuleID = 'xcrate_generic.515safou-cgu.0'
2020-03-06T22:30:58.4031124Z ^
2020-03-06T22:30:58.4031841Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/remap_path_prefix/xcrate-generic/xcrate-generic.ll:39:6: note: possible intended match here
2020-03-06T22:30:58.4032931Z !7 = !DIFile(filename: "/the/aux-src/xcrate-generic.rs", directory: "", checksumkind: CSK_MD5, checksum: "27cb50785fd61df201391d2b01e4c43c")
2020-03-06T22:30:58.4033592Z 
2020-03-06T22:30:58.4034207Z ------------------------------------------
2020-03-06T22:30:58.4034397Z 
2020-03-06T22:30:58.4034620Z 
---
2020-03-06T22:30:58.4038221Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
2020-03-06T22:30:58.4038787Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-03-06T22:30:58.4039119Z 
2020-03-06T22:30:58.4039277Z 
2020-03-06T22:30:58.4043096Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/codegen" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "codegen" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-7/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "7.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-03-06T22:30:58.4052058Z 
2020-03-06T22:30:58.4052358Z 
2020-03-06T22:30:58.4057958Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2020-03-06T22:30:58.4058331Z Build completed unsuccessfully in 1:10:27
2020-03-06T22:30:58.4058331Z Build completed unsuccessfully in 1:10:27
2020-03-06T22:30:58.4115972Z == clock drift check ==
2020-03-06T22:30:59.0883181Z   local time: Fri Mar  6 22:30:58 UTC 2020
2020-03-06T22:30:59.0883577Z   network time: Fri, 06 Mar 2020 22:30:58 GMT
2020-03-06T22:30:59.0884009Z == end clock drift check ==
2020-03-06T22:31:00.7121117Z 
2020-03-06T22:31:00.7208473Z ##[error]Bash exited with code '1'.
2020-03-06T22:31:00.7223706Z ##[section]Finishing: Run build
2020-03-06T22:31:00.7273178Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69718/merge to s
2020-03-06T22:31:00.7278689Z Task         : Get sources
2020-03-06T22:31:00.7279036Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-06T22:31:00.7279350Z Version      : 1.0.0
2020-03-06T22:31:00.7279583Z Author       : Microsoft
2020-03-06T22:31:00.7279583Z Author       : Microsoft
2020-03-06T22:31:00.7279922Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-06T22:31:00.7280315Z ==============================================================================
2020-03-06T22:31:01.0850802Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-06T22:31:01.0937681Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69718/merge to s
2020-03-06T22:31:01.1052990Z Cleaning up task key
2020-03-06T22:31:01.1054468Z Start cleaning up orphan processes.
2020-03-06T22:31:01.1243855Z Terminate orphan process: pid (3772) (python)
2020-03-06T22:31:01.1485460Z ##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Mar 9, 2020

☔ The latest upstream changes (presumably #69851) made this pull request unmergeable. Please resolve the merge conflicts.

src/librustc_span/lib.rs Outdated Show resolved Hide resolved
src/librustc_span/lib.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Mar 19, 2020

☔ The latest upstream changes (presumably #70132) made this pull request unmergeable. Please resolve the merge conflicts.

src/librustc_codegen_llvm/debuginfo/metadata.rs Outdated Show resolved Hide resolved
src/librustc_session/options.rs Outdated Show resolved Hide resolved
@eddyb
Copy link
Member

eddyb commented Mar 19, 2020

Seems like this would fix #68980.

src/librustc_span/lib.rs Outdated Show resolved Hide resolved
src/librustc_span/lib.rs Outdated Show resolved Hide resolved
src/librustc_span/lib.rs Outdated Show resolved Hide resolved
@nikomatsakis
Copy link
Contributor

So I opened a quick Zulip topic to discuss. I'd like to see this move forward. One thing I would like to see before we land it though is

  • a quick write-up of -- nothing too long -- of what this feature does. For now this can just be a gist, we'll figure out where to save it later. I think it should include
    • one or two paragraph english description of what the feature does
    • some motivation for why it's useful is always good
    • some links to LLVM docs or DWARF debuginfo docs about the feature
    • reference to whether there exist equivalent flags on C++ compilers
    • any particular impl concerns or downsides we should be aware of
  • we would create a tracking issue that references this write-up
  • documentation for the feature in the [unstable book], the sources for which are in the repo. You could add a section to the compiler flags section as part of the PR. This should probably be a subset of the write-up
  • side note that it'd be nice to have a rustc-dev-guide chapter (looks like it wouldn't have to be long) about this, probably just the text of the write-up, we can worry about that later

@nikomatsakis
Copy link
Contributor

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned estebank Mar 19, 2020
@eddyb
Copy link
Member

eddyb commented Mar 19, 2020

@arlosi @rylev How would you feel about keeping this MD5-only to start, replacing the existing src_hash in SourceFile instead of having two hashes, and having the flag only toggle whether LLVM gets the hash and puts it into DWARF/PDF output?

And we could even turn that flag by default (or not have a flag at all), that part I don't have too many opinions about.

EDIT: I suppose we could toggle between MD5 and SHA1 based on the target spec.
That way, we never compute more than one hash, and e.g. libstd has the best hashes possible (it couldn't be affected by a flag that you apply to your own project).

@arlosi
Copy link
Contributor Author

arlosi commented Mar 23, 2020

@eddyb storing the hash algorithm in the target spec makes sense to me. I've updated the PR to reflect this change.

Because the SourceMap needs to be constructed before the target is known, I had to make the checksum kind mutable, and update it after the target is parsed. Let me know if you see a better way to do this.

@eddyb
Copy link
Member

eddyb commented Mar 23, 2020

@arlosi Can you make creating a SourceFile fail before that happens?
Alternatively, SourceMap construction can potentially be delayed, I recall looking into something like this a long time ago.

Cargo.lock Outdated Show resolved Hide resolved
Copy link
Member

@eddyb eddyb left a comment

Choose a reason for hiding this comment

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

LGTM, r=me if this isn't waiting on anything else.

@eddyb
Copy link
Member

eddyb commented Mar 31, 2020

@bors r+ (assuming @nikomatsakis' "intent to merge" applies)

@bors
Copy link
Contributor

bors commented Mar 31, 2020

📌 Commit 776ebaf02071f99437c0040814904761c90c67f5 has been approved by eddyb

@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 Mar 31, 2020
@spastorino
Copy link
Member

Removing nomination, this was already discussed and it's about to be merged :).

@bors
Copy link
Contributor

bors commented Apr 2, 2020

☔ The latest upstream changes (presumably #70692) made this pull request unmergeable. Please resolve the merge conflicts.

@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 Apr 2, 2020
* Adds either an MD5 or SHA1 hash to the debug info.
* Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
@arlosi
Copy link
Contributor Author

arlosi commented Apr 3, 2020

@eddyb could you re-approve? I resolved merge conflicts.

@eddyb
Copy link
Member

eddyb commented Apr 3, 2020

@bors r+ (feel free to PM me on Zulip or elsewhere when this happens)

@bors
Copy link
Contributor

bors commented Apr 3, 2020

📌 Commit f86b078 has been approved by eddyb

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 3, 2020
@bors
Copy link
Contributor

bors commented Apr 4, 2020

⌛ Testing commit f86b078 with merge 6050e52...

@bors
Copy link
Contributor

bors commented Apr 4, 2020

☀️ Test successful - checks-azure
Approved by: eddyb
Pushing 6050e52 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 4, 2020
@bors bors merged commit 6050e52 into rust-lang:master Apr 4, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 5, 2020
Fix performance regression in debuginfo file_metadata.

Fixes performance regression caused by rust-lang#69718.

Finding the `SourceFile` associated with a `FileName` called `get_source_file` on the `SourceMap`, which does a linear search through all files in the `SourceMap`.

This resolves the issue by passing the `SourceFile` in from the caller (which already had it available) instead of the `FileName`

Fixes rust-lang#70785.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

Consider emitting LLVM DIFile checksums.