It mimics the GNU readelf where it prints a [VARIANT_PCS] for symbols
with st_other with STO_AARCH64_VARIANT_PCS.
Details
Diff Detail
Event Timeline
You may want to update obj2yaml and yaml2obj as well since they need no additional code (see D62596 for an example).
The binutils commit 2301ed1c9af1316b4bad3747d2b03f7d44940f87 does not have a test for [VARIANT_PCS | %x] (@nsz).
I believe currently there is no way to set the other st_other bits with MC so the lack of testing may be fine.
It seems that objdump does not understand STO_AARCH64_VARIANT_PCS.
llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test | ||
---|---|---|
353–359 | Ack, I will fix it. | |
llvm/tools/llvm-readobj/ELFDumper.cpp | ||
4050 | It is, but on a subsequent patch (https://reviews.llvm.org/D93045). I will add a standalone patch as well. |
llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-variant_pcs.s | ||
---|---|---|
1 ↗ | (On Diff #311294) | I'm interested to hear what @grimar thinks, but I feel like this test would be better written with a YAML input. That will a) allow the test to be tested without AArch64 target support enabled, and b) I feel like yaml2obj gives more precise control over teh symbol details, and c) it is clearer what the inputs actually are. |
llvm/tools/llvm-readobj/ELFDumper.cpp | ||
4051 | Maybe we should have a test case that shows for non AARCH64 cases, this code doesn't trigger? |
llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-variant_pcs.s | ||
---|---|---|
1 ↗ | (On Diff #311294) | I agree with all mentioned points. I guess that with use of YAML + macros this test also could be slightly shorter. |
llvm/lib/ObjectYAML/ELFYAML.cpp | ||
---|---|---|
1045 ↗ | (On Diff #311590) | This belongs to yaml2obj functionality, not to llvm-readelf/obj and can be fixed separatelly. I'd suggest either |
llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test | ||
13 | This output looks a bit wrong. # MIPS-LLVM:Name: foo # MIPS-LLVM:Other [ # MIPS-LLVM-NEXT: STO_MIPS_MICROMIPS (0x80) # MIPS-LLVM-NEXT: STO_MIPS_OPTIONAL (0x4) # MIPS-LLVM-NEXT: STO_MIPS_PIC (0x20) # MIPS-LLVM-NEXT: STO_MIPS_PLT (0x8) # MIPS-LLVM-NEXT:] # MIPS-LLVM:Name: bar # MIPS-LLVM:Other [ # MIPS-LLVM-NEXT: STO_MIPS_MIPS16 (0xF0) # MIPS-LLVM-NEXT:] I think you need to update LLVMStyle<ELFT>::printSymbol too. | |
17 | Please align. |
Updated patch based on previous comments. It depends on https://reviews.llvm.org/D93235 for YAML STO_AARCH64_VARIANT_PCS support.
llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test | ||
---|---|---|
13 | This wasn't addressed? |
llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test | ||
---|---|---|
28 | Perhaps also worth a case with the visibility bits set too (e.g. STV_HIDDEN)? |
Updated patch based on previous comments:
- Added LLVMStyle support.
- Add symbol visibility tests.
One test suggestion. Otherwise, this looks fine.
llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test | ||
---|---|---|
44–47 | The visibility bits aren't flags, they're values, so they can't be combined like you've done here (hence why you end up with STV_PROTECTED in the final output). I think as long as you've got the max visibility value (iSTV_PROTECTED) defined in one of these cases, I think that's all you need (you can then drop the other case). You might also want a negative case, using STV_PROTECTED, to make sure the STO_AARCH_VARIANT_PCS value isn't used in this case. Examples suggested with the inline edit. |
llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test | ||
---|---|---|
44–47 | Ack, I will change the tests with your suggestions. |
This output looks a bit wrong.
See the output from mips-symbols-stother.test:
I think you need to update LLVMStyle<ELFT>::printSymbol too.