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

            Bug ID: 45775
           Summary: Differences in DWARF line number info between directly
                    generated and assembled object files
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM assembly language parser
          Assignee: unassignedb...@nondot.org
          Reporter: wolfgang_p...@playstation.sony.com
                CC: llvm-bugs@lists.llvm.org

The following source, when compiled directly to an object file vs. when first
compiled to an assembly file, and then assembled, produces different line
number information.

struct Ctx
{
  int m1;
  int m2;
};

static Ctx States[2] =
{
  {0, 1}, {2, 3}
};

int getType(struct s* myS);
int foo(struct s* myS)
{
  int type = getType(myS);
  if (type != -1) {
    return States[type].m2;
  }
  return 0;
}

The difference can be demonstrated with the following script:

#!/bin/sh
clang -g -O2 -c test.cpp -o test.o
clang -g -O2 -S test.cpp -o test.s
clang -g -c test.s -o test.assembled.o

objdump -WliarfsoR test.o > 1
objdump -WliarfsoR test.assembled.o > 2
diff 1 2


I'm seeing the following differences:
265c237
<   Length:                      87
---
>   Length:                      88
319,322c291,295
<   [0x00000053]  Advance Line by 20 to 20
<   [0x00000055]  Special opcode 33: advance Address by 2 to 0x18 and Line by 0
to 20
<   [0x00000056]  Advance PC by 2 to 0x1a
<   [0x00000058]  Extended opcode 1: End of Sequence
---
>   [0x00000053]  Set is_stmt to 1
>   [0x00000054]  Advance Line by 20 to 20
>   [0x00000056]  Special opcode 33: advance Address by 2 to 0x18 and Line by 0 
> to 20
>   [0x00000057]  Advance PC by 2 to 0x1a
>   [0x00000059]  Extended opcode 1: End of Sequence

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to