From patchwork Tue Jun 11 00:01:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 91848 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F1AC13858282 for ; Tue, 11 Jun 2024 00:02:04 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 255683858410 for ; Tue, 11 Jun 2024 00:01:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 255683858410 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 255683858410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718064099; cv=none; b=PoTSkhkm7bZCbAiAtVo7O2ueNwtOlbn/96HCtsi6UguWjSFjGLrRFgNvYFMtZwIwIb5unjsETsjwKLNjGRRtVDx1K/mjaMWAIgQam8/MhN97MFjQItXC5uqRe1YdILPTFxzshzd14CcRr9Pt8L8Qb7pnCVKWdQf5J6yGyAwswXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718064099; c=relaxed/simple; bh=RCayyGBWyoOgV5vwrE5lHp40JcqeQ6vE4R4xBe8if6s=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=hRVHktkQVdQzRVtQPVlEv++UvwcZJcFgaF9Nk6zezCtNvnofx+AlaW5w1OIs7OT69qN7T/3x3ocPXUw8bLH2tUxVZs1GUA/UGdgDPmI5SBqQLFFPlnOZ7HK8YTomArNWjAfy8SgS27H57RibPOpAU4sRiFE4tNpv38h/JPhjgLU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7041a7d4beeso2754887b3a.2 for ; Mon, 10 Jun 2024 17:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718064092; x=1718668892; darn=sourceware.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=4lyT7BLmVvPWx2cnHOnQkGszkiqwUtgRlxdJ/gTA6yA=; b=gdYb9ayOHLCtU8w5kxGx5hBpjCgztRCGi4yIPIK1DdfY6quacOR+Ybw1wpFqZ15b3c TEPLsZeD25JDJQojdIclHu0pCqb64vCXThJ1RHBVJoBpJMQgyc8juaING4PgnbgHB+O4 9z4SKwN3avJ/jDmKNE1rjHMtPxZIilWdE6WUYv9ePqVPuSAUqpLibpM4A4Ux8/gLbmls WvPMJD3s3aPYcy9vCMegDVfXMnH+tp0Y42ctHOGpana9GH5yic+j2rMk46dQ/g3EkWww fuoMKdHVrsXGw4MF6l3nU8DWb98Afl1KS8XZEMCfocxWEPY9mP2xRCkr4HbCr8xFaPQN 1PVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718064092; x=1718668892; 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=4lyT7BLmVvPWx2cnHOnQkGszkiqwUtgRlxdJ/gTA6yA=; b=l+2VEYyZm0VABBPWmjXwsft+5tXpNVkCUdajge9vqGyU7Vbfqr+PDhmqIbeASJY8FD RSalN4uSDqVvokevz49uJTE+bpG9LHXp7h0qFbQHhviYji+J69RVMUZfxjFqQy0q+gy5 2AoQ3DKdjh7Z7tXQPmdrqLi2+nHmsFiSW2fI0TRUKaF+w+pzss40UDxc0Xf5T0bceMLh Pe6aJSN4BzjnP1dZX1tNUpkb8vn0hDFPmZPFBLq6p8SulaC9eCoYtcu8Ph7E5mkSrjhp w1v5vPuZzSCCWPs4yCD2Bl7fJAwcKR1LewPSWNEzdzw3qWluQoUHd6jjOaSkNVPzOc/l rKLA== X-Gm-Message-State: AOJu0Yx+KqQmndtktPco1HYdsdcvX6iPVX+0Cpa3fjAi4KXW4jKfAu7w 68bhCE81kocWPVZSeHCtuMMCOpnBCDZ9SzqIcffcAyU2i6VZvEx5pfDQMg== X-Google-Smtp-Source: AGHT+IEQZMA6QyinysSMmRptfTTrgCsyoxA/89nRWiQPR2inFdh6XV3YcXNYeKq7cfAC1ylG14oN+g== X-Received: by 2002:a05:6a00:14c2:b0:705:9748:7ba9 with SMTP id d2e1a72fcca58-70597487fcemr4304257b3a.0.1718064092240; Mon, 10 Jun 2024 17:01:32 -0700 (PDT) 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 d2e1a72fcca58-7041e9d55f1sm4908582b3a.220.2024.06.10.17.01.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 17:01:31 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 3DE181141264; Tue, 11 Jun 2024 09:31:29 +0930 (ACST) Date: Tue, 11 Jun 2024 09:31:29 +0930 From: Alan Modra To: binutils@sourceware.org Subject: PR31872, Segfault in objdump (elf_slurp_reloc_table_from_section) Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3033.4 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, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org This one was triggered by trying to dump an AMDGPU object. elf64-amdgcn.c lacks support for objdump relocation handling. PR 31872 * elfcode.h (elf_slurp_reloc_table_from_section): Don't segfault on NULL elf_info_to_howto_rel. diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 39dfe0ba234..3dcba4c4fd7 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1614,11 +1614,11 @@ elf_slurp_reloc_table_from_section (bfd *abfd, relent->addend = rela.r_addend; - if ((entsize == sizeof (Elf_External_Rela) - && ebd->elf_info_to_howto != NULL) - || ebd->elf_info_to_howto_rel == NULL) + res = false; + if (entsize == sizeof (Elf_External_Rela) + && ebd->elf_info_to_howto != NULL) res = ebd->elf_info_to_howto (abfd, relent, &rela); - else + else if (ebd->elf_info_to_howto_rel != NULL) res = ebd->elf_info_to_howto_rel (abfd, relent, &rela); if (! res || relent->howto == NULL)