[llvm-bugs] [Bug 47150] New: llvm-gsymutil reports errors for ICF folded symbols

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 12 16:18:41 PDT 2020


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

            Bug ID: 47150
           Summary: llvm-gsymutil reports errors for ICF folded symbols
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: phosek at chromium.org
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

See the following example:

```
$ cat >t.c <<EOF
int f() {
  return 1;
}

int g() {
  return 1;
}

int main() {
  f();
  g();
  return 0;
}
EOF
$ clang -g3 -c t.c -o t.o -ffunction-sections
$ clang -g3 t.o -o t -Wl,--icf=all
$ llvm-gsymutil --convert=t --out-file=t.gsym
error: line table has addresses that do not monotonically increase:
0x00000000002016c0      1      0      1   0             0  is_stmt
0x00000000002016c4      2      3      1   0             0  is_stmt prologue_end
0x00000000002016c0      5      0      1   0             0  is_stmt
0x00000000002016c4      6      3      1   0             0  is_stmt prologue_end

0x0000002a: DW_TAG_subprogram
              DW_AT_low_pc      (0x00000000002016c0)
              DW_AT_high_pc     (0x00000000002016cb)
              DW_AT_frame_base  (DW_OP_reg6)
              DW_AT_name        ("f")
              DW_AT_decl_file   ("/src/clang-llvm/llvm-build/debug/t.c")
              DW_AT_decl_line   (1)
              DW_AT_type        (0x00000075 "int")
              DW_AT_external    (true)
Loaded 2 functions from DWARF.
Loaded 10 functions from symbol table.
Pruned 0 functions, ended with 12 total
```

The line table has the following:

```
0x0000002a:   DW_TAG_subprogram
                DW_AT_low_pc    (0x00000000002016c0)
                DW_AT_high_pc   (0x00000000002016cb)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_name      ("f")
                DW_AT_decl_file ("/src/clang-llvm/llvm-build/debug/t.c")
                DW_AT_decl_line (1)
                DW_AT_type      (0x00000075 "int")
                DW_AT_external  (true)

0x00000043:   DW_TAG_subprogram
                DW_AT_low_pc    (0xffffffffffffffff)
                DW_AT_high_pc   (0x000000000000000a)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_name      ("g")
                DW_AT_decl_file ("/src/clang-llvm/llvm-build/debug/t.c")
                DW_AT_decl_line (5)
                DW_AT_type      (0x00000075 "int")
                DW_AT_external  (true)
```

The DIE for f has the correct low_pc while the DIE for g the tombstone low_pc
and an accordingly bogus high_pc (real_high_pc - real_low_pc - 1). However, the
both entries survived into the line table.

-- 
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/20200812/bbc30942/attachment-0001.html>


More information about the llvm-bugs mailing list