bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/30850] New: gas arm: Strange behaviors while handling operator


From: jwlee2217 at softsec dot kaist.ac.kr
Subject: [Bug gas/30850] New: gas arm: Strange behaviors while handling operator `[]`.
Date: Thu, 14 Sep 2023 04:10:00 +0000

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

            Bug ID: 30850
           Summary: gas arm: Strange behaviors while handling operator
                    `[]`.
           Product: binutils
           Version: 2.41
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: jwlee2217 at softsec dot kaist.ac.kr
  Target Milestone: ---

```
$ cat examples/bug4_1.s
bl [[1]*[[2] ^ 3]]
bl ((1)*((2) ^ 3))
$ ./arm-linux-gnueabi-as examples/bug4_1.s -o bug4_1.o
$ ./arm-linux-gnueabi-objdump -d bug4_1.o

bug4_1.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <.text>:
   0:   ebfffffe        bl      1 <.text+0x1>
   4:   ebfffffe        bl      1 <.text+0x1>
```

It seems that GAS treats brackets ([]) as parentheses (()). Normally, brackets
are used to represent memory operands. I wonder if this is the intended
behavior of GAS or not.

```
$ cat examples/bug4_2.s
bl [R0]
$ ./arm-linux-gnueabi-as examples/bug4_2.s -o bug4_2.o
$ ./arm-linux-gnueabi-objdump -d bug4_2.o

bug4_2.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <.text>:
   0:   ebfffffe        bl      0 <R0>
$ ./arm-linux-gnueabi-readelf -r bug4_2.o

Relocation section '.rel.text' at offset 0xc4 contains 1 entry:
 Offset     Info    Type            Sym.Value  Sym. Name
00000000  0000061c R_ARM_CALL        00000000   R0
```

Another (relevant) doubtful behavior of GAS is if we give a memory operand to
`bl` instruction then GAS ignores the bracket and generates a symbol for R0.

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