From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpout2.vodafonemail.de (smtpout2.vodafonemail.de [145.253.239.133]) by sourceware.org (Postfix) with ESMTPS id 4786D3858426 for ; Wed, 8 Dec 2021 18:27:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4786D3858426 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nexgo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nexgo.de Received: from smtp.vodafone.de (unknown [10.2.0.39]) by smtpout2.vodafonemail.de (Postfix) with ESMTP id 46E866133C for ; Wed, 8 Dec 2021 19:27:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexgo.de; s=vfde-smtpout-mb-15sep; t=1638988031; bh=KK6h3uKxZUd+yS3mKPeB5ZMVERG0w9ty/d/EEVzbBaE=; h=From:To:Subject:Date; b=QMtR9rFGnC3fG0SYXLukFum9bNhsG/aMf0LlqvALS0rA/5dqSKamZ0FlzIKeaMZ9N ojcJ+HyGYzFcZwRlbmgaiKODbxf0A4CkeMxHnAjXc65WPVm+Y5VR27CkDM04XrQO5S Cpax266E54GUidl/GIwd+u9jjuRbweygCXwNdIWI= Received: from Gertrud (p5b2f3fbc.dip0.t-ipconnect.de [91.47.63.188]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4J8QcZ4c87z9tFs for ; Wed, 8 Dec 2021 18:27:09 +0000 (UTC) From: Achim Gratz To: binutils@sourceware.org Subject: [Bug] DWARF-5 section names in PE/PEP and weak symbols User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Date: Wed, 08 Dec 2021 19:27:06 +0100 Message-ID: <878rwvrlz9.fsf@Rainer.invalid> MIME-Version: 1.0 Content-Type: text/plain X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 2976 X-purgate-ID: 149169::1638988030-000004E2-A95B41F5/0/0 X-Spam-Status: No, score=-3037.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Dec 2021 18:27:15 -0000 The commit --8<---------------cut here---------------start------------->8--- commit ba6eb62ff0ea9843a018cfd7cd06777bd66ae0a0 Author: Nick Clifton Date: Mon Mar 1 16:25:06 2021 +0000 Add DWARF-5 section names to PE and PEP linker scripts. PR 27268 * scripttempl/pe.sc: Add DWARF-5 section names. * scripttempl/pep.sc: Likewise. --8<---------------cut here---------------end--------------->8--- changed the behaviour of weak symbols in Cygwin. The following test from gnulib that should fail. In other words fputs should have a symbol value of 0x0 and the resulting executable should not be able to run since the Windows loader does not resolve weak symbols): --8<--weak.c-------cut here---------------start------------->8--- #include #pragma weak fputs int main () { return (fputs == NULL); } --8<---------------cut here---------------end--------------->8--- $ gcc -o weak weak.c # w/ binutils 2.36.1 $ ./weak ; echo $? ./weak: ./weak: cannot execute binary file 126 Instead, starting with the above commit, the test succeeds since fputs has the (expected) value from cygwin1.dll. This then leads to horrendous crashes in applications that attempt to actually use "real" weak symbols based on the (probably too simplistic) test from gnulib: $ gcc -o weak weak.c # w/ binutils 2.37 $ ./weak ; echo $? 0 I've narrowed it down to just one of the new DWARF5 sections and removing them from the linker scripts restores the correct behaviour of weak symbols in Cygwin (I have no idea if that triggers problems elsewhere): --8<---------------cut here---------------start------------->8--- diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc index e9d1f78cb32..2e64a681850 100644 --- a/ld/scripttempl/pe.sc +++ b/ld/scripttempl/pe.sc @@ -447,10 +447,12 @@ SECTIONS { *(.zdebug_line_str) } +/* === .debug_loclists ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : { *(.debug_loclists) } +=== */ .zdebug_loclists ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : { *(.zdebug_loclists) diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc index afa2d23871c..dbb657c2090 100644 --- a/ld/scripttempl/pep.sc +++ b/ld/scripttempl/pep.sc @@ -452,10 +452,12 @@ SECTIONS { *(.zdebug_line_str) } +/* === .debug_loclists ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : { *(.debug_loclists) } +=== */ .zdebug_loclists ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : { *(.zdebug_loclists) --8<---------------cut here---------------end--------------->8--- Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Waldorf MIDI Implementation & additional documentation: http://Synth.Stromeko.net/Downloads.html#WaldorfDocs