• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂3e14288eaaf62124d090b5225665632e1fe5d47c (tree)
時間2022-08-08 21:51:00
作者linted <linted@user...>
CommiterWaldemar Brodkorb

Log Message

Added support for creation of Static Position-Independent Executables (PIE) on aarch64

Updated config to allow compilation of rcrt1.o for aarch64 and modified it's crt1.S to relocate dynamic section prior to uClibc_main.

Disabled stack protector when compiling reloc_static_pie.c to avoid TLS access prior to it being setup.

Signed-off-by: linted <linted@users.noreply.github.com>

Change Summary

差異

--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -304,7 +304,7 @@ config DOPIC
304304 config STATIC_PIE
305305 bool "Add support for Static Position Independent Executables (PIE)"
306306 default n
307- depends on DOPIC && !UCLIBC_FORMAT_FDPIC_ELF && (TARGET_arm || TARGET_i386 || TARGET_x86_64)
307+ depends on DOPIC && !UCLIBC_FORMAT_FDPIC_ELF && (TARGET_arm || TARGET_i386 || TARGET_x86_64 || TARGET_aarch64)
308308
309309 config ARCH_HAS_NO_SHARED
310310 bool
--- a/libc/misc/internals/Makefile.in
+++ b/libc/misc/internals/Makefile.in
@@ -17,7 +17,7 @@ MISC_INTERNALS_SRC := $(patsubst %.c,$(MISC_INTERNALS_DIR)/%.c,$(CSRC-y))
1717 MISC_INTERNALS_OBJ := $(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC-y))
1818
1919 CFLAGS-__uClibc_main.c := $(SSP_DISABLE_FLAGS)
20-
20+CFLAGS-reloc_static_pie.c := $(SSP_DISABLE_FLAGS)
2121
2222 libc-y += $(MISC_INTERNALS_OBJ)
2323 ifneq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
--- a/libc/sysdeps/linux/aarch64/crt1.S
+++ b/libc/sysdeps/linux/aarch64/crt1.S
@@ -48,6 +48,20 @@ _start:
4848 mov x29, #0
4949 mov x30, #0
5050
51+#ifdef L_rcrt1
52+ /* Save off the atexit pointer */
53+ mov x19, x0
54+
55+ /* Calculate load address... idk how this works, but it does */
56+ adrp x0, _start
57+
58+ /* Do relocations */
59+ bl reloc_static_pie
60+
61+ /* restore atexit pointer */
62+ mov x0, x19
63+#endif
64+
5165 /* Setup _fini in argument register */
5266 mov x5, x0
5367