Home

jkoshy edited this page Oct 13, 2012 · 8 revisions
Clone this wiki locally

Elftoolchain In NetBSD

The ELF Toolchain Project maintains BSD licensed implementations of essential compilation tools and libraries for handling ELF based program images. This GitHub project is being used to experiment with integrating the Elftoolchain into the NetBSD build system.

Integration Notes

  • The Elftoolchain source tree would placed into $NETBSDSRC/external/bsd/elftoolchain/dist. Note: By convention, NetBSD build uses separate bin/ and lib/ directories which "reach into" the dist/ directory for sources.
  • A new build knob MKELFTOOLCHAIN specifies the ELFToolChain utilities that are to be built. This knob would contain a list of utilities to be built and installed, or "no". If "no", then the toolchain sources are ignored. Otherwise, the corresponding Elftoolchain utilities will be built in preference to the existing GNU ones. Note that the use of GNU binutils cannot be completely avoided at this time, since the Elftoolchain project is yet to release an ld(1) or an as(1).
  • share/mk/bsd.own.mk needs to handle the case where gcc is built with Elftoolchain utilities.
  • Other GNU toolchain related assumptions would need to be tracked down (TBD).
  • Documentation changes needed:
    • An entry describing the imported source tree needs to be added to the list in doc/3RDPARTY.
    • share/man5/mk.conf.5 needs a documentation entry.
    • doc/BUILDING.mdoc would need a description of the MKELFTOOLCHAIN knob.
  • Processing of the imported source tree:
    • The test and documentation directories need to be removed.
    • $NetBSD CVS tags need to be added to all relevant files.
    • An elftoolchain2netbsd script needs to be added, to automate future imports.

Older Source

  • The directories external/bsd/libelf and external/bsd/libdwarf have older versions of Elftoolchain code. Locally applied bug-fixes (if any) to these libraries would need to be integrated in the mainline Elftoolchain tree.

Other Utilities

  • dbsym

    On some architectures, the dbsym utility is used to move kernel symbol information into a pre-allocated array in the kernel's data segment. This utility uses -lbfd and would need to be ported to use -lelf.

  • mdsetimage

    This utility copies a disk image into a kernel. It uses -lbfd.

TODO

  1. Package building code under distrib needs to be examined for toolchain-related dependencies.