summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/gold/gold.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-11-21 14:05:40 -0800
committerRahul Chaudhry <rahulchaudhry@google.com>2017-04-13 15:13:33 -0700
commitc80811581709b9346364e3229b888f9ad830cdf5 (patch)
tree571d12ff7043ff1a31a2646e8734cb03ad861db0 /binutils-2.25/gold/gold.cc
parent07fbdd68b5ae77c35f0ffa8d13ab88eb22e28137 (diff)
downloadtoolchain_binutils-c80811581709b9346364e3229b888f9ad830cdf5.tar.gz
toolchain_binutils-c80811581709b9346364e3229b888f9ad830cdf5.tar.bz2
toolchain_binutils-c80811581709b9346364e3229b888f9ad830cdf5.zip
Fix bug where -u option with empty archive results in internal error.
gold/ PR gold/20693 * gold.cc (queue_middle_tasks): Force valid target earlier. This change is backport of commit c13b08dbbcf752480a7621aa1f89bc5440c74c25 - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c13b08dbbcf752480a7621aa1f89bc5440c74c25 to binutils 2.25.
Diffstat (limited to 'binutils-2.25/gold/gold.cc')
-rw-r--r--binutils-2.25/gold/gold.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/binutils-2.25/gold/gold.cc b/binutils-2.25/gold/gold.cc
index b278b3c3..d8a3f0c7 100644
--- a/binutils-2.25/gold/gold.cc
+++ b/binutils-2.25/gold/gold.cc
@@ -495,6 +495,14 @@ queue_middle_tasks(const General_options& options,
if (timer != NULL)
timer->stamp(0);
+ // We have to support the case of not seeing any input objects, and
+ // generate an empty file. Existing builds depend on being able to
+ // pass an empty archive to the linker and get an empty object file
+ // out. In order to do this we need to use a default target.
+ if (input_objects->number_of_input_objects() == 0
+ && layout->incremental_base() == NULL)
+ parameters_force_valid_target();
+
// Add any symbols named with -u options to the symbol table.
symtab->add_undefined_symbols_from_command_line(layout);
@@ -555,14 +563,6 @@ queue_middle_tasks(const General_options& options,
plugins->layout_deferred_objects();
}
- // We have to support the case of not seeing any input objects, and
- // generate an empty file. Existing builds depend on being able to
- // pass an empty archive to the linker and get an empty object file
- // out. In order to do this we need to use a default target.
- if (input_objects->number_of_input_objects() == 0
- && layout->incremental_base() == NULL)
- parameters_force_valid_target();
-
// TODO(tmsriram): figure out a more principled way to get the target
Target* target = const_cast<Target*>(&parameters->target());