<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 - wrong line number info for obj file compiled with -ffunction-sections"
   href="https://bugs.llvm.org/show_bug.cgi?id=40703">40703</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wrong line number info for obj file compiled with -ffunction-sections
          </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-objdump
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>a.v.lapshin@mail.ru
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For the following test case wrong line number info shown by llvm-objdump :

$ cat function-sections-line-numbers.cpp

__attribute__((__noinline__)) int Pow(int number, int count);

int Pow(int number, int count)
{
    int result = 1;

    for (int i = 0; i < count; ++i) 
    {
        result = result * number;
    }

    return result;
}





extern "C" int Func (void)
{
    return Pow(6, 0);
}

$ clang -ffunction-sections -gdwarf-5 -O -c function-sections-line-numbers.cpp
-o bad.o
$ llvm-objdump -disassemble -line-numbers -r -s -section-headers -t bad.o

....
Disassembly of section .text._Z3Powii:
_Z3Powii:
; /home/avl/bugs/objdump_linenumbers/function-sections-line-numbers.cpp:5
       0:       85 f6   testl   %esi, %esi
; /home/avl/bugs/objdump_linenumbers/function-sections-line-numbers.cpp:22
       2:       7e 12   jle     18 <_Z3Powii+0x16>
       4:       83 fe 07        cmpl    $7, %esi
       7:       77 13   ja      19 <_Z3Powii+0x1c>

Note "function-sections-line-numbers.cpp:22" - is incorrect for the function
Pow.

I have a fix for that bug. But I would like to discuss it at llvm-dev first.</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>