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 0dec6e81 for ; Wed, 29 Jan 2020 21:43:38 +0000 (UTC) Received: (qmail 26453 invoked by uid 550); 29 Jan 2020 21:43:36 -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 26432 invoked from network); 29 Jan 2020 21:43:36 -0000 Date: Wed, 29 Jan 2020 16:43:24 -0500 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20200129214324.GM30412@brightrain.aerifal.cx> References: <20200129205330.GK30412@brightrain.aerifal.cx> 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:14:00AM +0300, Андрей Аладьев wrote: > Thank you, I will definitely report this issue to gmp or provide more > information under existing one. Please see here: > > if (dso == &ldso) { > /* Only ldso's REL table needs addend saving/reuse. */ > if (rel == apply_addends_to) > reuse_addends = 1; > skip_relative = 1; > } > > if (skip_relative && IS_RELATIVE(rel[1], dso->syms)) continue; > > Musl already has "skip_relative" flag. This flag can be improved like: > > # ifdef SKIP_RELLOCATION_IN_READONLY_MODE > if (readonly_mode) { > skip_relative = 1; > } > # endif > > if (IS_RELATIVE(rel[1], dso->syms)) { > if (skip_relative) { > continue; > } else if (readonly_mode) { > error("Error it is not possible to make relocations in readonly mode"); > a_crash(); > } > } > > It will make musl more stronger and user friendlier. I can't say for sure because this is not a complete patch and probably not expressing things precisely, but I really don't think this is doing what you think it's doing. The logic you're trying to modify is about how the dynamic linker performs multiple passes of relocations over itself. Rich