[llvm-bugs] [Bug 40703] New: wrong line number info for obj file compiled with -ffunction-sections

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 12 05:29:24 PST 2019


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

            Bug ID: 40703
           Summary: wrong line number info for obj file compiled with
                    -ffunction-sections
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-objdump
          Assignee: unassignedbugs at nondot.org
          Reporter: a.v.lapshin at mail.ru
                CC: llvm-bugs at lists.llvm.org

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.

-- 
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/20190212/edaaaa64/attachment.html>


More information about the llvm-bugs mailing list