From patchwork Thu Jan 26 21:51:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 48906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp504511wrn; Thu, 26 Jan 2023 13:51:35 -0800 (PST) X-Google-Smtp-Source: AK7set+7za5kaiQW4hsH2ygvqMUQd6+VsniPHf1/Q1k0vt6D+atokL1fRIjcPmBEw2JZOjhrCJgo X-Received: by 2002:a50:d490:0:b0:4a0:8bcc:3cb6 with SMTP id s16-20020a50d490000000b004a08bcc3cb6mr10855171edi.17.1674769895042; Thu, 26 Jan 2023 13:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674769895; cv=none; d=google.com; s=arc-20160816; b=0SmPo2SZKyBMGR9nGFm8M4RT1NOjS+x3gzrGq0oeGOffGulvt6Cz1ixJ48B5NFkaTi +GYk/enoluzJWW58yh4+rjXlVh8b+xwIb1xxFV3FQLPHpphe+iDt0k3g7Y+GELjO7pvj DSbScYwB1+haj3r6GI6JnfpCbA2k+XnupzhCm1o+lFqSGFC81z2AmJ3FcgyxVbUSiz6c oBDiU1PvT7TRuJ7gqyqI801xciEphBdlLP3jy9WZFC5Jdta2o4r5KtGYKM2df1dwjH19 PMDnWD/bphcR4sfVRTx3SpnB6GwQdhCiXA5EV8ebTRYKxD2MQ0bM8QYvAfSTSfUpdEMF HDAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Yl9OH48SZdYpyfFkrzyzOlAuQm2dup9GWXc/KgwK0Y8=; b=wzpB01MsbIlcDIk3T8JfV6BpODtFwvwOHRTY13APrblIHVeY90V3IQxQWrnb+80T2F /1JhOGsbpfGClwpyQPJEU8Zb6q2Vtswbilt9KkAF+sJ716FTmGvPf7a42LyihPSHXH9B PYuaejElPhFSHwEtkcU8+tGouQrDruXvMs1+LIH6pYzuYVQC3CUhJda/g6AaHlWZPo9V NjAnBt+78K8ewrbztjmgb9U13HvCTQJC1M5Fvx15kX1hxu63U0uTGXrvx07my4sTH2ys MaJ8K0BrFy8Mv8uwzQhg0d07PDKL7yDpvToFTBLEjhvtdq38cyc1wKG6fk4kOQehozcE q5aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Zq4M5O6n; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b15-20020a0564021f0f00b004a0cfedbe2fsi2895497edb.554.2023.01.26.13.51.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 13:51:35 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Zq4M5O6n; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 74E7F3858D28 for ; Thu, 26 Jan 2023 21:51:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74E7F3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674769893; bh=Yl9OH48SZdYpyfFkrzyzOlAuQm2dup9GWXc/KgwK0Y8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Zq4M5O6npip8j0GLkveRECBJjZOc7X2ODA0xYn9NDYQmCN+yqsZNd6U379HrY8BuW 9mggvTb3fWn67Wz3L7OqDWF2Bog/voQPuvHldES9bgDaLGkdlVuxhlzQBJZERt1Hvi 0taT0DkPxaGPdRPl17Zk2g5pDCmGVDR6BrsXcq7E= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id B930E3858D20 for ; Thu, 26 Jan 2023 21:51:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B930E3858D20 Received: by mail-pj1-x1032.google.com with SMTP id e10-20020a17090a630a00b0022bedd66e6dso6688008pjj.1 for ; Thu, 26 Jan 2023 13:51:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Yl9OH48SZdYpyfFkrzyzOlAuQm2dup9GWXc/KgwK0Y8=; b=H2lzUW/7OTUMBpel1Nq1DqE60/c/5/r0HyUNYYAYpME6pb8G1y4a0fM/42q+hdr4LR RHon1WCLviAfgTcHJkEuOHOSFoOMbN3xIhgP332RSvrtVUZhelcwD94uxFZGv7q/8ac3 /HfqkVVF/ghblSkn2tf9plNB1alnpVsAq5SCF6EIxtc3QqO/haxRoIiA091wZ+a3l68Q fZWO4oVpUepB4hmeVznTwi8r+E05CrKomBbVU19t+KH2Yj4bIUAgDuIkrhM0NTX3Xqof YnlgfVX0Ee7owFRbQmx3Cr4Pj5gzsSr45KSL9/eb2XG/oDlIrbcfgM7rvIPNiICmU/v4 vM0A== X-Gm-Message-State: AO0yUKWbREU26bvYhe8oEjepxX9wrA8TP5sbeC1OKYiY7uIw2AdKV1rG /yrjF81mlEUK0yNxedTT6Ymylat/L9E= X-Received: by 2002:a17:903:32c2:b0:196:d05:bac7 with SMTP id i2-20020a17090332c200b001960d05bac7mr14861696plr.58.1674769884520; Thu, 26 Jan 2023 13:51:24 -0800 (PST) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id p18-20020a170902ebd200b00196053474a8sm1442348plg.53.2023.01.26.13.51.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 13:51:24 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 02BF61142CC6; Fri, 27 Jan 2023 08:21:21 +1030 (ACDT) Date: Fri, 27 Jan 2023 08:21:20 +1030 To: binutils@sourceware.org Subject: segv in coff_aarch64_addr32nb_reloc Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3035.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 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-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756123517560379478?= X-GMAIL-MSGID: =?utf-8?q?1756123517560379478?= * coff-aarch64.c (coff_aarch64_addr32nb_reloc): When output_bfd is NULL (which it is for objdump -W) get the output bfd via the input section. diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c index 12e242e18d0..659cd4f162d 100644 --- a/bfd/coff-aarch64.c +++ b/bfd/coff-aarch64.c @@ -189,9 +189,10 @@ coff_aarch64_addr32nb_reloc (bfd *abfd, + symbol->section->output_section->vma); bfd_vma addend = bfd_getl_signed_32 (data + reloc_entry->address); relocation += addend; - if (bfd_get_flavour (output_bfd) == bfd_target_coff_flavour - && obj_pe (output_bfd)) - relocation -= pe_data (output_bfd)->pe_opthdr.ImageBase; + bfd *obfd = input_section->output_section->owner; + if (bfd_get_flavour (obfd) == bfd_target_coff_flavour + && obj_pe (obfd)) + relocation -= pe_data (obfd)->pe_opthdr.ImageBase; else { *error_message = "unsupported";