diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2022-09-15 12:30:54 -0700 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2022-09-21 10:35:41 +0200 |
commit | 0c979facbd8b9c4af702edebec80a58fdb3b3e92 (patch) | |
tree | baf9977cd801a4c83869ccf29c2e21f34c1d9e71 /libc/sysdeps/linux/xtensa | |
parent | 191c0acf07a4e25a5cdb3937632eb0f81d578965 (diff) |
xtensa: add static pie support
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/xtensa')
-rw-r--r-- | libc/sysdeps/linux/xtensa/crt1.S | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/xtensa/crt1.S b/libc/sysdeps/linux/xtensa/crt1.S index efbe264c0..3fa14ae58 100644 --- a/libc/sysdeps/linux/xtensa/crt1.S +++ b/libc/sysdeps/linux/xtensa/crt1.S @@ -76,9 +76,26 @@ .global _start .type _start, @function _start: +#ifdef L_rcrt1 + .begin no-transform + call0 1f +.Lret_addr: + .end no-transform + .align 4 +1: +#endif #if defined(__XTENSA_WINDOWED_ABI__) +#ifdef L_rcrt1 + movi a6, .Lret_addr + sub a6, a0, a6 + movi a0, 0 + movi a4, reloc_static_pie + add a4, a4, a6 + callx4 a4 +#else /* Clear a0 to obviously mark the outermost frame. */ movi a0, 0 +#endif /* Load up the user's main function. */ movi a6, main @@ -106,8 +123,18 @@ _start: movi a4, __uClibc_main callx4 a4 #elif defined(__XTENSA_CALL0_ABI__) +#ifdef L_rcrt1 + mov a12, a2 + movi a2, .Lret_addr + sub a2, a0, a2 + movi a0, reloc_static_pie + add a0, a0, a2 + callx0 a0 + mov a7, a12 +#else /* Setup the shared library termination function. */ mov a7, a2 +#endif /* Load up the user's main function. */ movi a2, main |