[PATCH] D33436: [ARM] Create relocation for Thumb functions calling ARM fns.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 09:25:18 PDT 2017


fhahn added inline comments.


================
Comment at: test/MC/ARM/thumb-far-jump.s:25
 
-@ CHECK-NOT: 0x0 R_ARM_THM_CALL end 0x0
+@ CHECK: 0x0 R_ARM_THM_CALL end 0x0
 @ CHECK: 0x2004 R_ARM_THM_CALL main2 0x0
----------------
echristo wrote:
> I think this is right, but I'm curious how we had it precisely inverted. What's up?
Without the changes in this patch, no relocations are generated for branches to internal labels that are in range of the branch, which was the case for the branch to `end`. That means `BL` is used for all such branches, even for branches from Thumb to ARM code.

With this patch, a relocation is always generated when jumping to non Thumb code. But currently isThumbFunc only tracks function symbols, while `end` is a non-function label, meaning a relocation is added even though it is not really necessary because in this case we are branch from Thumb code to Thumb code.

 As Peter explained, additional relocations for non-function labels shouldn't cause problems, as long as there's no change in execution mode. And unless we are dealing with hand-written assembler that violates the ABI, the execution mode should only be changed by branches to function symbols AFAIK.


https://reviews.llvm.org/D33436





More information about the llvm-commits mailing list