From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mr6.vodafonemail.de (mr6.vodafonemail.de [145.253.228.166]) by sourceware.org (Postfix) with ESMTPS id 77EBF3858C74 for ; Tue, 15 Feb 2022 19:08:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 77EBF3858C74 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.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr6.vodafonemail.de (Postfix) with ESMTPS id 4JyrGB1vr1z24gS for ; Tue, 15 Feb 2022 19:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexgo.de; s=vfde-smtpout-mb-15sep; t=1644952098; bh=PwLwOIsvNdKoseo2SCx7cCngeAgOT9ofqwfI/iCis7Q=; h=From:To:Subject:References:Date:In-Reply-To:Message-ID:User-Agent: Content-Type:From; b=LCg/zqx8Y55sNm55LIU2GSVs2UkF4kt5Y4I92+hpvchTAIOoUFif1RQRIKXQ006pe tTjcocl6oavKM5nNUscKUe3E7pzCCYKhM0NDJVh+IaZWxzF7SM5AVAHf83ug+oi8Bk RKk5hFfaz6PJi4h8to5+RiqJClC33ot0knVrkJU4= Received: from Gertrud (p5b2f3a9b.dip0.t-ipconnect.de [91.47.58.155]) (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 4JyrG93ZsgzHnHg for ; Tue, 15 Feb 2022 19:08:14 +0000 (UTC) From: Achim Gratz To: binutils@sourceware.org Subject: Re: [Bug] DWARF-5 section names in PE/PEP and weak symbols References: <878rwvrlz9.fsf@Rainer.invalid> <87mtiumsgt.fsf@Rainer.invalid> <87y22d7lss.fsf@Otto.invalid> <87bkz8hv09.fsf@Rainer.invalid> Date: Tue, 15 Feb 2022 20:08:10 +0100 In-Reply-To: <87bkz8hv09.fsf@Rainer.invalid> (Achim Gratz's message of "Tue, 15 Feb 2022 18:58:30 +0100") Message-ID: <877d9whrs5.fsf@Rainer.invalid> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) 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: 2580 X-purgate-ID: 155817::1644952097-00000464-6542A2B1/0/0 X-Spam-Status: No, score=-3030.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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: Tue, 15 Feb 2022 19:08:22 -0000 Achim Gratz writes: > So, snprintf seems to behave as expected (it resolves NULL) and the two > other symbols are resolved even though they should not. If they had > resolved to the actual address things might even work, but the actual > values explain nicely why a program calling through the pointer crashes > in various horrible ways (depending on what actually is mapped there). So I've removed the "weak" attribute from snprintf so that it links: --8<---------------cut here---------------start------------->8--- ...packages/binutils-gdb/build (2139)# ...packages/binutils-gdb/build (2139)# objdump -x /usr/lib/libcygwin.a |less ...packages/binutils-gdb/build (2140)# gcc -Wl,--trace-symbol={fputs,snprintf,thrd_exit} -c -o weak_test.o weak_test.c ...packages/binutils-gdb/build (2141)# gcc -Wl,--trace-symbol={fputs,{a,v,}snprintf,thrd_exit} -o weak_test weak_test.o /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: weak_test.o: reference to snprintf /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: weak_test.o: reference to thrd_exit /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: weak_test.o: reference to fputs /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/libcygwin.a(t-d000578.o): definition of fputs /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/libcygwin.a(t-d001396.o): definition of snprintf /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../lib/libcygwin.a(t-d001527.o): definition of thrd_exit ...packages/binutils-gdb/build (2142)# ./weak_test ; echo $? snprintf => 0x0001004012e0 is not equal NULL fputs => 0x0001004012c0 is not equal NULL thrd_exit => 0x0001004012f0 is not equal NULL sprintf called through symbol 0 ...packages/binutils-gdb/build (2143)# nm weak_test.o /bin/cygwin1.dll | egrep ' (fputs|[av]?snprintf|thrd_exit)$' U fputs U snprintf U thrd_exit 00000001801abb10 T asnprintf 00000001801b1610 T fputs 00000001801c0380 T snprintf 00000001801849a0 T thrd_exit 00000001801eec30 T vsnprintf --8<---------------cut here---------------end--------------->8--- Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptations for KORG EX-800 and Poly-800MkII V0.9: http://Synth.Stromeko.net/Downloads.html#KorgSDada