The llc tool currently defaults to Static relocation model and generates non-relocatable code for 32-bit Power.
This is not desirable on AIX where we always generate Position Independent Code (PIC). This patch makes PIC the default relocation model for AIX.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 44113 Build 45251: arc lint + arc unit
Event Timeline
Address comments to:
- disable setting anything other than PIC for AIX,
- add an API unit test instead of LIT test.
llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | ||
---|---|---|
226 | I meant that the user-facing option processing code should generate an error message to prevent setting something other than PIC for AIX. The code here should assert !RM.hasValue() || *RM == Reloc::PIC_ for AIX. | |
llvm/unittests/CodeGen/CMakeLists.txt | ||
17 ↗ | (On Diff #237434) | Given the location of the code change, I think unittests/Target/PowerPC would be where the new test would go? |
llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | ||
---|---|---|
226 | As per personal discussion, the target could be unknown during option processing and therefore RM settings will need to be determined after that phase. An assertion will be added to this getter function, and the user error will be reported in the llc code before the powerpc target machine is created and this getter function is called, because the PPCTargetMachine constructor doesn't have an existing mechanism to report user errors. |
@stevewan, can you confirm if there are other tools/utilities that need similar treatment?
llvm/tools/llc/llc.cpp | ||
---|---|---|
399 | I suggest moving this to immediately before the use. | |
464 | s/will result in an user error/is considered a user error/; | |
llvm/unittests/Target/PowerPC/AIXRelocModelTest.cpp | ||
28 | powerpc--aix. | |
36 | s/force/forced/; |
llvm/tools/llc/llc.cpp | ||
---|---|---|
469 | A "lit" test that checks for this error message for would be appropriate. I would suggest checking that setting PIC explicitly works for both 32-bit and 64-bit AIX and setting other-than-PIC generates an error message for the same. |
llvm/tools/llc/llc.cpp | ||
---|---|---|
469 | Thanks for pointing out, LIT case added. |
Address comments regarding the lit test case.
llvm/test/tools/llc/aix-pic-setting.ll | ||
---|---|---|
7 | Thanks for noting. I tried to check for emptiness, but this look like the proper way of doing it. Also to avoid confusion, I'm omitting the CHECK-EMPTY prefix as it is already a predefined directive in FileCheck. |
llvm/unittests/Target/PowerPC/CMakeLists.txt | ||
---|---|---|
17 | Most of these look unused. You shouldn't need Analysis CodeGen Core MC MIRParser, only Support Target PowerPC* |
In addition to the lit issue on Windows, it looks like the test is also missing a REQUIRES: powerpc-registered-target line: http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/12986/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Aaix-pic-setting.ll
llvm/test/tools/llc/aix-pic-setting.ll | ||
---|---|---|
3 | The integrated shell is probably missing redirection support for stdin using 1> syntax. Plain > should work. |
Any luck? Bot's been broken for a while now. Maybe just remove the 1>/dev/null for now, or remove that test until things are figured out?
Added the REQUIRES directive which fixed part of the broken bots. The fix for the redirecting issue on Windows is also in, I'm monitoring the bots to validate.
llvm/unittests/Target/PowerPC/CMakeLists.txt | ||
---|---|---|
17 | Addressed in a follow-on patch, rGfc4e43ad618b. Thanks! |
I meant that the user-facing option processing code should generate an error message to prevent setting something other than PIC for AIX.
The code here should assert !RM.hasValue() || *RM == Reloc::PIC_ for AIX.