[0/1] LoongArch: Add static PIE support

Message ID 20220922091924.3033-1-xry111@xry111.site
Headers
Series LoongArch: Add static PIE support |

Message

Xi Ruoyao Sept. 22, 2022, 9:19 a.m. UTC
  Static PIE allows us to extend the ASLR to cover static executables,
this patch adds static PIE support for LoongArch.

Change from RFC to v1: no change, just remove "RFC" because the GCC [1]
and Binutils [2][3] patches are already merged.

[1]: https://gcc.gnu.org/r13-2728
[2]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae2e4d4

Summary of test results (with GCC trunk and Binutils trunk):
   4592 PASS
     22 UNSUPPORTED
     12 XFAIL
      6 XPASS

Use "sln" as an example to show it works:

$ file elf/sln     
elf/sln: ELF 64-bit LSB pie executable, LoongArch, version 1 (SYSV),
static-pie linked, for GNU/Linux 5.19.0, with debug_info, not stripped
$ touch a
$ elf/sln a b
$ readlink b
a

Xi Ruoyao (1):
  LoongArch: Add static PIE support

 sysdeps/loongarch/configure    | 37 ++++++++++++++++++++++++++++++++++
 sysdeps/loongarch/configure.ac | 14 +++++++++++++
 sysdeps/loongarch/start.S      | 14 ++++++++++---
 3 files changed, 62 insertions(+), 3 deletions(-)