Browse Source

Added some documentation on how to add static-pie support to the porting guide

Signed-off-by: linted <linted@users.noreply.github.com>
linted 1 year ago
parent
commit
0f2cede0fa
1 changed files with 11 additions and 0 deletions
  1. 11 0
      docs/porting.txt

+ 11 - 0
docs/porting.txt

@@ -12,6 +12,8 @@ you are hacking on.
    the shared library loader work requires you first have basic architecture
    the shared library loader work requires you first have basic architecture
    support working.  Thus you should add ARCH_HAS_NO_SHARED and
    support working.  Thus you should add ARCH_HAS_NO_SHARED and
    ARCH_HAS_NO_LDSO to Config.ARCH's TARGET_ARCH
    ARCH_HAS_NO_LDSO to Config.ARCH's TARGET_ARCH
+- When static pie support is added this TARGET_arch can be appended to the 
+   list in extra/Configs/Config.in
 
 
 ====================
 ====================
 === libc sysdeps ===
 === libc sysdeps ===
@@ -56,6 +58,15 @@ you are hacking on.
   usually these are written in assembler, but you may be able to cheat and
   usually these are written in assembler, but you may be able to cheat and
   write them in C ... see other ports for more information
   write them in C ... see other ports for more information
 
 
+- Once static and pie executables are stable, static-pie support can be 
+  added by modifying crt1.S to calculate the address that the kernel loaded 
+  the main elf. Once the elf load address is found, call reloc_static_pie to
+  perform all the dynamic relocations normally handled by ldso. This new
+  code should be placed at the begining of _start and surrounded by defines
+  so that it is only compiled into rcrt1.o and not the static or shared 
+  versions. This is usually done by using the special L_rcrt1 preprocessor 
+  define. i386 and x86_64 have good reference implementations.
+
 ====================
 ====================
 === ldso sysdeps ===
 === ldso sysdeps ===
 ====================
 ====================