From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 05F923858D38 for ; Wed, 12 Oct 2022 18:17:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 05F923858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x629.google.com with SMTP id f23so16993151plr.6 for ; Wed, 12 Oct 2022 11:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zuNJbr6w0CDZW41uYEII7uMjfm9aWQgDFYTIBCqKcL4=; b=oq7lr32i2p5gKQsa5b39I4hLo6ngt23f6F+kDGc8Qx9OCVZWkNP3ZYgRBEmnh73OE5 Ch/agNf4a2IGkp0uPrVOb6bq6mDcOr0+1s8mpgeHIUxpCvGDzTQkLAgTeAPo69bBGIAt L+WWpoI4pClM1wGCNzShzdN4iF8NV8w1uAf2btY59IgDSfKDSCebYPNFSqrbAy9mu2od JEch/akP+d5hhjDiEmrQJbd3rFzcsi7oKACM4dF1/T/rrTGjAxy0134Jj1S1q3zosUfl Tpp4s075uZceXAVEVv3tOPE3GFK/PfUWknebyibtyynVOd3cKtiFNfHsYDRgwjqN20T+ rL3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zuNJbr6w0CDZW41uYEII7uMjfm9aWQgDFYTIBCqKcL4=; b=PUQMupnMa7EBB2Aj1205rGuJnSLswpx97Fr1mq4KMPwMPfjJJybpZEXlnPStTK285x ersB+A6yuA5wmQ6VpPburGSQYWbx1UkynY6Peh8KRIIXGEheJJ+FZNZ1A7AsVUBmBm5Y YABKTHnCZf0mcgU04NeDZMK/JMge7Wd89H49KmECm7QTSM32kExabTIFt5YzyvXtwKcA 3E/cbI6aR13vg2CmsUamqidalPfKTmT4n94sPiXtZkHEb5nORynqk4sF++iWOiurDRDU UzirJnnR0in2TGhtP7aI3YUSC35PcLdXy6HPbm4joJxlREd1uyl6dnKSGPA/uoL1kpJ/ EIMw== X-Gm-Message-State: ACrzQf1hPjFmf8FjySIToOFQSTOnUQB8RyHEathBuXtbLoXKf9UF9n20 Juw3zcz/LccSw9LU7sshXwewUP2cijnH9Q== X-Google-Smtp-Source: AMsMyM6I87JwkGcHk5mfz0lRC1L2PQq/C5s/MCVxga8sppY9KqIq4HWK9otmqmzI/zmdU2Eqt0lHPw== X-Received: by 2002:a17:902:ca02:b0:17f:762e:2dd2 with SMTP id w2-20020a170902ca0200b0017f762e2dd2mr31020751pld.91.1665598624647; Wed, 12 Oct 2022 11:17:04 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id kb8-20020a17090ae7c800b001df264610c4sm5130532pjb.0.2022.10.12.11.17.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Oct 2022 11:17:03 -0700 (PDT) Message-ID: <578535c7-ecb9-b0c6-f34e-f3292aa6a6a8@gmail.com> Date: Wed, 12 Oct 2022 12:17:02 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] mips: Add appropriate linker flags when compiling with -static-pie Content-Language: en-US To: gcc-patches@gcc.gnu.org References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,NICE_REPLY_A,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 List-Id: On 9/25/22 09:49, linted via Gcc-patches wrote: > Hello, > I'm just checking to see if anyone has had a chance to look at this. > > Thank you > > On Wed, Sep 14, 2022 at 2:09 PM linted wrote: > >> Hello, >> >> This patch fixes missing flags when compiling with -static-pie on mips. I >> made these modifications based on the previously submitted static pie patch >> for arm as well as the working code for aarch64. >> >> I tested with a host of mips-elf and checked with mips-sim. This patch was >> also tested and used with uclibc-ng to generate static pie elfs. >> >> This is my first patch for gcc, so please let me know if there is anything >> I missed. >> >> >> >> Signed-off-by: linted >> --- >> gcc/config/mips/gnu-user.h | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h >> index 6aad7192e69..b1c665b7f37 100644 >> --- a/gcc/config/mips/gnu-user.h >> +++ b/gcc/config/mips/gnu-user.h >> @@ -56,11 +56,12 @@ along with GCC; see the file COPYING3. If not see >> #define GNU_USER_TARGET_LINK_SPEC "\ >> %{G*} %{EB} %{EL} %{mips*} %{shared} \ >> %{!shared: \ >> - %{!static: \ >> + %{!static:%{!static-pie: \ >> %{rdynamic:-export-dynamic} \ >> %{mabi=n32: -dynamic-linker " GNU_USER_DYNAMIC_LINKERN32 "} \ >> %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \ >> - %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \ >> + %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \ >> + %{static-pie:-Bstatic -pie --no-dynamic-linker -z text} \ >> %{static}} \ This is a bit out of my usual areas of expertise.  But what I find odd here is that for -static we essentially do nothing, but for -static-pie we need "-Bstatic -pie --no-dynamic-linker -z text".    Is the -Bstatic really needed for static-pie  And if it is, then wouldn't it be needed for -static as well?    If you look carefully at aarch64, you'll see it includes -Bstatic for -static. Jeff