[PATCH] D50998: [LLD] [COFF] Check the instructions in ARM MOV32T relocations

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 21 00:26:15 PDT 2018


mstorsjo added a comment.

In https://reviews.llvm.org/D50998#1207125, @ruiu wrote:

> This seems fine, but we generally trust input and don't do too many error checks, so I wonder what is your motivation to add this error check. Was this something you can hit without doing assembly programming?


I ran into a bug when LLVM can produce code where the movw+movt instructions are separated. (I have a fix for the bug, just missing a good testcase before I'll submit it.)

This relocation is tricky since it covers both instructions, but the way it is handled within LLVM is that it only is attached to the movw (and the relocation for the movt is dropped). Ideally maybe LLVM should have a check at some point to make sure that wherever we have this relocation, it actually points to both these instructions - but I don't really know where such a check would be placed.



================
Comment at: COFF/Chunks.cpp:137
+  if ((Op1 & 0xfbf0) != (MOVT ? 0xf2c0 : 0xf240))
+    error("Unexpected instruction in " + Twine(MOVT ? "MOVT" : "MOVW") +
+          " instruction in MOV32T relocation");
----------------
ruiu wrote:
> Error messages should start with a lowercase letter.
Will fix.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D50998





More information about the llvm-commits mailing list