You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of how APE binaries are designed, they are not natively executable using exec*() syscalls and require invocation from a shell.
While this can be worked around with assimilate, there are two major issues with this approach:
This breaks user expectations for a "self contained", "no installation required" binary artifact.
assimilate strips support for other platforms, thus requiring the software distributor to have multiple binaries for different platforms, thus negating the use case for cosmopolitan.
Therefore, there should be a way to emit a binary artifact with a standard #!/bin/sh header such that portability is maintained for MachO + Linux + BSD platforms.
Although I'm not familiar with the codebase, as I understand, there are two things that would need to be done to implement this:
1 #!/bin/sh is longer than the current magic. To prevent complicating the codebase with conditional offset generation when this option is enabled, extend the default magic headers in apelink.c by some additional bytes such that the executable nature of the PE binaries and the magic header string is preserved, for example, MZqFpD='\n[...] would become `MZqFpD='\nxxx[...]"
2. Modify the detection logic in loader.c to pick up on this new "shell-script but actually APE" binaries.
3. Modify ape.S to use the new magic.
Thanks!
The text was updated successfully, but these errors were encountered:
Because of how APE binaries are designed, they are not natively executable using
exec*()
syscalls and require invocation from a shell.While this can be worked around with
assimilate
, there are two major issues with this approach:assimilate
strips support for other platforms, thus requiring the software distributor to have multiple binaries for different platforms, thus negating the use case for cosmopolitan.Therefore, there should be a way to emit a binary artifact with a standard
#!/bin/sh
header such that portability is maintained for MachO + Linux + BSD platforms.Although I'm not familiar with the codebase, as I understand, there are two things that would need to be done to implement this:
1
#!/bin/sh
is longer than the current magic. To prevent complicating the codebase with conditional offset generation when this option is enabled, extend the default magic headers in apelink.c by some additional bytes such that the executable nature of the PE binaries and the magic header string is preserved, for example,MZqFpD='\n[...]
would become `MZqFpD='\nxxx[...]"2. Modify the detection logic in loader.c to pick up on this new "shell-script but actually APE" binaries.
3. Modify ape.S to use the new magic.
Thanks!
The text was updated successfully, but these errors were encountered: