bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/24991] New: the assembler generates incorrect offset for jumps


From: mikulas at artax dot karlin.mff.cuni.cz
Subject: [Bug gas/24991] New: the assembler generates incorrect offset for jumps on arm thumb2
Date: Tue, 10 Sep 2019 18:36:44 +0000

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

            Bug ID: 24991
           Summary: the assembler generates incorrect offset for jumps on
                    arm thumb2
           Product: binutils
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: mikulas at artax dot karlin.mff.cuni.cz
  Target Milestone: ---

Created attachment 11985
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11985&action=edit
a test file

Compile the attached file without optimizations and run it. You'll get a crash:

$ arm-linux-gnueabihf-gcc -mthumb long.c
$ ./a.out
Segmentation fault (core dumped)

If you look at the assembler output, you'll see that the beq.w instruction that
is supposed to jump over the function body points backwards.

0000050c <f>:
     50c:       b580            push    {r7, lr}
     50e:       b082            sub     sp, #8
     510:       af00            add     r7, sp, #0
     512:       6078            str     r0, [r7, #4]
     514:       687b            ldr     r3, [r7, #4]
     516:       2b00            cmp     r3, #0
     518:       f406 8e45       beq.w   fff871a6 <__bss_end__+0xffdef15e>     
<<<<<<< BUG
     51c:       f8df 3ffc       ldr.w   r3, [pc, #4092] ; 151c <f+0x1010>
     520:       447b            add     r3, pc
     522:       4618            mov     r0, r3
     524:       f7ff ef52       blx     3cc <puts@plt>
     528:       f8df 3ff4       ldr.w   r3, [pc, #4084] ; 1520 <f+0x1014>
     52c:       447b            add     r3, pc
     52e:       4618            mov     r0, r3
     530:       f7ff ef4c       blx     3cc <puts@plt>
     534:       f8df 3fec       ldr.w   r3, [pc, #4076] ; 1524 <f+0x1018>
     538:       447b            add     r3, pc
     53a:       4618            mov     r0, r3
     53c:       f7ff ef46       blx     3cc <puts@plt>
     540:       f8df 3fe4       ldr.w   r3, [pc, #4068] ; 1528 <f+0x101c>
     544:       447b            add     r3, pc
     546:       4618            mov     r0, r3

-- 
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]