This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Fix compressed-debug-level test on SystemZ
ClosedPublic

Authored by uweigand on Apr 26 2023, 10:49 AM.

Details

Summary

The libz compression library on SystemZ by default makes use of the platform's hardware-accelerated compression facility. This is much faster than the regular software implementation, but often results in slightly different outputs. This causes failures with the compressed-debug-level test case.

To fix this, run this test while setting the DFLTCC environment variable to zero, which prevents use of hardware compression and falls back to the software implementation. (This should not have any effect on other platforms.)

Diff Detail

Event Timeline

uweigand created this revision.Apr 26 2023, 10:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 10:49 AM
Herald added a subscriber: emaste. · View Herald Transcript
uweigand requested review of this revision.Apr 26 2023, 10:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2023, 10:49 AM
MaskRay accepted this revision.Apr 26 2023, 10:59 AM
This revision is now accepted and ready to land.Apr 26 2023, 10:59 AM
This revision was landed with ongoing or failed builds.Apr 27 2023, 8:51 AM
This revision was automatically updated to reflect the committed changes.

Hey, looks like this is causing test failures on the Fuchsia Windows builders:
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-windows-x64/b8782647969396934929/overview

Script:
--
: 'RUN: at line 3';   c:\b\s\w\ir\x\w\staging\llvm_build\bin\yaml2obj.exe C:\b\s\w\ir\x\w\llvm-llvm-project\lld\test\ELF\compressed-debug-level.test -o C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.o
: 'RUN: at line 9';   DFLTCC=0 c:\b\s\w\ir\x\w\staging\llvm_build\bin\ld.lld.exe C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.o -o C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.default --compress-debug-sections=zlib
: 'RUN: at line 10';   c:\b\s\w\ir\x\w\staging\llvm_build\bin\llvm-readelf.exe --sections C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.default | c:\b\s\w\ir\x\w\staging\llvm_build\bin\filecheck.exe -check-prefixes=HEADER,LEVEL1 C:\b\s\w\ir\x\w\llvm-llvm-project\lld\test\ELF\compressed-debug-level.test
: 'RUN: at line 12';   DFLTCC=0 c:\b\s\w\ir\x\w\staging\llvm_build\bin\ld.lld.exe -O0 C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.o -o C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O0 --compress-debug-sections=zlib
: 'RUN: at line 13';   c:\b\s\w\ir\x\w\staging\llvm_build\bin\llvm-readelf.exe --sections C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O0 | c:\b\s\w\ir\x\w\staging\llvm_build\bin\filecheck.exe -check-prefixes=HEADER,LEVEL1 C:\b\s\w\ir\x\w\llvm-llvm-project\lld\test\ELF\compressed-debug-level.test
: 'RUN: at line 14';   cmp C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.default C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O0
: 'RUN: at line 16';   DFLTCC=0 c:\b\s\w\ir\x\w\staging\llvm_build\bin\ld.lld.exe -O1 C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.o -o C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O1 --compress-debug-sections=zlib
: 'RUN: at line 17';   c:\b\s\w\ir\x\w\staging\llvm_build\bin\llvm-readelf.exe --sections C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O1 | c:\b\s\w\ir\x\w\staging\llvm_build\bin\filecheck.exe -check-prefixes=HEADER,LEVEL1 C:\b\s\w\ir\x\w\llvm-llvm-project\lld\test\ELF\compressed-debug-level.test
: 'RUN: at line 18';   cmp C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.default C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O1
: 'RUN: at line 20';   DFLTCC=0 c:\b\s\w\ir\x\w\staging\llvm_build\bin\ld.lld.exe -O2 C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.o -o C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O2 --compress-debug-sections=zlib
: 'RUN: at line 21';   c:\b\s\w\ir\x\w\staging\llvm_build\bin\llvm-readelf.exe --sections C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.O2 | c:\b\s\w\ir\x\w\staging\llvm_build\bin\filecheck.exe -check-prefixes=HEADER,LEVEL6 C:\b\s\w\ir\x\w\llvm-llvm-project\lld\test\ELF\compressed-debug-level.test
--
Exit Code: 127

Command Output (stdout):
--
$ ":" "RUN: at line 3"
$ "c:\b\s\w\ir\x\w\staging\llvm_build\bin\yaml2obj.exe" "C:\b\s\w\ir\x\w\llvm-llvm-project\lld\test\ELF\compressed-debug-level.test" "-o" "C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.o"
$ ":" "RUN: at line 9"
$ "DFLTCC=0" "c:\b\s\w\ir\x\w\staging\llvm_build\bin\ld.lld.exe" "C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.o" "-o" "C:\b\s\w\ir\x\w\staging\llvm_build\tools\lld\test\ELF\Output\compressed-debug-level.test.tmp.default" "--compress-debug-sections=zlib"
# command stderr:
'DFLTCC=0': command not found
error: command failed with exit status: 127

--
uweigand reopened this revision.Apr 28 2023, 3:20 AM

I've reverted this now as 84539a24632235868cb58f3c167838e32fa42940. Sorry for the breakage. I'll look for another way to set env variables that also works on Windows, and resubmit.

This revision is now accepted and ready to land.Apr 28 2023, 3:20 AM
uweigand planned changes to this revision.Apr 28 2023, 3:21 AM
uweigand updated this revision to Diff 517888.Apr 28 2023, 6:01 AM

Use config.environment to set environment variable.

This revision is now accepted and ready to land.Apr 28 2023, 6:01 AM
uweigand requested review of this revision.Apr 28 2023, 6:02 AM

This version now uses config.environment to set the DFLTCC environment variable, which should work on any supported platform. In addition, the environment variable is only set on SystemZ as host platform.

simpal01 removed a subscriber: simpal01.
simpal01 added a subscriber: simpal01.
MaskRay accepted this revision.May 4 2023, 9:19 AM

LGTM.

This revision is now accepted and ready to land.May 4 2023, 9:19 AM
This revision was automatically updated to reflect the committed changes.