This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Check return value of bfd_new_link_order
- From: Tobias Ulmer <tobiasu at tmux dot org>
- To: binutils at sourceware dot org
- Cc: Tobias Ulmer <tobiasu at tmux dot org>
- Date: Thu, 30 Nov 2017 15:04:12 +0100
- Subject: [PATCH] Check return value of bfd_new_link_order
- Authentication-results: sourceware.org; auth=none
Signed-off-by: Tobias Ulmer <tobiasu@tmux.org>
---
ld/ldwrite.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index 1cd111d2..1abea29b 100644
--- a/ld/ldwrite.c
+++ b/ld/ldwrite.c
@@ -254,6 +254,8 @@ build_link_order (lang_statement_union_type *statement)
link_order = bfd_new_link_order (link_info.output_bfd,
output_section);
+ if (link_order == NULL)
+ einfo (_("%P%F: bfd_new_link_order failed\n"));
if ((i->flags & SEC_NEVER_LOAD) != 0
&& (i->flags & SEC_DEBUGGING) == 0)
@@ -293,6 +295,8 @@ build_link_order (lang_statement_union_type *statement)
link_order = bfd_new_link_order (link_info.output_bfd,
output_section);
+ if (link_order == NULL)
+ einfo (_("%P%F: bfd_new_link_order failed\n"));
link_order->type = bfd_data_link_order;
link_order->size = statement->padding_statement.size;
link_order->offset = statement->padding_statement.output_offset;
--
2.15.0