chiark / gitweb /
base/asm-common.h: Use new literal-pool stuff for ARM PIC macros.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 24 Jun 2016 00:17:37 +0000 (01:17 +0100)
commitadca2a186e811c5122418d379a10d6b295157a89
treedf417d1b153c9e4214631e73075048a7f73e5a5e
parentf8e509a9dd942ca23013df8fd7a834d30589f8b8
base/asm-common.h: Use new literal-pool stuff for ARM PIC macros.

The support in GAS for the ARM literal-loading syntax is entirely
hopeless.

  * It unnecessarily refuses to allow expressions involving external
    symbols as literal values (e.g., `ldr r0, =_GLOBAL_OFFSET_TABLE_ -
    . - 12').  I've checked: if you modify GAS to remove the pointless
    check, then it produces the right result.

  * It doesn't use the enhanced expression evaluator which understands
    relocation annotations (so you can't say `ldr r0, =foo(GOT)').
    Indeed, this evaluator is internal to the handler for `.word' and
    friends.  Fixing this would be rather hard work, and involve
    uprating the literal-pool machinery quite a bit.

Instead, use the new subsection-based fake literal pool handling
machinery `_LIT' and `_ENDLIT' and some per-macro symbols with awful
names.

This also removes the magic knowledge which the previous version of the
`ldgot' had about the right PC offset, which would have been wrong for
Thumb code.
base/asm-common.h