Files
Paweł Marczewski 2cfdd510dc [LibOS] Remove dynamic linking
After this change, LibOS will no longer perform dynamic linking.
The ELF loading code executes load commands and passes control to
interpreter (ld.so), which handles necessary relocations and
loading additional libraries. In this way, the code resembles what
Linux kernel does when executing a new program.

Before, dynamic linking was necessary for making LibOS entry point
(syscalldb function) available for applications. However, that meant
duplicating the work already done by ld.so, and introduced a lot of
unnecessary complexity. After changing LibOS entry API to use the
GS register, it's possible to omit dynamic linking entirely.

The main function (__load_elf_object()) still needs cleanup and
possibly rewriting from scratch. However, this change prepares
ground for that rewrite.

Summary of changes:

- Remove dynamic relocation step (DO_DYNAMIC_RELOCATE()).
- Don't call __load_elf_object() again for ELFs reported
  via register_library(). We only need to notify GDB about these.
- Remove fields related to dynamic linking from link_map (dynamic
  section address, hashes, etc.), and setup for these fields.
- need_interp(): To check if we need an interpreter, check only if
  the binary requests one (PT_INTERP), instead of traversing the
  dynamic section (before, we ignored dynamic dependencies on LibOS
  itself, but now there shouldn't be any).
- RELOCATE(): always adjust addresses, instead of checking if
  they're already inside the mapped range. I think the previous
  behaviour was a workaround to make repeated relocations work.
- Get rid of load modes that are no longer used (OBJECT_REMAP,
  OBJECT_USER).
- Remove the workaround for repeated relocation in glibc patches
  (R_X86_64_NONE).

Signed-off-by: Paweł Marczewski <pawel@invisiblethingslab.com>
2021-02-18 02:48:02 +01:00
..
2021-02-01 02:36:59 +01:00
2020-10-14 20:01:13 +02:00
2021-02-18 02:48:02 +01:00
2020-10-14 20:01:13 +02:00