<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - ARM ELF writer not marking all thumb functions correctly"
   href="http://llvm.org/bugs/show_bug.cgi?id=19484">19484</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ARM ELF writer not marking all thumb functions correctly
          </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>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dpeixott@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The integrated assembler is not properly marking all thumb functions. Small
test case:

$ cat A.s
        .text
        .syntax unified
        .globl  A
        .type   A,%function
        .code   16
        .thumb_func
A:
        .fnstart
        bx      lr
        .globl  B
B = A

GCC will mark both A and B as thumb functions, but llvm only marks A as a thumb
function.

$ llvm-mc A.s -triple arm-none-linux -mcpu=cortex-a9 -filetype=obj -o A.o
$ llvm-readobj -symbols A.o
  Symbol {
    Name: A (1)
    Value: 0x1
    Size: 0
    Binding: Global (0x1)
    Type: Function (0x2)
    Other: 0
    Section: .text (0x1)
  }
  Symbol {
    Name: B (8)
    Value: 0x0
    Size: 0
    Binding: Global (0x1)
    Type: Function (0x2)
    Other: 0
    Section: .text (0x1)
  }

We should mark both A and B as thumb functions by setting the least-significant
bit to 1. It is done correctly for A (Value=0x1), but not for B (Value=0x0). 

This worked previously, but was recently broken around 3/20. I suspect it might
be related to this change, but I'm not certain:

  commit 0a70f9b3b9b4a8cb92f187ea0563c1a2ac784e6e
  Author: Rafael Espindola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>>
  Date:   Thu Mar 20 02:12:01 2014 +0000

      Look through variables when computing relocations.

This is causing multiple failures in C++ programs in our test suite because it
generates incorrect code for C++ constructors. Here is a small c++ program that
exhibits the same failure.

class Foo
{
public:
    Foo();
private:
    int x;
};

Foo::Foo()
{
  x = 0;
}</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>