Skip to content

symbolizer.o should be buildable with a regular cmake rule #30098

Open
@pcc

Description

@pcc
Bugzilla Link 30750
Version unspecified
OS Linux
Attachments attempt
CC @eugenis,@vitalybuka

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacmakeBuild system in general and CMake in particularcompiler-rt

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions