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 61fdef29 for ; Wed, 29 Jan 2020 20:48:44 +0000 (UTC) Received: (qmail 26474 invoked by uid 550); 29 Jan 2020 20:48:42 -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 26453 invoked from network); 29 Jan 2020 20:48:42 -0000 Date: Wed, 29 Jan 2020 15:48:30 -0500 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20200129204830.GJ30412@brightrain.aerifal.cx> References: <20200129191946.GI2020@voyager> <20200129193810.GJ2020@voyager> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200129193810.GJ2020@voyager> 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 Wed, Jan 29, 2020 at 08:38:10PM +0100, Markus Wichmann wrote: > On Wed, Jan 29, 2020 at 08:19:46PM +0100, Markus Wichmann wrote: > > On Wed, Jan 29, 2020 at 09:41:46PM +0300, Андрей Аладьев wrote: > > > gcc main.c /usr/lib/libgmp.a -o main && ./main > > > > Ooh boy, why would you do this? When there's a perfectly good -lgmp just > > waiting for you. > > > > To expand upon this: libgmp makes sure not to create TEXTRELs if > compiling for PIC. The function in question uses the m4 macro LEA, which > picks the correct code for either situation. Using libgmp.a explicitly > here means you told the code it would be running statically compiled and > then used it for dynamic compilation, anyway. This is a bug in gmp -- static libraries can be used in (static or dynamic linked) PIE executables, and therefore should be compatible with being built as PIC. Rich