-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
debuginfo: add compiler option to allow compressed debuginfo sections #115358
Conversation
This comment has been minimized.
This comment has been minimized.
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
936a13e
to
d1f923b
Compare
This comment has been minimized.
This comment has been minimized.
This failure is what I'd expect given no way to detect missing zlib
support, so maybe someone has an idea how we should check that in the test?
…On Tue, Aug 29, 2023, 20:34 Rust Log Analyzer ***@***.***> wrote:
The job *x86_64-gnu-llvm-15* failed! Check out the build log: (web)
<https://github.com/rust-lang/rust/actions/runs/6018812772/job/16327664411>
(plain)
<https://github.com/rust-lang/rust/commit/d1f923b0632d4d8b656a1a2f970fb2910288ae9f/checks/16327664411/logs>
*Click to see the possible cause of the failure (guessed by this bot)*
---- [run-make] tests/run-make/compressed-debuginfo stdout ----
error: make failed
status: exit status: 2
command: cd "/checkout/tests/run-make/compressed-debuginfo" && AR="ar" CC="cc -ffunction-sections -fdata-sections -fPIC -m64" CXX="c++ -ffunction-sections -fdata-sections -fPIC -m64" HOST_RPATH_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" LD_LIB_PATH_ENVVAR="LD_LIBRARY_PATH" LLVM_BIN_DIR="/usr/lib/llvm-15/bin" LLVM_COMPONENTS="aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwp engine executionengine extensions filecheck frontendopenacc frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto m68k m68kasmparser m68kcodegen m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objcopy object objectyaml option orcjit orcshared orctargetprocess passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils ve veasmparser vecodegen vectorize vedesc vedisassembler veinfo webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsdriver windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" LLVM_FILECHECK="/usr/lib/llvm-15/bin/FileCheck" NODE="/usr/bin/node" PYTHON="/usr/bin/python3" RUSTC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUSTDOC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_BUILD_STAGE="stage2-x86_64-unknown-linux-gnu" RUST_DEMANGLER="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools-bin/rust-demangler" S="/checkout" TARGET="x86_64-unknown-linux-gnu" TARGET_RPATH_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" TMPDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/compressed-debuginfo/compressed-debuginfo" "make"
--- stdout -------------------------------
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/compressed-debuginfo/compressed-debuginfo:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/compressed-debuginfo/compressed-debuginfo -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/compressed-debuginfo/compressed-debuginfo -Ainternal_features --crate-name=foo --crate-type=lib --emit=obj -C debuginfo=full -Z debuginfo-compression=zlib foo.rs
readelf -t /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/compressed-debuginfo/compressed-debuginfo/foo.o | grep -q ZLIB
--- stderr -------------------------------
--- stderr -------------------------------
make: *** [Makefile:12: zlib] Error 1
Build completed unsuccessfully in 0:25:21
—
Reply to this email directly, view it on GitHub
<#115358 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAE6LPCZENHNF2UQSMI4WLXX2C7ZANCNFSM6AAAAAA4DPEYM4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
is this failure because our CI does not have zlib installed? |
That's my assumption - I'm not familiar enough with the Rust project's LLVM setup to know how to check. I'm also not sure how to make the test gracefully degrade if zlib is missing. :( |
If compression is requested but not available, a warning might be appropriate. Then you could check for presence of the warning. |
Right - I'm not sure how I should be printing a warning from where I've got access to the LLVM API in question. Any pointers? Alternatively, if I can run |
Oh, I might have had the dumb. I may see what I missed on my last attempt to print the warning... |
Ah, I remember the stumbling block I hit: rustc_codegen_llvm isn't currently used by rustc_session, and that seems like a layering violation to me naively, so I can't call into the FFI functions to look if the requested compression is available from there. But by the time we're in a location where we can check that in rustc_codegen_llvm, I don't seem to have a way to emit warnings at all (eg from Any hints? |
d1f923b
to
8ce75c8
Compare
Manishearth got me sorted as far as I can tell on printing the diagnostic, and I came up with some Shell Crimes for the test in the makefile, so I think this is ready for review. |
This comment has been minimized.
This comment has been minimized.
8ce75c8
to
afaaec8
Compare
This comment has been minimized.
This comment has been minimized.
afaaec8
to
4865077
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a style nit, then this lgtm
This comment has been minimized.
This comment has been minimized.
@bors r+ rollup |
debuginfo: add compiler option to allow compressed debuginfo sections LLVM already supports emitting compressed debuginfo. In debuginfo=full builds, the debug section is often a large amount of data, and it typically compresses very well (3x is not unreasonable.) We add a new knob to allow debuginfo to be compressed when the matching LLVM functionality is present. Like clang, if a known-but-disabled compression mechanism is requested, we disable compression and emit uncompressed debuginfo sections. The API is different enough on older LLVMs we just pretend the support is missing on LLVM older than 16.
Using `ld.lld` may have been clever, but that was getting the /system/ ld.lld, not one we may have built as part of building llvm. By using the warning message coming directly from rustc we now correctly skip the zlib and zstd tests when the support is missing.
8577e3e
to
78d805c
Compare
Rebased (thus the force push) and reworked test to actually do what it says on the tin. |
@rustbot label -S-waiting-on-author +S-waiting-on-review |
@bors r+ |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#113807 (Tests crash from inappropriate use of common linkage) - rust-lang#115358 (debuginfo: add compiler option to allow compressed debuginfo sections) - rust-lang#115630 (Dont suggest use between `use` and cfg attr) - rust-lang#115662 (Improve "associated type not found" diagnostics) - rust-lang#115673 (Fix sanitize/cfg.rs test) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#115358 - durin42:compress-debuginfo, r=oli-obk debuginfo: add compiler option to allow compressed debuginfo sections LLVM already supports emitting compressed debuginfo. In debuginfo=full builds, the debug section is often a large amount of data, and it typically compresses very well (3x is not unreasonable.) We add a new knob to allow debuginfo to be compressed when the matching LLVM functionality is present. Like clang, if a known-but-disabled compression mechanism is requested, we disable compression and emit uncompressed debuginfo sections. The API is different enough on older LLVMs we just pretend the support is missing on LLVM older than 16.
Just tried this option got |
That means the LLVM your rustc was compiled against didn't have zstandard support enabled. zlib is probably already on, maybe try that? |
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Note that the releases built by the Rust project (i.e. the ones provided by rustup) do not enable support for zstd in their bundled LLVM (yet, at least), thus the Rust compiler will warn, but the build will proceed: warning: unknown debuginfo compression algorithm zstd - will fall back to uncompressed debuginfo Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org [ Added note about zstd support in Rust-provided binaries. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Note that the releases built by the Rust project (i.e. the ones provided by rustup) do not enable support for zstd in their bundled LLVM (yet, at least), thus the Rust compiler will warn, but the build will proceed: warning: unknown debuginfo compression algorithm zstd - will fall back to uncompressed debuginfo Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org [ Added note about zstd support in Rust-provided binaries. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Rust 1.74.0 introduced (unstable) support for the `-Zdebuginfo-compression` flag, thus use it. Note that the releases built by the Rust project (i.e. the ones provided by rustup) do not enable support for zstd in their bundled LLVM (yet, at least), thus the Rust compiler will warn, but the build will proceed: warning: unknown debuginfo compression algorithm zstd - will fall back to uncompressed debuginfo Link: rust-lang/rust#120953 Link: rust-lang/rust#115358 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240217002622.57322-1-ojeda@kernel.org [ Added note about zstd support in Rust-provided binaries. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
LLVM already supports emitting compressed debuginfo. In debuginfo=full builds, the debug section is often a large amount of data, and it typically compresses very well (3x is not unreasonable.) We add a new knob to allow debuginfo to be compressed when the matching LLVM functionality is present. Like clang, if a known-but-disabled compression mechanism is requested, we disable compression and emit uncompressed debuginfo sections.
The API is different enough on older LLVMs we just pretend the support
is missing on LLVM older than 16.