From patchwork Tue Dec 12 17:21:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 177484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7874779vqy; Tue, 12 Dec 2023 09:21:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZWYx2qIvBDtZk4qqe8GkLJwG3cCehVuGZAPXJJtw7YaoIj5xtA93kBvupzQg1zWWpWuYs X-Received: by 2002:a9d:73d1:0:b0:6d8:5432:7e66 with SMTP id m17-20020a9d73d1000000b006d854327e66mr5115770otk.16.1702401702288; Tue, 12 Dec 2023 09:21:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702401702; cv=pass; d=google.com; s=arc-20160816; b=Ut8fClDUuQI/wfd9AeysTtZk+jcIoqLL5wmH0gwTA3fiGbTzJgG+Ej6wF1D8j4JZbs hOrqtGmaZL0svhrx3Jycn769rpMi/T1cQL7C7G1RH2h9KkW+3n1WZTtnCw+8ty/FP+CV ZfD714ZyNdfb6C1jrl8lG2R4MKDIK7OFgrwfkdms62LhYUAj0MBVskHgi/R7CTr6KMTH sW8owNZ+vB+C0cUhpdS9xTEoJKuZZCWjgG8T5SAzgN30u0JQ9yMQYTrhXfonF9U6mEIL zwI1alhMzwc7nJ+3g7FvIEKCUkc9l/Tolf54hUhbh+A3bBfx5qxP+uohGwT102sv7aUj D4gw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:arc-filter :dmarc-filter:delivered-to; bh=f/m7n7dNITZYTFlHRMzrOL8URlhb/t59z/mLdm2h0Fk=; fh=XN73cxgh+3u/l6bn27aALQx2pOHitMLJCmNdOfDqmkk=; b=Zlutq2tkJ8VqEFE9uS61/pEc9kvL5dGiIcgRfxuhnoxaY6OGri6goMD2sKGXFs0Eca aEoNj8cyt0f1wWSXNwwRksn7yf42n9UbHL/8C/06oOIp3C9LmwWHYia1c650ggB36bAq 720PiW0VOZINZkgyFBpoeMPLgpD7rvTtE/FufCcqi24YJkKwTszdEKMe+1BVEqDQowTr LLFjqKsh/O7IqYgW46yUNVQnpwnrdlUCENseV9LH25K2lp8hB9+O79J6LtX9s17xGdA7 PTvCjqzuMuF0eJcwH26oeCpC4BrZuWNKIIdXr6/Yhmp3WirWhjzsF+1jYd/eBpRgcmkp 20RA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d20-20020ab03794000000b007c3f8adf7c1si171203uav.36.2023.12.12.09.21.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 09:21:42 -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; arc=pass (i=1); 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 029413857C47 for ; Tue, 12 Dec 2023 17:21:42 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from dellerweb.de (dellerweb.de [173.249.48.176]) by sourceware.org (Postfix) with ESMTPS id 180033858C2A for ; Tue, 12 Dec 2023 17:21:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 180033858C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=parisc-linux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=parisc-linux.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 180033858C2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=173.249.48.176 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702401698; cv=none; b=jjTeBQX4gfnO8OdQqgq9biQFaxUOdsKJpGaz0CueuRXVmIWDnkZupOD6l0d5Jz1P9cNFj9vskBO8Mx8Yp/MMzFs7mqc9Z025qM/XSRhoUhIDGzqLFQ2ZPwjam0vfgkdL9miTkAfx0Y/mYW4QYEY+GUBaS3kdkVmvnhtezcB1JA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702401698; c=relaxed/simple; bh=sq90FIyv67Ba6eksasbY5Sad6FYW+f4MUfxvEyUg/Lg=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=nGeTTLWLXwpVAv3FjJqRhjLnSqkRv4eaPIXmWbB5jXpi6eMF1raoh1DFpeTBLWDFqS3d1pIoJ/O+rTZ2sayzozYOhqSy1YmBPqVebJFUH5dyOO2lYnB/+BdYXi2I7GAklXPF14OfYYmpmFnPDcNgOgE62aNVTLevuYtwwWiSumQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mx3210.localdomain (bras-base-otwaon0906w-grc-03-142-126-114-79.dsl.bell.ca [142.126.114.79]) by dellerweb.de (Postfix) with ESMTPSA id 264E31600462; Tue, 12 Dec 2023 18:21:35 +0100 (CET) Received: by mx3210.localdomain (Postfix, from userid 1000) id 6214422012C; Tue, 12 Dec 2023 17:21:28 +0000 (UTC) Date: Tue, 12 Dec 2023 17:21:28 +0000 From: John David Anglin To: Binutils Cc: Alan Modra Subject: [PATCH] Fix segmentation fault in bfd/elf32-hppa.c Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, 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+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785097567073116288 X-GMAIL-MSGID: 1785097567073116288 Tested on hppa-unknown-linux-gnu with no regressions. Okay? Dave --- Fix segmentation fault in bfd/elf32-hppa.c 2023-12-12 John David Anglin PR ld/31148 bfd/ChangeLog: * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Don't output relative reloc if eh->root.type is bfd_link_hash_undefined. diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 44129c80138..131f6806aa7 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -4216,7 +4216,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, file, we just want to emit a RELATIVE reloc. The entry in the global offset table will already have been initialized in the relocate_section function. */ - if (!is_dyn) + if (!is_dyn && eh->root.type != bfd_link_hash_undefined) { rela.r_info = ELF32_R_INFO (0, R_PARISC_DIR32); rela.r_addend = (eh->root.u.def.value