This is an archive of the discontinued LLVM Phabricator instance.

[lit] Pass through QEMU's configuration environmental variables
Needs ReviewPublic

Authored by reames on Jun 29 2022, 11:10 AM.

Details

Summary

I ran across this when cross building LLVM for riscv64. I have qemu-riscv64 installed, and can thus run riscv64 binaries on my stock X86 linux system. However, I need the QEMU_LD_PREFIX set so that dynamic loading works properly. llvm-lit currently isolates tests from the environment which exists at launch, and thus tests run through LIT were always failing. This change pulls all of the QEMU configuration variables from the environment and passes them through to the test so that qemu-user can successfully run the binaries.

I do want to note that test-suite has a wrapper script mechanism (TEST_SUITE_RUN_UNDER) I could implement in LLVM to solve this instead. I prefer this approach, but the other is also possible.

Even with this, ninja check-llvm doesn't yet work. There's another layer of environmental isolation somewhere that I haven't tracked down.

If we decide this is the right direction, we will need similar changes to other config files (e.g. test suite). I'll hold off posting them until we've confirmed this is the right direction.

Diff Detail

Event Timeline

reames created this revision.Jun 29 2022, 11:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 11:10 AM
reames requested review of this revision.Jun 29 2022, 11:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2022, 11:10 AM
reames edited the summary of this revision. (Show Details)Jun 29 2022, 11:46 AM
vitalybuka resigned from this revision.Jul 10 2022, 9:09 PM

I have no idea what is use-case for QEMU here.
I run some sanitizers with QEMU using DemangleSwift COMPILER_RT_EMULATOR=

I have no idea what is use-case for QEMU here.
I run some sanitizers with QEMU using DemangleSwift COMPILER_RT_EMULATOR=

The use case here is building clang with a cross compiler (either clang itself, or the cross compiled gcc toolchain), and then running llvm-lit using the cross compiled binaries.

ping. Any chance of a review here?

The patch looks fine to me. TEST_SUITE_RUN_UNDER is a great alternative, but just setting these env variables should be enough for now.
@jdenny, can you please take a look at this patch?