Check return value of bfd_new_link_order
authorTobias Ulmer <tobiasu@tmux.org>
Fri, 1 Dec 2017 08:55:19 +0000 (19:25 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 1 Dec 2017 08:56:45 +0000 (19:26 +1030)
* ldwrite.c (build_link_order): Check return value of all
bfd_new_link_order calls.

ld/ChangeLog
ld/ldwrite.c

index e0873827ba98fb33d2a9304b13746591d79a94db..0d1d3c7b2229c2b103bc19937376fdcc8842db4c 100644 (file)
@@ -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,
index 1cd111d20a38d939c5b593d0858d2a3257ce5dc8..1abea29bd3002742e722275378d08945f4d0273f 100644 (file)
@@ -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;