From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by inbox.vuxu.org (OpenSMTPD) with SMTP id ee8c4543 for ; Wed, 29 Jan 2020 21:46:55 +0000 (UTC) Received: (qmail 29808 invoked by uid 550); 29 Jan 2020 21:46:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 29790 invoked from network); 29 Jan 2020 21:46:53 -0000 Date: Wed, 29 Jan 2020 16:46:41 -0500 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20200129214641.GN30412@brightrain.aerifal.cx> References: <20200129205330.GK30412@brightrain.aerifal.cx> <20200129211024.GY23985@port70.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: Rich Felker Subject: Re: [musl] Static linking is broken after creation of DT_TEXTREL segment On Thu, Jan 30, 2020 at 12:35:52AM +0300, Андрей Аладьев wrote: > "readelf -d main | grep TEXTREL" returns the same text on both musl and > glibc containers: > > 0x0000000000000016 (TEXTREL) 0x0 > 0x000000000000001e (FLAGS) TEXTREL > > "gcc -no-pie" is another workaround for musl container like Rich said. But > I think that 'set(CMAKE_EXE_LINKER_FLAGS "-static")' will be best cross > platform solution. As I know "-static" implies "no-pie". -static normally does not imply -no-pie with musl target. musl was the first to introduce static pie, and it was not treated as something special/weird you have to request, just what you get with -static + -pie or -static and default-pie toolchain. When GCC upstreamed static pie with glibc support, they made it so -static overrides -pie and so you need the new -static-pie to get static pie. musl patches for gcc revert this change since it's a regression to the original behavior, treats static-pie a second-class, and does not work with environments where pie is mandatory (like nommu targets) where default-pie *must* be honored. Rich