From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from boar.tulip.relay.mailchannels.net (boar.tulip.relay.mailchannels.net [23.83.218.250]) by sourceware.org (Postfix) with ESMTPS id 13BEF382C14D for ; Wed, 26 Oct 2022 20:34:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 13BEF382C14D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E2A94641C1A; Wed, 26 Oct 2022 20:34:38 +0000 (UTC) Received: from pdx1-sub0-mail-a305 (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 41E62641BCE; Wed, 26 Oct 2022 20:34:38 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1666816478; a=rsa-sha256; cv=none; b=2MfSXuR6xw+gGsuHnlbUsMlsPtKm5hCYdQvX9px2VSSTSGqGqxBj+vnVt7LnX0ziOTakfA pNsYyvqfEaheSLk6dzHNKNORkF3Pss6EYYP8/ScHKCH5cVjOgnD8mmdhVz7FqNtzoLbJJm FEptj7zsrFD5Xw5A6ZFvSwERX/HviWO/+Jz/bMUEA13xalc3FmEnhhIhwT0rLbVynbhJYO S04jYiKkUfAnbJieoh80fp9z5F4AQJroVG8IjCmEajB7eTaAUGycyGLl6pePeAjEmF7uQo PQS+9NVI4VmCPfaw0EF7/vG+pZua8xd5SpcOVSAO3+cg//Vt8nt4RcrhjS8rqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1666816478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uk1FdtEDSM3kNB/tBnWImcguagxQkGbSvqclx7rvwns=; b=SWl8+XEY8zHJUa35rIWLCDtoNVB1CCGRsV3AIdGBiKE2mCnSVsyd6v+8rfhClNmv2C0rz6 Ly4J7av2XvNxQOLUDuveSJm4SYK14cja6yrbzsO4MsuXKJ/c1B2JnPgkguyFktRKH1Y6wA fd8u52nyEpJORCLyQSxVop62q62w4kaot8X3qqpJlzSUCXRWE+1YlRI/alUZonFgBHXEr5 J8+FzPiD9mEgMA9E7kcGBlrKUpQJXJuGiK6XzA4wpq7chCtztnhJCMmuwai8//xEIvQITD lp1xD66ichae+8CXSoHBH7OxQgB+eVlrNkyyMbSULbrIye4rnj/9VOYymeaV0A== ARC-Authentication-Results: i=1; rspamd-7fb88f4dd5-b6x5z; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Bubble-Towering: 5a4f1b171ec61667_1666816478710_738453538 X-MC-Loop-Signature: 1666816478710:3527965661 X-MC-Ingress-Time: 1666816478710 Received: from pdx1-sub0-mail-a305 (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.122.213.136 (trex/6.7.1); Wed, 26 Oct 2022 20:34:38 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-05-174-93-41-34.dsl.bell.ca [174.93.41.34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305 (Postfix) with ESMTPSA id 4MyLC06LD7z58; Wed, 26 Oct 2022 13:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1666816477; bh=uk1FdtEDSM3kNB/tBnWImcguagxQkGbSvqclx7rvwns=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=ECLD66La/j7nsP7JUxbVDpdxzav7xHSjDbF5+a+aQiZBjkaV4Fwk1AhJ8w6sE6Xfs 5d72UgniyiYYDai8G80/0vfPZm2ZYlqTPLgx8Xvd4+2azJxJOLfSqhYLx9f5/0HRXM nQzAbFsh8HmIinWTHVx6OwnIBzG0ZJJ2bngnphU5dPixOeTXPG9PzmSWSB6Awn11Zx 4Mn/1qWsLYHDCrtFxpN9ni0+urLBHM7Y/eAneUcP6EY1GEbn2KtZ51hAHcvtNXrcHc FfS8BGly+CoMMI/bP2N5UIaCA8S9bo6tch0hkmFrDGqdhNxVLKdq3/BVPE3Ht/7D2B 9nzceVXRQMhbA== Message-ID: <5a563a18-b992-13d0-7a3b-d538d086079c@gotplt.org> Date: Wed, 26 Oct 2022 16:34:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v4 2/3] scripts/localplt.awk: Handle DT_JMPREL with empty PLT (for C-SKY) Content-Language: en-US To: Florian Weimer , libc-alpha@sourceware.org References: From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3036.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-08-29 08:26, Florian Weimer via Libc-alpha wrote: > On csky-linux-gnuabiv2, binutils 2.33 produces a DT_JMPREL entry > for the dynamic loader if it does not contain any PLT relocations: > > Dynamic section at offset 0x1df48 contains 19 entries: > Tag Type Name/Value > 0x0000000e (SONAME) Library soname: [ld-linux-cskyv2-hf.so.1] > 0x00000004 (HASH) 0xd4 > 0x6ffffef5 (GNU_HASH) 0x1a8 > 0x00000005 (STRTAB) 0x4ac > 0x00000006 (SYMTAB) 0x28c > 0x0000000a (STRSZ) 527 (bytes) > 0x0000000b (SYMENT) 16 (bytes) > 0x00000003 (PLTGOT) 0x1f000 > 0x00000002 (PLTRELSZ) 0 (bytes) > 0x00000014 (PLTREL) RELA > 0x00000017 (JMPREL) 0xaa4 > 0x00000007 (RELA) 0x75c > 0x00000008 (RELASZ) 840 (bytes) > 0x00000009 (RELAENT) 12 (bytes) > 0x6ffffffc (VERDEF) 0x700 > 0x6ffffffd (VERDEFNUM) 3 > 0x6ffffff0 (VERSYM) 0x6bc > 0x6ffffff9 (RELACOUNT) 68 > 0x00000000 (NULL) 0x0 > > This confuses the script: > > Unexpected output from check-localplt: …/elf/ld.so.jmprel: > *** DT_JMPREL does not match any section's address > > This commit changes the script to record the DT_PLTRELSZ value and > reject DT_JMPREL values not a section boundary only if DT_PLTRELSZ > is present with a non-zero value. > --- > scripts/localplt.awk | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) LGTM. Reviewed-by: Siddhesh Poyarekar > > diff --git a/scripts/localplt.awk b/scripts/localplt.awk > index beaa342922..fe79ca01ab 100644 > --- a/scripts/localplt.awk > +++ b/scripts/localplt.awk > @@ -4,17 +4,25 @@ > # It writes "NAME: SYMBOL" for each PLT entry in NAME that refers to a > # symbol defined in the same object. > > -BEGIN { result = 0 } > +BEGIN { > + result = 0; > + pltrelsize = -1; > +} > > FILENAME != lastfile { > if (lastfile && jmprel_offset == 0 && rela_offset == 0 && rel_offset == 0) { > print FILENAME ": *** failed to find expected output (readelf -WSdr)"; > result = 2; > } > + if (pltrelsz > 0 && jmprel_offset == -1) { > + print FILENAME ": Could not find section for DT_JMPREL"; > + result = 2; > + } > lastfile = FILENAME; > jmprel_offset = 0; > rela_offset = 0; > rel_offset = 0; > + pltrelsz = -1; > delete section_offset_by_address; > } > > @@ -82,12 +90,16 @@ $2 == "(JMPREL)" { > if (jmprel_addr in section_offset_by_address) { > jmprel_offset = section_offset_by_address[jmprel_addr]; > } else { > - print FILENAME ": *** DT_JMPREL does not match any section's address"; > - result = 2; > + jmprel_offset = -1 > } > next > } > > +$2 == "(PLTRELSZ)" { > + pltrelsz = strtonum($3); > + next > +} > + > $2 == "(RELA)" { > rela_addr = strtonum($3); > if (rela_addr in section_offset_by_address) {