The shared libraries build fails due to a missing dependency. This just adds it. It is NFC otherwise.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Could you be a little more specific? I just ran a build with BUILD_SHARED_LIBS=ON and it seemed to work.
unittests/CodeGen/CMakeLists.txt | ||
---|---|---|
12 ↗ | (On Diff #225286) | Why is this necessary? There's a subdirectory for GlobalISel, if some unit test in here is pulling in GlobalISel it's worth investigating why. |
unittests/Target/ARM/CMakeLists.txt | ||
15 ↗ | (On Diff #225286) | Nit; These lists are sorted alphabetically. |
unittests/CodeGen/CMakeLists.txt | ||
---|---|---|
12 ↗ | (On Diff #225286) | Sorry, I probably should have added that to the description. It is missing vtables for two classes. unittests/Target/ARM/CMakeFiles/ARMTests.dir/MachineInstrTest.cpp.o:(.toc+0x0): undefined reference to `vtable for llvm::RegisterBankInfo' unittests/Target/ARM/CMakeFiles/ARMTests.dir/MachineInstrTest.cpp.o:(.toc+0x8): undefined reference to `vtable for llvm::LegalizerInfo' Build info: |
unittests/Target/ARM/CMakeLists.txt | ||
15 ↗ | (On Diff #225286) | Oops, sorry about that. I'll reorder them. |
The references are coming from ARMSubtarget which is instantiated in MachineInstrTest.cpp. These have in the ARMSubtarget.h header file:
/// GlobalISel related APIs. std::unique_ptr<CallLowering> CallLoweringInfo; std::unique_ptr<InstructionSelector> InstSelector; std::unique_ptr<LegalizerInfo> Legalizer; std::unique_ptr<RegisterBankInfo> RegBankInfo;
There are code-generation differences in GCC and Clang. GCC generates the destructors for RegBankInfo and Legalizer in Comdat groups and calls them from the destructor of ArmSubTargetInfo, whereas LLVM does not. I don't intuitively know why there is this difference in code-generation.
In the static build libLLVMGlobalISel.a is included in the link line whereas it isn't for the shared build. I think that unless there is a good reason for GCC not to output the destructors then it is worth adding GlobalIsel.
We don't really have control over how the GCC build compiler works, so I really think we should go ahead with this patch. This is particularly important since the PPC bot has also been failing for 3 days or so with the same error (caused by r374887):
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/10972
I initially didn't realize that this is causing build bot breaks, so I plan to commit this patch today to get the bot back to green.
unittests/CodeGen/CMakeLists.txt | ||
---|---|---|
8 ↗ | (On Diff #225490) | This one is actually not needed. Just the other one. So on the commit, I'll commit just the change in unittests/Target/ARM. |