From patchwork Thu Sep 22 09:19:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 55140 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB7B83857B82 for ; Thu, 22 Sep 2022 09:20:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB7B83857B82 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663838415; bh=JvNllkoVqvgJh2p+aibjvwbBp+xmR/m0AamsxS2m0yY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ysz2BIluxyxO7MEqrqzU2mqBeE9M66bFmVUv3LwL2EBTNXfFvP1OmNVeEmZEskmM+ OEY2VOrFZIRdyFV/5SRKn+SM7UYB6MuCR4gmXim5xYAlICsjehMNnH69qWiMTjA1kW u1HIGFJuZwOK57xXz6/GzQ6RZAYFxA8dmntaxEgw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 18C193858422 for ; Thu, 22 Sep 2022 09:19:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18C193858422 Received: from xry111-x57s1.. (unknown [IPv6:240e:358:11dd:8700:dc73:854d:832e:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 9354B667B5; Thu, 22 Sep 2022 05:19:43 -0400 (EDT) To: libc-alpha@sourceware.org Subject: [PATCH 0/1] LoongArch: Add static PIE support Date: Thu, 22 Sep 2022 17:19:23 +0800 Message-Id: <20220922091924.3033-1-xry111@xry111.site> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP, KAM_SHORT, LIKELY_SPAM_FROM, SPF_HELO_PASS, SPF_PASS, TXREP, T_PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xi Ruoyao via Libc-alpha From: Xi Ruoyao Reply-To: Xi Ruoyao Cc: caiyinyu , Chenghua Xu , liuzhensong , Lulu Cheng , Wang Xuerui Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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(-)