From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 359E8384B070 for ; Tue, 9 Mar 2021 11:24:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 359E8384B070 Received: by mail-pl1-x62a.google.com with SMTP id d23so3200480plq.2 for ; Tue, 09 Mar 2021 03:24:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SdxKi1jQMjje+zfqOYZR4097jYBGPUQNZzTX018nzlI=; b=a+zmsbiYDhyOIQKCGNKZXKtN/pLTrFZfHyl75zYk81oYE1LSD7ni3CkIYip3l0gxYK DYgrFOBC+Bhj2Oda833/9ybu/cIcZ2Lxi+Ojg8DupOnlDD9YwzhRgommMLTUSccOzYtu TiX6zSKdyco/dH2OHk6NgJfuvBPzNXnQQnINBJLxU+oFOsjonY4BjP7TKSue2zTodmyF 2DdMwf31XalboaJ4Tq1KP3OsHHJ0Q5/aH9oh+c4INdVN5emJWTnijDCA4sIbAb7ruIQU aqjT7L9vOhCwpgjFdbVsoZcdmZZ/YcPvYzIEA7KTZZNKLfx8T6/khHDKtFWPfDv9gcM5 Kc+g== X-Gm-Message-State: AOAM533wmTnjGY9JbfRLz4gtowxz243sE+jZSz7BGmkQWuNSSUCPNYjJ 7TAb2v9wey+73y1cSKQZsVYU7Ddg15Uzww== X-Google-Smtp-Source: ABdhPJymg4hKuYjTmBFMxWSq4MtnpcR01KHoP/PQ/y+8bQB7bL/0tpTmLZRBCiwtF9ZMXvWv5AjERA== X-Received: by 2002:a17:902:d114:b029:e4:87c7:39f5 with SMTP id w20-20020a170902d114b02900e487c739f5mr25474528plw.72.1615289039074; Tue, 09 Mar 2021 03:23:59 -0800 (PST) Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id q2sm12289877pfu.215.2021.03.09.03.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 03:23:58 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id A8E3041A83; Tue, 9 Mar 2021 21:53:54 +1030 (ACDT) Date: Tue, 9 Mar 2021 21:53:54 +1030 From: Alan Modra To: Jan Beulich Cc: Binutils Subject: Re: [PATCH 3/6] bfd: refine handling of relocations between debugging sections Message-ID: <20210309112354.GJ6042@bubble.grove.modra.org> References: <67c184ec-e370-46ee-46d3-bd001ef80445@suse.com> <20210304061023.GR6042@bubble.grove.modra.org> <41f2d3d5-c98b-7db5-8c91-26b7ceb780e3@suse.com> <20210305120036.GA6042@bubble.grove.modra.org> <4efef1cc-0b6f-150a-b598-89e0c704d01b@suse.com> <20210309022426.GH6042@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-3034.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 09 Mar 2021 11:24:01 -0000 On Tue, Mar 09, 2021 at 08:46:08AM +0100, Jan Beulich wrote: > On 09.03.2021 03:24, Alan Modra wrote: > > @@ -1323,6 +1322,19 @@ bfd_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, > > return bfd_reloc_ok; > > } > > > > + /* In some cases the relocation should be treated as input section > > + relative, as when linking ELF DWARF into PE COFF. Many ELF > > + targets lack section relative relocations and instead use > > + ordinary absolute relocations for references between DWARF > > + sections. That is arguably a bug in those targets but it happens > > + to work for the usual case of linking to non-loaded ELF debug > > + sections with VMAs forced to zero. PE COFF on the other hand > > + doesn't allow a section VMA of zero. */ > > + if (output_bfd == NULL > > + && (symbol->section->flags & SEC_DEBUGGING) != 0 > > + && (input_section->flags & SEC_DEBUGGING) != 0) > > + reloc_entry->addend -= symbol->section->output_section->vma; > > ... already in your reduced replacement suggestion to my change > to bfd_perform_relocation() you didn't only drop the "just to > be on the safe side" checks, but also the pc-relative one. Are > you sure there aren't any cases where such relocations might be > used, particularly when the relocation points back to the same > section? I'm aware of DW_OP_skip, DW_OP_bra, DW_OP_call[24] that use relative offsets to the same section. I figured these ought to resolve at assembly time and thus not have relocations. But I suppose some targets might emit needless relocs, so yes, I'll put the pc-relative test back. -- Alan Modra Australia Development Lab, IBM