https://sourceware.org/bugzilla/show_bug.cgi?id=21183

            Bug ID: 21183
           Summary: ARM: allow relative symbol references in PC relative
                    ldr literals
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: ard.biesheuvel at linaro dot org
  Target Milestone: ---

One thing that would be particularly useful in position independent bare metal
code that needs to be portable across older ARM versions and even OABI code
(such as the Linux kernel) is the ability to emit relative symbol references
via ldr.

For examples, this code is currently rejected by GAS:

        ldr     \reg, =\sym - (8887f + 8)
8887:   ldr     \reg, [pc, \reg]

but can be open coded in the following way:

        ldr     \reg, 8888f
8887:   ldr     \reg, [pc, \reg]
        b       8889f
8888:   .long   \sym - (8887b + 8)
8889:

but this requires an additional branch to jump over the explicit literal.

Since this is not a limitation of the ISA, but of the assembler, please
consider adding support for this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to