Pass the --compress-debug-sections=zlib argument to the linker when
the use of compressed debug info is requested.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lgtm, but we should be sure to advise users that their debugging tools may need build adjustments to ensure they support the compressed formats.
Hello all,
really sorry but I've had to revert this patch due to failures on the following build bot:
I think the problem here is that if zlib is not available, you won't get the clang command line you expect:
https://lab.llvm.org/buildbot/#/builders/216/builds/3519
Input was: <<<<<< 1: clang version 15.0.0 (https://github.com/llvm/llvm-project.git 2d0c897212d0551966b26eae986209ea31c4f032) 2: Target: x86_64-unknown-fuchsia 3: Thread model: posix 4: InstalledDir: c:\buildbot-root\llvm-clang-x86_64-sie-win\build\bin 5: clang: warning: cannot compress debug sections (zlib not installed) [-Wdebug-compression-unavailable] 6: "c:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\bin\\clang.exe" "-cc1" "-triple" "x86_64-unknown-fuchsia" "-emit-obj" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "fuchsia.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=C:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\tools\\clang\\test\\Driver" "-resource-dir" "c:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\lib\\clang\\15.0.0" "-isysroot" "C:\\buildbot-root\\llvm-clang-x86_64-sie-win\\llvm-project\\clang\\test\\Driver/platform" "-internal-isystem" "c:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\lib\\clang\\15.0.0\\include" "-internal-externc-isystem" "C:\\buildbot-root\\llvm-clang-x86_64-sie-win\\llvm-project\\clang\\test\\Driver/platform\\include" "-Og" "-fdebug-compilation-dir=C:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\tools\\clang\\test\\Driver" "-ferror-limit" "19" "-fsanitize=safe-stack" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "C:\\Users\\BUILDB~1\\AppData\\Local\\Temp\\lit-tmp-f3r87ykv\\fuchsia-9a49da.o" "-x" "c" "C:\\buildbot-root\\llvm-clang-x86_64-sie-win\\llvm-project\\clang\\test\\Driver\\fuchsia.c" 7: "c:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\bin\\ld.lld" "-z" "max-page-size=4096" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments" "-z" "rel" "--pack-dyn-relocs=relr" "--sysroot=C:\\buildbot-root\\llvm-clang-x86_64-sie-win\\llvm-project\\clang\\test\\Driver/platform" "-pie" "--build-id" "--hash-style=gnu" "--eh-frame-hdr" "-dynamic-linker" "ld.so.1" "-o" "a.out" "Scrt1.o" "-LC:\\buildbot-root\\llvm-clang-x86_64-sie-win\\llvm-project\\clang\\test\\Driver/platform\\lib" "--compress-debug-sections=zlib" "C:\\Users\\BUILDB~1\\AppData\\Local\\Temp\\lit-tmp-f3r87ykv\\fuchsia-9a49da.o" "c:\\buildbot-root\\llvm-clang-x86_64-sie-win\\build\\lib\\clang\\15.0.0\\lib\\fuchsia\\libclang_rt.builtins-x86_64.a" "-lc" >>>>>>
Since lld does produce the expected argument, it suggests that maybe LLD isn't doing any detection of whether zlib is available like the compiler is.
Lit is aware of zlib's presence or absence, you could use REQUIRES: zlib (or you might factor that bit out into its own test with the REQUIRES).
I have moved that test to clang/test/Driver/compress.c which already has REQUIRES: zlib.