[llvm-bugs] [Bug 47581] New: llvm-readobj prints wrong addresses for arm32 unwind info (-u)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 18 17:02:32 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47581

            Bug ID: 47581
           Summary: llvm-readobj prints wrong addresses for arm32 unwind
                    info (-u)
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-readobj
          Assignee: unassignedbugs at nondot.org
          Reporter: rprichard at google.com
                CC: jh7370.2008 at my.bristol.ac.uk, llvm-bugs at lists.llvm.org

Created attachment 23983
  --> https://bugs.llvm.org/attachment.cgi?id=23983&action=edit
test binary

cat >test.c << EOF
void func1() {}
void func2() { func1(); }
void func3() {}
EOF

$ clang -target arm-linux-gnueabi test.c -fpic -shared -nostdlib
-funwind-tables

$ nm a.out | grep func
00000230 T func1
00000234 T func2
00000248 T func3

$ readelf -u a.out

Unwind section '.ARM.exidx' at offset 0x24c contains 4 entries:

0x230 <func1>: 0x80b0b0b0
  Compact model index: 0
  0xb0      finish
  0xb0      finish
  0xb0      finish

0x234 <func2>: 0x809b8480
  Compact model index: 0
  0x9b      vsp = r11
  0x84 0x80 pop {r11, r14}

0x248 <func3>: 0x80b0b0b0
  Compact model index: 0
  0xb0      finish
  0xb0      finish
  0xb0      finish

0x24c <func3+0x4>: 0x1 [cantunwind]

$ /x/llvm-upstream/stage1/bin/llvm-readobj --unwind a.out

File: a.out
Format: elf32-littlearm
Arch: arm
AddressSize: 32bit
LoadName: 
UnwindInformation {
  UnwindIndexTable {
    SectionIndex: 9
    SectionName: .ARM.exidx
    SectionOffset: 0x24C
    Entries [
      Entry {
        FunctionAddress: 0x230
        FunctionName: func1
        Model: Compact (Inline)
        PersonalityIndex: 0
        Opcodes [
          0xB0      ; finish
          0xB0      ; finish
          0xB0      ; finish
        ]
      }
      Entry {
        FunctionAddress: 0x22C
        Model: Compact (Inline)
        PersonalityIndex: 0
        Opcodes [
          0x9B      ; vsp = r11
          0x84 0x80 ; pop {fp, lr}
        ]
      }
      Entry {
        FunctionAddress: 0x238
        Model: Compact (Inline)
        PersonalityIndex: 0
        Opcodes [
          0xB0      ; finish
          0xB0      ; finish
          0xB0      ; finish
        ]
      }
      Entry {
        FunctionAddress: 0x234
        FunctionName: func2
        Model: CantUnwind
      }
    ]
  }
}

binutils readobj and nm reports these addresses:
 - func1 == 0x230
 - func2 == 0x234
 - func3 == 0x248
 - end   == 0x24c

llvm-readobj reports these addresses:
 - func1 == 0x230
 - func2 == 0x22C
 - func3 == 0x238
 - end   == 0x234

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200919/d10e1739/attachment.html>


More information about the llvm-bugs mailing list