Hello again! Since we have the steps pretty well fleshed out, I figured it was about time to update the porting docs to describe how to add support for static-pie. Here is a patch with some notes about the steps I usually take when updating another architecture to support it.
-- >From afaa287e28e8e120bf55a7de368253f445a6deea Mon Sep 17 00:00:00 2001 From: linted <lin...@users.noreply.github.com> Date: Mon, 26 Sep 2022 13:40:50 -0400 Subject: [PATCH] Added some documentation on how to add static-pie support to the porting guide Signed-off-by: linted <lin...@users.noreply.github.com> --- docs/porting.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/porting.txt b/docs/porting.txt index 380645801..31c188ae1 100644 --- a/docs/porting.txt +++ b/docs/porting.txt @@ -12,6 +12,8 @@ you are hacking on. the shared library loader work requires you first have basic architecture support working. Thus you should add ARCH_HAS_NO_SHARED and 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 === @@ -56,6 +58,15 @@ you are hacking on. usually these are written in assembler, but you may be able to cheat and 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 === ==================== -- 2.34.1
From afaa287e28e8e120bf55a7de368253f445a6deea Mon Sep 17 00:00:00 2001 From: linted <lin...@users.noreply.github.com> Date: Mon, 26 Sep 2022 13:40:50 -0400 Subject: [PATCH] Added some documentation on how to add static-pie support to the porting guide Signed-off-by: linted <lin...@users.noreply.github.com> --- docs/porting.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/porting.txt b/docs/porting.txt index 380645801..31c188ae1 100644 --- a/docs/porting.txt +++ b/docs/porting.txt @@ -12,6 +12,8 @@ you are hacking on. the shared library loader work requires you first have basic architecture support working. Thus you should add ARCH_HAS_NO_SHARED and 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 === @@ -56,6 +58,15 @@ you are hacking on. usually these are written in assembler, but you may be able to cheat and 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 === ==================== -- 2.34.1
_______________________________________________ devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-le...@uclibc-ng.org