public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "David Lanzenörfer" <leviathan@libresilicon.com>
To: binutils@sourceware.org
Cc: "David Lanzendörfer" <leviathan@libresilicon.com>
Subject: [PATCH 1/2] z/OS Support: Catching segfaults
Date: Sun, 26 Jan 2020 11:38:00 -0000	[thread overview]
Message-ID: <20200126113756.2009-2-leviathan@libresilicon.com> (raw)
In-Reply-To: <20200126113756.2009-1-leviathan@libresilicon.com>

From: David Lanzendörfer <leviathan@libresilicon.com>

When handling the z/OS object files in F4SA format certain fields
are blank which caused segfaults in ld during linking.
---
 bfd/linker.c | 2 +-
 ld/ldlang.c  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/bfd/linker.c b/bfd/linker.c
index d8703179e5..9711951ea7 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -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' )
     return NULL;
 
   ret = ((struct bfd_link_hash_entry *)
diff --git a/ld/ldlang.c b/ld/ldlang.c
index e100c0533c..5fbba7e723 100644
--- 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;
-- 
2.25.0

  parent reply	other threads:[~2020-01-26 11:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-26 11:38 [PATCH 0/2] Introducing support for cross compiling/linking for the z/OS platform David Lanzenörfer
2020-01-26 11:38 ` [PATCH 1/2] z/OS support: Introducing z/OS support David Lanzenörfer
2020-01-26 11:38 ` [PATCH 2/2] " David Lanzenörfer
2020-01-27  8:42   ` Alan Modra
2020-01-28  7:37     ` David Lanzendörfer
2020-01-26 11:38 ` David Lanzenörfer [this message]
2020-01-27  7:18   ` [PATCH 1/2] z/OS Support: Catching segfaults Alan Modra
2020-01-28  7:39     ` David Lanzendörfer
2020-01-26 11:38 ` [PATCH 2/2] " David Lanzenörfer
2020-01-26 15:50 ` [PATCH 0/2] Introducing support for cross compiling/linking for the z/OS platform David Lanzendörfer
2020-01-26 11:43 David Lanzenörfer
2020-01-26 11:43 ` [PATCH 1/2] z/OS Support: Catching segfaults David Lanzenörfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200126113756.2009-2-leviathan@libresilicon.com \
    --to=leviathan@libresilicon.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).