From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id E69071F45E for ; Sat, 15 Feb 2020 20:18:28 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:in-reply-to:references :message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=EZKyvPKhq0Bv8q64 Qd+zx7XqbTl21QVdLyZYNDpzM1OVkaBp3NzFyPrclviKkBJ4WL96TMws6VPbYAaP dKwOfkwE5ea7ctQFi3WGAcRZUs9dGPJDtsQJqLP6KCG9ta/1DBoBK77TraFv/dzb bCSQ7CVlPum4Pbw9DzFP0HpB3OU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:in-reply-to:references :message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=dNZFtKk4PCwS8eMFQjBNKm JsiZ0=; b=h7jlybfN65XQmAqhPqADZSWK8bP6UWPZs1xFVDm/OSu8o2kJs0Xe/U dTPiiO1scuI7hygr/yc8SI3IGhS2NHaJQaHl/1Iz18D/9RNvr9aXBPBesoWbeBjo yqV7Rsd2/1LG5gHrLljv9unzexAvw8bujpik9EJR3DCR9j9vD+Yic= Received: (qmail 2198 invoked by alias); 15 Feb 2020 20:18:24 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 2103 invoked by uid 89); 15 Feb 2020 20:18:23 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581797900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G5uOSYNUonEjNMiGEsgJxydpU5z1Y4kCT7ApkJpVhUU=; b=IPUZu8V1UXrUYeiW6xZ5acrDWoNijXtgim0/+5sC/3XPwghbXqd/Cq0ZAmbSzAM7p/IXlZ //jTVn1L63XcWLgRddGa77mrwr2XouRsSgPon9amBl7ix5NAen9O9l0VzSCQ2Raidx7nKp bkV26qP1tkYhZyrJRr+mgFKNZwRE+eQ= From: Florian Weimer To: libc-alpha@sourceware.org Cc: Mao Han Subject: [PATCH 2/3] scripts/localplt.awk: Handle DT_JMPREL with empty PLT (for C-SKY) In-Reply-To: References: X-From-Line: cecc925370ac13cb3268ad489a47acf35adb8381 Mon Sep 17 00:00:00 2001 Message-Id: Date: Sat, 15 Feb 2020 21:18:14 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-h= f.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: =E2=80=A6/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(-) 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. =20 -BEGIN { result =3D 0 } +BEGIN { + result =3D 0; + pltrelsize =3D -1; +} =20 FILENAME !=3D lastfile { if (lastfile && jmprel_offset =3D=3D 0 && rela_offset =3D=3D 0 && rel_of= fset =3D=3D 0) { print FILENAME ": *** failed to find expected output (readelf -WSdr)"; result =3D 2; } + if (pltrelsz > 0 && jmprel_offset =3D=3D -1) { + print FILENAME ": Could not find section for DT_JMPREL"; + result =3D 2; + } lastfile =3D FILENAME; jmprel_offset =3D 0; rela_offset =3D 0; rel_offset =3D 0; + pltrelsz =3D -1; delete section_offset_by_address; } =20 @@ -82,12 +90,16 @@ $2 =3D=3D "(JMPREL)" { if (jmprel_addr in section_offset_by_address) { jmprel_offset =3D section_offset_by_address[jmprel_addr]; } else { - print FILENAME ": *** DT_JMPREL does not match any section's address"; - result =3D 2; + jmprel_offset =3D -1 } next } =20 +$2 =3D=3D "(PLTRELSZ)" { + pltrelsz =3D strtonum($3); + next +} + $2 =3D=3D "(RELA)" { rela_addr =3D strtonum($3); if (rela_addr in section_offset_by_address) { --=20 2.24.1