[llvm-dev] Relinking (syscall-free) ELF executable into Mach-O and PE executables

Pavel Labath via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 23 03:10:02 PDT 2018


On Mon, 23 Jul 2018 at 05:31, Zachary Turner via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> Couldn’t you write the relocations to the ELF executable?  I don’t know if current linkers have support for this, but it seems possible in theory to make a relinkable executable.  If you want to do this with an already linked executable though, then yea this won’t be possible.

You can do a "ld --relocatable" to create an elf file that can be used
as further input to the linker (so relocations will be preserved,
etc.). However, that file will not be a fully functional executable
until you do a final non-relocatable link on it.


More information about the llvm-dev mailing list