[PATCH] D113509: [lld][ELF] Support for R_ARM_THM_JUMP8

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 02:02:32 PST 2021


peter.smith added a comment.

Code looks good to me.

Will probably need to use the .reloc directive in a regular test. Most assemblers don't emit the relocation for the Thumb conditional branch as it is so small in range that going out of the section usually means it will be out of range of its target. I think something like:

  .text
  .thumb
  .global undefined
  .inst.n 0xd0fe
  .reloc 0, R_ARM_THM_JUMP8, undefined

Should work, this produces:

  00000000 <$t.0>:
         0: fe d0         beq     0x0 <$t.0>              @ imm = #-4
                          00000000:  R_ARM_THM_JUMP8      undefined



================
Comment at: lld/test/ELF/arm-thumb-undefined-weak-narrow.test:27
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
-    Content:         "fee7"
+    Content:         "fee7ffe7"
   - Type:            SHT_REL
----------------
The R_ARM_THM_JUMP8 is for the thumb conditional branch. I think that for a jump to a symbol this should be with little-endian `fed0` for beq undefined_weak
| 0xd   | 0x0 | 0xfe |
| 1101 | cond | imm8  |
Where the imm8 is -4 (Thumb PC-bias).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113509/new/

https://reviews.llvm.org/D113509



More information about the llvm-commits mailing list