bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/19744] New: Thumb-1 pcrop relocations don't work on Thumb-2 tar


From: cbaylis at gcc dot gnu.org
Subject: [Bug gas/19744] New: Thumb-1 pcrop relocations don't work on Thumb-2 targets
Date: Mon, 29 Feb 2016 15:42:47 +0000

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

            Bug ID: 19744
           Summary: Thumb-1 pcrop relocations don't work on Thumb-2
                    targets
           Product: binutils
           Version: 2.27 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: cbaylis at gcc dot gnu.org
  Target Milestone: ---

Created attachment 9052
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9052&action=edit
test case

There are two problems when using the Thumb-1 pcrop relocations on Thumb-2
targets. Firstly, incorrect "undefined symbol" errors are triggered. Secondly,
the assembler may generate 32 bit instructions when 16bit encodings are
available.


The attached test-case works as expected for Thumb-1 targets.

$ arm-unknown-linux-gnueabihf-gcc -c pcrop.S -march=armv4t
$ arm-unknown-linux-gnueabihf-objdump -d pcrop.o
pcrop.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <foo>:
   0:   2300            movs    r3, #0
   2:   021b            lsls    r3, r3, #8
   4:   3300            adds    r3, #0
   6:   021b            lsls    r3, r3, #8
   8:   3300            adds    r3, #0
   a:   021b            lsls    r3, r3, #8
   c:   3300            adds    r3, #0


With a Thumb-2 target, undefined symbol errors are reported instead:
$ arm-unknown-linux-gnueabihf-gcc -c pcrop.S -march=armv7-m
pcrop.S: Assembler messages:
pcrop.S:7: Error: undefined symbol foo used as an immediate value
pcrop.S:9: Error: undefined symbol foo used as an immediate value
pcrop.S:11: Error: undefined symbol foo used as an immediate value
pcrop.S:13: Error: undefined symbol foo used as an immediate value


With a Thumb-2 target, and working around the undefined symbol error, the
assembler generates 32 bit instructions, even though 16 bit encodings are
available.
$ arm-unknown-linux-gnueabihf-gcc -c pcrop.S -march=armv7-m -DDEF_SYM
$ arm-unknown-linux-gnueabihf-objdump -d pcrop.o
pcrop.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <foo>:
   0:   f05f 0300       movs.w  r3, #0       ;// 32 bit
   4:   021b            lsls    r3, r3, #8
   6:   f113 0300       adds.w  r3, r3, #0   ;// 32 bit
   a:   021b            lsls    r3, r3, #8
   c:   f113 0300       adds.w  r3, r3, #0   ;// 32 bit
  10:   021b            lsls    r3, r3, #8
  12:   f113 0300       adds.w  r3, r3, #0   ;// 32 bit

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]