From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96379 invoked by alias); 27 Jan 2020 07:18:42 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 96359 invoked by uid 89); 27 Jan 2020 07:18:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail-pl1-f195.google.com Received: from mail-pl1-f195.google.com (HELO mail-pl1-f195.google.com) (209.85.214.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Jan 2020 07:18:40 +0000 Received: by mail-pl1-f195.google.com with SMTP id p23so3411240plq.10 for ; Sun, 26 Jan 2020 23:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Ig3E2MRu0FQygQpwrr4D62EFg6jGm2uBCxcjnKXbV0o=; b=HXHaH+hCgmvudmtA7bqu4ZXjeLoSAYR2wf1DOWNH1suo6dqzuuN1F20FsHs9WQe5Hi t+sFOfmJAuWZDFasDAuSgoXzksclUfcetFyNEYmxIQtYRkF2tJt8lA3F3EOagbKNC6cw 3qeaf1TwcwM2tv/PqoDVOR+KGhGzy8Gkwhxl4EXqDO5pxLbB/PZsygF6wdodOfXkDT38 Leumlt886fWqD17utCfUqvYTSAJ/ND0kqfcarlWZusrQm3ysds8EzZnpspViPpSF2lEG AymRp0+FGB7G5Wb+vMGdkDN8CWPdpdKw+zgEYDNBB/XYSmDZ/2geSkGm/LzK19mw4aQ7 /BQw== Return-Path: Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id h3sm14530525pjs.0.2020.01.26.23.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2020 23:18:38 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 5A64B80903; Mon, 27 Jan 2020 17:48:34 +1030 (ACDT) Date: Mon, 27 Jan 2020 07:18:00 -0000 From: Alan Modra To: David =?iso-8859-1?Q?Lanzen=F6rfer?= Cc: binutils@sourceware.org Subject: Re: [PATCH 1/2] z/OS Support: Catching segfaults Message-ID: <20200127071834.GQ4433@bubble.grove.modra.org> References: <20200126113756.2009-1-leviathan@libresilicon.com> <20200126113756.2009-2-leviathan@libresilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200126113756.2009-2-leviathan@libresilicon.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00381.txt.bz2 On Sun, Jan 26, 2020 at 07:37:53PM +0800, David Lanzenörfer wrote: > When handling the z/OS object files in F4SA format certain fields > are blank which caused segfaults in ld during linking. Where were the segfaults? As far as I know, bfd_link_hash_lookup is fine with an empty string, > @@ -508,7 +508,7 @@ bfd_link_hash_lookup (struct bfd_link_hash_table *table, > { > struct bfd_link_hash_entry *ret; > > - if (table == NULL || string == NULL) > + if (table == NULL || string == NULL || string[0]=='\0' ) so this isn't OK. The formatting is wrong too. > --- a/ld/ldlang.c > +++ b/ld/ldlang.c > @@ -6521,6 +6521,8 @@ foreach_start_stop (void (*func) (struct bfd_link_hash_entry *)) > static void > undef_start_stop (struct bfd_link_hash_entry *h) > { > + if (h==-1) > + return; > if (h->ldscript_def) > return; > > @@ -6586,6 +6588,8 @@ lang_init_startof_sizeof (void) > static void > set_start_stop (struct bfd_link_hash_entry *h) > { > + if(h==-1) > + return; > if (h->ldscript_def > || h->type != bfd_link_hash_defined) > return; These also are not OK. You should prevent whatever caused an entry in start_stop_syms[] from being -1, rather than papering over the problem like this. -- Alan Modra Australia Development Lab, IBM