core: support launching statically linked executables #1254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch enhances the dynamic linker to support launching statically linked executables.
The dynamically linked executables or shared libraries are typically launched by calling a "main" function which is exported and can be resolved using the ELF symbol table. The statically linked executables do not export
such symbols and instead must be launched by jumping to the ELF entry point specified in the header. To that end this patch implements new functions -
run_entry_point()
- specific for each architecture - x86_64 and aarch64 which fundamentally do a similar thing - putargc
,argv
, environment variables, and auxiliary vector on the stack and jump to the elf entry point.In addition, this patch enhances other parts of the dynamic linker logic to do things a little bit differently for statically linked executables:
This patch also adds augment_auxv() to add the extra auxiliary vector entries needed by statically linked executables to bootstrap themselves
In addition, this 2nd version of the PR renames the method
is_statically_linked()
tois_statically_linked_executable()
and fixes it by identifying if an ELF is not a shared library. So it should fix the "liblua.so" problem reported by Nadav.Closes #1140