This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Check return value of bfd_new_link_order


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7b2d20948528f94b405af3e951931758e92e8e4d

commit 7b2d20948528f94b405af3e951931758e92e8e4d
Author: Tobias Ulmer <tobiasu@tmux.org>
Date:   Fri Dec 1 19:25:19 2017 +1030

    Check return value of bfd_new_link_order
    
    	* ldwrite.c (build_link_order): Check return value of all
    	bfd_new_link_order calls.

Diff:
---
 ld/ChangeLog | 5 +++++
 ld/ldwrite.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index e087382..0d1d3c7 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-01  Tobias Ulmer  <tobiasu@tmux.org>
+
+	* ldwrite.c (build_link_order): Check return value of all
+	bfd_new_link_order calls.
+
 2017-12-01  Alan Modra  <amodra@gmail.com>
 
 	* testsuite/ld-elfweak/alias.c,
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index 1cd111d..1abea29 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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]