[llvm-dev] Arm: disabling/disallowing Thumb instructions

Erik de Castro Lopo via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 16 15:34:34 PDT 2015


Renato Golin wrote:

> You're not the first one to fall for that. As a matter of fact, that
> was probably one of my first "bugs" in LLVM, too. :)

Yeah, this GHC one was a little more complex. The compiler itself was
completely fine. The linker was quite happy to link Arm and Thumb code
into an executable that worked.

The problem was the GHC interactive environment which has its own runtime
linker that loads object files. The problem here was that the run time
linker was loading code compiled from Haskell and hence generated as Arm
code (via the LLVM backend), but that code was being called from the C
runtime code that was compiled as Thumb. 

The C code was calling into Haskell compiled function inside the executable
without a problem (the platform linker was doing the right thing). It was
also able to execute the Arm code loaded by the run time linker. The SIGILL
was happening in the C run time code after it *returned* from the Arm code
that was loaded by the runtime linker.

Bizzare!

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the llvm-dev mailing list