aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-11-21 14:05:40 -0800
committerCary Coutant <ccoutant@gmail.com>2016-11-21 14:06:15 -0800
commitc13b08dbbcf752480a7621aa1f89bc5440c74c25 (patch)
tree728725027481b9a817f997588ce5d615a34bc601 /gold/gold.cc
parentAdd missing POSTCOMPILE step to mi/ file generation rules (diff)
downloadbinutils-gdb-c13b08dbbcf752480a7621aa1f89bc5440c74c25.tar.gz
binutils-gdb-c13b08dbbcf752480a7621aa1f89bc5440c74c25.tar.bz2
binutils-gdb-c13b08dbbcf752480a7621aa1f89bc5440c74c25.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.
Diffstat (limited to 'gold/gold.cc')
-rw-r--r--gold/gold.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/gold/gold.cc b/gold/gold.cc
index 123d79bc17d..7b3414f5f91 100644
--- a/gold/gold.cc
+++ b/gold/gold.cc
@@ -492,6 +492,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);
@@ -589,14 +597,6 @@ queue_middle_tasks(const General_options& options,
}
}
- // 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();
-
int thread_count = options.thread_count_middle();
if (thread_count == 0)
thread_count = std::max(2, input_objects->number_of_input_objects());