From patchwork Wed Apr 19 23:11:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 85642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp722720vqo; Wed, 19 Apr 2023 16:11:31 -0700 (PDT) X-Google-Smtp-Source: AKy350atPGxeZMvSZslfgLN9/d7P279q5197kZxc/tQc1eBKSSQDKK5YqPPVfG7Xb+AEN8pC1hKj X-Received: by 2002:a05:6402:2046:b0:504:8a10:ac34 with SMTP id bc6-20020a056402204600b005048a10ac34mr6856378edb.24.1681945890972; Wed, 19 Apr 2023 16:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681945890; cv=none; d=google.com; s=arc-20160816; b=EogOObD+pLnJnQelUWKUAgYgcJTYtWUEfmosf0ELPPTE+3ukDMBFZzKpmBv2TcGP2g ZeUOs1JH15g3jYDP037zSmaKR3cTAJHCOSrYIlQr1VbtO7ggtJWntEOKSCWGGDUa+3hZ UPsC9FtDx9gozMRRctXOZoripJM40cpIhGALqgRGLyR7Ja1GdRd+a0RaGoWz+wqNg3nV 3+F7XF9Ae/xQ+UHKEUhXufQXv90j8K8rQgct4QoLxkYhNiyNNgWVO/wcG1LpGcqZcGzR Ax56coKUfUiAMXUCxF7YDzU0QGeWiACHEnRTRQiXsi3Re1pg//win84wmvQQbBlNZPzN GY+Q== 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=pyWaXscKGzo4huie9oWK8//cmqlYlqi0+eN2CapG4k8=; b=cSO78hSyPOP5/13a7G1Ceg5uDFYN6Dzv0YF+NRuiBdl0nRHbVDSCo5V1yRBVJEhZIo rkpz58d+pGOD50Rn6PkvRGi7iAVLe5pslEi0GtboVmLsDhvtRV0WO8q7S3tjSLMfcoZh kD9fZ+h0Qu7enFaowC2ekosJ3ReXA5dN+jquFLg99WEY9DCTp+lRb2hEzMXB3F7IRu4D 01G7vU/Pu8nBtVta+x5dni8eibAp/VtuXkXZybr4DQX8T3D1eOX6D7aAjsVIvLP2kQl4 iZljsIRXPoEMTXQbg9nOgiCXmca+/PEgSjaJvYQwFV11F/12FdmlaAGB1szROqvrnEYx TcXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=c8Wi0pTN; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id c7-20020aa7df07000000b00504927b9514si165893edy.213.2023.04.19.16.11.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 16:11:30 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=c8Wi0pTN; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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 DEA573858401 for ; Wed, 19 Apr 2023 23:11:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DEA573858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681945889; bh=pyWaXscKGzo4huie9oWK8//cmqlYlqi0+eN2CapG4k8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=c8Wi0pTNnft18PNGa7p/7R6cFhvHVC0KiyH0NnsjHHIwGWzk3MQh/SeFzL6wkBPRM V6fyIIhsU5xXZKruEu7ZiIy6tJmhY3eRnOvkafKcuQsgvialqhwnycR3MunAOtwy79 g28kkNfqMGpC1nRYaf8JJStnEpEAiXqlXfI4mwnM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 152333858D33 for ; Wed, 19 Apr 2023 23:11:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 152333858D33 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1a6bc48aec8so4334865ad.2 for ; Wed, 19 Apr 2023 16:11:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681945879; x=1684537879; 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=pyWaXscKGzo4huie9oWK8//cmqlYlqi0+eN2CapG4k8=; b=j6ev+lFXoPM2vor4qIRWiOiEf4Rq0qzuduYFmZRjmdFoX+Wiz9PtAAXycRVquz2yJV HhE7uNyf6wgn9yIOyYbUscgeAJX/Ow1unHYp03aHv5jsf/fvSnU1ON/L/IGO9F7KBiJ6 gObZNX181j9R4n3oUND02oUQVRoQsNMIHM2MSPZwz3jWLBnWDQtZOeWMVJADduhxs2Vp /2IR8UuxEIHHOCq/u8AIEv4VNjMuvPGArdSAfcGT4zG194dJKBXr5byr1DPlWfHkek/q RYMWnntMlmvYjwexGbgnKlDHDIsmXL49HuAZJAPwDOq+M7EAXbYt//1JunsXLkSKzA/W VNIQ== X-Gm-Message-State: AAQBX9dLp+scsNvzTpaK3qGT+A8Tg1ei976M7H+1Q0NkXgSe1AjBDbo8 3nN1Z6gmYCLfVsRXjJQaynMupkUsjJI= X-Received: by 2002:a17:902:c613:b0:1a2:8c7e:f310 with SMTP id r19-20020a170902c61300b001a28c7ef310mr5949818plr.35.1681945879476; Wed, 19 Apr 2023 16:11:19 -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 k1-20020a170902760100b001a1adbe215asm1459pll.142.2023.04.19.16.11.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 16:11:18 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id C9CCF1142CAE; Thu, 20 Apr 2023 08:41:16 +0930 (ACST) Date: Thu, 20 Apr 2023 08:41:16 +0930 To: binutils@sourceware.org Subject: sh4-linux segfaults running ld testsuite Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_STOCKGEN, 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.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?1763648094484239138?= X-GMAIL-MSGID: =?utf-8?q?1763648094484239138?= Segmentation fault FAIL: pr22269-1 (static pie undefined weak) and others running "visibility (hidden undef)" tests No code has any right to access bfd_link_hash_entry u.def without first checking the type, and SYMBOL_REFERENCES_LOCAL isn't sufficient. * elf32-sh.c (sh_elf_finish_dynamic_symbol): Don't use relative relocs in GOT unless symbol is defined. diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index fdcc5870890..499233d1355 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -6174,6 +6174,8 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, The entry in the global offset table will already have been initialized in the relocate_section function. */ if (bfd_link_pic (info) + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) && SYMBOL_REFERENCES_LOCAL (info, h)) { if (htab->fdpic_p)