[llvmlinux] ARM Integrated Assembler by default

Behan Webster behanw at converseincode.com
Tue Dec 10 14:09:41 UTC 2013


On 12/06/13 10:56, Renato Golin wrote:
> Folks,
>
> We're trying to push the IAS by default on ARM's back-end to be ready
> for 3.5, and I need your help to make an argument.
>
> So far, people have compiled large projects (like Chromium and other
> internal stuff) with the IAS, as well as I am running the test-suite
> and the build tests with it and all seem fine. There were a number of
> bugs (which we'll collect here: http://llvm.org/PR18158) but all of
> them were fixed.
>
> Can you guys compile the kernel with the IAS turned on, just to see
> how many bugs would crop up? You can either add "-integrated-as" on
> Clang's command line, or apply the attached patch to LLVM before
> building the kernel.
>
> Also, I don't expect it to solve any problem, so please compile the
> kernel with your patches already in it, just to make sure we're not
> hitting bugs that GAS also fails.
We don't get very far without gas. That's the problem. There are a LOT
of things which don't work with IA (in both ARM and X86_64).

For now we've mostly just used "-no-integrated-as" to narrow down our
focus of getting the rest working and upstream first.

But things break early and often with IA enabled. It's not a simple
thing to come up with a list of bugs by merely turning it back on.

The simplest thing to say is that IA on the ARM side doesn't support
non-unified ARM ASM format, nor the many GNU extensions used in the
kernel code (though there are plenty of x86 specific issues we also
preclude by turning IA off).

> Let me know your findings, and I hope we don't find too many bugs...
> fingers crossed! ;)
The problem is that many of them could probably be argued as needing to
be changed in the kernel code, not the tool.

For instance, look at __my_cpu_offset() in this file:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/include/asm/percpu.h?id=refs/tags/v3.13-rc3

There is a stack read which is used in this ASM which is never actually
used in the resulting code produced by the assembler. But gas appears to
determine in the specific case where this code is inlined whether or not
a memory barrier is necessary or not just by attempting to perform this
fake stack read and then does the right thing. IA on the other hand
complains. This is hacky code, however the side effect makes the
resulting code quite efficient.

As Vinicius is proving, compiling without -no-integerated-as isn't
trivial. :(

Behan

-- 
Behan Webster
behanw at converseincode.com



More information about the LLVMLinux mailing list