RFA: ARM: Implement __builtin_trap
Mikael Pettersson
mikpe@it.uu.se
Fri Sep 10 13:12:00 GMT 2010
Richard Earnshaw writes:
>
> On Thu, 2010-09-09 at 14:20 -0700, Chris Lattner wrote:
> > On Sep 9, 2010, at 11:44 AM, Mark Mitchell wrote:
> >
> > > On 9/9/2010 11:34 AM, Chris Lattner wrote:
> > >
> > >> FWIW, the LLVM ARM backend compiles __builtin_trap into "trap" (aka .word 0xe7ffdefe).
> > >
> > > Is "trap" a standard pseudo-op? I didn't see it in either the ARM ARM
> > > or in ARM's assembler manual, but that doesn't mean it isn't there.
> > > ARM's assembler has an "UND" pseudo-op, which takes an argument to say
> > > exactly which undefined instruction you want. From the documentation,
> > > it looks like the default, if you don't specify an argument is 0xe7f000f0.
> >
> > Specifically, the LLVM backend emits:
> >
> > _t: @ @t
> > .long 0xe7ffdefe @ trap
> >
> >
> > So no, I don't think that trap is a standard mnemonic. I have a vague memory of ARM not having an official trap instruction, but then retroactively deciding that some invalid encodings would never be defined.
> >
> > -Chris
>
> You shouldn't use ".long" for instructions, use ".inst". ".long"
> implies a word of data while ".inst" implies an instruction: in
> big-endian mode the difference is significant.
It also affects objdump, which in recent binutils won't disassemble
code in .text entered with pseudo-ops like .long or .word. ".inst" works.
/Mikael
More information about the Gcc-patches
mailing list