<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - llvm-readobj prints wrong addresses for arm32 unwind info (-u)"
   href="https://bugs.llvm.org/show_bug.cgi?id=47581">47581</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-readobj prints wrong addresses for arm32 unwind info (-u)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llvm-readobj
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rprichard@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23983" name="attach_23983" title="test binary">attachment 23983</a> <a href="attachment.cgi?id=23983&action=edit" title="test binary">[details]</a></span>
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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>