This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/2] z/OS Support: Catching segfaults
- From: David Lanzenörfer <leviathan at libresilicon dot com>
- To: binutils at sourceware dot org
- Cc: David Lanzendörfer <leviathan at libresilicon dot com>
- Date: Sun, 26 Jan 2020 19:42:56 +0800
- Subject: [PATCH 1/2] z/OS Support: Catching segfaults
- References: <20200126114257.2619-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