mbox series

[v2,0/1] LoongArch: Add static PIE support

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

Message

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

Changes from v1 to v2: check the relocation of linker output for
-static-pie to see if it really works, instead of checking GCC version.

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(-)