Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Added more relocations.
Could not find a test case for IMAGE_REL_ARM64_ADDR32NB.
I see that IMAGE_REL_ARM64_SECTION is generated only on Windows with dumpbin (and not on Linux with llvm-objdump). Does it make sense to limit this unit test only for Windows?
test/MC/AArch64/coff-relocations.ll | ||
---|---|---|
1 ↗ | (On Diff #106788) | Use a .s test instead. You can probably run this file through llc, and then run llvm-mc on that to generate an object. |
78 ↗ | (On Diff #106788) | With a .s test, you won't need all this complex debug info to make SECREL and SECTION relocations, you can just directly use the .secrel and .secidx directives. |
Changed unit test to .s according to comments.
Unit tests for IMAGE_REL_ARM64_PAGEOFFSET_12A and IMAGE_REL_ARM64_PAGEOFFSET_12L not added as llvm-mc currently cannot parse the assembly for these. Here is my code for the above two relocations:
adrp x0, foo add x0, x0, foo
This is the error I get:
error: expected compatible register, symbol or integer in range [0, 4095] add x0, x0, foo ^
I'd rather have a look at llvm-objdump and see if it can easily be fixed to show what you want.
The correct syntax that llvm-mc should accept is this:
add x0, x0, :lo12:foo
IIRC this should also work with ldr/str:
ldr x0, [x0, :lo12:foo]
Thanks @mstorsjo for pointing me to the correct assembly for add/ldr. My test cases now work for all the implemented relocation types.
Please fix the relocation type before you commit this.
lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp | ||
---|---|---|
43–90 | Use auto and clang-format. | |
59 | Shouldn't this be IMAGE_REL_ARM64_SECREL? | |
60 | Why no newline here? Can you make the newline spacing uniform? | |
test/MC/AArch64/coff-relocations.s | ||
3 | Don't think that you need the second RUN: here. |
I have addressed comments, and my previous patch was accepted by @compnerd. So unless someone has any more comments I will go ahead and commit this.
test/MC/AArch64/coff-relocations.s | ||
---|---|---|
3 | Without the second RUN, this line is reported as malformed. I checked that a lot of the other tests also use a similar format of multiple RUNs. |
Shouldn't this be IMAGE_REL_ARM64_SECREL?