[LLVMdev] ARM/MC/ELF questions on .ARM.attributes section

Renato Golin
2010-09-30T23:13:50Z

On 30 September 2010 22:50, Jason Kim <jasonwkim at google.com>
wrote:
> 3. For the existing GNU ARM toolchain, what are the supported blobs
> that go into the ARM specific sections in the ELF file? (Renato, could
> you possibly shed light on  this?) I'd like to figure this out before
> I attempt to fill out ARM-specific changes to the MCELFStreamer

Hi Jason,

>From our tests, GCC doesn't understand most of them. I haven't dig
up
the source code, but we tried to pass them in different combinations
and everything gets overwritten but what GCC thinks it's right. So
far, everything but cpu and fpu gets overwritten, and the instruction
set is defined by the instructions in the assembly code, rather than
by its build attribute.

I think GCC does it mostly for compatibility, as it getting it wrong
is worse than ignoring it completely. But build attributes were not
designed to describe the standard configuration of an architecture,
but to change it according to user's necessities.

It would be great if we can get them right in LLVM, but there are
catches. We need to let the options available to all passes. The code
generation / instruction selection phases have to be in sync with all
the implications of the selected attribute, or the linking process
could blow up. Also, we need to get the possible combinations right
and show errors/warnings to the user when they get them wrong. I don't
have any case on the top of my head that could blow up but I will see
if there is any public document we can create the list of combinations
from.

About MC...

We tried to put some build attributes into the AsmWriter, but GAS
ignored it completely, and it was nothing MC related. I think we
should do it right, so we can get ASM and ELF in sync.

I'm still getting my head around MC, but I agree this should be an
ARM-only feature. Can't we override MCELFStreamer and MCAsmStreamer to
add that to the begin section of both? I think by using MCSymbols (or
maybe MCTargetExpr) attached to MCSection named ".ARM.attributes"
should do the job.

--
cheers,
--renato