Skip to content

cmELF: Allow building without system libelf headers

Instead provide the few enums, types, and structures that are needed to build cmELF locally inside cmELF.cxx. I copied these structures from LLVM's llvm/include/llvm/BinaryFormat/ELF.h (removing unnecessary values), so they should definitely be correct. The ELF parser code is still optional and can be disabled with an option() which defaults to on (but it won't be included in the bootstrap CMake).

This allows me to use CMAKE_BUILD_WITH_INSTALL_RPATH=False and the Ninja generator on macOS, whereas before it would always give me the following error message (despite cross-compiling for an ELF-based platform):

The install of the <name> target requires changing an RPATH from
  the build tree, but this is not supported with the Ninja generator unless
  on an ELF-based platform.  The CMAKE_BUILD_WITH_INSTALL_RPATH variable may
  be set to avoid this relinking step.

Topic-rename: import-elf

Edited by Brad King

Merge request reports