From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id 2B9103853572 for ; Fri, 3 Jun 2022 03:47:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2B9103853572 Received: by mail-pj1-x102d.google.com with SMTP id v5-20020a17090a7c0500b001df84fa82f8so6325426pjf.5 for ; Thu, 02 Jun 2022 20:47:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iylcmFIdMw1WeT1MXnWGeLB9KEM8WwoPT/i4Rrdob7Y=; b=zFR5+8LGgvVX/ks5g8VEt5r5qKZaCMzV3vntvgMNLoZRRZGjHNjGU+IZpBpqQ8kAu0 wBkLONSKxet2vnCysJwawClRMUD1Be+9y1dqQlYNYyG1gBpHHCqakaE/f1gjrMEiH0Ye qjvH2N43xyyQ/1RG223oxP7BBzv+FeWZyjgdlIVhTGsYSaryDFgAepUna2CnSil11Sno fFZumlGeaQ2lzffl8MzqWoD5MXldppPen3dFZHqiuf1LPSi/zRQ/hCJX8w1hAETBlplT eKMJdmlwBHm/XxgZziL0+tkQcUvVRPT/Cxg4mlIHHfnUEq/5zMQxPBsy2lEzauy8wPXK n72g== X-Gm-Message-State: AOAM5327hfncQSAgOlcuQiUBJyoHcXCxrlL466hjWbBGFZRKPmsgNy+N tmIUqhcafNZrgPN/IOH5qoCehdsrRkg= X-Google-Smtp-Source: ABdhPJyZ76YOoIb5j1oxlUEl1BNmmGk/iYlT9mT8V14Ql0iykfSFMvxOq63jvgPXGcJbb8AD63/s+Q== X-Received: by 2002:a17:903:2cb:b0:14f:4fb6:2fb0 with SMTP id s11-20020a17090302cb00b0014f4fb62fb0mr8092871plk.172.1654228073569; Thu, 02 Jun 2022 20:47:53 -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 z6-20020a170903018600b001621a66b318sm4447124plg.130.2022.06.02.20.47.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 20:47:52 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 229D3114015F; Fri, 3 Jun 2022 13:17:50 +0930 (ACST) Date: Fri, 3 Jun 2022 13:17:50 +0930 From: Alan Modra To: binutils@sourceware.org Subject: Re: mips_gprel_reloc segfault Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3037.1 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.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2022 03:47:57 -0000 Similarly for the elf mips support. * elf32-mips.c (mips_elf_final_gp): Don't segfault on symbols in any of the bfd_is_const_section sections. * elf64-mips.c (mips_elf64_final_gp): Likewise. * elfn32-mips.c (mips_elf_final_gp): Likewise. diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index a4c88c6b089..8989011edc9 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -1720,8 +1720,7 @@ static bfd_reloc_status_type mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable, char **error_message, bfd_vma *pgp) { - if (bfd_is_und_section (symbol->section) - && ! relocatable) + if (output_bfd == NULL) { *pgp = 0; return bfd_reloc_undefined; diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 6fa9d44300c..7f6f7ef0053 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -3427,8 +3427,7 @@ static bfd_reloc_status_type mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable, char **error_message, bfd_vma *pgp) { - if (bfd_is_und_section (symbol->section) - && ! relocatable) + if (output_bfd == NULL) { *pgp = 0; return bfd_reloc_undefined; diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 1ae51a4648c..07b753f0cc1 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -3254,8 +3254,7 @@ static bfd_reloc_status_type mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable, char **error_message, bfd_vma *pgp) { - if (bfd_is_und_section (symbol->section) - && ! relocatable) + if (output_bfd == NULL) { *pgp = 0; return bfd_reloc_undefined; -- Alan Modra Australia Development Lab, IBM