From patchwork Wed Jul 20 14:06:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lance Fredrickson X-Patchwork-Id: 56196 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 D5A0D3858009 for ; Wed, 20 Jul 2022 14:07:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5A0D3858009 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658326036; bh=mv4R50dmNu8hJ5p2Qb7jMmBmbz6o7+R4bMoUbUcS6wg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eWnY3a0rg+eaUUJBkM5oOv48DAe2KrZ1Iae/Mccp1x0grZ/WXogOO6+m8heTlXVLG l8VqT3C6h2XpVhMxmJN94SrcV4/b9IE/uwKYU3Cb4JA3QO95M6NFj8e/KKDPrIY2Z6 Po/tlJ0y7VzULurhgXHnId8lx9ueeW0raMbgKiFU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id ADFE33858D37 for ; Wed, 20 Jul 2022 14:06:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ADFE33858D37 Received: by mail-ot1-x334.google.com with SMTP id a14-20020a0568300b8e00b0061c4e3eb52aso14208123otv.3 for ; Wed, 20 Jul 2022 07:06:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject; bh=mv4R50dmNu8hJ5p2Qb7jMmBmbz6o7+R4bMoUbUcS6wg=; b=jNcCOBq4yL6+GSBwsAVhZqZ5JgpdgD2WjnpNz/OWBu0GW7kxmVEaW8H4qqRR0Hdetf Bo2k5Uu86mtvgoZt3PEs7AZutOF4GxDncz6edw02d/fCI0ZhrOG93reZx/VlF4kZ1gbA kM5SSfvzA/JZjrpHMp/W6M2ZsozA3GpgjqBDntBWs33m8tROWnpjv6JckVFWF8OfoYX0 5UayXzGU/S/4BiXGmYRVo+ChaJfSlxUZZOOblN66uUvO+3ZwjsOespn9vo5x5HPw71+c 5b+8zJKq9H+3wukeU7OZTSAW9tI4NMcENnigKzccjq9iv9pbzjmUwohIa6FxAo8e66/X MyNg== X-Gm-Message-State: AJIora/Km7ZgFrS6jNuPKxTA/tGTu4iLoWRR+sXcKo+qutr61FZfw8SC 6Eq4hqyS6zUuvYLzSha1ZSn/aAkvXKcPwg== X-Google-Smtp-Source: AGRyM1soyFhEw06fxcoQpDA5EY4sCi21cCoSGbYt1yARVdeojZ7PCXYKPGZyUuTtUTNXS9yQuRUchg== X-Received: by 2002:a05:6830:2b0c:b0:61c:a516:2150 with SMTP id l12-20020a0568302b0c00b0061ca5162150mr6012699otv.255.1658325997449; Wed, 20 Jul 2022 07:06:37 -0700 (PDT) Received: from [10.0.0.73] (96-82-249-149-static.hfc.comcastbusiness.net. [96.82.249.149]) by smtp.gmail.com with ESMTPSA id a15-20020a056870618f00b00101cdb417f1sm9056870oah.22.2022.07.20.07.06.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Jul 2022 07:06:36 -0700 (PDT) Message-ID: Date: Wed, 20 Jul 2022 08:06:35 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2 Content-Language: en-US To: gcc-patches@gcc.gnu.org Subject: [PATCH V2] arm: add -static-pie support X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Lance Fredrickson via Gcc-patches From: Lance Fredrickson Reply-To: Lance Fredrickson Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch adds -static-pie support for the arm architecture. aarch64 had the appropriate code for handling -static-pie, so this just mirrors the code found there.  Tested with uclibc-ng and musl c-standard libraries to produce static-pie binaries.  Re-submitted with minor spell check fix. From 4e122adfea2a6247f2da0c094f3203cbdf2a578c Mon Sep 17 00:00:00 2001 From: lancethepants Date: Tue, 19 Jul 2022 14:21:05 -0600 Subject: [PATCH V2] arm: add -static-pie support The commit mirrors code from aarch64 to handle -static-pie. Tested with uclibc-ng and musl c-standard libraries. Signed-off-by: Lance Fredrickson --- gcc/config/arm/linux-elf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h index df3da67c4f0..70f71b051a3 100644 --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h @@ -66,9 +66,10 @@ %{static:-Bstatic} \ %{shared:-shared} \ %{symbolic:-Bsymbolic} \ - %{!static: \ + %{!static:%{!static-pie: \ %{rdynamic:-export-dynamic} \ - %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}} \ + %{static-pie:-Bstatic -pie --no-dynamic-linker -z text} \ -X \ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ SUBTARGET_EXTRA_LINK_SPEC