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

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 20 10:29:54 PDT 2018


Typically people do this kind of thing by writing a loader for the
executable format you want to run, and they create libc stubs that either
delegate or reimplement enough functionality to get the app in question to
run. Wine, for example, uses this approach. It loads native PE executables,
and implements enough of the win32 API to run some applications.

"Re-linking" would be tough because linking typically throws away static
relocations that you would need.

On Fri, Jul 20, 2018 at 12:46 AM ardi via llvm-dev <llvm-dev at lists.llvm.org>
wrote:

> Hi,
>
> Let's suppose we have an ELF executable that doesn't issue any syscall
> (I mean, syscalls are issued from an external dynamic library, not
> from the executable, and we can ignore such dynamic library because we
> have the proper equivalent library with the proper syscalls in MacOS
> and Windows).
>
> So, the question: Is it "currently possible" (by "currently possible"
> I mean that all the needed tools/code already exist) to somehow
> "unlink" the code and data from the ELF executable, and relink it as
> two new executables: one Mach-O and another PE?
>
> Would this be possible with just LLVM tools, or would other
> libraries/tools also be needed?
>
> Thanks a lot!
>
> ardi
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180720/ec326c35/attachment.html>


More information about the llvm-dev mailing list