<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-objcopy --compress-debug-sections does not work on any non-trivial example"
   href="https://bugs.llvm.org/show_bug.cgi?id=40885">40885</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-objcopy --compress-debug-sections does not work on any non-trivial example
          </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>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llvm-objcopy
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jh7370.2008@my.bristol.ac.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>alexander.v.shaposhnikov@gmail.com, jake.h.ehrlich@gmail.com, jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org, rupprecht@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I stumbled on this and filed <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Removing sections does not check for invalidated relocations"
   href="show_bug.cgi?id=40818">bug 40818</a>, whilst trying to test
<a href="https://reviews.llvm.org/D58510">https://reviews.llvm.org/D58510</a>. <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Removing sections does not check for invalidated relocations"
   href="show_bug.cgi?id=40818">Bug 40818</a> fixed the invalidation of
relocations (by emitting a new error message), but as a result, the new error
message now always fires with any non-trivial example:

// test.cpp - could be basically anything...
int foo();

int bar ()
{
  return foo();
}

$ clang -c -g test.cpp
$ llvm-objcopy --compress-debug-sections test.o test2.o
llvm-objcopy: error: Section .debug_abbrev cannot be removed because of symbol
'' used by the relocation patching offset 0x6 from section .rela.debug_info.

The problem is that --compress-debug-sections attempts to replace (by removing
and adding a new section) debug sections containing section symbols referred to
by relocations (usually which patch other debug sections). The relocations are
supposed to remain unchanged, which implies that the symbols in these sections
(including the section symbols) must remain unchanged. Instead, llvm-objcopy
attempts to remove them and emits an error. Conclusion: when replacing the
sections due to --compress-debug-sections, we should update the symbols in
those sections to reference the new sections.</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>