From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 4AD743850416 for ; Thu, 15 Jul 2021 05:46:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4AD743850416 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-8YUVXY7kN7qakkFK0vwsSw-1; Thu, 15 Jul 2021 01:46:18 -0400 X-MC-Unique: 8YUVXY7kN7qakkFK0vwsSw-1 Received: by mail-wm1-f71.google.com with SMTP id j141-20020a1c23930000b0290212502cb19aso1344168wmj.0 for ; Wed, 14 Jul 2021 22:46:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kr8DnY2ERZ6o/pxpTaeRI1yPp6qKscIDHnVhdg+TsYA=; b=uPaKDw4nfp/iu3B/EZamMqeNSeu+2M55uqy0Abu79+vTbmJ/GAvvS9r8O7xr4nf7CD Joym3RVfAvtzrCRDqezg43l4maN+GTRAqav4Snd/v46+92g+IFA0+Wi7KrxiowrpMHHj FnMgiX+LCwIF9QhG8JrBdiwD60mo+JLcVqYzaGJ9Prb1JlfRpDOUz7BCxJX2lc7t+JYN qxgVvX+OS64f4DTiyv6JYJtPsMrYC70tLKi+adwYWS3FeBZCmhW2nOH6SX4A5bAhXp3j agG7odhNxLUzB+k3oD64UHwjc/EwToCmpVvq/YxC4mBSclA1ktYa05nZTycQfU2sEHlj GEPQ== X-Gm-Message-State: AOAM533pCz1ENx4Pkbw+3OzrEar1f6IyVZvA0oI+44aF4s3/RmdAdyCW t8m0bN1le2Y5s3w1BeI/rywxDIV56GA/0kRaUy0ZjC/621KLzFA/eYXQ9SCHGTZODMgx6oMkdCt 4w2wU9DW3TRf+gF2vmX4ETxbNAHClkA/LVezCNWahQvIQbgkEtTGbGMYDTSM1Ch4pcmaiwswmCV 2/ X-Received: by 2002:adf:e10c:: with SMTP id t12mr3039074wrz.36.1626327977178; Wed, 14 Jul 2021 22:46:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfOxw+mmEGOaulXY8luYI1xNvuwuAVi9FP5fU7VvLcf4V1ErgnmryuPTQGR9Rkx9ZcAW9/jw== X-Received: by 2002:adf:e10c:: with SMTP id t12mr3039038wrz.36.1626327976881; Wed, 14 Jul 2021 22:46:16 -0700 (PDT) Received: from ?IPv6:2a01:c22:cd70:e600:c8ac:505a:d671:c183? (dynamic-2a01-0c22-cd70-e600-c8ac-505a-d671-c183.c22.pool.telefonica.de. [2a01:c22:cd70:e600:c8ac:505a:d671:c183]) by smtp.gmail.com with ESMTPSA id p5sm5365993wrd.25.2021.07.14.22.46.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Jul 2021 22:46:16 -0700 (PDT) Subject: Re: [PATCH] readelf: allow build with LLVM/clang To: Mark Wielaard , =?UTF-8?Q?Tomasz_Pawe=c5=82_Gajc?= Cc: elfutils-devel@sourceware.org References: <20210712095941.15620-1-tpgxyz@gmail.com> From: Timm Baeder Message-ID: <37614938-c55e-32aa-78ba-1fb8b8969f32@redhat.com> Date: Thu, 15 Jul 2021 07:46:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 05:46:24 -0000 On 14/07/2021 19:40, Mark Wielaard wrote: >> AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))], >> ac_cv_visibility, [dnl >> diff --git a/src/readelf.c b/src/readelf.c >> index 161d7e65..3d6f263e 100644 >> --- a/src/readelf.c >> +++ b/src/readelf.c >> @@ -8763,13 +8763,17 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr, >> /* Apply the "operation advance" from a special opcode >> or DW_LNS_advance_pc (as per DWARF4 6.2.5.1). */ >> unsigned int op_addr_advance; >> - inline void advance_pc (unsigned int op_advance) >> - { >> - op_addr_advance = minimum_instr_len * ((op_index + op_advance) >> - / max_ops_per_instr); >> - address += op_addr_advance; >> - op_index = (op_index + op_advance) % max_ops_per_instr; >> - } >> + bool show_op_index; >> + #define advance_pc(op_advance_arg) \ >> + ( { \ >> + unsigned int op_advance = op_advance_arg; \ >> + op_addr_advance = minimum_instr_len * ((op_index + (op_advance)) \ >> + / max_ops_per_instr); \ >> + address += (op_advance); \ >> + show_op_index = (op_index > 0 || \ >> + (op_index + (op_advance)) % max_ops_per_instr > 0); \ >> + op_index = (op_index + (op_advance)) % max_ops_per_instr; \ >> + } ) > > This doesn't compile with gcc: > > readelf.c: In function ‘print_debug_line_section’: > readelf.c:8766:12: error: variable ‘show_op_index’ set but not used [-Werror=unused-but-set-variable] > 8766 | bool show_op_index; > | ^~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > Removing the unused show_op_index makes two testcases fail: > > FAIL: run-readelf-line.sh > ========================= > > --- readelf.out 2021-07-14 19:37:00.962372827 +0200 > +++ - 2021-07-14 19:37:00.971161054 +0200 > @@ -42,13 +42,13 @@ > [ 36] set prologue end flag > [ 37] special opcode 19: address+0 = 0x100005a4
, line+1 = 6 > [ 38] set column to 8 > - [ 3a] special opcode 47: address+8 = 0x100005a6 , line+1 = 7 > + [ 3a] special opcode 47: address+8 = 0x100005ac , line+1 = 7 > [ 3b] set 'is_stmt' to 0 > [ 3c] advance line by constant -7 to 0 > - [ 3e] special opcode 32: address+4 = 0x100005a7 , line+0 = 0 > + [ 3e] special opcode 32: address+4 = 0x100005b0 , line+0 = 0 > [ 3f] set column to 3 > [ 41] set 'is_stmt' to 1 > - [ 42] special opcode 108: address+24 = 0x100005ad , line+6 = 6 > - [ 43] special opcode 76: address+16 = 0x100005b1 , line+2 = 8 > - [ 44] advance address by 32 to 0x100005b9 > + [ 42] special opcode 108: address+24 = 0x100005c8 , line+6 = 6 > + [ 43] special opcode 76: address+16 = 0x100005d8 , line+2 = 8 > + [ 44] advance address by 32 to 0x100005f8 > [ 46] extended opcode 1: end of sequence > FAIL run-readelf-line.sh (exit status: 1) > > FAIL: run-readelf-multi-noline.sh > ================================= > > --- readelf.out 2021-07-14 19:37:10.054186557 +0200 > +++ - 2021-07-14 19:37:10.062074795 +0200 > @@ -112,6 +112,6 @@ > [ 6e] extended opcode 2: set address to +0x724
> [ 79] copy > [ 7a] set column to 15 > - [ 7c] special opcode 32: address+4 = +0x725 , line+0 = 1 > - [ 7d] advance address by 4 to +0x726 > + [ 7c] special opcode 32: address+4 = +0x728 , line+0 = 1 > + [ 7d] advance address by 4 to +0x72c > [ 7f] extended opcode 1: end of sequence > FAIL run-readelf-multi-noline.sh (exit status: 1) FWIW, there is a different version of this patch at https://sourceware.org/pipermail/elfutils-devel/2021q1/003674.html that doesn't have those problems as far as I remember.