[PATCH] D34622: [Linker] Add directives to support mixing ARM/Thumb module-level inline asm.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 09:39:56 PDT 2017


fhahn added inline comments.


================
Comment at: lib/Linker/IRMover.cpp:1299
+    // and Thumb modules.
+    if (SrcTriple.getArch() == Triple::thumb ||
+        SrcTriple.getArch() == Triple::thumbeb)
----------------
tejohnson wrote:
> Should this first check if the dest module is of the other arch before emitting these?
> 
> I guess by always emitting then you don't have to worry about needing to switch the arch again back to the dest arch. I.e. in the case where the dest module is arm, a source module with thumb inline assembly linked in, followed by another source module with arm inline assembly being linked in (I assume this needs to get ".thumb" for source module 1 and then ".arm" for source module 2). Is that why it is being unconditionally emitted? 
Exactly. Also I think there are cases where we have to emit .arm even though we merge an ARM module into an ARM module. For example: We merge module M1 - Thumb and module M2 - ARM into an ARM module.

We have to emit .arm for the inline assembly of M2 (even thought the dest module is also ARM), because M1 set .thumb.



================
Comment at: test/MC/ARM/inline-asm-switch-mode.ll:10
+
+; CHECK: .code 16
+; CHECK-next: .p2align 1
----------------
tejohnson wrote:
> Confused as to what is being tested here since no llvm-link invocation.
Ah sorry about that. This test ensures that the mode is reset properly before the first function. I'll remove it from this patch and commit is separately.


https://reviews.llvm.org/D34622





More information about the llvm-commits mailing list