<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 - llvm-gsymutil reports errors for ICF folded symbols"
   href="https://bugs.llvm.org/show_bug.cgi?id=47150">47150</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-gsymutil reports errors for ICF folded symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>DebugInfo
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>phosek@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</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>