<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - symbolizer.o should be buildable with a regular cmake rule"
   href="https://llvm.org/bugs/show_bug.cgi?id=30750">30750</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>symbolizer.o should be buildable with a regular cmake rule
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>compiler-rt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>peter@pcc.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17471" name="attach_17471" title="attempt">attachment 17471</a> <a href="attachment.cgi?id=17471&action=edit" title="attempt">[details]</a></span>
attempt

The internal symbolizer.o object is currently built with the script
compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh.

We should really be using a simpler approach to building this object
file, and it should be available as a regular cmake rule. Conceptually, we
want to be doing "ld -r" followed by "objcopy -G" to create a relocatable
object file with only our entry points exposed. Attached is an attempt at doing
this in cmake. However, this does not work at present due to linker and objcopy
bugs:
- the presence of local symbols named the same as global symbols confuses at
  least bfd and gold, so we need to rename local symbols
- ld.gold fails to link symbolizer0.o (fails an assertion)
- ld.bfd succeeds, but seemingly creates an invalid .eh_frame section
(segfaults
  in the unwinder)
- ld.lld succeeds but creates multiple .eh_frame sections which confuses
  objcopy into creating an invalid output file (lld refuses to accept it, gold
  creates an invalid .eh_frame, bfd fails assertions)
To the extent that these are bugs in lld and objcopy, we can probably fix the
bugs in lld and write our own llvm-objcopy (perhaps with a nicer interface for
doing this transformation), then call the tools directly from cmake.</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>