This is an archive of the discontinued LLVM Phabricator instance.

[WIP] [llvm-tapi] ELF binary writing initial draft
AbandonedPublic

Authored by amontanez on Oct 24 2018, 4:25 PM.

Details

Reviewers
None
Summary

This is a workspace dump of the current progress on llvm-tapi for ELF. Subject to change, open to feedback.

Added:

  • ELF binary write support:
    • ELF header
    • Section headers
    • .dynsym, .dynstr, .def (SH_NOBITS), .shstrtab, .dynamic,
  • Output format selection via a crude flag.
  • Additional integration tests.

Fixed:

  • ELFArch now conforms directly to the architectures in the ELF namespace.
  • Fixed bug where converting to an ELF binary would throw an unsupported error.
  • Fixed TBE YAML so that .tbe files with no specified symbols would load correctly.

Changed:

  • ELF_DSO file type has been replaced with ELF_[32/64][LE/BE].

Diff Detail

Repository
rL LLVM

Event Timeline

amontanez created this revision.Oct 24 2018, 4:25 PM
amontanez edited the summary of this revision. (Show Details)

Many changes. Binary stubs produced by this tool are now linkable in the small subset of test cases I've tried.

Added:

  • .dynamic, program headers.
  • Support for weak symbols.
  • Support for DT_NEEDED entries.

TODO:

  • Coding style hasn't been fixed. [1]
  • Currently not using FileOutputBuffer.
  • Program header implementation subject to change.
  • Not updated to match the initial patch's change in structure/naming/etc. [1]
  • Needs more tests. [1]
  • Many more TODOs listed in the code.

[1] These will be addressed as pieces of this patch are upstreamed.

amontanez abandoned this revision.Jan 25 2019, 9:28 AM

This has been redesigned as part of the ELF TextAPI and the llvm-elfabi tool. Those interested should follow the progress of elfabi.