3 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7 * object.cc (Sized_relobj::do_count_local_symbols): Check for
12 * layout.cc (Layout::layout): If the output section flags change,
17 * incremental-dump.cc (dump_incremental_inputs): Print local
18 symbol info for each input file.
20 (Output_section_incremental_inputs::set_final_data_size): Add local
21 symbol info to input file entries in incremental info.
22 (Output_section_incremental_inputs::write_info_blocks): Likewise.
23 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
24 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
25 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
27 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
28 (Sized_incr_relobj::do_relocate): Write the local symbols.
29 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
30 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
31 Adjust size of input file header.
32 (Incremental_inputs_reader::get_local_symbol_offset): New function.
33 (Incremental_inputs_reader::get_local_symbol_count): New function.
34 (Incremental_inputs_reader::get_input_section): Adjust size of input
36 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
37 (Sized_incr_relobj::This): New typedef.
38 (Sized_incr_relobj::sym_size): New const data member.
39 (Sized_incr_relobj::Local_symbol): New struct.
40 (Sized_incr_relobj::do_output_local_symbol_count): New function.
41 (Sized_incr_relobj::do_local_symbol_offset): New function.
42 (Sized_incr_relobj::local_symbol_count_): New data member.
43 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
44 (Sized_incr_relobj::local_symbol_index_): New data member.
45 (Sized_incr_relobj::local_symbol_offset_): New data member.
46 (Sized_incr_relobj::local_dynsym_offset_): New data member.
47 (Sized_incr_relobj::local_symbols_): New data member.
48 * object.h (Relobj::output_local_symbol_count): New function.
49 (Relobj::local_symbol_offset): New function.
50 (Relobj::do_output_local_symbol_count): New function.
51 (Relobj::do_local_symbol_offset): New function.
52 (Sized_relobj::do_output_local_symbol_count): New function.
53 (Sized_relobj::do_local_symbol_offset): New function.
57 * descriptors.cc (set_close_on_exec): New function.
58 (Descriptors::open): Use set_close_on_exec.
59 * output.cc (S_ISLNK): Define if not defined.
63 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
65 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
66 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
67 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
69 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
70 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
71 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
73 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
75 (Incremental_binary::apply_incremental_relocs): New function.
76 (Incremental_binary::do_apply_incremental_relocs): New function.
77 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
79 (Sized_incremental_binary::add_global_symbol): New function.
80 (Sized_incremental_binary::global_symbol): New function.
81 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
82 (Sized_incremental_binary::symbol_map_): New data member.
83 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
84 * target.h (Sized_target::apply_relocation): New function.
85 * target-reloc.h (apply_relocation): New function.
86 * x86_64.cc (Target_x86_64::apply_relocation): New function.
90 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
91 flag of a SHT_ARM_EXIDX section.
92 * testsuite/Makefile.am (arm_exidx_test): New test rules.
93 * testsuite/Makefile.in: Regenerate.
94 * testsuite/arm_exidx_test.s: New file.
95 * testsuite/arm_exidx_test.sh: Same.
100 * archive.h (Incremental_archive_entry::Archive_member):
101 Initialize arg_serial_ (second constructor).
105 * object.cc (Relocate_info::location): Simplify location string.
106 * errors.cc (Errors::error_at_location): Don't print program
108 (Errors::warning_at_location): Likewise.
109 (Errors::undefined_symbol): Likewise.
110 * testsuite/debug_msg.sh: Update accordingly.
114 * gold/layout.cc (Layout::symtab_section_offset): New function.
115 * gold/layout.h (Layout::symtab_section_offset): New function.
116 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
120 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
122 * output.h (class Output_file): Add map_is_allocated_ field.
123 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
124 not available, provide stubs. If mremap is not available, #define
126 (MREMAP_MAYMOVE): Define if not defined.
127 (Output_file::Output_file): Initialize map_is_allocated_.
128 (Output_file::resize): Check map_is_allocated_.
129 (Output_file::map_anonymous): If mmap fails, use malloc.
130 (Output_file::unmap): Don't do anything for an anonymous map.
131 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
132 is not available, provide stubs.
133 (File_read::View::~View): Use free rather than delete[].
134 (File_read::make_view): Use malloc rather than new[]. If mmap
136 (File_read::find_or_make_view): Use malloc rather than new[].
137 * gold.h: Remove HAVE_REMAP code.
138 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
139 exists. Rename mremap to gold_mremap. If mmap is not available
141 * configure, config.in: Rebuild.
145 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
146 initialize local variable v.
150 * archive.cc (Archive::include_member): Adjust call to
152 (Add_archive_symbols::run): Track argument serial numbers.
153 (Lib_group::include_member): Likewise.
154 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
155 * archive.h (Incremental_archive_entry::Archive_member):
156 Initialize arg_serial_.
157 (Archive_member::arg_serial_): New data member.
158 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
159 (Sized_dynobj::do_add_symbols): Track symbols when doing an
161 (Sized_dynobj::do_for_all_local_got_entries): New function.
162 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
164 * fileread.cc (get_mtime): New function.
165 * fileread.h (get_mtime): New function.
166 * gold.cc (queue_initial_tasks): Check for incremental update.
167 (process_incremental_input): New function.
168 (queue_middle_tasks): Don't force valid target for incremental
170 * incremental-dump.cc (find_input_containing_global): Adjust
171 size of symbol info entry.
172 (dump_incremental_inputs): Dump argument serial number and
173 in_system_directory flag; bias shndx by 1; print symbol names
174 when dumping per-file symbol lists; use new symbol info readers.
176 (Output_section_incremental_inputs:update_data_size): New function.
177 (Sized_incremental_binary::setup_readers): Setup input readers
178 for each input file; build maps for files added from libraries
180 (Sized_incremental_binary::check_input_args): New function.
181 (Sized_incremental_binary::do_check_inputs): Build map of argument
182 serial numbers to input arguments.
183 (Sized_incremental_binary::do_file_has_changed): Rename
184 do_file_is_unchanged to this; compare file modification times.
185 (Sized_incremental_binary::do_init_layout): New function.
186 (Sized_incremental_binary::do_reserve_layout): New function.
187 (Sized_incremental_binary::do_get_input_reader): Remove.
188 (Sized_incremental_binary::get_symtab_view): New function.
189 (Incremental_checker::can_incrementally_link_output_file): Remove.
190 (Incremental_inputs::report_command_line): Exclude --debug options.
191 (Incremental_inputs::report_archive_begin): Add parameter; track
192 argument serial numbers; don't put input file entry for archive
193 before archive members.
194 (Incremental_inputs::report_archive_end): Put input file entry
195 for archive after archive members.
196 (Incremental_inputs::report_object): Add parameter; track argument
197 serial numbers and in_system_directory flag.
198 (Incremental_inputs::report_script): Add parameter; track argument
200 (Output_section_incremental_inputs::set_final_data_size): Adjust
201 size of symbol info entry; check for forwarding symbols.
202 (Output_section_incremental_inputs::write_input_files): Write
203 in_system_directory flag and argument serial number.
204 (Output_section_incremental_inputs::write_info_blocks): Map section
205 indices between incremental info and original input file; store
206 input section index for each symbol.
207 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
208 change operator() to visit().
209 (class Global_got_offset_visitor): Likewise.
210 (class Global_symbol_visitor_got_plt):
211 (Output_section_incremental_inputs::write_got_plt): Use new visitor
213 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
214 (Sized_incr_relobj::do_read_symbols): New function.
215 (Sized_incr_relobj::do_layout): New function.
216 (Sized_incr_relobj::do_layout_deferred_sections): New function.
217 (Sized_incr_relobj::do_add_symbols): New function.
218 (Sized_incr_relobj::do_should_include_member): New function.
219 (Sized_incr_relobj::do_for_all_global_symbols): New function.
220 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
221 (Sized_incr_relobj::do_section_size): New function.
222 (Sized_incr_relobj::do_section_name): New function.
223 (Sized_incr_relobj::do_section_contents): New function.
224 (Sized_incr_relobj::do_section_flags): New function.
225 (Sized_incr_relobj::do_section_entsize): New function.
226 (Sized_incr_relobj::do_section_address): New function.
227 (Sized_incr_relobj::do_section_type): New function.
228 (Sized_incr_relobj::do_section_link): New function.
229 (Sized_incr_relobj::do_section_info): New function.
230 (Sized_incr_relobj::do_section_addralign): New function.
231 (Sized_incr_relobj::do_initialize_xindex): New function.
232 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
233 (Sized_incr_relobj::do_read_relocs): New function.
234 (Sized_incr_relobj::do_gc_process_relocs): New function.
235 (Sized_incr_relobj::do_scan_relocs): New function.
236 (Sized_incr_relobj::do_count_local_symbols): New function.
237 (Sized_incr_relobj::do_finalize_local_symbols): New function.
238 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
239 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
240 (Sized_incr_relobj::do_relocate): New function.
241 (Sized_incr_relobj::do_set_section_offset): New function.
242 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
243 (Sized_incr_dynobj::do_read_symbols): New function.
244 (Sized_incr_dynobj::do_layout): New function.
245 (Sized_incr_dynobj::do_add_symbols): New function.
246 (Sized_incr_dynobj::do_should_include_member): New function.
247 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
248 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
249 (Sized_incr_dynobj::do_section_size): New function.
250 (Sized_incr_dynobj::do_section_name): New function.
251 (Sized_incr_dynobj::do_section_contents): New function.
252 (Sized_incr_dynobj::do_section_flags): New function.
253 (Sized_incr_dynobj::do_section_entsize): New function.
254 (Sized_incr_dynobj::do_section_address): New function.
255 (Sized_incr_dynobj::do_section_type): New function.
256 (Sized_incr_dynobj::do_section_link): New function.
257 (Sized_incr_dynobj::do_section_info): New function.
258 (Sized_incr_dynobj::do_section_addralign): New function.
259 (Sized_incr_dynobj::do_initialize_xindex): New function.
260 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
261 (make_sized_incremental_object): New function.
262 (Incremental_library::copy_unused_symbols): New function.
263 (Incremental_library::do_for_all_unused_symbols): New function.
264 * incremental.h (enum Incremental_input_flags): New type.
265 (class Incremental_checker): Remove.
266 (Incremental_input_entry::Incremental_input_entry): Add argument
268 (Incremental_input_entry::arg_serial): New function.
269 (Incremental_input_entry::set_is_in_system_directory): New function.
270 (Incremental_input_entry::is_in_system_directory): New function.
271 (Incremental_input_entry::arg_serial_): New data member.
272 (Incremental_input_entry::is_in_system_directory_): New data member.
273 (class Script_info): Move here from script.h.
274 (Script_info::Script_info): Add filename parameter.
275 (Script_info::filename): New function.
276 (Script_info::filename_): New data member.
277 (Incremental_script_entry::Incremental_script_entry): Add argument
279 (Incremental_object_entry::Incremental_object_entry): Likewise.
280 (Incremental_object_entry::add_input_section): Build list of input
281 sections with map to original shndx.
282 (Incremental_object_entry::get_input_section_index): New function.
283 (Incremental_object_entry::shndx_): New data member.
284 (Incremental_object_entry::name_key_): Rename; adjust all refs.
285 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
286 (Incremental_archive_entry::Incremental_archive_entry): Add argument
288 (Incremental_inputs::report_archive_begin): Likewise.
289 (Incremental_inputs::report_object): Likewise.
290 (Incremental_inputs::report_script): Likewise.
291 (class Incremental_global_symbol_reader): New class.
292 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
293 and store flags and input file type.
294 (Incremental_input_entry_reader::arg_serial): New function.
295 (Incremental_input_entry_reader::type): Extract type from flags.
296 (Incremental_input_entry_reader::is_in_system_directory): New function.
297 (Incremental_input_entry_reader::get_input_section_count): Call
298 accessor function for type.
299 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
300 function for type; adjust size of global symbol entry.
301 (Incremental_input_entry_reader::get_global_symbol_count): Call
302 accessor function for type.
303 (Incremental_input_entry_reader::get_object_count): Likewise.
304 (Incremental_input_entry_reader::get_object_offset): Likewise.
305 (Incremental_input_entry_reader::get_member_count): Likewise.
306 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
307 (Incremental_input_entry_reader::get_member_offset): Likewise.
308 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
309 (Incremental_input_entry_reader::Global_symbol_info): Remove.
310 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
311 (Incremental_input_entry_reader::get_global_symbol_reader): New
313 (Incremental_input_entry_reader::get_output_symbol_index): New
315 (Incremental_input_entry_reader::type_): Remove.
316 (Incremental_input_entry_reader::flags_): New data member.
317 (Incremental_inputs_reader::input_file_offset): New function.
318 (Incremental_inputs_reader::input_file_index): New function.
319 (Incremental_inputs_reader::input_file): Call input_file_offset.
320 (Incremental_inputs_reader::input_file_at_offset): New function.
321 (Incremental_relocs_reader::get_r_type): Reformat.
322 (Incremental_relocs_reader::get_r_shndx): Reformat.
323 (Incremental_relocs_reader::get_r_offset): Reformat.
324 (Incremental_relocs_reader::data): New function.
325 (Incremental_binary::Incremental_binary): Initialize new data members.
326 (Incremental_binary::check_inputs): Add cmdline parameter.
327 (Incremental_binary::file_is_unchanged): Remove.
328 (Input_reader::arg_serial): New function.
329 (Input_reader::get_unused_symbol_count): New function.
330 (Input_reader::get_unused_symbol): New function.
331 (Input_reader::do_arg_serial): New function.
332 (Input_reader::do_get_unused_symbol_count): New function.
333 (Input_reader::do_get_unused_symbol): New function.
334 (Incremental_binary::input_file_count): New function.
335 (Incremental_binary::get_input_reader): Change signature to use
336 index instead of filename.
337 (Incremental_binary::file_has_changed): New function.
338 (Incremental_binary::get_input_argument): New function.
339 (Incremental_binary::get_library): New function.
340 (Incremental_binary::get_script_info): New function.
341 (Incremental_binary::init_layout): New function.
342 (Incremental_binary::reserve_layout): New function.
343 (Incremental_binary::output_file): New function.
344 (Incremental_binary::do_check_inputs): New function.
345 (Incremental_binary::do_file_is_unchanged): Remove.
346 (Incremental_binary::do_file_has_changed): New function.
347 (Incremental_binary::do_init_layout): New function.
348 (Incremental_binary::do_reserve_layout): New function.
349 (Incremental_binary::do_input_file_count): New function.
350 (Incremental_binary::do_get_input_reader): Change signature.
351 (Incremental_binary::input_args_map_): New data member.
352 (Incremental_binary::library_map_): New data member.
353 (Incremental_binary::script_map_): New data member.
354 (Sized_incremental_binary::Sized_incremental_binary): Initialize
356 (Sized_incremental_binary::output_section): New function.
357 (Sized_incremental_binary::inputs_reader): Add const.
358 (Sized_incremental_binary::symtab_reader): Add const.
359 (Sized_incremental_binary::relocs_reader): Add const.
360 (Sized_incremental_binary::got_plt_reader): Add const.
361 (Sized_incremental_binary::get_symtab_view): New function.
362 (Sized_incremental_binary::Inputs_reader): New typedef.
363 (Sized_incremental_binary::Input_entry_reader): New typedef.
364 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
365 (Sized_incremental_binary::do_file_is_unchanged): Remove.
366 (Sized_incremental_binary::do_file_has_changed): New function.
367 (Sized_incremental_binary::do_init_layout): New function.
368 (Sized_incremental_binary::do_reserve_layout): New function.
369 (Sized_input_reader::Inputs_reader): Remove.
370 (Sized_input_reader::Input_entry_reader): Remove.
371 (Sized_input_reader::do_arg_serial): New function.
372 (Sized_input_reader::do_get_unused_symbol_count): New function.
373 (Sized_input_reader::do_get_unused_symbol): New function.
374 (Sized_incremental_binary::do_input_file_count): New function.
375 (Sized_incremental_binary::do_get_input_reader): Change signature;
376 use index instead of filename.
377 (Sized_incremental_binary::section_map_): New data member.
378 (Sized_incremental_binary::input_entry_readers_): New data member.
379 (class Sized_incr_relobj): New class.
380 (class Sized_incr_dynobj): New class.
381 (make_sized_incremental_object): New function.
382 (class Incremental_library): New class.
383 * layout.cc (Free_list::num_lists): New static data member.
384 (Free_list::num_nodes): New static data member.
385 (Free_list::num_removes): New static data member.
386 (Free_list::num_remove_visits): New static data member.
387 (Free_list::num_allocates): New static data member.
388 (Free_list::num_allocate_visits): New static data member.
389 (Free_list::init): New function.
390 (Free_list::remove): New function.
391 (Free_list::allocate): New function.
392 (Free_list::dump): New function.
393 (Free_list::print_stats): New function.
394 (Layout_task_runner::run): Resize output file for incremental updates.
395 (Layout::Layout): Initialize new data members.
396 (Layout::set_incremental_base): New function.
397 (Layout::init_fixed_output_section): New function.
398 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
400 (Layout::create_gold_note): Do not create gold note section for
402 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
403 for incremental updates.
404 (Layout::set_section_offsets): For incremental updates, allocate space
406 (Layout::create_symtab_sections): Layout with offsets relative to
407 start of section; for incremental updates, allocate space from free
409 (Layout::create_shdrs): For incremental updates, allocate space from
411 (Layout::finish_dynamic_section): For incremental updates, do not
412 check --as-needed (fixed in subsequent patch).
413 * layout.h (class Free_list): New class.
414 (Layout::set_incremental_base): New function.
415 (Layout::incremental_base): New function.
416 (Layout::init_fixed_output_section): New function.
417 (Layout::allocate): New function.
418 (Layout::incremental_base_): New data member.
419 (Layout::free_list_): New data member.
420 * main.cc (main): Print Free_list statistics.
421 * object.cc (Relobj::finalize_incremental_relocs): Add
422 clear_counts parameter; clear counts only when clear_counts is set.
423 (Sized_relobj::Sized_relobj): Initialize new base class.
424 (Sized_relobj::do_layout): Don't report special sections.
425 (Sized_relobj::do_for_all_local_got_entries): New function.
426 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
427 symtab_off to all symbol table offsets.
428 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
429 * object.h (class Got_offset_list): Move to top of file.
430 (Object::Object): Allow case where input_file == NULL.
431 (Object::~Object): Likewise.
432 (Object::input_file): Assert that input_file != NULL.
433 (Object::lock): Allow case where input_file == NULL.
434 (Object::unlock): Likewise.
435 (Object::is_locked): Likewise.
436 (Object::token): Likewise.
437 (Object::release): Likewise.
438 (Object::is_incremental): New function.
439 (Object::get_mtime): New function.
440 (Object::for_all_local_got_entries): New function.
441 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
442 (Object::set_is_in_system_directory): New function.
443 (Object::is_in_system_directory): New function.
444 (Object::do_is_incremental): New function.
445 (Object::do_get_mtime): New function.
446 (Object::do_for_all_local_got_entries): New function.
447 (Object::is_in_system_directory_): New data member.
448 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
449 (class Sized_relobj_base): New class.
450 (class Sized_relobj): Derive from Sized_relobj_base.
451 (class Sized_relobj::Symbols): Redeclare from base class.
452 (class Sized_relobj::local_got_offset_list): Remove.
453 (class Sized_relobj::Output_sections): Redeclare from base class.
454 (class Sized_relobj::do_for_all_local_got_entries): New function.
455 (class Sized_relobj::write_local_symbols): Add offset parameter.
456 (class Sized_relobj::local_symbol_offset_): Update comment.
457 (class Sized_relobj::local_dynsym_offset_): Update comment.
458 * options.cc (Input_arguments::add_file): Remove const.
459 * options.h (Input_file_argument::Input_file_argument):
460 Initialize arg_serial_ (all constructors).
461 (Input_file_argument::set_arg_serial): New function.
462 (Input_file_argument::arg_serial): New function.
463 (Input_file_argument::arg_serial_): New data member.
464 (Input_arguments::Input_arguments): Initialize file_count_.
465 (Input_arguments::add_file): Remove const.
466 (Input_arguments::number_of_input_files): New function.
467 (Input_arguments::file_count_): New data member.
468 (Command_line::number_of_input_files): Call
469 Input_arguments::number_of_input_files.
470 * output.cc (Output_segment_headers::Output_segment_headers):
472 (Output_section::Input_section::current_data_size): New function.
473 (Output_section::Output_section): Initialize new data members.
474 (Output_section::add_input_section): Don't do merge sections for
475 an incremental link; allocate space from free list for an
477 (Output_section::add_output_section_data): Allocate space from
478 free list for an incremental update.
479 (Output_section::update_data_size): New function.
480 (Output_section::set_fixed_layout): New function.
481 (Output_section::reserve): New function.
482 (Output_segment::set_section_addresses): Remove const.
483 (Output_segment::set_section_list_addresses): Remove const; allocate
484 space from free list for an incremental update.
485 (Output_segment::set_offset): Adjust size of RELRO segment for an
487 * output.h (Output_data::current_data_size): Move here from
489 (Output_data::pre_finalize_data_size): New function.
490 (Output_data::update_data_size): New function.
491 (Output_section_headers::update_data_size): new function.
492 (Output_section_data_build::current_data_size): Move to Output_data.
493 (Output_data_strtab::update_data_size): New function.
494 (Output_section::current_data_size): Move to Output_data.
495 (Output_section::set_fixed_layout): New function.
496 (Output_section::has_fixed_layout): New function.
497 (Output_section::reserve): New function.
498 (Output_section::update_data_size): New function.
499 (Output_section::has_fixed_layout_): New data member.
500 (Output_section::free_list_): New data member.
501 (Output_segment::set_section_addresses): Remove const.
502 (Output_segment::set_section_list_addresses): Remove const.
503 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
505 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
507 * readsyms.cc (Read_symbols::do_read_symbols): Add library
508 parameter when calling Add_symbols constructor; store argument
509 serial number for members of a lib group.
510 (Add_symbols::locks): Allow case where token == NULL.
511 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
512 (Read_member::~Read_member): New function.
513 (Read_member::is_runnable): New function.
514 (Read_member::locks): New function.
515 (Read_member::run): New function.
516 (Check_script::~Check_script): New function.
517 (Check_script::is_runnable): New function.
518 (Check_script::locks): New function.
519 (Check_script::run): New function.
520 (Check_library::~Check_library): New function.
521 (Check_library::is_runnable): New function.
522 (Check_library::locks): New function.
523 (Check_library::run): New function.
524 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
525 (Add_symbols::library_): New data member.
526 (class Read_member): New class.
527 (class Check_script): New class.
528 (class Check_library): New class.
529 * reloc.cc (Read_relocs::is_runnable): Allow case where
531 (Read_relocs::locks): Likewise.
532 (Scan_relocs::locks): Likewise.
533 (Relocate_task::locks): Likewise.
534 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
536 (Sized_relobj::incremental_relocs_scan): Fix comment.
537 (Sized_relobj::do_relocate): Pass output file offset to
539 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
540 from class declaration.
541 * script.cc (read_input_script): Allocate Script_info; pass
542 argument serial number to report_script.
543 * script.h (class Script_info): Move to incremental.h.
544 * symtab.cc (Symbol_table::add_from_incrobj): New function.
545 * symtab.h (Symbol_table::add_from_incrobj): New function.
546 (Symbol_table::set_file_offset): New function.
550 * incremental-dump.cc (dump_incremental_inputs): Change signature
551 to take a Sized_incremental_binary; change caller. Use readers
552 in Sized_incremental_binary.
554 (Sized_incremental_binary::find_incremental_inputs_sections):
555 Rename do_find_incremental_inputs_sections to this.
556 (Sized_incremental_binary::setup_readers): New function.
557 (Sized_incremental_binary::do_check_inputs): Check
558 has_incremental_info_ flag; move setup code to setup_readers;
560 (Sized_incremental_binary::do_file_is_unchanged): New function.
561 (Sized_incremental_binary::do_get_input_reader): New function.
562 * incremental.h (class Incremental_binary): Move to end of file.
563 (Incremental_binary::file_is_unchanged): New function.
564 (Incremental_binary::do_file_is_unchanged): New function.
565 (Incremental_binary::Input_reader): New class.
566 (Incremental_binary::get_input_reader): New function.
567 (class Sized_incremental_binary): Move to end of file.
568 (Sized_incremental_binary::Sized_incremental_binary): Setup the
569 input section reader classes.
570 (Sized_incremental_binary::has_incremental_info): New function.
571 (Sized_incremental_binary::inputs_reader): New function.
572 (Sized_incremental_binary::symtab_reader): New function.
573 (Sized_incremental_binary::relocs_reader): New function.
574 (Sized_incremental_binary::got_plt_reader): New function.
575 (Sized_incremental_binary::do_file_is_unchanged): New function.
576 (Sized_incremental_binary::Sized_input_reader): New class.
577 (Sized_incremental_binary::get_input_reader): New function.
578 (Sized_incremental_binary::find_incremental_inputs_sections):
579 Rename do_find_incremental_inputs_sections to this.
580 (Sized_incremental_binary::setup_readers): New function.
581 (Sized_incremental_binary::has_incremental_info_): New data member.
582 (Sized_incremental_binary::inputs_reader_): New data member.
583 (Sized_incremental_binary::symtab_reader_): New data member.
584 (Sized_incremental_binary::relocs_reader_): New data member.
585 (Sized_incremental_binary::got_plt_reader_): New data member.
586 (Sized_incremental_binary::current_input_file_): New data member.
591 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
596 * archive.cc (Archive::include_member): Adjust call to report_object.
597 (Add_archive_symbols::run): Add script_info to call to
598 report_archive_begin.
599 (Lib_group::include_member): Adjust call to report_object.
600 (Add_lib_group_symbols::run): Adjust call to report_object.
601 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
602 blocks. Add object count for script input files.
603 * incremental.cc (Incremental_inputs::report_archive_begin): Add
604 script_info parameter; change all callers.
605 (Incremental_inputs::report_object): Add script_info parameter;
607 (Incremental_inputs::report_script): Store backpointer to
608 incremental info entry.
609 (Output_section_incremental_inputs::set_final_data_size): Record
610 additional information for scripts.
611 (Output_section_incremental_inputs::write_info_blocks): Likewise.
612 * incremental.h (Incremental_script_entry::add_object): New function.
613 (Incremental_script_entry::get_object_count): New function.
614 (Incremental_script_entry::get_object): New function.
615 (Incremental_script_entry::objects_): New data member; adjust
617 (Incremental_inputs::report_archive_begin): Add script_info parameter.
618 (Incremental_inputs::report_object): Add script_info parameter.
619 (Incremental_inputs_reader::get_object_count): New function.
620 (Incremental_inputs_reader::get_object_offset): New function.
621 * options.cc (Input_arguments::add_file): Return reference to
623 * options.h (Input_argument::set_script_info): New function.
624 (Input_argument::script_info): New function.
625 (Input_argument::script_info_): New data member; adjust all
627 (Input_file_group::add_file): Return reference to new input argument.
628 (Input_file_lib::add_file): Likewise.
629 (Input_arguments::add_file): Likewise.
630 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
631 * script.cc (Parser_closure::Parser_closure): Add script_info
632 parameter; adjust all callers.
633 (Parser_closure::script_info): New function.
634 (Parser_closure::script_info_): New data member.
635 (read_input_script): Report scripts earlier to incremental info.
636 (script_add_file): Set script_info in Input_argument.
637 (script_add_library): Likewise.
638 * script.h (Script_options::Script_info): Rewrite class.
642 * archive.cc (Library_base::should_include_member): Move
643 method here from class Archive.
644 (Archive::Archive): Initialize base class.
645 (Archive::should_include_member): Move to base class.
646 (Archive::do_for_all_unused_symbols): New function.
647 (Add_archive_symbols::run): Remove redundant access to
649 (Lib_group::Lib_group): Initialize base class.
650 (Lib_group::do_filename): New function.
651 (Lib_group::include_member): Pass pointer to Lib_group to
653 (Lib_group::do_for_all_unused_symbols): New function.
654 (Add_lib_group_symbols::run): Report archive information for
656 * archive.h (class Library_base): New base class.
657 (class Archive): Derive from Library_base.
658 (Archive::filename): Move to base class.
659 (Archive::set_incremental_info): Likewise.
660 (Archive::incremental_info): Likewise.
661 (Archive::Should_include): Likewise.
662 (Archive::should_include_member): Likewise.
663 (Archive::Armap_entry): Remove.
664 (Archive::Unused_symbol_iterator): Remove.
665 (Archive::unused_symbols_begin): Remove.
666 (Archive::unused_symbols_end): Remove.
667 (Archive::do_filename): New function.
668 (Archive::do_get_mtime): New function.
669 (Archive::do_for_all_unused_symbols): New function.
670 (Archive::task_): Move to base class.
671 (Archive::incremental_info_): Likewise.
672 (class Lib_group): Derive from Library_base.
673 (Lib_group::do_filename): New function.
674 (Lib_group::do_get_mtime): New function.
675 (Lib_group::do_for_all_unused_symbols): New function.
676 (Lib_group::task_): Move to base class.
677 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
679 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
681 * incremental.cc (Incremental_inputs::report_archive_begin):
682 Use Library_base; call library's get_mtime; add incremental inputs
683 entry before members.
684 (class Unused_symbol_visitor): New class.
685 (Incremental_inputs::report_archive_end): Use Library_base; use
686 visitor class to record unused symbols; don't add incremental inputs
688 (Incremental_inputs::report_object): Use Library_base.
690 (Incremental_archive_entry::Incremental_archive_entry): Remove
691 unused Archive parameter.
692 (Incremental_inputs::report_archive_begin): Use Library_base.
693 (Incremental_inputs::report_archive_end): Likewise.
694 (Incremental_inputs::report_object): Likewise.
695 * object.cc (Sized_relobj::do_for_all_global_symbols): New
697 * object.h (Object::for_all_global_symbols): New function.
698 (Object::do_for_all_global_symbols): New function.
699 (Sized_relobj::do_for_all_global_symbols): New function.
700 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
702 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
707 * archive.cc (Archive::interpret_header): Return -1 if something
708 goes wrong. Change callers accordingly.
712 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
713 * testsuite/Makefile.in: Regenerate.
717 * plugin.cc (get_view): New.
718 (Plugin::load): Pass get_view to the plugin.
719 (Plugin_manager::get_view): New.
723 * testsuite/final_layout.sh: Rewrite to not use dc.
724 * testsuite/relro_test.sh: Fail if dc is not present.
728 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
730 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
731 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
733 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
734 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
738 * script-sections.cc (Sort_output_sections::script_compare):
739 Rename from is_before, change return type.
740 (Sort_output_sections::operator()): Adjust accordingly.
745 * testsuite/odr_violation2.cc: Add comment to make all error line
746 numbers double digits.
747 * testsuite/debug_msg.sh: Adjust expected errors.
751 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
752 but mark earlier ones as non-canonical
753 (offset_to_iterator): Update search target and example
754 (do_addr2line): Return extra lines in a vector*
755 (format_file_lineno): Extract from do_addr2line
756 (one_addr2line): Add vector* out-param
757 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
758 when a lineno entry appeared last for its instruction
759 (Dwarf_line_info): Add vector* out-param
760 * object.cc (Relocate_info): Pass NULL for the vector* out-param
761 * symtab.cc (Odr_violation_compare): Include the lineno in the
763 (linenos_from_loc): New. Combine the canonical line for an
764 address with its other lines.
765 (True_if_intersect): New. Helper functor to make
766 std::set_intersection a query.
767 (detect_odr_violations): Compare sets of lines instead of just
768 one line for each function. This became less deterministic, but
769 has fewer false positives.
770 * symtab.h: Declarations.
771 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
772 mix an optimized and non-optimized object in the same binary
773 (odr_violation2.so): Same.
774 * testsuite/Makefile.in: Regenerate from Makefile.am.
775 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
776 * testsuite/debug_msg.sh: Update line numbers and add
778 * testsuite/odr_violation1.cc: Use OdrDerived, in a
779 non-optimized context.
780 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
781 isn't inlined, and use OdrDerived in an optimized context.
782 * testsuite/odr_header1.h: Defines OdrDerived, where
783 optimization will change the
784 first-instruction-in-the-destructor's file and line number.
785 * testsuite/odr_header2.h: Defines OdrBase.
789 * fileread.cc (File_read::clear_views): Don't delete the whole
795 * fileread.cc: #include <climits>.
796 (GOLD_IOV_MAX): Define.
797 (File_read::read_multiple): Limit number of entries by iov_max.
798 * fileread.h (class File_read): Always set max_readv_entries to
804 * options.h (class General_options): Add -dy and -dn.
808 * testsuite/script_test_9.t: Add TLS segment.
812 * configure.ac: Add check for gnu_indirect_function support in
813 the toolchain building binutils.
814 * configure: Rebuild.
818 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
820 (Symbol_table::sized_finalize_symbol) Mark symbol only present
821 in plugin files as not needed in the symbol table.
825 * output.cc (Output_section::add_input_section): Delay fill
826 generation for section ordering.
831 * object.h (class Sized_relobj): Remove clear_local_symbols.
832 * reloc.cc (Sized_relobj::do_relocate): Don't call
837 * plugin.cc (is_visible_from_outside): Return true for symbols
842 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
847 * icf.h (is_section_foldable_candidate): Change type of parameter
849 * icf.cc (Icf::find_identical_sections): Change type of local variable
850 section_name to be std::string.
851 (is_function_ctor_or_dtor): Change type of parameter to std::string.
855 * script.cc (script_add_extern): Rewrite to use
856 add_symbol_reference.
860 * icf.cc (get_section_contents): Always lock section's object.
864 * options.h (class General_options): Accept
865 --no-detect-odr-violations.
869 * version.cc (version_string): Bump to 1.11.
873 * plugin.cc (class Plugin_rescan): Define new class.
874 (Plugin_manager::claim_file): Set any_claimed_.
875 (Plugin_manager::save_archive): New function.
876 (Plugin_manager::save_input_group): New function.
877 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
879 (Plugin_manager::new_undefined_symbol): New function.
880 (Plugin_manager::rescan): New function.
881 (Plugin_manager::rescannable_defines): New function.
882 (Plugin_manager::add_input_file): Set any_added_.
883 * plugin.h (class Plugin_manager): define new fields rescannable_,
884 undefined_symbols_, any_claimed_, and any_added_. Declare
885 Plugin_rescan as friend. Declare new functions.
886 (Plugin_manager::Rescannable): Define type.
887 (Plugin_manager::Rescannable_list): Define type.
888 (Plugin_manager::Undefined_symbol_list): Define type.
889 (Plugin_manager::Plugin_manager): Initialize new fields.
890 * archive.cc (Archive::defines_symbol): New function.
891 (Add_archive_symbols::run): Pass archive to plugins if any.
892 * archive.h (class Archive): Declare defines_symbol.
893 * readsyms.cc (Input_group::~Input_group): New function.
894 (Finish_group::run): Pass input_group to plugins if any.
895 * readsyms.h (class Input_group): Declare destructor.
896 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
901 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
903 (Layout::set_segment_offsets): Reset increase_relro before calling
904 set_section_addresses a second time.
908 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
909 sections before NOBITS sections.
913 * version.cc (print_version): Update copyright to 2011.
917 * output.h (Output_data_reloc::add_output_section): Pass OD instead
918 of OS to this->add. Add OD parameter to second form of the function.
922 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
923 second of two consecutive entries with same offset.
927 * testsuite/Makefile.am (ifuncmain2static_LDADD)
928 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
929 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
930 to avoid unneeded links against $(LDADD).
931 * testsuite/Makefile.in: Regenerate.
936 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
937 for R_X86_64_32 and R_X86_64_PC32.
938 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
939 ver_matching_def_pic.o.
940 (ver_matching_def_pic.o): New target.
944 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
945 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
946 Move definition before File_read::View member definitions.
947 (File_read::View::~View): Initialize and hold lock before
948 updating current_mapped_bytes.
952 * dwarf_reader.cc: Remove outdated comment.
953 * gold-threads.cc: Fix typo in error message.
954 * archive.cc: Fix typos in comments.
955 * archive.h: Likewise.
956 * arm-reloc-property.cc: Likewise.
957 * arm-reloc-property.h: Likewise.
958 * arm-reloc.def: Likewise.
960 * attributes.h: Likewise.
962 * ehframe.cc: Likewise.
963 * fileread.h: Likewise.
967 * incremental.h: Likewise.
968 * int_encoding.cc: Likewise.
969 * layout.h: Likewise.
972 * object.cc: Likewise.
973 * object.h: Likewise.
974 * options.cc: Likewise.
975 * readsyms.cc: Likewise.
976 * reduced_debug_output.cc: Likewise.
977 * reloc.cc: Likewise.
978 * script-sections.cc: Likewise.
979 * sparc.cc: Likewise.
980 * symtab.h: Likewise.
981 * target-reloc.h: Likewise.
982 * target.cc: Likewise.
983 * target.h: Likewise.
984 * timer.cc: Likewise.
986 * x86_64.cc: Likewise.
990 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
992 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
993 parameter; change all callers.
994 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
995 * options.h (warn_execstack): New option.
999 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1000 like function call relocations.
1004 * archive.cc (Archive::get_elf_object_for_member): Permit
1005 punconfigured to be NULL.
1006 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1007 (Archive::include_member): Pass NULL to get_elf_object_for_member
1008 if we searched for the archive and this is the first included
1013 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1014 track_relocs_type_ field.
1015 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1016 Set track_relocs_type_.
1017 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1018 contents when using RELA relocs.
1019 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1021 * reloc.cc (Track_relocs::next_addend): New function.
1022 * reloc.h (class Track_relocs): Declare next_addend.
1026 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1031 * README: Update compilers known to work and fail.
1035 * configure.in: For --enable-gold, handle value `default' instead of
1036 `both*'. Always install ld as ld.bfd, install as ld if gold is
1038 * configure: Regenerate.
1042 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1043 and right_alignment to be zero. Store result alignment only if it is
1044 greater than existing alignment.
1049 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1050 Check for ".zdebug_line".
1055 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1056 by reference; adjust all callers.
1057 * output.cc (Output_segment::set_section_addresses): Adjust references
1058 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1060 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1061 end at page boundary.
1066 * layout.cc (Layout::choose_output_section): Transform names of
1067 compressed sections even when using a script with a SECTIONS clause.
1068 (Layout::output_section_name): Remove code to transform
1069 compressed debug section names.
1070 * output.cc (Output_section::add_input_section): Use uncompressed
1071 section size when tracking input sections.
1075 * symtab.h (Symbol::NON_PIC_REF): Remove.
1076 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1077 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1078 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1079 (Symbol::use_plt_offset): Take a flags argument and pass it
1080 directly to needs_dynamic_reloc. Restrict check for undefined
1081 weak symbols to function calls.
1082 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1083 (Target_arm::Scan::global): Use it.
1084 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1085 (Target_arm::Relocate::relocate): Likewise.
1086 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1087 parameter with an r_type parameter. Use get_reference_flags
1089 (Target_arm::Relocate::relocate): Update accordingly.
1090 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1091 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1092 (Target_i386::Scan::global): Likewise.
1093 (Target_i386::Relocate::relocate): Likewise.
1094 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1095 parameter with an r_type parameter. Use get_reference_flags
1097 (Target_i386::Relocate::relocate): Update accordingly.
1098 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1099 (Target_powerpc::Scan::global): Use it.
1100 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1101 (Target_powerpc::Relocate::relocate): Likewise.
1102 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1103 (Target_sparc::Scan::global): Use it.
1104 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1105 (Target_sparc::Relocate::relocate): Likewise.
1106 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1107 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1108 (Target_x86_64::Scan::global): Likewise.
1109 (Target_x86_64::Relocate::relocate): Likewise.
1114 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1115 (Arm_exidx_merge_section::section_contents_): New data member.
1116 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1117 (Arm_input_section::~Arm_input_section): De-allocate memory.
1118 (Arm_input_section::original_contents_): New data member.
1119 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1120 in parameters instead of calling Object::section_contents without
1122 (Arm_output_section::group_section): New parameter TASK. Pass it
1123 to callees that need locking objects.
1124 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1125 to lock EXIDX input sections. Fix a formatting issue. Call
1126 Arm_exidx_merged_section::build_contents to create merged section
1128 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1129 to lock object of stub table owner.
1130 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1131 TEXT_SIZE to initialize data member TEXT_SIZE_.
1132 (Arm_exidx_input_section::addralign): Fix typo in comment.
1133 (Arm_exidx_input_section::text_size): New method.
1134 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1135 that require locking objects. Lock objects before scanning for stubs
1136 and updating local symbols.
1137 (Arm_input_section<big_endian>::init): Copy contents of original
1139 (Arm_input_section<big_endian>::do_write): Use saved contents of
1140 original input section instead of calling Object::section_contents
1142 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1143 size without calling Object::section_size().
1144 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1145 for size. Allocate a buffer for merged EXIDX entries.
1146 (Arm_exidx_merged_section::build_contents): New method.
1147 (Arm_exidx_merged_section::do_write): Move merge section contents
1148 building code to Arm_exidx_merged_section::build_contetns. Write
1149 out contetns in buffer instead of building it on the fly.
1150 (Arm_relobj::make_exidx_input_section): Also pass text section size
1151 to Arm_exidx_input_section constructor.
1152 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1153 (Arm_dynobj::do_read_symbols): Fix memory leak.
1154 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1155 * target.h: (class Task): Add forward declaration.
1156 (Target::relax): Add new parameter TASK and pass it to
1158 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1163 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1164 object when reading from the file.
1165 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1167 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1168 when reading section contents.
1169 (get_section_contents): Likewise.
1170 (icf::find_identical_sections): Likewise.
1171 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1172 object when reading from the file.
1173 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1174 the object when doing deferred section layout.
1179 * script.h (class Symbol_assignment: name): New member. Returns
1180 the name of the symbol.
1181 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1182 Returns true if the given symbol name is on the list of
1183 assignments wating to be processed.
1184 * archive.cc (should_incldue_member): If the symbol is undefined,
1185 check to see if it is on the list of symbols pending assignment.
1189 * script-sections.cc (Script_sections::find_memory_region): Check
1190 for a NULL output section pointer.
1194 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1195 Output_section::add_relaxed_input_section.
1196 * output.cc (Output_section::add_relaxed_input_section): Add new
1197 arguments LAYOUT and NAME. Set section order index.
1198 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1199 Copy section order index.
1200 * output.h (Output_section::add_relaxed_input_section): Add new
1201 arguments LAYOUT and NAME.
1205 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1206 NATIVE_OR_CROSS_LINKER.
1207 * testsuite/Makefile.in: Regenerate.
1211 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1212 without SHF_LINK_ORDER flags.
1213 * layout.cc (Layout::choose_output_section): Do not filter
1214 SHF_LINK_ORDER flag in a relocatable link.
1218 * output.h (Output_segment::set_section_addresses): Change function
1219 signature. Update all callers.
1220 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1222 (Output_segment::set_section_addresses): Align after last TLS
1223 section. Add padding before last relro section instead of after.
1227 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1228 GOT output section to be writable.
1232 * debug.h (DEBUG_INCREMENTAL): New flag.
1233 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1234 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1236 * incremental.cc (report_command_line): Ignore all forms of
1238 * layout.cc (Layout::Layout): Check parameters for incremental link
1240 * options.cc (General_options::parse_incremental): New function.
1241 (General_options::parse_no_incremental): New function.
1242 (General_options::parse_incremental_full): New function.
1243 (General_options::parse_incremental_update): New function.
1244 (General_options::incremental_mode_): New data member.
1245 (General_options::finalize): Check incremental_mode_.
1246 * options.h (General_options): Update help text for --incremental.
1247 Add --no-incremental, --incremental-full, --incremental-update.
1248 (General_options::Incremental_mode): New enum type.
1249 (General_options::incremental_mode): New function.
1250 (General_options::incremental_mode_): New data member.
1251 * parameters.cc (Parameters::incremental_mode_): New data member.
1252 (Parameters::set_options): Set incremental_mode_.
1253 (Parameters::set_incremental_full): New function.
1254 (Parameters::incremental): New function.
1255 (Parameters::incremental_update): New function.
1256 (set_parameters_incremental_full): New function.
1257 * parameters.h (Parameters::set_incremental_full): New function.
1258 (Parameters::incremental): New function.
1259 (Parameters::incremental_update): New function.
1260 (Parameters::incremental_mode_): New data member.
1261 (set_parameters_incremental_full): New function.
1262 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1263 incremental link mode.
1264 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1265 (Sized_relobj::do_relocate_sections): Likewise.
1266 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1268 * testsuite/Makefile.in: Regenerate.
1269 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1273 * script-sections.h (class Script_sections): Make
1274 Sections_elements typedef public.
1275 * script-sections.cc (class Sort_output_sections): Add elements_
1276 field. Add constructor which sets it; change all callers.
1277 (Sort_output_sections::is_before): New function.
1278 (Sort_output_sections::operator()): Call is_before.
1279 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1281 * testsuite/script_test_10.sh: New test. Test script section
1283 * testsuite/script_test_10.t: Likewise.
1284 * testsuite/script_test_10.s: Likewise.
1285 * testsuite/Makefile.am: Wrap the cross linker tests and the
1286 common tests into NATIVE_OR_CROSS_LINKER.
1287 (check_SCRIPTS): Add script_test_10.sh.
1288 (check_DATA): Add script_test_10.stdout.
1289 (script_test_10.o, script_test_10): New targets.
1290 (script_test_10.stdout): New target.
1291 * configure, testsuite/Makefile.in: Regenerate.
1295 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1296 error for the deprecated relocations.
1297 (Target_arm::Scan::global): Likewise.
1298 (Target_arm::Relocate::relocate): Likewise.
1302 * fileread.cc (Input_file::find_file): Initialize *found_name
1303 and *namep when using the fallback search for case 4.
1307 * options.h (class General_options): Redefine -z lazy as an alias for
1308 the negation of -z now.
1312 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1317 * script-sections.cc(class Memory_region): Remove
1318 current_lma_offset_ field. Rename current_vma_offset_ to
1319 current_offset_. Add last_section_ field.
1320 (Memory_region::get_current_vma_address): Rename to
1321 get_current_address.
1322 (Memory_region::get_current_lma_address): Delete.
1323 (Memory_region::increment_vma_offset): Rename to
1325 (Memory_region::increment_lma_offset): Delete.
1326 (Memory_region::attributes_compatible): New method. Returns
1327 true if the provided section is compatible with the region.
1328 (Memory_region::get_last_section): New method. Returns the last
1329 section to use the region.
1330 (Memory_region::set_last_section): New method. Stores the last
1331 section to use the region.
1332 (Script_sections::block_in_region): New method. Returns true if
1333 a block of memory is contained within a region.
1334 (Script_sections::find_memory_region): New method. Locates a
1335 memory region to be used to set a VMA or LMA address.
1336 (Output_section_definition::set_section_addresses): Add code to
1337 check for addresses set by memory regions.
1338 (Output_segment::set_section_addresses): Remove memory region
1340 (Script_sections::create_segment): Add a warning if a header
1341 segment is created outside of any region.
1342 * script-sections.h (class Script_sections): Add prototypes for
1343 find_memory_region and block_in_region methods.
1344 * testsuite/memory_test.s: Use .long instead of .word.
1345 * testsuite/memory_test.t: Add some more output sections.
1346 * testsuite/memory_test.sh: Update expected output.
1350 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1351 defintion to symtab.h
1352 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1353 declaration to defintion.
1357 * expression.cc (eval): Replace dummy argument with NULL.
1358 (eval_maybe_dot): Check for a NULL result section pointer.
1359 (Symbol_expression::value): Likewise.
1360 (Dot_expression::value): Likewise.
1361 (BINARY_EXPRESSION): Likewise.
1362 (Max_expression::value): Likewise.
1363 (Min_expression::value): Likewise.
1364 (Absolute_expression::value): Likewise.
1365 (Addr_expression::value_from_output_section): Likewise.
1366 (Loaddddr_expression::value_from_output_section): Likewise.
1367 (Segment_start_expression::value): Likewise.
1368 * script-sections.cc
1369 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1371 (Sections_elememt_dot_assignment::set_section_addresses):
1373 (Output_data_expression::do_write_to_buffer): Likewise.
1374 (Output_section_definition::finalize_symbols): Likewise.
1375 (Output_section_definition::set_section_addresses): Likewise.
1379 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1383 * target.h (Target::can_icf_inline_merge_sections): New virtual
1385 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1387 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1389 * icf.cc (get_section_contents): Inline merge sections only when
1394 * configure: Regenerate.
1398 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1399 * testsuite/Makefile.am (memory_test.o): New target.
1400 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1402 * testsuite/Makefile.in: Rebuild.
1406 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1407 defintion if relocation uses GOT entries of the symbol.
1408 * testsuite/icf_safe_test.sh: Fix test.
1409 * testsuite/icf_safe_so_test.sh: Fix test.
1413 * script_sections.cc (class Memory_region): Remove "NULL" from
1414 vector initializations.
1418 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1419 Resolve forwarding symbols.
1423 * gold/testsuite/script_test_3.t: Add ARM special sections.
1424 * gold/testsuite/script_test_4.t: Same.
1425 * gold/testsuite/script_test_5.t: Same.
1426 * gold/testsuite/script_test_6.t: Same.
1427 * gold/testsuite/script_test_7.t: Same.
1428 * gold/testsuite/script_test_7.t: Same.
1429 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1433 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1434 (Target_x86_64::Relocate::relocate_tls): Replace check for
1435 saw_tls_block_reloc_ with test for executable section.
1439 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1440 position-independent executables to shared libraries need dynamic
1442 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1443 position-independent executables.
1444 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1445 * testsuite/Makefile.in: Regenerate.
1450 * testsuite/memory_test.t: Discard any sections that are not
1456 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1457 "This::" to work around a bug in gcc 4.2.
1459 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1463 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1464 sections with different PF_X flags in the same segment.
1465 (Layout::find_first_load_seg): Search all segments to find the first
1467 * options.h (rosegment): New.
1471 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1475 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1476 (Arm_relobj::do_relocate_sections): Add new parameter for output
1477 file to match the parent.
1478 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1479 of local symbols instead of input values. Update code to track
1480 changes in gold::relocate_section.
1481 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1482 (Sized_relobj::compute_final_local_value_internal): New methods.
1483 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1484 body into private version of Sized_relobj::compute_final_local_value.
1485 Call the inline method.
1486 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1487 merged symbol value if there is one.
1488 (Symbol_value::has_output_value): New method defintiion.
1489 (Sized_relobj::Compute_final_local_value_status): New enum type.
1490 (Sized_relobj::compute_final_local_value): New methods.
1491 (Sized_relobj::compute_final_local_value_internal): New methods.
1492 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1493 and arm_cortex_a8.sh.
1494 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1495 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1497 * Makefile.in: Regenerate.
1498 * testsuite/arm_bl_out_of_range.s: Update test.
1499 * testsuite/thumb_bl_out_of_range.s: Ditto.
1500 * testsuite/thumb_blx_out_of_range.s: Ditto.
1501 * testsuite/arm_branch_out_of_range.sh: New file.
1502 * testsuite/arm_cortex_a8.sh: Ditto.
1503 * testsuite/arm_cortex_a8_b.s: Ditto.
1504 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1505 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1506 * testsuite/arm_cortex_a8_bl.s: Ditto.
1507 * testsuite/arm_cortex_a8_blx.s: Ditto.
1508 * testsuite/arm_cortex_a8_local.s: Ditto.
1509 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1510 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1514 * Makefile.am (memory_test.stdout): Run readelf with -W.
1515 * Makefile.in: Regenerate.
1516 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1521 * script-sections.cc (Script_sections::add_memory_region): Convert
1522 field precision to int.
1523 * script.cc (script_set_section_region, script_set_section_region):
1524 Convert field precision to int.
1528 * arm.cc (do_finalize_sections): Create the __exidx_start and
1529 __exdix_end symbols even when the section is missing.
1533 * README: Remove claim that MEMORY is not supported.
1534 * expression.cc (script_exp_function_origin)
1535 (script_exp_function_length): Move from here to ...
1536 * script.cc: ... here.
1537 (script_set_section_region, script_add_memory)
1538 (script_parse_memory_attr, script_include_directive): New
1540 * script-sections.cc
1541 (class Memory_region): New class.
1542 (class Output_section_definition): Add set_memory_region,
1543 set_section_vma, set_section_lma and get_section_name methods.
1544 (class Script_Sections): Add add_memory_region,
1545 find_memory_region, find_memory_region_origin,
1546 find_memory_region_length and set_memory_region methods.
1547 Have set_section_addresses method walk the list of set memory
1549 Extend the print methos to display memory regions.
1550 * script-sections.h: Add prototypes for new methods.
1551 Add enum for MEMORY region attributes.
1552 * yyscript.y: Add support for parsing MEMORY regions.
1553 * script-c.h: Add prototypes for new functions.
1554 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1555 * testsuite/Makefile.in: Regenerate.
1556 * testsuite/memory_test.sh: New script.
1557 * testsuite/memory_test.s: New assembler source file.
1558 * testsuite/memory_test.t: New linker script.
1562 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1563 reference override an existing dynamic weak reference.
1564 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1565 * testsuite/Makefile.in: Regenerate.
1566 * testsuite/dyn_weak_ref.sh: New file.
1567 * testsuite/dyn_weak_ref_1.c: Ditto.
1568 * testsuite/dyn_weak_ref_2.c: Ditto.
1572 * incremental.h (class Incremental_input_entry): Add virtual
1577 * testsuite/start_lib_test_3.c: Mark t3 as used.
1581 * options.cc (version_script): Fix small typo in previous
1586 * archive.cc: Formatting fixes: Remove whitespace between
1587 typename and following asterisk. Remove whitespace between
1588 function name and opening parenthesis.
1589 * archive.h: Likewise.
1591 * attributes.cc: Likewise.
1592 * attributes.h: Likewise.
1593 * common.cc: Likewise.
1594 * copy-relocs.cc: Likewise.
1595 * dirsearch.h: Likewise.
1596 * dynobj.cc: Likewise.
1597 * ehframe.cc: Likewise.
1598 * ehframe.h: Likewise.
1599 * expression.cc: Likewise.
1600 * fileread.cc: Likewise.
1601 * fileread.h: Likewise.
1603 * gold-threads.cc: Likewise.
1604 * gold.cc: Likewise.
1605 * i386.cc: Likewise.
1607 * incremental-dump.cc: Likewise.
1608 * incremental.cc: Likewise.
1609 * layout.cc: Likewise.
1610 * layout.h: Likewise.
1611 * main.cc: Likewise.
1612 * merge.cc: Likewise.
1613 * merge.h: Likewise.
1614 * object.cc: Likewise.
1615 * object.h: Likewise.
1616 * options.cc: Likewise.
1617 * options.h: Likewise.
1618 * output.cc: Likewise.
1619 * output.h: Likewise.
1620 * plugin.cc: Likewise.
1621 * plugin.h: Likewise.
1622 * powerpc.cc: Likewise.
1623 * reloc.cc: Likewise.
1624 * script-c.h: Likewise.
1625 * script-sections.cc: Likewise.
1626 * script.cc: Likewise.
1627 * stringpool.cc: Likewise.
1628 * symtab.cc: Likewise.
1629 * symtab.h: Likewise.
1630 * target.cc: Likewise.
1631 * timer.cc: Likewise.
1632 * timer.h: Likewise.
1633 * version.cc: Likewise.
1634 * x86_64.cc: Likewise.
1639 * layout.cc (segment_precedes): Sort segments by their physical
1640 addresses, if they have been set.
1644 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1646 (Lib_group::include_member): Unlock object after deleting its
1648 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1654 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1655 constructor, and set_blocker.
1656 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1658 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1659 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1660 * testsuite/Makefile.am (start_lib_test): New test case.
1661 * testsuite/Makefile.in: Regenerate.
1662 * testsuite/start_lib_test_main.c: New file.
1663 * testsuite/start_lib_test_1.c: New file.
1664 * testsuite/start_lib_test_2.c: New file.
1665 * testsuite/start_lib_test_3.c: New file.
1669 * Makefile.in: Rebuild with automake 1.11.1.
1670 * aclocal.m4: Likewise.
1671 * testsuite/Makefile.in: Likewise.
1676 * i386.cc (class Output_data_plt_i386): Update declarations.
1677 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1678 local_ifuncs_ fields.
1679 (Target_i386::do_plt_section_for_global): New function.
1680 (Target_i386::do_plt_section_for_local): New function.
1681 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1682 parameter; change all callers. Initialize global_ifuncs_ and
1683 local_ifuncs_. If doing a static link define __rel_iplt_start and
1685 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1686 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1687 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1689 (Target_i386::make_plt_section): New function, broken out of
1690 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1691 (Target_i386::make_plt_entry): Call make_plt_section.
1692 (Target_i386::make_local_ifunc_plt_entry): New function.
1693 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1694 (Target_i386::Scan::local): Handle IFUNC symbols. Add
1695 R_386_IRELATIVE to switch.
1696 (Target_i386::Scan::global): Likewise.
1697 (Target_i386::Relocate::relocate): Likewise.
1698 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1700 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1701 (Target_x86_64::do_plt_section_for_global): New function.
1702 (Target_x86_64::do_plt_section_for_local): New function.
1703 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1704 parameter; change all callers. If doing a static link define
1705 __rela_iplt_start and __rela_iplt_end.
1706 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1707 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1708 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1710 (Target_x86_64::make_local_ifunc_plt_entry): New function.
1711 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1713 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1714 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
1715 R_X86_64_IRELATIVE to switch.
1716 (Target_x86_64::Scan::global): Likewise.
1717 (Target_x86_64::Relocate::relocate): Likewise.
1718 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1720 * target.h (class Target): Add plt_section_for_global and
1721 plt_section_for_local functions. Add do_plt_section_for_global
1722 and do_plt_section_for_local virtual functions.
1723 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
1724 clarifying comments.
1725 (Symbol::use_plt_offset): Handle IFUNC symbol.
1726 * object.cc (Sized_relobj::Sized_relobj): Initialize
1728 (Sized_relobj::local_has_plt_offset): New function.
1729 (Sized_relobj::local_plt_offset): New function.
1730 (Sized_relobj::set_local_plt_offset): New function.
1731 (Sized_relobj::do_count): Handle IFUNC symbol.
1732 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
1733 a bit away from input_shndx_ field. Add set_is_func_symbol and
1734 is_ifunc_symbol functions.
1735 (class Sized_relobj): Update declarations. Remove Tls_got_entry
1736 and Local_tls_got_offsets. Define Local_plt_offsets. Add
1737 local_plt_offsets_ field.
1738 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1739 * output.h (class Output_section_data): Add non-const
1740 output_section function.
1741 (class Output_data_got): Update declarations.
1742 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1743 Add use_plt_offset parameter to global and local constructors.
1744 Change all callers. Change local_sym_index_ field to 31 bits.
1745 Change GSYM_CODE and CONSTANT_CODE accordingly.
1746 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1747 doing a static link don't set sh_link field.
1748 (Output_data_got::Got_entry::write): Use PLT offset if
1750 (Output_data_got::add_global_plt): New function.
1751 (Output_data_got::add_local_plt): New function.
1752 * target-reloc.h (relocate_section): Handle IFUNC symbol.
1753 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1754 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1755 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1756 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1758 * testsuite/ifunc-sel.h: New file.
1759 * testsuite/ifuncmain1.c: New file.
1760 * testsuite/ifuncmain1vis.c: New file.
1761 * testsuite/ifuncmod1.c: New file.
1762 * testsuite/ifuncdep2.c: New file.
1763 * testsuite/ifuncmain2.c: New file.
1764 * testsuite/ifuncmain3.c: New file.
1765 * testsuite/ifuncmod3.c: New file.
1766 * testsuite/ifuncmain4.c: New file.
1767 * testsuite/ifuncmain5.c: New file.
1768 * testsuite/ifuncmod5.c: New file.
1769 * testsuite/ifuncmain6pie.c: New file.
1770 * testsuite/ifuncmod6.c: New file.
1771 * testsuite/ifuncmain7.c: New file.
1772 * configure, testsuite/Makefile.in: Rebuild.
1777 (Output_section_incremental_inputs::write_input_files): Add cast
1778 to avoid signed/unsigned comparison warning.
1779 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1783 * common.cc (Sort_commons::operator()): Remove unnecessary code.
1787 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1792 * resolve.cc (Symbol_table::should_override): When a weak dynamic
1793 defintion overrides non-weak undef, remember that the original undef
1795 * symtab.cc (Symbol_table::sized_write_global): For undef without
1796 an original weak binding, set binding to global in output.
1797 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1798 * testsuite/Makefile.in: Regenerate.
1799 * testsuite/strong_ref_weak_def.sh: New file.
1800 * testsuite/strong_ref_weak_def_1.c: Ditto.
1801 * testsuite/strong_ref_weak_def_2.c: Ditto.
1805 * testsuite/incremental_test.sh: Rewrite.
1806 * testsuite/incremental_test_1.c: Rewrite.
1807 * testsuite/incremental_test_2.c: Rewrite.
1811 * arm.cc (Target_arm::got_size): Add const.
1812 (Target_arm::got_entry_count): New function.
1813 (Target_arm::plt_entry_count): New function.
1814 (Target_arm::first_plt_entry_offset): New function.
1815 (Target_arm::plt_entry_size): New function.
1816 (Output_data_plt_arm::entry_count): New function.
1817 (Output_data_plt_arm::first_plt_entry_offset): New function.
1818 (Output_data_plt_arm::get_plt_entry_size): New function.
1819 * i386.cc (Target_i386::got_size): Add const.
1820 (Target_i386::got_entry_count): New function.
1821 (Target_i386::plt_entry_count): New function.
1822 (Target_i386::first_plt_entry_offset): New function.
1823 (Target_i386::plt_entry_size): New function.
1824 (Output_data_plt_i386::entry_count): New function.
1825 (Output_data_plt_i386::first_plt_entry_offset): New function.
1826 (Output_data_plt_i386::get_plt_entry_size): New function.
1827 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1828 find_incremental_inputs_sections. Dump incremental_got_plt section.
1829 * incremental.cc: Include target.h.
1830 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1831 parameter. Adjust all callers. Find incremental_got_plt section.
1832 (Incremental_inputs::create_data_sections): Create incremental_got_plt
1834 (Output_section_incremental_inputs::set_final_data_size): Calculate
1835 size of incremental_got_plt section.
1836 (Output_section_incremental_inputs::do_write): Write the
1837 incremental_got_plt section.
1838 (Got_plt_view_info): New struct.
1839 (Local_got_offset_visitor): New class.
1840 (Global_got_offset_visitor): New class.
1841 (Global_symbol_visitor_got_plt): New class.
1842 (Output_section_incremental_inputs::write_got_plt): New function.
1843 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1844 Add parameter. Adjust all callers.
1845 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1846 (Incremental_inputs::got_plt_section): New function.
1847 (Incremental_inputs::got_plt_section_): New data member.
1848 (Incremental_got_plt_reader): New class.
1849 * layout.cc (Layout::create_incremental_info_sections): Add the
1850 incremental_got_plt section.
1851 * object.h (Got_offset_list::get_list): New function.
1852 (Got offset_list::for_all_got_offsets): New function.
1853 (Sized_relobj::local_got_offset_list): New function.
1854 * powerpc.cc (Target_powerpc::got_size): Add const.
1855 (Target_powerpc::got_entry_count): New function.
1856 (Target_powerpc::plt_entry_count): New function.
1857 (Target_powerpc::first_plt_entry_offset): New function.
1858 (Target_powerpc::plt_entry_size): New function.
1859 (Output_data_plt_powerpc::entry_count): New function.
1860 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1861 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1862 * sparc.cc (Target_sparc::got_size): Add const.
1863 (Target_sparc::got_entry_count): New function.
1864 (Target_sparc::plt_entry_count): New function.
1865 (Target_sparc::first_plt_entry_offset): New function.
1866 (Target_sparc::plt_entry_size): New function.
1867 (Output_data_plt_sparc::entry_count): New function.
1868 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1869 (Output_data_plt_sparc::get_plt_entry_size): New function.
1870 * symtab.h (Symbol::got_offset_list): New function.
1871 (Symbol_table::for_all_symbols): New function.
1872 * target.h (Sized_target::got_entry_count): New function.
1873 (Sized_target::plt_entry_count): New function.
1874 (Sized_target::plt_entry_size): New function.
1875 * x86_64.cc (Target_x86_64::got_size): Add const.
1876 (Target_x86_64::got_entry_count): New function.
1877 (Target_x86_64::plt_entry_count): New function.
1878 (Target_x86_64::first_plt_entry_offset): New function.
1879 (Target_x86_64::plt_entry_size): New function.
1880 (Output_data_plt_x86_64::entry_count): New function.
1881 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1882 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1886 * archive.cc: Include incremental.h.
1887 (Archive::Archive): Initialize incremental_info_.
1888 (Archive::include_member): Record archive members in incremental info.
1889 (Add_archive_symbols::run): Record begin and end of an archive in
1891 (Lib_group::include_member): Record objects in incremental info.
1892 * archive.h (Incremental_archive_entry): Forward declaration.
1893 (Archive::set_incremental_info): New member function.
1894 (Archive::incremental_info): New member function.
1895 (Archive::Unused_symbol_iterator): New class.
1896 (Archive::unused_symbols_begin): New member function.
1897 (Archive::unused_symbols_end): New member function.
1898 (Archive::incremental_info_): New data member.
1899 * incremental-dump.cc (find_input_containing_global): New function.
1900 (dump_incremental_inputs): Dump new incremental info sections.
1901 * incremental.cc: Include symtab.h.
1902 (Output_section_incremental_inputs): New class.
1903 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1904 new incremental info sections.
1905 (Sized_incremental_binary::do_check_inputs): Likewise.
1906 (Incremental_inputs::report_archive): Remove.
1907 (Incremental_inputs::report_archive_begin): New function.
1908 (Incremental_inputs::report_archive_end): New function.
1909 (Incremental_inputs::report_object): New function.
1910 (Incremental_inputs::finalize_inputs): Remove.
1911 (Incremental_inputs::report_input_section): New function.
1912 (Incremental_inputs::report_script): Rewrite.
1913 (Incremental_inputs::finalize): Do nothing but finalize string table.
1914 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1915 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1916 (Incremental_inputs::create_data_sections): New function.
1917 (Incremental_inputs::relocs_entsize): New function.
1918 (Output_section_incremental_inputs::set_final_data_size): New function.
1919 (Output_section_incremental_inputs::do_write): New function.
1920 (Output_section_incremental_inputs::write_header): New function.
1921 (Output_section_incremental_inputs::write_input_files): New function.
1922 (Output_section_incremental_inputs::write_info_blocks): New function.
1923 (Output_section_incremental_inputs::write_symtab): New function.
1924 * incremental.h (Incremental_script_entry): Forward declaration.
1925 (Incremental_object_entry): Forward declaration.
1926 (Incremental_archive_entry): Forward declaration.
1927 (Incremental_inputs): Forward declaration.
1928 (Incremental_inputs_header_data): Remove.
1929 (Incremental_inputs_header): Remove.
1930 (Incremental_inputs_header_write): Remove.
1931 (Incremental_inputs_entry_data): Remove.
1932 (Incremental_inputs_entry): Remove.
1933 (Incremental_inputs_entry_write): Remove.
1934 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1935 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1936 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1937 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1939 (Incremental_input_entry): New class.
1940 (Incremental_script_entry): New class.
1941 (Incremental_object_entry): New class.
1942 (Incremental_archive_entry): New class.
1943 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1944 (Incremental_inputs::report_inputs): Remove.
1945 (Incremental_inputs::report_archive): Remove.
1946 (Incremental_inputs::report_archive_begin): New function.
1947 (Incremental_inputs::report_archive_end): New function.
1948 (Incremental_inputs::report_object): Change prototype.
1949 (Incremental_inputs::report_input_section): New function.
1950 (Incremental_inputs::report_script): Change prototype.
1951 (Incremental_inputs::get_reloc_count): New function.
1952 (Incremental_inputs::set_reloc_count): New function.
1953 (Incremental_inputs::create_data_sections): New function.
1954 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1955 (Incremental_inputs::inputs_section): New function.
1956 (Incremental_inputs::symtab_section): New function.
1957 (Incremental_inputs::relocs_section): New function.
1958 (Incremental_inputs::get_stringpool): Add const.
1959 (Incremental_inputs::command_line): Add const.
1960 (Incremental_inputs::inputs): Remove.
1961 (Incremental_inputs::command_line_key): New function.
1962 (Incremental_inputs::input_file_count): New function.
1963 (Incremental_inputs::input_files): New function.
1964 (Incremental_inputs::relocs_entsize): New function.
1965 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1966 (Incremental_inputs::finalize_inputs): Remove.
1967 (Incremental_inputs::Input_info): Remove.
1968 (Incremental_inputs::lock_): Remove.
1969 (Incremental_inputs::inputs_): Change type.
1970 (Incremental_inputs::inputs_map_): Remove.
1971 (Incremental_inputs::current_object_entry_): New data member.
1972 (Incremental_inputs::inputs_section_): New data member.
1973 (Incremental_inputs::symtab_section_): New data member.
1974 (Incremental_inputs::relocs_section_): New data member.
1975 (Incremental_inputs::reloc_count_): New data member.
1976 (Incremental_inputs_reader): New class.
1977 (Incremental_symtab_reader): New class.
1978 (Incremental_relocs_reader): New class.
1979 * layout.cc (Layout::finalize): Move finalization of incremental info
1980 and creation of incremental info sections to follow finalization of
1981 symbol table. Set offsets for postprocessing sections.
1982 (Layout::create_incremental_info_sections): Call
1983 Incremental_inputs::create_data_sections. Add incremental symtab
1984 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1985 sections to layout after input sections.
1986 * layout.h (struct Timespec): Forward declaration.
1987 (Layout::incremental_inputs): Add const.
1988 (Layout::create_incremental_info_sections): Add parameter.
1989 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1990 * object.cc: Include incremental.h.
1991 (Relobj::finalize_incremental_relocs): New function.
1992 (Sized_relobj::do_layout): Record input sections in incremental info.
1993 * object.h (Object::output_section): New function.
1994 (Object::output_section_offset): Moved from Relobj.
1995 (Object::get_incremental_reloc_base): New function.
1996 (Object::get_incremental_reloc_count): New function.
1997 (Object::do_output_section): New function.
1998 (Object::do_output_section_offset): Moved from Relobj.
1999 (Object::do_get_incremental_reloc_base): New function.
2000 (Object::do_get_incremental_reloc_count): New function.
2001 (Object::Object): Initialize new data members.
2002 (Relobj::output_section): Renamed do_output_section and moved to
2004 (Relobj::output_section_offset): Moved to Object.
2005 (Relobj::do_get_incremental_reloc_base): New function.
2006 (Relobj::do_get_incremental_reloc_count): New function.
2007 (Relobj::allocate_incremental_reloc_counts): New function.
2008 (Relobj::count_incremental_reloc): New function.
2009 (Relobj::finalize_incremental_relocs): New function.
2010 (Relobj::next_incremental_reloc_index): New function.
2011 (Relobj::reloc_counts_): New data member.
2012 (Relobj::reloc_bases_): New data member.
2013 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2014 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2015 (Sized_relobj::incremental_relocs_scan): New function.
2016 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2017 (Sized_relobj::incremental_relocs_write): New function.
2018 (Sized_relobj::incremental_relocs_write_reltype): New function.
2019 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2021 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2022 archives and object files elsewhere.
2023 (Add_symbols::run): Report object files here.
2024 (Finish_group::run): Report end of archive at end of group.
2025 * reloc.cc: Include layout.h, incremental.h.
2026 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2027 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2028 (Sized_relobj::incremental_relocs_scan): New function.
2029 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2030 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2031 (Sized_relobj::incremental_relocs_write): New function.
2032 (Sized_relobj::incremental_relocs_write_reltype): New function.
2033 * script.cc (read_input_script): Rewrite test for incremental link.
2034 Change call to Incremental_inputs::report_script.
2035 * symtab.h (Symbol_table::first_global_index): New function.
2036 (Symbol_table::output_count): New function.
2040 * arm.cc (Target_arm::merge_object_attributes): Check command line
2041 options --no-wchar-size-warning and --no-enum-size-warning.
2042 * options.h (General_options): Add ld-compatible options
2043 --no-enum-size-warning and --no-wchar-size-warning.
2047 * x86_64.cc (Target_x86_64::Scan::local): Use
2048 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2049 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2050 (Target_x86_64::Scan::global): Likewise.
2051 (Target_x86_64::Relocate::relocate): Likewise.
2052 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2057 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2058 to reserve space in merged_strings vector. Keep total input size
2060 (Output_merge_string::do_print_merge_stats): Print total input size.
2061 * merge.h (Output_merge_string): Add input_size_ field.
2062 * stringpool.cc (Stringpool_template::string_length): Move
2063 implementations out of Stringpool_template class and place in
2065 * stringpool.h (string_length): Move out of Stringpool_template.
2070 * layout.cc (relaxation_loop_body): If address of load segment is
2071 set, adjust address to include headers if possible.
2075 * version.cc (version_string): Bump to 1.10.
2080 * layout.h (enum Output_section_order): Define.
2081 (class Layout): Update declarations.
2082 * layout.cc (Layout::get_output_section): Add order parameter.
2083 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2084 is_first_non_relro parameters. Change all callers.
2085 (Layout::choose_output_section): Likewise.
2086 (Layout::add_output_section_data): Likewise.
2087 (Layout::make_output_section): Likewise. Set order.
2088 (Layout::default_section_order): New function.
2089 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2090 * output.cc (Output_section::Output_section): Initialize order_.
2091 Don't initialize deleted fields.
2092 (Output_segment::Output_segment): Don't initialize deleted
2094 (Output_segment::add_output_section_to_load): New function
2095 replacing add_output_section. Change all callers to call this or
2096 add_output_section_to_nonload.
2097 (Output_segment::add_output_section_to_nonload): New function.
2098 (Output_segment::remove_output_section): Rewrite.
2099 (Output_segment::add_initial_output_data): Likewise.
2100 (Output_segment::has_any_data_sections): Likewise.
2101 (Output_segment::is_first_section_relro): Likewise.
2102 (Output_segment::maximum_alignment): Likewise.
2103 (Output_segment::has_dynamic_reloc): New function replacing
2104 dynamic_reloc_count. Change all callers.
2105 (Output_segment::has_dynamic_reloc_list): New function replacing
2106 dynamic_reloc_count_list. Change all callers.
2107 (Output_segment::set_section_addresses): Rewrite.
2108 (Output_segment::set_offset): Rewrite.
2109 (Output_segment::find_first_and_last_list): Remove.
2110 (Output_segment::set_tls_offsets): Rewrite.
2111 (Output_segment::first_section_load_address): Likewise.
2112 (Output_segment::output_section_count): Likewise.
2113 (Output_segment::section_with_lowest_load_address): Likewise.
2114 (Output_segment::write_section_headers): Likewise.
2115 (Output_segment::print_sections_to_map): Likewise.
2116 * output.h (class Output_data): Remove dynamic_reloc_count_
2117 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2118 (Output_data::add_dynamic_reloc): Rewrite.
2119 (Output_data::has_dynamic_reloc): New function.
2120 (Output_data::dynamic_reloc_count): Remove.
2121 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2122 is_last_relro_, is_first_non_relro_, is_interp_,
2123 is_dynamic_linker_section_ fields. Add order and set_order
2124 functions. Remove is_relro_local, set_is_relro_local,
2125 is_last_relro, set_is_last_relro, is_first_non_relro,
2126 set_is_first_non_relro functions, is_interp, set_is_interp,
2127 is_dynamic_linker_section, and set_is_dynamic_linker_section
2129 (class Output_segment): Change Output_data_list from std::list to
2130 std:;vector. Add output_lists_ field. Remove output_data_ and
2131 output_bss_ fields. Update declarations.
2135 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2136 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2137 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2142 * script.cc (Script_options::Script_options): Initialize
2143 symbol_definitions_ and symbol_references_.
2144 (Script_options::add_symbol_assignment): Update
2145 symbol_definitions_ and symbol_references_.
2146 (Script_options::add_symbol_reference): New function.
2147 (script_symbol): New function.
2148 * script.h (class Script_options): Add symbol_definitions_ and
2149 symbol_references_ fields.
2150 (Script_options::referenced_const_iterator): New type.
2151 (Script_options::referenced_begin): New function.
2152 (Script_options::referenced_end): New function.
2153 (Script_options::is_referenced): New function.
2154 (Script_options::any_unreferenced): New function.
2155 * script-c.h (script_symbol): Declare.
2156 * yyscript.y (exp): Call script_symbol.
2157 * symtab.cc: Include "script.h".
2158 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2159 Change all callers. Check symbols referenced by scripts.
2160 (Symbol_table::add_undefined_symbols_from_command_line): Add
2161 layout parameter. Change all callers.
2162 (Symbol_table::do_add_undefined_symbols_from_command_line):
2163 Likewise. Break out loop body. Check symbols referenced by
2165 (Symbol_table::add_undefined_symbol_from_command_line): New
2166 function broken out of
2167 do_add_undefined_symbols_from_command_line.
2168 * symtab.h (class Symbol_table): Update declarations.
2169 * archive.cc: Include "layout.h".
2170 (Archive::should_include_member): Add layout parameter. Change
2171 all callers. Check for symbol mentioned in expression.
2172 * archive.h (class Archive): Update declaration.
2173 * object.cc (Sized_relobj::do_should_include_member): Add layout
2175 * object.h (Object::should_include_member): Add layout parameter.
2177 (Object::do_should_include_member): Add layout parameter.
2178 (class Sized_relobj): Update declaration.
2179 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2181 * dynobj.h (class Sized_dynobj): Update declaration.
2182 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2184 * plugin.h (class Sized_pluginobj): Update declaration.
2189 * output.cc (Output_segment::set_offset): Search for the first and
2190 last sections rather than assuming that the list is in order.
2191 (Output_segment::find_first_and_last_list): New function.
2192 * output.h (class Output_segment): Update declarations.
2193 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2194 (relro_strip_test_SOURCES): New variable.
2195 (relro_strip_test_DEPENDENCIES): New variable.
2196 (relro_strip_test_LDFLAGS): New variable.
2197 (relro_strip_test_LDADD): New variable.
2198 (relro_strip_test.so): New target.
2202 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2203 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2204 (Target_i386::got_tlsdesc_section): New function.
2205 (Target_i386::got_section): Create space for GOT entries for
2206 TLSDESC relocations.
2207 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2209 (Target_i386::Scan::global): Likewise.
2210 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2212 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2213 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2214 (Target_x86_64::got_tlsdesc_section): New function.
2215 (Target_x86_64::got_section): Create space for GOT entries for
2216 TLSDESC relocations.
2217 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2219 (Target_x86_64::Scan::global): Likewise.
2220 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2225 * testsuite/final_layout.sh: Use dc to convert from hex to
2230 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2231 paramter to the call to gold::gc_process_relocs.
2232 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2233 paramter to the call to gold::gc_process_relocs.
2234 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2235 parameter to the call to gold::gc_process_relocs.
2236 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2237 template parameter to the call to gold::gc_process_relocs.
2238 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2239 paramter to the call to gold::gc_process_relocs.
2240 * gc.h (get_embedded_addend_size): New function.
2241 (gc_process_relocs): Save the size of the reloc for use by ICF.
2242 * icf.cc (get_section_contents): Get the addend from the text section
2243 for SHT_REL relocation sections.
2244 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2245 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2246 * int_encoding.h (read_from_pointer): New overloaded function.
2247 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2248 * testsuite/icf_sht_rel_addend_test.sh: New file.
2249 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2250 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2254 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2255 * Makefile.in: Regenerate.
2256 * testsuite/Makefile.in: Regenerate.
2260 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2261 * gold/testsuite/debug_msg.cc: Likewise.
2262 * gold/testsuite/odr_violation1.cc
2263 * gold/testsuite/odr_violation2.cc
2267 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2268 string, and length fields.
2269 (Output_merge_string::Merged_strings_list): New type.
2270 (Output_merge_string::Merged_strings_lists): New typedef.
2271 (Output_merge_string): Replace merged_strings_ with
2272 merged_strings_lists_.
2273 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2274 Merged_strings_list per input object and section. Don't store pointer
2275 to the string. Don't store length with each merged string entry.
2276 (Output_merge_string::finalize_merged_data): Loop over list of merged
2277 strings lists. Recompute length of each merged string.
2281 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2286 * descriptors.cc (Descriptors::open): Report correct name in error
2291 * arm.cc (Arm_input_section::Arm_input_section): For a
2292 SHT_ARM_EXIDX section, always keeps the input sections.
2293 (Arm_input_section::set_exidx_section_link): New method.
2294 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2295 has_errors_ to false.
2296 (Arm_exidx_input_section::has_errors,
2297 Arm_exidx_input_section::set_has_errors): New methods.
2298 (Arm_exidx_input_section::has_errors_): New data member.
2299 (Arm_relobj::get_exidx_shndx_list): New method.
2300 (Arm_output_section::append_text_sections_to_list): Do not skip
2301 section without SHF_EXECINSTR.
2302 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2304 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2305 section header. Make error messages more verbose. Check for
2306 a non-executable section linked to an EXIDX section.
2307 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2308 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2309 check that there is no deferred EXIDX section if we exit early.
2310 Instead of not making an EXIDX section in case of an error, make one
2311 and set the has_errors flag of it.
2312 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2313 in a relocatable link.
2314 (Target_arm::do_relax): Look for the EXIDX output section instead of
2315 assuming that it is called .ARM.exidx.
2316 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2317 section list. Do not check for SHF_EXECINSTR section flags but
2318 skip any input section with errors.
2319 * output.cc (Output_section::Output_section): Initialize
2320 always_keeps_input_sections_ to false.
2321 (Output_section::add_input_section): Check for
2322 always_keeps_input_sections_.
2323 * output.h (Output_section::always_keeps_input_sections,
2324 Output_section::set_always_keeps_input_sections): New methods.
2325 (Output_section::always_keeps_input_sections): New data member.
2329 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2330 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2335 * output.h (Output_section_lookup_maps::add_merge_section):
2336 Correct check of whether value was inserted.
2337 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2338 (Output_section_lookup_maps::add_relaxed_input_section):
2340 * arm.cc (Target_arm::got_section): Remove used local os.
2341 * i386.cc (Target_i386::got_section): Likewise.
2342 * x86_64.cc (Target_x86_64::got_section): Likewise.
2343 * sparc.cc (Target_sparc::got_section): Likewise.
2344 (Target_sparc::relocate): Remove unused local have_got_offset.
2345 * powerpc.cc (Target_powerpc::relocate): Likewise.
2349 * compressed_output.cc (zlib_decompress): Fix signature in
2352 * archive.cc (Archive::include_member): Unlock an external member
2353 of a thin archive. Don't bother to delete an object we know is
2358 * compressed_output.cc (zlib_decompress): New function.
2359 (get_uncompressed_size): New function.
2360 (decompress_input_section): New function.
2361 * compressed_output.h (get_uncompressed_size): New function.
2362 (decompress_input_section): New function.
2363 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2364 Handle compressed debug sections.
2365 * layout.cc (is_compressed_debug_section): New function.
2366 (Layout::output_section_name): Map compressed section names to
2368 * layout.h (is_compressed_debug_section): New function.
2369 (is_debug_info_section): Recognize compressed debug sections.
2370 * merge.cc: Include compressed_output.h.
2371 (Output_merge_data::do_add_input_section): Handle compressed
2373 (Output_merge_string::do_add_input_section): Handle compressed
2375 * object.cc: Include compressed_output.h.
2376 (Sized_relobj::Sized_relobj): Initialize new data members.
2377 (build_compressed_section_map): New function.
2378 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2379 * object.h (Object::section_is_compressed): New method.
2380 (Object::do_section_is_compressed): New method.
2381 (Sized_relobj::Compressed_section_map): New type.
2382 (Sized_relobj::do_section_is_compressed): New method.
2383 (Sized_relobj::compressed_sections_): New data member.
2384 * output.cc (Output_section::add_input_section): Handle compressed
2386 * reloc.cc: Include compressed_output.h.
2387 (Sized_relobj::write_sections): Handle compressed debug sections.
2391 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2392 weak when resolving to a dynamic def.
2393 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2394 for weak undef/dynamic def cases. Adjust callers.
2395 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2396 undef_binding_weak_.
2397 (Symbol_table::sized_write_globals): Adjust symbol binding.
2398 (Symbol_table::sized_write_symbol): Add binding parameter.
2399 * symtab.h (Symbol::set_undef_binding): New method.
2400 (Symbol::is_undef_binding_weak): New method.
2401 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2402 (Symbol_table::should_override): Add new parameter.
2403 (Symbol_table::sized_write_symbol): Add new parameter.
2405 * testsuite/weak_undef_file1.cc: Add new test case.
2406 * testsuite/weak_undef_file2.cc: Fix header comment.
2407 * testsuite/weak_undef_test.cc: Add new test case.
2411 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2412 Initialize USE_SYMBOL_.
2413 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2415 (Arm_reloc_property::uses_symbol_): New data member declaration.
2416 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2417 uses symbol value and symbol is undefined but not weakly undefined.
2421 * plugin.cc (Plugin::load): Use dlerror.
2425 * symtab.cc (detect_odr_violations): When reporting an ODR
2426 violation, report an object where the symbol is defined.
2430 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2431 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2433 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2434 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2435 target hook to detect function points.
2436 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2437 * icf.h (Icf::check_section_for_function_pointers): Change type of
2438 parameter SECTION_NAME to const reference to std::string. Use
2439 target hook to determine if section may have unsafe pointers.
2440 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2445 * fileread.cc (Input_file::find_fie): New
2446 (Input_file::open): Use Input_file::find_fie.
2447 * fileread.h (Input_file::find_fie): New
2448 * plugin.cc (set_extra_library_path): New.
2449 (Plugin::load): Add set_extra_library_path to the transfer vector.
2450 (Plugin_manager::set_extra_library_path): New.
2451 (Plugin_manager::add_input_file): Use the extra search path if set.
2452 (set_extra_library_path(): New.
2453 * plugin.h (Plugin_manager): Add set_extra_library_path and
2458 * layout.cc (gdb_sections): Add .debug_types.
2459 (lines_only_debug_sections): Likewise.
2463 * plugin.cc (add_input_file,add_input_library)
2464 (Plugin_manager::add_input_file): Make filename arguments const.
2465 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2470 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2471 .ARM.attributes section if we have not merged any input
2472 attributes sections.
2476 * arm.cc: Allow combining objects with no EABI version
2481 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2485 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2486 (struct iovec): Correct !HAVE_READV definition.
2490 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2491 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2493 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2496 * symtab.h (Symbol::is_placeholder): New member function.
2497 * target-reloc.h (relocate_section): Check for placeholder symbols.
2499 * testsuite/Makefile.am (plugin_test_8): New test.
2500 (plugin_test_9): New test.
2501 * testsuite/Makefile.in: Regenerate.
2505 * yyscript.y (input_list_element): Allow strings prefixed with
2506 the '-' character. Treat these as libraries.
2507 * script.cc (script_add_library): New function. Adds a library
2508 specified by "-l<name>" found in an input script.
2509 * script-c.h: Add prototype for script_add_library.
2513 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2514 Restrict stub-group size to be within long conditional branch
2515 range when working around cortex-A8 erratum.
2519 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2526 (Output_section::Input_section_sort_entry::compare_section_ordering):
2527 Change to return non-zero correctly.
2528 (Output_section::Input_section_sort_section_order_index_compare
2529 ::operator()): Change to fix ambiguity in comparisons.
2533 * gold.h (is_wildcard_string): New function.
2534 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2535 (Layout::layout_eh_frame): Ditto.
2536 (Layout::find_section_order_index): New method.
2537 (Layout::read_layout_from_file): New method.
2538 * layout.h (Layout::find_section_order_index): New method.
2539 (Layout::read_layout_from_file): New method.
2540 (Layout::input_section_position_): New private member.
2541 (Layout::input_section_glob_): New private member.
2542 * main.cc (main): Call read_layout_from_file here.
2543 * options.h (--section-ordering-file): New option.
2544 * output.cc (Output_section::input_section_order_specified_): New
2546 (Output_section::Output_section): Initialize new member.
2547 (Output_section::add_input_section): Add new parameter.
2548 Keep input sections when --section-ordering-file is used.
2549 (Output_section::set_final_data_size): Sort input sections when
2550 section ordering file is specified.
2551 (Output_section::Input_section_sort_entry): Add new parameter.
2553 (Output_section::Input_section_sort_entry::compare_section_ordering):
2555 (Output_section::Input_section_sort_compare::operator()): Change to
2556 consider section_order_index.
2557 (Output_section::Input_section_sort_init_fini_compare::operator()):
2558 Change to consider section_order_index.
2559 (Output_section::Input_section_sort_section_order_index_compare
2560 ::operator()): New method.
2561 (Output_section::sort_attached_input_sections): Change to sort
2562 according to section order when specified.
2563 (Output_section::add_input_section<32, true>): Add new parameter.
2564 (Output_section::add_input_section<64, true>): Add new parameter.
2565 (Output_section::add_input_section<32, false>): Add new parameter.
2566 (Output_section::add_input_section<64, false>): Add new parameter.
2567 * output.h (Output_section::add_input_section): Add new parameter.
2568 (Output_section::input_section_order_specified): New
2570 (Output_section::set_input_section_order_specified): New method.
2571 (Input_section::Input_section): Initialize section_order_index_.
2572 (Input_section::section_order_index): New method.
2573 (Input_section::set_section_order_index): New method.
2574 (Input_section::section_order_index_): New member.
2575 (Input_section::Input_section_sort_section_order_index_compare): New
2577 (Output_section::input_section_order_specified_): New member.
2578 * script-sections.cc (is_wildcard_string): Delete and move modified
2580 (Output_section_element_input::Output_section_element_input): Modify
2581 call to is_wildcard_string.
2582 (Output_section_element_input::Input_section_pattern
2583 ::Input_section_pattern): Ditto.
2584 (Output_section_element_input::Output_section_element_input): Ditto.
2585 * testsuite/Makefile.am (final_layout): New test case.
2586 * testsuite/Makefile.in: Regenerate.
2587 * testsuite/final_layout.cc: New file.
2588 * testsuite/final_layout.sh: New file.
2592 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2596 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2597 visibility of symbols.
2601 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2602 from start of output section instead of address for a local symbol
2603 in a merged or relaxed section when doing a relocatable link.
2608 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2609 adding sections the garbage collector removed.
2610 * gold/testsuite/Makefile.am: Add test.
2611 * gold/testsuite/Makefile.in: Regenerate.
2612 * gold/testsuite/plugin_test_7.sh: New.
2613 * gold/testsuite/plugin_test_7_1.c: New.
2614 * gold/testsuite/plugin_test_7_2.c: New.
2618 * script-sections.cc (Output_section_definition::set_section_addresses):
2619 Check for --section-start.
2623 * arm.cc (Arm_scan_relocatable_relocs): New class.
2624 (Target_arm::relocate_special_relocatable): New method.
2625 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2626 (Arm_relocate_functions::thumb_branch_common): Same.
2627 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2628 instead of Default_scan_relocatable_relocs.
2629 * target-reloc.h (relocate_for_relocatable): Let target handle
2630 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2631 * target.h (Sized_target::relocate_special_relocatable): New method.
2635 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2639 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2641 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2642 with a direct branch, not a conditional branch, to a stub.
2643 * merge.cc (Output_merge_base::record_input_section): New method
2645 (Output_merge_data::do_add_input_section): Record input section if
2646 keeps-input-sections flag is set.
2647 (Output_merge_string::do_add_input_section): Ditto.
2648 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2649 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2651 (Output_merge_base::keeps_input_sections,
2652 Output_merge_base::set_keeps_input_sections,
2653 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2655 (Output_merge_base::Input_sections): New type declaration.
2656 (Output_merge_base::input_sections_begin,
2657 Output_merge_base::input_sections_end,
2658 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2659 (Output_merge_base::bool keeps_input_sections_,
2660 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2661 Output_merge_base::input_sections_): New data members.
2662 (Output_merge_data::do_set_keeps_input_sections): New method
2664 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2665 * output.cc (Output_section::Input_section::relobj): Move method
2666 defintion from class declaration to here and handle merge sections.
2667 (Output_section::Input_section::shndx): Ditto.
2668 (Output_section::Output_section): Remove initializations of removed
2669 data members and initialize new data member LOOKUP_MAPS_.
2670 (Output_section::add_input_section): Set keeps-input-sections flag
2671 for a newly created merge output section as appropriate. Adjust code
2672 to use Output_section_lookup_maps class.
2673 (Output_section::add_relaxed_input_section): Adjst code for lookup
2674 maps code refactoring.
2675 (Output_section::add_merge_input_section): Add a new parameter
2676 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2677 class. If adding input section to a newly created merge output
2678 section fails, remove the new merge section.
2679 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2680 Adjust code for use of the Output_section_lookup_maps class.
2681 (Output_section::find_merge_section): Ditto.
2682 (Output_section::build_lookup_maps): New method defintion.
2683 (Output_section::find_relaxed_input_section): Adjust code to use
2684 Output_section_lookup_maps class.
2685 (Output_section::get_input_sections): Export merge sections. Adjust
2686 code to use Output_section_lookup_maps class.
2687 (Output_section:::add_script_input_section): Adjust code to use
2688 Output_section_lookup_maps class. Update lookup maps for merge
2690 (Output_section::discard_states): Use Output_section_lookup_maps.
2691 (Output_section::restore_states): Same.
2692 * output.h (Merge_section_properties): Move class defintion out of
2694 (Output_section_lookup_maps): New class.
2695 (Output_section::Input_section::is_merge_section): New method
2697 (Output_section::Input_section::relobj): Move defintion out of class
2698 defintion. Declare method only.
2699 (Output_section::Input_section::shndx): Ditto.
2700 (Output_section::Input_section::output_merge_base): New method defintion.
2701 (Output_section::Input_section::u2_.pomb): New union field.
2702 (Output_section::Merge_section_by_properties_map,
2703 Output_section::Output_section_data_by_input_section_map,
2704 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2706 (Output_section::add_merge_input_section): Add new parameter
2707 KEEPS_INPUT_SECTIONS.
2708 (Output_section::build_lookup_maps): New method declaration.
2709 (Output_section::merge_section_map_,
2710 Output_section::merge_section_by_properties_map_,
2711 Output_section::relaxed_input_section_map_,
2712 Output_section::is_relaxed_input_section_map_valid_): Remove data
2714 (Output_section::lookup_maps_): New data member.
2719 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2720 avoid a compilation error.
2724 * script-sections.cc (Output_section_definition::allocate_to_segment):
2725 Update the phdrs_list even when the output section is NULL.
2726 * testsuite/Makefile.am: Add test.
2727 * testsuite/Makefile.in: Regenerate.
2728 * testsuite/script_test_9.cc: New.
2729 * testsuite/script_test_9.sh: New.
2730 * testsuite/script_test_9.t: New.
2734 * arm.cc (Arm_input_section::original_size): New method.
2735 (Arm_input_section::do_addralign): Add a cast.
2736 (Arm_input_section::do_output_offset): Remove static cast.
2737 (Arm_input_section::original_addralign,
2738 Arm_input_section::original_size_): Change type to uint32_t.
2739 (Arm_input_section::init): Add safe casts for section alignment
2741 (Arm_input_section::set_final_data_size): Do not set address and
2742 offset of stub table.
2743 (Arm_output_section::fix_exidx_coverage): Change use of of
2744 Output_section::Simple_input_section to that of
2745 Output_section::Input_section.
2746 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2747 except for the first pass.
2748 * output.cc (Output_section::get_input_sections): Change type of
2749 input_sections to std::list<Input_section>.
2750 (Output_section::add_script_input_section): Rename from
2751 Output_section::add_simple_input_section. Change type of SIS
2752 parameter from Simple_input_section to Input_section.
2753 * output.h (Output_section::Simple_input_section): Remove class.
2754 (Output_section::Input_section): Change class visibility to public.
2755 (Output_section::Input_section::addralign): Use stored alignments
2756 for special input sections if set.
2757 (Output_section::Input_section::set_addralign): New method.
2758 (Output_section::get_input_sections): Change parameter type from
2759 list of Simple_input_section to list of Input_section.
2760 (Output_section::add_script_input_section): Rename from
2761 Output_section::add_simple_input_section. Change first parameter's
2762 type from Simple_input_section to Input_section and remove the
2763 second and third parameters.
2764 * script-sections.cc (Input_section::Input_section_list): Change
2765 type to list of Output_section::Input_section/
2766 (Input_section_info::Input_section_info): Change parameter type of
2767 INPUT_SECTION to Output_section::Input_section.
2768 (Input_section_info::input_section): Change return type.
2769 (Input_section_info::input_section_): Change type to
2770 Output_section::Input_section.
2771 (Output_section_element_input::set_section_addresses): Adjust code
2772 to use Output_section::Input_section instead of
2773 Output_section::Simple_input_section. Adjust code for renaming
2774 of Output_section::add_simple_input_section.
2775 (Orphan_output_section::set_section_addresses): Ditto.
2779 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2780 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2784 * options.cc (General_options::finalize): Handle -nostdlib.
2785 * options.h (nostdlib): New option.
2786 * script.cc (script_add_search_dir): Handle -nostdlib.
2790 * arm.cc (Target_arm::do_finalize_sections): Create an empty
2791 attributes section only if there no attributes section after merging.
2792 (Target_arm::merge_object_attributes): Move value of
2793 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2794 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2795 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2796 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2797 and arm_attr_merge_7.stdout.
2798 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2799 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2800 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2801 arm_attr_merge_7b.o): New rules.
2802 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2804 * testsuite/Makefile.in: Regenerate.
2805 * testsuite/arm_attr_merge.sh: New file.
2806 * testsuite/arm_attr_merge_[67][ab].s: Same.
2810 * po/es.po: Updated Spanish translation.
2814 * Makefile.am (install-exec-local): Properly install gold as
2815 default cross linker.
2816 * Makefile.in: Regenerated.
2821 * configure.ac (install_as_default): Define and set to false
2822 unless --enable-gold or --enable-gold=both/gold has been
2824 * configure: Regenerate.
2826 * Makefile.am (install-exec-local): Install the executable as
2827 'ld.gold'. If install_as_default is true then also install it as
2829 * Makefile.in: Regenerated.
2833 * layout.cc (Layout::layout_reloc): In relocatable link don't
2834 combine reloc sections for grouped sections.
2838 * gc.h (gc_process_relocs): Pass information on relocs pointing to
2839 sections that are not ordinary to icf.
2840 * icf.cc (get_section_contents): Handle relocation pointing to section
2841 with no object or shndx information.
2842 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2843 * testsuite/Makefile.in: Regenerate.
2844 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2845 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2849 * expression.cc (Expression::Expression_eval_info): Add
2850 result_alignment_pointer field.
2851 (Expression::eval_with_dot): Add result_alignment_pointer
2852 parameter. Change all callers.
2853 (Expression::eval_maybe_dot): Likewise.
2854 (class Binary_expression): Add alignment_pointer parameter to
2855 left_value and right_value. Change all callers.
2856 (BINARY_EXPRESSION): Set result alignment.
2857 (class Trinary_expression): Add alignment_pointer parameter to
2858 arg2_value and arg3_value. Change all callers.
2859 (Trinary_cond::value): Set result alignment.
2860 (Max_expression::value, Min_expression::value): Likewise.
2861 (Align_expression::value): Likewise.
2862 * script-sections.cc (class Sections_element): Add dot_alignment
2863 parameter to set_section_addresses virtual function. Update
2865 (class Output_section_element): Likewise.
2866 (Script_sections::create_segments): Add dot_alignment parameter.
2868 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2869 (Script_sections::set_phdrs_clause_addresses): Likewise.
2870 * script-sections.h: Update declarations.
2871 * script.h: Update declarations.
2872 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2874 * testsuite/script_test_3.t: Set large alignment.
2875 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2876 segment has expected alignment.
2880 * po/gold.pot: Updated by the Translation project.
2881 * po/vi.po: Updated Vietnamese translation.
2885 * testsuite/Makefile.am (check_PROGRAMS): Add
2886 icf_virtual_function_folding_test.
2887 * testsuite/Makefile.in: Regenerated.
2891 * options.h (merge_exidx_entries): New option.
2892 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2893 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2894 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2895 (Target_arm::merge_exidx_entries): New function.
2896 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2897 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2898 to Arm_exidx_fixup constructor.
2899 Add new arg, merge_exidx_entries.
2900 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2901 Arm_output_section::fix_exidx_coverage.
2905 * icf.cc (get_section_contents): Check for preemptible functions.
2906 Ignore addend when appropriate.
2907 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2909 (add_from_relobj): Check for section folded.
2910 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2911 * symtab.h (should_add_dynsym_entry): Add new parameter.
2912 * target-reloc.h (scan_relocs): Check for section folded.
2913 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2914 Check reloc types for function pointers in shared objects.
2915 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2917 (icf_preemptible_functions_test): New test case.
2918 (icf_string_merge_test): New test case.
2919 * testsuite.Makefile.in: Regenerate.
2920 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2921 bar_glob. Refactor code.
2922 * testsuite/icf_preemptible_functions_test.cc: New file.
2923 * testsuite/icf_preemptible_functions_test.sh: New file.
2924 * testsuite/icf_string_merge_test.cc: New file.
2925 * testsuite/icf_string_merge_test.sh: New file.
2926 * testsuite/icf_virtual_function_folding_test.cc: New file.
2927 * testsuite/icf_virtual_function_folding_test.sh: New file.
2931 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2932 for local symbol recounting if we remove a section due to ICF.
2933 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2934 there are no regular objects in input.
2938 * arm.cc (Arm_input_section::set_final_data_size): Compute
2939 accurate final data size instead of using current data size.
2943 * layout.cc (Layout::choose_output_section): Handle script section
2945 (Layout::make_output_section_for_script): Add section type parameter.
2946 Handle script section types.
2947 * layout.h (Layout::make_output_section_for_script): Add section
2949 * output.cc (Output_section::Output_section): Initialize data member
2951 (Output_section::do_reset_address_and_file_offset): Do not set address
2952 to 0 if section is a NOLOAD section.
2953 * output.h (Output_section::is_noload): New method.
2954 (Output_section::set_is_noload): Ditto.
2955 (Output_section::is_noload_): New data member.
2956 * script-c.h (Script_section_type): New enum type.
2957 (struct Parser_output_section_header): Add new file section_type.
2958 * script-sections.cc (Sections_element::output_section_name): Add
2959 parameter for returning script section type.
2960 (Output_section_definition::output_section_name): Ditto.
2961 (Output_section_definition::section_type)P; New method.
2962 (Output_section_definiton::script_section_type_name): Ditto.
2963 (Output_section_definition::script_section_type_): New data member.
2964 (Output_section_definition::Output_section_definition): Initialize
2965 data member Output_section_definition::script_section_type_.
2966 (Output_section_definition::create_sections): Pass script section type
2967 to Layout::make_output_section_for_script.
2968 (Output_section_definition::output_section_name): Return script
2969 section type to caller.
2970 (Output_section_definition::set_section_address): Do not advance
2971 dot value and load address if section type is NOLOAD. Set address
2972 of NOLOAD sections regardless of section flags.
2973 (Output_section_definition::print): Print section type if it is
2974 not SCRIPT_SECTION_TYPE_NONE.
2975 (Output_section_definition::section_type): New method.
2976 (Output_section_definition::script_section_type_name): Ditto.
2977 (Script_sections::output_section_name): Add new parameter
2978 PSECTION_TYPE for returning script section type. Pass it to
2979 section elements. Handle discard sections.
2980 (Sort_output_sections::operator()): Handle NOLOAD sections.
2981 * script-sections.h (Script_sections::Section_type): New enum type.
2982 (Script_sections::output_section_name): Add a new parameter for
2983 returning script section type.
2984 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2986 * yyscript.y (union): Add new field SECTION_TYPE.
2987 (COPY, DSECT, INFO, NOLOAD): New tokens.
2988 (opt_address_and_section_type): Change type to output_section_header.
2989 (section_type): New non-terminal
2990 (section_header): Handle section type.
2991 (opt_address_and_section_type): Return section type value.
2995 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2996 * testsuite/plugin_common_test_2.c (foo): Likewise.
3000 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3002 * output.cc (Output_section::add_merge_input_section): Simplify
3003 code and return status of Output_merge_base::add_input_section.
3004 Update merge section map only if Output_merge_base::add_input_section
3009 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3010 if section is marked as containing instructions but has no mapping
3012 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3013 correct section index.
3014 (Arm_relobj::find_linked_text_section): Ditto.
3018 * archive.cc (include_member): Destroy Read_symbols_data object before
3020 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3021 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3022 (Read_symbols_data::~Read_symbols_data) New destructor.
3023 (Section_relocs::Section_relocs) New constructor.
3024 (Section_relocs::~Section_relocs) New destructor.
3025 (Read_relocs_data::Read_relocs_data) New constructor.
3026 (Read_relocs_data::~Read_relocs_data) New destructor.
3027 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3028 pointers to NULL after deleting.
3032 * arm.cc: Replace "endianity" with "endianness" in comments.
3033 (Arm_exidx_cantunwind): Ditto.
3034 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3035 (Arm_relobj::merge_flags_and_attributes): New method.
3036 (Arm_relobj::merge_flags_and_attributes_): New data member.
3037 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3038 (Arm_relobj::scan_sections_for_stubs): Ditto.
3039 (Arm_relobj::do_read_symbols): Check to see if we really want to
3040 merge processor-specific flags and attributes. Exit early if
3041 an object is empty except for section names and the undefined symbol.
3042 (Target_arm::do_finalize_sections): Move check for ELF format to
3043 Arm_relobj::do_read_symbols. Merge processor specific flags and
3044 attributes from a regular object only when we have determined that
3045 it is aapropriate. Do not create an .ARM.attributes section in
3046 output if there is no regular input object.
3047 (Target_arm::merge_processor_specific_flags): Check
3048 --warn-mismatch before printing any error.
3049 (Target_arm::merge_object_attributes): Ditto.
3050 * gold.cc (queue_middle_tasks): Handle the case in which there is
3051 no regular object in input.
3052 * options.cc (General_options::parse_EB): New method.
3053 (General_options::parse_EL): Same.
3054 (General_options::General_options): Initialize endianness_.
3055 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3057 (General_options::Endianness): New enum.
3058 (General_options::endianness): New method.
3059 (General_options::endianness_): New data member.
3060 * parameters.cc (Parameters::set_options): Check target endianness.
3061 (Parameters::set_target_once): Ditto.
3062 (Parameters::check_target_endianness): New method.
3063 (parameters_force_valid_target): If either -EL or -EB is specified,
3064 use it to define endianness of default target.
3065 * parameters.h (Parameters::check_target_endianness): New method
3067 * target.h (class Target): Change "endianity" to "endianness"
3072 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3073 * configure: Regenerate.
3074 * Makefile.in: Regenerate.
3075 * testsuite/Makefile.in: Regenerate.
3080 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3081 prevailing definitions of common symbols.
3082 * testsuite/plugin_test_6.sh: New test case.
3083 * testsuite/plugin_common_test_1.c: New test case.
3084 * testsuite/plugin_common_test_2.c: New test case.
3085 * testsuite/Makefile.am (plugin_test_6): New test case.
3086 * testsuite/Makefile.in: Regenerate.
3090 * po/vi.po: New Vietnamese translation.
3094 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3098 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3099 to avoid a conversion warning on a 32-bit host.
3103 * testsuite/script_test_3.t: Add a TLS segment.
3104 * testsuite/Makefile.am (check_PROGRAMS): Add
3105 tls_phdrs_script_test.
3106 (tls_phdrs_script_test_SOURCES): Define.
3107 (tls_phdrs_script_test_DEPENDENCIES): Define.
3108 (tls_phdrs_script_test_LDFLAGS): Define.
3109 (tls_phdrs_script_test_LDADD): Define.
3110 * testsuite/Makefile.in: Rebuild.
3114 * fileread.cc (find_or_make_view): Fix comment.
3118 * script-sections.cc (class Orphan_section_placement): Define
3119 PLACE_TLS and PLACE_TLS_BSS.
3120 (Orphan_section_placement::Orphan_section_placement): Initialize
3122 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3123 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3124 (tls_script_test_SOURCES): Define.
3125 (tls_script_test_DEPENDENCIES): Define.
3126 (tls_script_test_LDFLAGS): Define.
3127 (tls_script_test_LDADD): Define.
3128 * testsuite/Makefile.in: Rebuild.
3132 * arm.cc (Arm_relocate_functions::abs8,
3133 Arm_relocate_functions::abs16): Use correct check for overflow
3134 specified in the ARM ELF specs.
3135 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3136 target of a BLX instruction specially.
3137 (Reloc_stub::stub_type_for_reloc): Ditto.
3138 (Relocate::relocate): Use symbolic names instead of numeric relocation
3139 codes to report error.
3140 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3142 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3143 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3144 thumb2_blx_out_of_range.stdout
3145 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3146 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3147 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3148 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3149 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3150 thumb2_blx_in_range, thumb2_blx_in_range.o,
3151 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3152 thumb2_blx_out_of_range.o): New rules.
3153 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3154 thumb2_blx_in_range and thumb2_blx_out_of_range.
3155 * testsuite/Makefile.in: Regenerate.
3156 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3157 * testsuite/thumb_blx_in_range.s: New file.
3158 * testsuite/thumb_blx_out_of_range.s: New file.
3162 * archive.cc (Should_include): Move to archive.h.
3163 (should_include_member): Make it a member of Archive.
3165 (Add_lib_group_symbols): New.
3166 * archive.h: Include options.h.
3167 (Archive_member): Moved from Archive.
3168 (Should_include): Moved from archive.cc.
3170 (Add_lib_group_symbols): New.
3171 * dynobj.cc (do_should_include_member): New.
3172 * dynobj.h (do_should_include_member): New.
3173 * gold.cc (queue_initial_tasks): Update call to queue.
3174 * main.cc (main): Print lib group stats.
3175 * object.cc (do_should_include_member): New.
3176 * object.h: Include archive.h.
3177 (Object::should_include_member): New.
3178 (Object::do_should_include_member): New.
3179 (Sized_relobj::do_should_include_member): New.
3180 * options.cc (General_options::parse_start_lib): New.
3181 (General_options::parse_end_lib): New.
3182 (Input_arguments::add_file): Handle lib groups.
3183 (Input_arguments::start_group): Check we are not in a lib.
3184 (Input_arguments::start_lib): New.
3185 (Input_arguments::end_lib): New.
3186 * options.h (General_options): Add start_lib and end_lib.
3187 (Input_argument::lib_): New.
3188 (Input_argument::lib): New.
3189 (Input_argument::is_lib): New.
3190 (Input_file_lib): New.
3191 (Input_arguments::in_lib_): New.
3192 (Input_arguments::in_lib): New.
3193 (Input_arguments::start_lib): New.
3194 (Input_arguments::end_lib_): New.
3195 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3196 in unused members as preempted.
3197 (Sized_pluginobj::do_should_include_member): New.
3198 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3199 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3201 (Read_symbols::do_whole_lib_group): New.
3202 (Read_symbols::do_lib_group): New.
3203 (Read_symbols::do_read_symbols): Handle lib groups.
3204 (Read_symbols::get_name): Handle lib groups.
3205 * readsyms.h (Read_symbols): Add an archive member pointer.
3206 (Read_symbols::do_whole_lib_group): New.
3207 (Read_symbols::do_lib_group): New.
3208 (Read_symbols::member_): New.
3209 * script.cc (read_input_script): Update call to queue_soon.
3213 * arm.cc (Stub_table::Stub_table): Initialize new data members
3214 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3215 (Stub_table::add_reloc_stub): Assign stub offset and update
3216 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3217 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3219 (Stub_table::update_data_size_and_addralign): Use
3220 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3221 instead of going over all reloc stubs.
3222 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3223 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3224 Stringpool_template::offset_ to size of Stringpool_char.
3225 (Stringpool_template::new_key_offset): Remove code to initialize
3226 Stringpool_template::offset_.
3227 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3228 Stringpool_template::offset_ to zero.
3232 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3234 (Stringpool_template::new_key_offset): New method.
3235 (Stringpool_template::add_string): Assign offsets when adding new
3237 (Stringpool_template::set_string_offsets): Do not set string offsets
3238 when not optimizing.
3239 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3241 (Chunked_vector::clear): Clear size_.
3242 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3243 (Chunked_vector::size): Return size_.
3244 (Chunked_vector::push_back): Use size_ to find insert position.
3245 (Chunked_vector::size_): New data member.
3246 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3247 (Stringpool_template::new_key_offset): New method declaration.
3248 (Stringpool_template::offset_): New data member.
3252 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3253 Add_symbols' constructor.
3254 * readsyms.h (Add_symbols): Remove the input_group member.
3258 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3259 target to ask whether a reference to a symbol requires a stack
3261 * target.h (Target::is_call_to_non_split): New function.
3262 (Target::do_is_call_to_non_split): Declare virtual function.
3263 * target.cc: Include "symtab.h".
3264 (Target::do_is_call_to_non_split): New function.
3265 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3269 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3270 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3271 (File_read::open[2]): Add whole_file_view_ to list of views.
3272 (File_read::make_view): Remove test of whole_file_view_.
3273 (File_read::find_or_make_view): Create whole_file_view_ if
3275 (File_read::clear_views): Replace bool parameter with enum;
3276 adjust all callers. Don't delete views with permanent data;
3277 do delete cached views and views from archives if
3278 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3279 if clearing the corresponding view.
3280 * fileread.h (File_read::Clear_views_mode): New enum.
3281 (File_read::View::is_permanent_view): New method.
3282 (File_read::clear_views): Replace bool parameter
3283 with enum; adjust all callers.
3284 * options.h (General_options): Change keep_files_mapped option;
3285 add map_whole_files.
3286 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3288 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3293 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3297 * icf.cc (get_section_contents): Add '@' marker after processing the
3302 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3303 due to a conversion warning.
3304 (Arm_relobj::update_output_local_symbol_count): Check for local
3305 symbol with unset output index.
3309 * options.h (class General_options): Add --spare-dynamic-tags.
3310 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3311 --spare-dynamic-tags.
3315 * incremental.cc: Include "libiberty.h".
3319 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3320 function, is_info_ member.
3321 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3322 (Versions::Versions): Update caller.
3323 (Versions::define_base_version): Likewise.
3324 (Versions::add_def): Likewise.
3328 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3329 (Scan::possible_function_pointer_reloc): New function.
3330 (Scan::local_reloc_may_be_function_pointer): Change to call
3331 possible_function_pointer_reloc.
3332 (Scan::global_reloc_may_be_function_pointer): Ditto.
3333 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3334 relocations in ".data.rel.ro._ZTV" section.
3335 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3336 * testsuite/icf_safe_so_test.cc: Ditto.
3337 * testsuite/icf_safe_test.cc: Ditto.
3338 * testsuite/icf_safe_test.sh: Ditto.
3343 * target-reloc.h (relocate_section): Check the symbol table index
3344 for -1U before setting the local symbol index.
3345 (scan_relocatable_relocs): If copying the relocation, record that
3346 the local symbol is required.
3347 * object.h (Symbol_value::is_output_symtab_index_set): New
3349 (Symbol_value::may_be_discarded_from_output_symtab): New
3351 (Symbol_value::has_output_symtab_entry): New function.
3352 (Symbol_value::needs_output_symtab_entry): Remove.
3353 (Symbol_value::output_symtab_index): Make sure the symbol index is
3355 (Symbol_value::set_output_symtab_index): Make sure the symbol
3356 index is not set. Make sure the new index is valid.
3357 (Symbol_value::set_must_have_output_symtab_entry): New function.
3358 (Symbol_value::has_output_dynsym_entry): New function.
3359 (Symbol_value::set_output_dynsym_index): Make sure the new index
3361 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3362 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3363 local symbol if permitted.
3364 (Sized_relobj::do_finalize_local_symbols): Call
3365 is_output_symtab_index_set rather than needs_output_symtab_entry.
3366 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3367 rather than needs_output_symtab_entry. Call
3368 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3369 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3370 is_output_symtab_index_set rather than needs_output_symtab_entry.
3371 * testsuite/discard_locals_relocatable_test.c: New file.
3372 * testsuite/discard_locals_test.sh: Test -r.
3373 * testsuite/Makefile.am (check_DATA): Add
3374 discard_locals_relocatable_test1.syms,
3375 discard_local_relocatable_test2.syms.
3376 (MOSTLYCLEANFILES): Likewise. Also add
3377 discard_locals_relocatable_test1.lout and
3378 discard_locals_relocatable_test2.out.
3379 (discard_locals_relocatable_test1.syms): New target.
3380 (discard_locals_relocatable_test.o): New target.
3381 (discard_locals_relocatable_test1.out): New target.
3382 (discard_locals_relocatable_test2.syms): New target.
3383 (discard_locals_relocatable_test2.out): New target.
3384 (various): Add missing ../ld-new dependencies.
3385 * testsuite/Makefile.in: Rebuild.
3389 * po/fi.po: New Finnish translation.
3393 * layout.cc (Layout::Layout): Force section types of .init_array*,
3394 .preinit_array* and .fini_array* sections.
3395 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3396 Fix check of return value of std::string::find.().
3397 (Output_section::Input_section_sort_compare::operator()): Remove
3398 comment about .init_array.
3399 (Output_section::Input_section_sort_init_fini_compare::operator()):
3401 (Output_section::sort_attached_input_sections): Handle .init_array
3402 and .fini_array specially.
3403 * output.h (Output_section::Inut_section_sort_compare): Update
3405 (Output_section::Input_section_sort_init_fini_compare): New struct.
3409 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3410 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3411 * testsuite/debug_msg.sh: Avoid matching source line number for
3412 use of global variable undef_int.
3416 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3417 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3418 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3419 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3420 * options.cc (General_options::General_options): Initialize member
3422 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3423 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3424 and rm_no_fix_v4bx.stdout
3425 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3426 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3427 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3428 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3429 and arm_no_fix_v4bx.
3430 * Makefile.in: Regenerate.
3431 * testsuite/arm_fix_v4bx.s: New file.
3432 * testsuite/arm_fix_v4bx.sh: Ditto.
3436 * arm.cc (Target_arm::got_section): Make the .got section the first
3437 non RELRO section in the data segment.
3438 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3439 suffixes of section names.
3443 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3444 flags and attributes merging if an input file is a binary file.
3445 * fileread.cc (Input_file::open): Record format of original file.
3446 * fileread.h (Input_file::Format): New enum type.
3447 (Input_file::Input_file): Initialize data member format_.
3448 (Input_file::format): New method definition.
3449 (Input_file::format_):: New data member.
3453 * arm.cc (Arm_output_data_got): New class.
3454 (ARM_TCB_SIZE): New constant
3455 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3456 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3457 If user uses a script with a SECTIONS clause, issue only a warning
3458 for a misplaced EXIDX input section. Otherwise, issue an error.
3459 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3461 (Target_arm::got_mode_index_entry): Handle static linking.
3462 (Target_arm::Scan::local): Ditto.
3463 (Target_arm::Scan::global): Ditto.
3464 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3465 all incorrectly implemented relocations.
3466 (Target_arm::fix_exidx_coverage): Pass layout to
3467 Arm_output_section::fix_exidx_coverage.
3468 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3469 from ".ARM.exidx." and ".ARM.extab.".
3473 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3474 section if it does not already exist.
3475 * attributes.cc (Attributes_section_data::Attributes_section_data):
3476 Don't crash if size is zero.
3481 * gold.cc (queue_middle_tasks): If no input files were opened,
3483 * workqueue.h (Task_function::Task_function): Assert that there is
3488 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3489 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3490 types to avoid warnings due to different uint64_t implementations
3495 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3496 handling of the maximum backward branch offset.
3497 (Arm_relocate_functions::thumb_branch_common): Ditto.
3498 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3499 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3500 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3501 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3502 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3503 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3504 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3505 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3506 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3507 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3508 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3509 thumb2_bl_out_of_range.o): New rules.
3510 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3511 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3512 thumb2_bl_out_of_range
3513 * testsuite/Makefile.in: Regenerate.
3514 * testsuite/arm_bl_in_range.s: New file.
3515 * testsuite/arm_bl_out_of_range.s: Ditto.
3516 * testsuite/arm_branch_in_range.sh: Ditto.
3517 * testsuite/arm_branch_range.t: Ditto.
3518 * testsuite/thumb2_branch_range.t: Ditto.
3519 * testsuite/thumb_bl_in_range.s: Ditto.
3520 * testsuite/thumb_bl_out_of_range.s: Ditto.
3521 * testsuite/thumb_branch_range.t: Ditto.
3525 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3526 Add reloc offset information.
3527 * icf.cc (get_section_contents): Change iterators to point to the new
3528 vectors. Add reloc offset information to the contents.
3529 * icf.h (Icf::Sections_reachable_info): New typedef.
3530 (Icf::Sections_reachable_list): New typedef.
3531 (Icf::Offset_info): New typedef.
3532 (Icf::Reloc_info): New struct typedef.
3533 (Icf::Reloc_info_list): New typedef.
3534 (Icf::symbol_reloc_list): Delete method.
3535 (Icf::addend_reloc_list): Delete method.
3536 (Icf::section_reloc_list): Delete method.
3537 (Icf::reloc_info_list): New method.
3538 (Icf::reloc_info_list_): New member.
3542 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3543 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3544 * arm.cc (Arm_relocation_functions): New forward declaration.
3545 (Target_arm::Target_arm): Initialize new data members
3546 got_mod_index_offset_ and tls_base_symbol_defined_.
3547 (Target_arm::Relocate::relocate_tls): New method.
3548 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3549 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3551 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3552 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3553 (Target_arm::got_mod_index_offset_,
3554 Target_arm::tls_base_symbol_defined_): New data members.
3555 (Target_arm::Scan::local, Target::Scan::global,
3556 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3561 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3562 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3563 text section as a parameter becuase some broken tools may not set
3564 the link in section header.
3565 (Target_arm::has_got_section): New method.
3566 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3567 without any mapping symbol as data only. Remove warning.
3568 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3569 link in its section header, try to discover the link by inspecting the
3570 REL31 relocation at the beginning of the section.
3571 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3573 (Target_arm::Scan::global): Treat any reference to the symbol
3574 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3578 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3579 (Scan::global_reloc_may_be_function_pointer): New function.
3580 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3581 (Scan::global_reloc_may_be_function_pointer): New function.
3582 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3583 (Scan::global_reloc_may_be_function_pointer): New function.
3584 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3585 (Scan::global_reloc_may_be_function_pointer): New function.
3586 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3587 (Scan::global_reloc_may_be_function_pointer): New function.
3588 (Scan::possible_function_pointer_reloc): New function.
3589 (Target_x86_64::can_check_for_function_pointers): New function.
3590 * gc.h (gc_process_relocs): Scan relocation types to determine if
3591 function pointers were taken for targets that support it.
3592 * icf.cc (Icf::find_identical_sections): Include functions for
3593 folding in safe ICF whose pointer is not taken.
3594 * icf.h (Secn_fptr_taken_set): New typedef.
3595 (fptr_section_id_): New member.
3596 (section_has_function_pointers): New function.
3597 (set_section_has_function_pointers): New function.
3598 (check_section_for_function_pointers): New function.
3599 * options.h: Fix comment for safe ICF option.
3600 * target.h (can_check_for_function_pointers): New function.
3601 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3602 Modify icf_safe_test for X86-64.
3603 * testsuite/Makefile.in: Regenerate.
3604 * testsuite/icf_safe_so_test.cc: New file.
3605 * testsuite/icf_safe_so_test.sh: New file.
3606 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3607 (main): Change to take pointer to function kept_func_3.
3608 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3609 folding is done correctly for X86-64.
3613 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3614 is_symbolless parameter.
3615 (Output_reloc<SHT_REL>::is_symbolless): New.
3616 (Output_reloc<SHT_REL>::is_symbolless_): New.
3617 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3618 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3619 (Output_reloc<SHT_RELA>::is_symbolless): New.
3620 (Output_data_reloc::add_global): Handle is_symbolless.
3621 (Output_data_reloc::add_global_relative): Likewise.
3622 (Output_data_reloc::add_local): Likewise.
3623 (Output_data_reloc::add_local_relative): Likewise.
3624 (Output_data_reloc::add_symbolless_global_addend): New.
3625 (Output_data_reloc::add_symbolless_local_addend): New.
3626 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3628 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3629 instead of ->is_relative_
3630 (Output_reloc::write): Likewise.
3631 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3632 (Output_reloc::write_rel): Simplify.
3634 * sparc.cc (Target_sparc::Scan::local): Use
3635 ->add_symbolless_local_addend as needed.
3636 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3637 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3638 based upon relocation offset.
3642 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3643 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3644 beginning of function.
3645 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3646 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3647 parameter is_32bit in calls to should_apply_static_reloc.
3648 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3649 (check_DATA): Add arm_abs_global.stdout.
3650 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3651 arm_abs_global.stdout): New rules.
3652 (MOSTLLYCLEANFILES): Add arm_abs_global
3653 * Makefile.in: Regenerate.
3654 * testsuite/arm_abs_global.s: New file.
3655 * testsuite/arm_abs_global.sh: Ditto.
3656 * testsuite/arm_abs_lib.s: Ditto.
3660 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3662 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3663 Allocate_commons_task first.
3664 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3665 task, rather than symtab_lock_.
3666 (Gc_process_relocs::~Gc_process_relocs): New function.
3667 (Gc_process_relocs::is_runnable): Check this_blocker_.
3668 (Gc_process_relocs::locks): Use next_blocker_ rather than
3670 (Scan_relocs::~Scan_relocs): New function.
3671 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3673 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3675 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3676 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3677 constructor accordingly.
3678 (class Gc_process_relocs): Likewise.
3679 (class Scan_relocs): Likewise.
3680 * common.h (class Allocate_commons_task): Remove symtab_lock_
3681 field, and corresponding constructor parameter.
3682 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3684 (Allocate_commons_task::locks): Likewise.
3688 * gold-threads.h (class Once): Define.
3689 (class Initialize_lock): Rewrite as child of Once.
3690 * gold-threads.cc (class Once_initialize): Define.
3691 (once_pointer_control): New static variable.
3692 (once_pointer, once_arg): New static variables.
3693 (c_run_once): New static function.
3694 (Once::Once, Once::run_once, Once::internal_run): New functions.
3695 (class Initialize_lock_once): Remove.
3696 (initialize_lock_control): Remove.
3697 (initialize_lock_pointer): Remove.
3698 (initialize_lock_once): Remove.
3699 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3700 (Initialize_lock::initialize): Rewrite.
3701 (Initialize_lock::do_run_once): New function.
3702 * archive.cc (Archive::interpret_header): Only clear name if it is
3704 * fileread.cc: Include "gold-threads.h"
3705 (file_counts_lock): New static variable.
3706 (file_counts_initialize_lock): Likewise.
3707 (File_read::release): Only increment counts when using --stats.
3708 Use a lock around the increment.
3709 * parameters.cc (class Set_parameters_target_once): Define.
3710 (set_parameters_target_once): New static variable.
3711 (Parameters::Parameters): Move here from parameters.h.
3712 (Parameters::set_target): Rewrite.
3713 (Parameters::set_target_once): New function.
3714 (Parameters::clear_target): Move here and rewrite.
3715 * parameters.h (class Parameters): Update declarations. Add
3716 set_parameters_target_once_ field.
3717 (Parameters::Parameters): Move to parameters.cc.
3718 (Parameters::clear_target): Likewise.
3719 * readsyms.cc (Read_symbols::do_group): Create a Start_group
3721 (Start_group::~Start_group): New function.
3722 (Start_group::is_runnable): New function.
3723 (Start_group::locks, Start_group::run): New functions.
3724 (Finish_group::run): Change saw_undefined to size_t.
3725 * readsyms.h (class Start_group): Define.
3726 (class Finish_group): Change saw_undefined_ field to size_t.
3727 (Finish_group::Finish_group): Remove saw_undefined and
3728 this_blocker parameters. Change all callers.
3729 (Finish_group::set_saw_undefined): New function.
3730 (Finish_group::set_blocker): New function.
3731 * symtab.h (class Symbol_table): Change saw_undefined to return
3732 size_t. Change saw_undefined_ field to size_t.
3733 * target-select.cc (Set_target_once::do_run_once): New function.
3734 (Target_selector::Target_selector): Initialize set_target_once_
3735 field. Don't initialize lock_ and initialize_lock_ fields.
3736 (Target_selector::instantiate_target): Rewrite.
3737 (Target_selector::set_target): New function.
3738 * target-select.h (class Set_target_once): Define.
3739 (class Target_selector): Update declarations. Make
3740 Set_target_once a friend. Remove lock_ and initialize_lock_
3741 fields. Add set_target_once_ field.
3745 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3747 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
3748 (queue_middle_tasks): Add all blockers before queueing any tasks.
3749 (queue_final_tasks): Likewise.
3750 * token.h (Task_token::add_blockers): New function.
3751 * object.h (Input_objects::number_of_relobjs): New function.
3755 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3756 shared, not if not position independent.
3757 * x86_64.cc (Relocate::relocate_tls): Likewise.
3758 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3759 (tls_pie_pic_test): New target.
3760 * testsuite/Makefile.in: Rebuild.
3762 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3763 (tls_test_main_pie.o, tls_test_pie.o): New targets.
3764 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3765 * testsuite/Makefile.in: Rebuild.
3769 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3770 R_SPARC_RELATIVE using ->add_local_relative().
3771 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3773 * output.h (Output_data_dynamic::add_section_size): New method
3774 that takes two Output_data objects.
3775 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3776 entry param. Handle it in initializers.
3777 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3778 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3779 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3781 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3782 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3783 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3784 for dynrel_includes_plt.
3785 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3786 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3787 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3789 (Target_sparc::do_finalize_sections): Update to pass true for
3790 dynrel_includes_plt.
3791 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3792 output before .rela.plt
3793 (Target_powerpc::do_finalize_sections): Update to pass true for
3794 dynrel_includes_plt when 32-bit.
3798 * arm.cc (Arm_relobj::simple_input_section_output_address): New
3800 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3801 Arm_relobj::scan_section_for_cortex_a8_stubs,
3802 Arm_relobj::do_relocation_section): Instead of calling
3803 Output_section::output_address, use faster
3804 Arm_relobj::simple_input_section_output_address.
3808 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3809 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3810 relocation helper function.
3812 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3813 just like R_SPARC_GOT{10,13,22}.
3814 (Target_sparc::Scan::local): Likewise.
3815 (Target_sparc::Relocate:relocate): Likewise.
3819 * configure.ac: Rewrite targetobjs duplicate removal code to use
3820 only shell constructs.
3821 * configure: Rebuild.
3826 * arm.cc (Arm_relobj::section_is_scannable): New method.
3827 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3828 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3833 * arm-reloc-property.cc (cstdio): Include.
3834 * configure.ac (targetobjs): Remove duplicates.
3835 * configure: Regenerate.
3836 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3837 big and little endian version for a given address size.
3841 * arm-reloc-property.cc
3842 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3844 * arm-reloc-property.h
3845 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3846 New method definition.
3847 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3849 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3851 (GOT_PREL): Change implemented to Y.
3852 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3853 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3854 (Arm_relocate_functions::movw_abs_nc): Remove method.
3855 (Arm_relocate_functions::movt_abs): Ditto.
3856 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3857 (Arm_relocate_functions::thm_movt_abs): Ditto.
3858 (Arm_relocate_functions::movw_rel_nc): Ditto.
3859 (Arm_relocate_functions::movw_rel): Ditto.
3860 (Arm_relocate_functions::movt_rel): Ditto.
3861 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3862 (Arm_relocate_functions:thm_movw_rel): Ditto.
3863 (Arm_relocate_functions:thm_movt_rel): Ditto.
3864 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3865 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3866 New method definitions.
3867 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3868 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3869 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3870 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3871 (Target_arm::Relocate::relocate): Check for non-static or
3872 unimplemented relocation code and exit early. Change calls to
3873 Target_arm::reloc_uses_thumb_bit and
3874 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3875 instead. Refactor code to handle similar relocations to increase
3876 code sharing. Remove check for unsupported relocation code in switch
3878 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3879 relocation property table to find out size. Change error message to
3880 print out the name of a relocation code instead of the numeric value.
3881 (Target_arm::scan_reloc_for_stub): Use relocation property table
3882 instead of calling Target_arm::reloc_uses_thumb_bit().
3886 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3887 types of relaxed input section.
3891 * Makefile.am (HFILES): Add arm-reloc-property.h.
3893 (TARGETSOURCES): Add arm-reloc-property.cc
3894 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3895 (libgold_a_SOURCES): $(DEFFILES)
3896 * Makefile.in: Regenerate.
3897 * arm-reloc-property.cc: New file.
3898 * arm-reloc-property.h: New file.
3899 * arm-reloc.def: New file.
3900 * arm.cc: Update comments.
3901 (arm-reloc-property.h): New included header.
3902 (arm_reloc_property_table): New global variable.
3903 (Target_arm::do_select_as_default_target): New method definition.
3904 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3905 arm-reloc-property to targ_extra_obj.
3906 * parameters.cc (set_parameters_target): Call
3907 Target::select_as_default_target().
3908 * target.h (Target::select_as_default_target): New method definition.
3909 (Target::do_select_as_default_target): Same.
3913 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3914 first_output_text_section_.
3915 (Arm_exidx_fixup::first_output_text_section): New method definition.
3916 (Arm_exidx_fixup::first_output_text_section_): New data member.
3917 (Arm_exidx_fixup::process_exidx_section): Record the first text
3918 output section seen.
3919 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3920 and entsize in output section header.
3924 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3925 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3926 (Arm_relocate_functions::thm_alu11): New Method.
3927 (Arm_relocate_functions::thm_pc8): New Method.
3928 (Arm_relocate_functions::thm_pc12): New Method.
3929 (Target_arm::Scan::local): Handle the relocations.
3930 (Target_arm::Scan::global): Likewise.
3931 (Target_arm::Relocate::relocate): Likewise.
3932 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3936 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3937 of relocation types as ld.
3941 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3943 (Arm_relocate_functions::thumb_branch_common): Ditto.
3944 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3945 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3946 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3947 Arm_relocate_functions::jump24): Remove.
3948 (Target_arm::Relocate::relocate): Adjust code to call
3949 Arm_relocation_functions::arm_branch_common and
3950 Arm_relocation_functions::thumb_branch_common instead of their removed
3951 wrappers. Merge switch-cases together to reduce source code size.
3955 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3956 output_local_symbol_count_needs_update_.
3957 (Arm_relobj::output_local_symbol_count_needs_update,
3958 Arm_relobj::set_output_local_symbol_count_needs_update,
3959 Arm_relobj::update_output_local_symbol_count): New methods.
3960 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3962 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3963 of pointed function as in a R_ARM_PREL31 relocation.
3964 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3965 for output local symbol count updating.
3966 (Target_arm::do_relax): Update output local symbol counts in objects
3968 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3972 * arm.cc: Added support for the ARM relocations:
3973 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3974 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3975 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3977 (Arm_relocate_functions::movw_rel): New method.
3978 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3979 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3981 (Arm_relocate_functions::thm_movw_rel): New method.
3982 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3984 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3986 (Target_arm::Scan::global): Likewise.
3987 (Target_arm::Relocate::relocate): Likewise.
3988 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3993 * arm.cc: Added support for ARM group relocations.
3994 (Target_arm::reloc_needs_sym_origin): New method.
3995 (Arm_relocate_functions::calc_grp_kn): New method.
3996 (Arm_relocate_functions::calc_grp_residual): New method.
3997 (Arm_relocate_functions::calc_grp_gn): New method.
3998 (Arm_relocate_functions::arm_grp_alu): New Method.
3999 (Arm_relocate_functions::arm_grp_ldr): New Method.
4000 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4001 (Arm_relocate_functions::arm_grp_ldc): New Method.
4002 (Target_arm::Scan::local): Handle the ARM group relocations.
4003 (Target_arm::Scan::global): Likewise.
4004 (Target_arm::Relocate::relocate): Likewise.
4005 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4010 * arm.cc (set): Include.
4011 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4013 (Arm_output_section::Text_section_list): New type.
4014 (Arm_output_section::append_text_sections_to_list): New method.
4015 (Arm_output_section::fix_exidx_coverage): Ditto.
4016 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4017 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4018 Relobj::set_section_offset() instead of
4019 Sized_relobj::invalidate_section_offset().
4020 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4021 parameter for section headers. Ignore relocation sections for
4022 unallocated sections and EXIDX sections.
4023 (Target_arm::fix_exidx_coverage): New method.
4024 (Target_arm::output_section_address_less_than): New type.
4025 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4026 linked text section instead of the EXIDX section.
4027 (Arm_output_section::create_stub_group): Add an assertion to check
4028 that this is not an EXIDX output section.
4029 (Arm_output_section::append_text_sections_to_list): New method.
4030 (Arm_output_section::fix_exidx_coverage): Ditto.
4031 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4032 Arm_relobj::section_needs_reloc_stub_scanning.
4033 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4035 (Target_arm::fix_exidx_coverage): New method.
4036 * object.h (Relobj::set_output_section): New method.
4037 (Sized_relobj::invalidate_section_offset): Remove method.
4038 (Sized_relobj::do_invalidate_section_offset): Remove method.
4039 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4043 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4044 Fix warning due to signed and unsigned comparison on a 32-bit host.
4048 * arm.cc (Target_arm::do_relax): Record an output section for section
4049 offset adjustment it contains any stub table that has changed.
4050 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4051 offsets in an output section if necessary.
4052 * output.cc (Output_section::Output_section): Initialize
4053 section_offsets_need_adjustments_.
4054 (Output_section::add_input_section_for_script): Renamed to
4055 Output_section::add_simple_input_section.
4056 (Output_section::save_states): Add a comment.
4057 (Output_section::discard_states): New method defintion.
4058 (Output_section::adjust_section_offsets): Same.
4059 * output.h (Output_section::add_input_section_for_script): Renamed to
4060 Output_section::add_simple_input_section.
4061 (Output_section::discard_states): New method declaration.
4062 (Output_section::adjust_section_offsets): Same.
4063 (Output_section::section_offsets_need_adjustment,
4064 Output_section::set_section_offsets_need_adjustment): New method
4066 (Output_section::section_offsets_need_adjustment_): New data member.
4067 * script-sections.cc
4068 (Output_section_element_input::set_section_address): Adjust code for
4069 renaming of Output_section::add_input_section_for_script.
4070 (Orphan_output_section::set_section_address): Same.
4074 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4075 Fix_v4bx enum values .
4076 * gold/options.h (General_options): New option definitions.
4077 (General_options::fix_v4bx): New method.
4078 (General_options::Fix_v4bx): New enum.
4079 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4080 (General_options::parse_fix_v4bx_interworking): New method.
4084 * arm.cc (Arm_exidx_fixup): New class.
4088 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4090 (Arm_exidx_section_offset_map): New type.
4094 * arm.cc (Arm_exidx_input_section): New class.
4095 (Arm_relobj::exidx_input_section_by_link,
4096 Arm_relobj::exidx_input_section_by_shndx,
4097 Arm_relobj::make_exidx_input_section): New methods.
4098 (read_arm_attributes_section): Remove.
4099 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4100 information about them.
4101 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4106 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4107 Input_section_specifier to Section_id.
4108 (Target_arm::new_arm_input_section: Adjust code for change of key
4110 (Target_arm::find_arm_input_section): Ditto.
4111 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4112 (Section_id): Remove.
4113 (Garbage_collection::Section_id_hash): Remove.
4114 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4115 (Section_id): Remove.
4116 (Icf::Section_id_hash): Remove.
4117 * object.h (Section_id, Const_section_id, Section_id_hash,
4118 Const_section_id_hash): New type definitions.
4119 * output.cc (Output_section::add_relaxed_input_section): Change to
4120 use Const_section_id instead of Input_section_specifier as key type.
4121 (Output_section::add_merge_input_section): Ditto.
4122 (Output_section::build_relaxation_map): Change to use Section_id
4123 instead of Input_section_specifier as key type.
4124 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4126 (Output_section::convert_input_sections_to_relaxed_sections): Change
4127 to use Const_section_id instead of Input_section_specifier as key type.
4128 (Output_section::find_merge_section): Ditto.
4129 (Output_section::find_relaxed_input_section): Ditto.
4130 * output.h (Input_section_specifier): Remove class.
4131 (Output_section::Output_section_data_by_input_section_map): Change
4132 key type to Const_section_id.
4133 (Output_section::Output_relaxed_input_section_by_input_section_map):
4135 (Output_section::Relaxation_map): Change key type to Section_id.
4139 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4140 (class Arm_v4bx_stub): New class.
4141 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4142 (Stub_factory::make_arm_v4bx_stub): New method.
4143 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4144 (Stub_table::empty): Handle v4bx stubs.
4145 (Stub_table::add_arm_v4bx_stub): New method.
4146 (Stub_table::find_arm_v4bx_stub): New method.
4147 (Arm_relocate_functions::v4bx): New method.
4148 (Target_arm::fix_v4bx): New method.
4149 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4150 (Stub_table::relocate_stubs): Likewise.
4151 (Stub_table::do_write): Likewise.
4152 (Stub_table::update_data_size_and_addralign): Likewise.
4153 (Stub_table::finalize_stubs): Likewise.
4154 (Target_arm::Scan::local): Likewise.
4155 (Target_arm::Scan::global): Likewise.
4156 (Target_arm::do_finalize_sections): Likewise.
4157 (Target_arm::Relocate::relocate): Likewise.
4158 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4160 (Target_arm::scan_reloc_for_stub): Likewise.
4161 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4165 * output.cc (Output_section_headers::do_sized_write): Write large
4166 segment count to sh_info field.
4167 (Output_file_header::do_sized_write): For large segment count,
4168 write PN_XNUM to e_phnum field.
4172 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4173 (Arm_relocate_functions::thm_jump8): New function.
4174 (Arm_relocate_functions::thm_jump11): New function.
4175 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4177 (Target_arm::Scan::global): Likewise.
4178 (Target_arm::Relocate::relocate): Likewise.
4179 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4184 * arm.cc (map, utility): Include headers.
4185 (Target_arm::apply_cortex_a8_workaround): New method.
4186 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4187 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4188 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4189 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4190 the --[no-]fix-cortex-a8 command line options.
4191 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4192 (Target_arm::relocate_stub): Use addend in instruction template.
4193 * options.h (DEFINE_bool): Set the user-set flag.
4194 (General_options): Add --[no-]-fix-cortex options.
4195 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4196 : Update fast look-up map after conversion.
4200 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4201 in the first pass of do_layout.
4205 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4206 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4207 apparent compiler problem of not folding static constant integral
4208 data members of elfcpp::Elf_sizes<32>.
4212 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4213 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4214 Arm_relobj::scan_section_for_cortex_a8_erratum,
4215 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4216 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4217 sections to scan for relocation stubs into a new method
4218 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4219 relocation and Cortex-A8 stub scanning.
4220 (Target_arm::do_relax): Force stubs to be after stubbed sections
4221 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4222 the beginning of a new relaxation pass. Update a comment.
4223 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4227 * target-reloc.h (visibility_error): New inline function.
4228 (relocate_section): Call visibility_error.
4229 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4230 (MOSTLYCLEANFILES): Likewise.
4231 (protected_4_pic.o, protected_3.err): New targets.
4232 * testsuite/protected_4.cc: New file.
4236 * arm.cc (Cortex_a8_reloc): New class.
4237 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4238 and cortex_a8_relocs_info_.
4239 (Target_arm::fix_cortex_a8): New method definition.
4240 (Target_arm::Cortex_a8_relocs_info): New type.
4241 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4242 New data member declarations.
4243 (Target_arm::scan_reloc_for_stub): Record information about
4244 relocations for THUMB branches that might be exempted from the
4245 Cortex-A8 workaround.
4246 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4247 at the beginning of a relaxation pass.
4251 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4252 (Arm_relobj::Mapping_symbol_position,
4253 Arm_reloj::Mapping_symbol_position_less,
4254 Arm_relobj::Mapping_symbols_info): New types.
4255 (Target_arm::is_mapping_symbol_name): New method definition.
4256 (Arm_relobj::do_count_local_symbols): Save information about mapping
4261 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4262 Arm_relocate_functions::thumb32_branch_upper,
4263 Arm_relocate_functions::thumb32_branch_lower,
4264 Arm_relocate_functions::thumb32_cond_branch_offset,
4265 Arm_relocate_functions::thumb32_cond_branch_upper,
4266 Arm_relocate_functions::thumb32_cond_branch_lower,
4267 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4268 branch offset encoding.
4269 (Arm_relocate_functions::thumb_branch_common): Use new branch
4270 offset encoding methods to avoid code duplication.
4271 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4272 (Stub_addend_reader::operator()): Use new branch encoding method
4273 to avoid code duplication.
4277 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4278 (Target_arm::do_finalize_sections): Define special EXIDX section
4279 symbols only if referenced.
4280 * gc.h (Garbage_collection::add_reference): New method.
4281 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4286 * script.cc (Version_script_info::build_expression_list_lookup):
4287 Change complaing about duplicate wildcard match from error to
4290 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4292 (Version_script_info::Version_script_info): Initialize globs_,
4293 default_version_, default_is_global_, and exact_. Don't
4294 initialize globals_ or locals_.
4295 (Version_script_info::build_lookup_tables): Build local symbols
4297 (Version_script_info::unquote): New function.
4298 (Version_script_info::add_exact_match): New function.
4299 (Version_script_info::build_expression_list_lookup): Remove lookup
4300 parameter. Add is_global parameter. Change all callers. Handle
4301 wildcard pattern specially. Unquote pattern. Call
4303 (Version_script_info::get_name_to_match): New function.
4304 (Version_script_info::get_symbol_version): New function.
4305 (Version_script_info::get_symbol_version_helper): Remove.
4306 (Version_script_info::check_unmatched_names): Call unquote.
4307 * script.h (class Version_script_info): Change get_symbol_version
4308 to be non-inline and add is_global parameter; change all callers.
4309 Rewrite symbol_is_local. Update declarations. Define struct
4310 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4311 Remove globals_ and locals_ members. Add exact_, globs_,
4312 default_version_, is_global_.
4313 (Version_script_info::Glob): Remove pattern, add expression and
4314 is_global. Update constructor. Change all callers.
4315 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4317 (Versions::symbol_section_contents): If a symbol is undefined, or
4318 defined in a dynamic object, set the version index to
4320 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4322 (Symbol_table::add_from_pluginobj): Likewise.
4323 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4327 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4328 (incremental_dump_LDADD): Add linking option for libintl.
4329 * Makefile.in: Regenerate.
4334 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4336 * testsuite/Makefile.in: Regenerated.
4340 * options.h (DEFINE_var): Use parentheses around argument varname__
4341 in macro body to avoid any unintended subsequent substitutions.
4345 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4346 candidates before doing symbol resolution.
4348 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4349 ODR candidates if only one is weak.
4353 * script.cc (Version_script_info::build_expression_list_lookup):
4354 Don't warn about ambiguous version, just record the ambiguity.
4355 (Version_script_info::get_symbol_version_helper): Give error if
4356 version is ambiguous.
4360 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4361 prev_data_size_ and prev_addralign_. Remove initializer for
4362 deleted data member has_been_changed_.
4363 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4364 to determine if the table is empty.
4365 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4367 (Stub_table::add_reloc_stub): Define method in class definition
4368 instead of just declaring it there.
4369 (Stub_table::add_cortex_a8_stub): New method definition.
4370 (Stub_table::update_data_size_and_addralign): Ditto.
4371 (Stub_table::finalize_stubs): Ditto.
4372 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4373 (Stub_table::do_addralign_): Return address alignment in the
4374 (Stub_table::do_reset_address_and_file_offset): Define method in
4375 class definition instead of declaring it there. Set current data
4376 size to be the data size of the previous pass.
4377 (Stub_table::set_final_data_size): Use current data size as the
4379 (Stub_table::relocate_stub): Change parameter type of stub from
4380 Reloc_stub pointer to Stub pointer.
4381 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4382 (Stub_table::Cortex_a8_stub_list): New typedef.
4383 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4384 Stub_table::prev_addralign_): New data member.
4385 (Arm_relobj::Arm_relobj): Initialize data member
4386 section_has_cortex_a8_workaround_.
4387 (Arm_relobj::section_has_cortex_a8_workaround,
4388 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4390 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4392 (Target_arm::relocate_stub): Change parameter type of stub from
4393 Reloc_stub pointer to Stub pointer.
4394 (Insn_template::size, Insn_template::alignment): Handle
4395 THUMB16_SPECIAL_TYPE.
4396 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4397 Stub_table::update_data_size_and_addralign,
4398 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4400 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4401 (Stub_table::do_write): Ditto.
4402 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4407 * symtab.h (class Symbol): Remove fields is_target_special_ and
4408 has_plt_offset_. Add field is_defined_in_discarded_section_.
4409 (Symbol::is_defined_in_discarded_section): New function.
4410 (Symbol::set_is_defined_in_discarded_section): New function.
4411 (Symbol::has_plt_offset): Rewrite.
4412 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4413 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4414 Don't initialize is_target_special_ or has_plt_offset_.
4415 Initialize is_defined_in_discarded_section_.
4416 (Symbol_table::add_from_relobj): If appropriate, set
4417 is_defined_in_discarded_section.
4418 * resolve.cc (Symbol::override_base_with_special): Don't test
4419 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4420 * target-reloc.h (relocate_section): Do special handling for
4421 symbols defined in discarded sections for global symbols as well
4426 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4427 the SHT_SYMTAB case.
4431 * object.cc (Sized_relobj::do_layout): Don't get confused if
4432 layout_eh_frame returns NULL.
4437 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4438 dynamic symbol table, use the normal symbol table.
4439 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4445 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4450 * version.cc (print_version): Change to "Copyright 2010".
4456 * i386.cc (class Target_i386): Change return type of plt_section
4458 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4459 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4460 tls_desc_rel_ field.
4461 (Output_data_plt_i386::rel_tls_desc): New function.
4462 (Target_i386::rel_tls_desc_section): New function.
4463 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4464 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4465 R_386_TLS_DESC reloc in rel_tls_desc_section.
4466 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4467 Define struct Tlsdesc_info.
4468 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4469 (Target_x86_64::do_reloc_symbol_index): New function.
4470 (Target_x86_64::add_tlsdesc_info): New function.
4471 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4472 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4474 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4476 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4477 (Target_x86_64::rela_tlsdesc_section): New function.
4478 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4480 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4481 (Target_x86_64::do_reloc_addend): New function.
4482 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4483 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4484 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4485 (Output_reloc::type): New function.
4486 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4487 (Output_reloc::is_target_specific): New function.
4488 (Output_reloc::target_arg): New function.
4489 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4490 absolute relocs and target specific relocs.
4491 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4492 add_target_specific.
4493 (class Output_data_reloc) [SHT_RELA]: Likewise.
4494 * output.cc (Output_reloc::Output_reloc): Add four new versions
4495 for absolute relocs and target specific relocs.
4496 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4497 (Output_reloc::get_symbol_index): Likewise.
4498 (Output_reloc::local_section_offset): Check that local_sym_index_
4499 is not TARGET_CODE or 0.
4500 (Output_reloc::symbol_value): Likewise.
4501 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4503 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4504 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4506 * layout.cc (add_target_dynamic_tags): Use output section for
4507 DT_PLTRELSZ and DT_JMPREL.
4512 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4514 (class Output_data_reloc_generic): Define.
4515 (class Output_data_reloc_base): Change base class to
4516 Output_data_reloc_generic. Change add() method to call
4517 bump_relative_reloc_count for a relative reloc. Remove
4519 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4521 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4522 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4524 * layout.h (class Layout): Update declaration.
4528 * output.h (class Output_data): Add const version of
4529 output_section and do_output_section.
4530 (class Output_section_data): Add const version of
4532 (class Output_section): Likewise.
4533 * layout.cc (Layout::add_target_dynamic_tags): New function.
4534 * layout.h (class Layout): Update declarations.
4535 * arm.cc (Target_arm::do_finalize_sections): Use
4536 add_target_dynamic_tags.
4537 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4538 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4539 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4540 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4545 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4552 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4553 Xindex::read_symtab_xindex.
4557 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4558 (Insn_template::thumb16_bcond_insn): New method declaration.
4559 (Insn_template): Fix spelling.
4560 (Stub::thumb16_special): New method declaration.
4561 (Stub::do_write): Define virtual method which was previously pure
4563 (Stub::do_thumb16_special): New method declaration.
4564 (Stub::do_fixed_endian_write): New template member.
4565 (Reloc_stub::do_write): Remove.
4566 (Reloc_stub::do_fixed_endian_write): Remove.
4567 (Cortex_a8_stub): New class definition.
4568 (Stub_factory::make_cortex_a8_stub): New method definition.
4569 (Stub_factory::Stub_factory): Add missing static storage class
4570 qualifier for elf32_arm_stub_a8_veneer_blx.
4575 * options.h (class General_options): Add --warn-unresolved-symbols
4576 and --error-unresolved-symbols.
4577 * errors.cc (Errors::undefined_symbol): Implement
4578 --warn-unresolved-symbols.
4580 * options.h (class General_options): Add -z text and -z textoff.
4581 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4585 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4586 (Garbage_collection::cident_sections): New function.
4587 (Garbage_collection::add_cident_section): New function.
4588 (Garbage_collection::cident_sections_): New member.
4589 (gc_process_relocs): Add references to sections whose names are C
4591 * gold.h (cident_section_start_prefix): New constant.
4592 (cident_section_stop_prefix): New constant.
4593 (is_cident): New function.
4594 * layout.cc (Layout::define_section_symbols): Replace string constants
4595 with the newly defined constants.
4596 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4598 * testsuite/Makefile.am: Add gc_orphan_section_test.
4599 * testsuite/Makefile.in: Regenerate.
4600 * testsuite/gc_orphan_section_test.cc: New file.
4601 * testsuite/gc_orphan_section_test.sh: New file.
4606 * options.h (class General_options): Add --warn-shared-textrel.
4607 * layout.cc (Layout::finish_dynamic_section): Implement
4608 --warn-shared-textrel.
4611 * options.h (class General_options): Add --warn-multiple-gp.
4615 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4616 $(THREADSLIB) and $(LIBDL).
4617 * Makefile.in: Rebuild.
4622 * options.cc (General_options::parse_section_start): New function.
4623 (General_options::section_start): New function.
4624 (General_options::General_options): Initialize all members.
4625 * options.h: Include <map>
4626 (class General_options): Add --section-start. Add section_starts_
4628 * layout.cc (Layout::attach_allocated_section_to_segment): If
4629 --section-start was used, set the address of the segment. Remove
4630 local sort_sections.
4631 (Layout::relaxation_loop_body): If the address of the load segment
4632 has been set by --section-start, don't use it.
4633 * output.h (Output_segment::update_flags_for_output_section): New
4635 * output.cc (Output_segment::add_output_section): Call
4636 update_flags_for_output_section.
4641 * options.h (class General_options): Add --undefined-version.
4642 * script.cc (struct Version_expression): Add was_matched_by_symbol
4644 (Version_script_info::matched_symbol): New function.
4645 (Version_script_info::get_symbol_version_helper): Call
4647 (Version_script_info::check_unmatched_names): New function.
4648 * script.h (class Version_script_info): Update declarations.
4649 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4651 * options.h (class General_options): Use DEFINE_bool_alias for
4652 allow_multiple_definition.
4653 * resolve.cc (Symbol_table::should_override): Don't test
4654 allow_multiple_definition.
4657 * options.h (class General_options): Add --cref.
4658 * main.cc (main): Print cref table if --cref. Don't close mapfile
4659 until after printing cref table.
4660 * cref.cc: Include "symtab.h".
4661 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4662 (Cref_table_compare::operator()): New function.
4663 (Cref_inputs::gather_cref): New function.
4664 (filecol): New static const.
4665 (Cref_inputs::print_cref): New function.
4666 (Cref::print_cref): New function.
4667 * cref.h: Include <cstdio>.
4668 (class Cref): Update declarations.
4669 * mapfile.h (Mapfile::file): New function.
4670 * object.h (class Object): Define Symbols. Declare virtual
4671 do_get_global_symbols.
4672 (Object::get_global_symbols): New function.
4673 * object.cc (Input_objects::add_object): Pass object to cref_ if
4675 (Input_objects::archive_start): Likewise.
4676 (Input_objects::archive_stop): Likewise.
4677 (Input_objects::print_cref): New function.
4678 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4679 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4681 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4683 * plugin.h (class Sized_pluginobj): Update declarations.
4687 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4688 to is_default_version. Rename insdef to insdefault.
4689 (Symbol_table::add_from_relobj): Rename def to is_default_version
4690 and local to is_forced_local.
4691 (Symbol_table::add_from_pluginobj): Likewise.
4692 (Symbol_table::add_from_dynobj): Likewise.
4693 (Symbol_table::define_special_symbol): Rename insdef to
4699 * options.h (class General_options): Add
4700 --allow-multiple-definition and -z muldefs.
4701 * resolve.cc (Symbol_table::should_override): Don't warn about a
4702 multiple symbol definition if --allow-multiple-definition or -z
4706 * options.h (class General_options): Add --add-needed and
4707 --copy-dt-needed-entries. Tweak --as-needed help entry.
4708 * object.cc (Input_objects::check_dynamic_dependencies): Give an
4709 error if --copy-dt-needed-entries aka --add-needed is used and
4710 would cause a change in behaviour.
4713 * options.h (class General_options): Add -G as a short version of
4714 --shared. Add no-op options -assert, -g, and -i.
4718 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4719 check for .text or .gnu.linkonce.t sections.
4720 * icf.cc (Icf::find_identical_sections): Ditto.
4721 Change the detection for mangled function name within the section
4723 * icf.h (is_section_foldable_candidate): New function.
4728 * options.h (class General_options): Permit two dashes with
4729 --retain-symbols-file.
4734 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4735 don't put the file header and segment headers in the text
4739 * common.cc (Sort_commons::operator()): Stabilize sort when both
4741 (Symbol_table::do_allocate_commons_list): When allocating common
4742 symbols, skip a symbol which is no longer common.
4743 * symtab.h (Symbol::is_common): Test whether the symbol comes from
4744 an object before checking its type.
4745 * testsuite/common_test_2.c: New file.
4746 * testsuite/common_test_3.c: New file.
4747 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4748 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4749 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4750 (common_test_2_pic.o, common_test_2.so): New targets.
4751 (common_test_3_pic.o, common_test_3.so): New targets.
4752 * testsuite/Makefile.in: Rebuild.
4755 * script.cc (read_input_script): If we see a new SECTIONS clause,
4756 and we have added an input section, give an error.
4757 * layout.h (class Layout): Add have_added_input_section function.
4758 Add have_added_input_section_ field.
4759 * layout.cc (Layout::Layout): Initialize
4760 have_added_input_section_.
4761 (Layout::layout): Set have_added_input_section_.
4762 (Layout::layout_eh_frame): Likewise.
4767 * options.h (class General_options): Add --sort-common option.
4768 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4769 * common.cc (Sort_common): Add sort_order parameter to
4770 constructor. Add sort_order_ field.
4771 (Sort_commons::operator): Check sort_order_.
4772 (Symbol_table::allocate_commons): Determine the sort order.
4773 (Symbol_table::do_allocate_commons): Add sort_order parameter.
4775 (Symbol_table::do_allocate_commons_list): Likewise.
4780 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4781 symbols from this object, don't change the visibility of an
4783 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4788 * script.h (class Version_script_info): Define Language enum.
4789 Update declarations. Define Glob, Exact, and Lookup types. Add
4790 new fields globals_, locals_, and is_finalized_.
4791 * script.cc: Various formatting fixes.
4792 (class Parser_closure): Change language_stack_ from a vector of
4793 std::string to one of Version_script_info::Language. Adjust all
4795 (class Lazy_demangler): Remove.
4796 (struct Version_expression): Change language from std::string to
4797 Version_script_info::Language.
4798 (Version_script_info::Version_script_info): New function.
4799 (Version_script_info::~Version_script_info): Don't call clear.
4800 (Version_script_info::finalize): New function.
4801 (Version_script_info::build_lookup_tables): New function.
4802 (Version_script_info::build_expression_list_lookup): New
4804 (Version_script_info::get_symbol_version_helper): Rewrite to use
4806 (Version_script_info::print_expression_list): Adjust to use
4807 Version_script_info::Language.
4808 (script_push_lex_into_version_mode): Check that the version script
4809 has not been finalized.
4810 (version_script_push_lang): Change language string to
4811 Version_script_info::Language.
4812 * options.cc (Command_line::version_script): New function.
4813 * options.h (class General_options): Add finalize_dynamic_list
4814 function. Change version_script from declaration to definition.
4815 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4816 * testsuite/version_script.map: Remove duplicate def of foo.
4817 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4819 * testsuite/Makefile.in: Rebuild.
4824 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4825 if the input symbol index is 0, make the output symbol index 0.
4830 * options.h (class General_options): Add -x/--discard-all.
4831 * object.cc (Sized_relobj::do_count_local_symbols): Handle
4832 --discard-all. If the local symbol needs a dynamic entry, check
4833 that before handling --discard-locals.
4838 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4840 (Output_segment::add_output_section): Don't change the flags if
4844 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4845 GNU hash table if they need a dynamic value. Otherwise, don't add
4846 them if they are defined in a dynamic object or are forced local.
4851 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4852 .gnu.hash table for a 32-bit target.
4855 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4856 regular and a dynamic object only needs a dynamic symbol table
4857 entry if it is externally visible.
4860 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4861 constructor. Add global_offset_table_ field.
4862 (Target_i386::got_section): Set global_offset_table_.
4863 (Target_i386::do_finalize_sections): Set global_offset_table_
4865 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4866 in constructor. Add global_offset_table_ field.
4867 (Target_x86_64::got_section): Set global_offset_table_.
4868 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4871 * layout.cc (Layout::Layout): Initialize increase_relro_.
4872 (Layout::get_output_section): Add is_relro, is_last_relro, and
4873 is_first_non_relro parameters. Change all callers.
4874 (Layout::choose_output_section): Likewise.
4875 (Layout::add_output_section_data): Likewise.
4876 (Layout::make_output_section): Likewise.
4877 (Layout::set_segment_offsets): Clear increase_relro when using a
4879 * layout.h (class Layout): Add increase_relro method. Add
4880 increase_relro_ field. Update declarations.
4881 * output.cc (Output_section::Output_section): Initialize
4882 is_last_relro_ and is_first_non_relro_.
4883 (Output_segment::add_output_section): Group relro sections is
4884 do_sort is true. Handle is_last_relro and is_first_non_relro.
4885 (Output_segment::maximum_alignment): Remove relro handling.
4886 (Output_segment::set_section_addresses): Add increase_relro
4887 parameter. Change all callers. Add initial alignment to align
4888 relro sections on separate page. Remove old relro handling.
4889 (Output_segment::set_section_list_addresses): Remove in_relro
4890 parameter. Change all callers.
4891 (Output_segment::set_offset): Add increase parameter. Change all
4892 callers. Remove old relro handling.
4893 * output.h (class Output_section): Add new methods: is_last_relro,
4894 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4895 Add is_last_relro_ and is_first_non_relro_ fields.
4896 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4897 Create separate .got.plt section. Call increase_relro.
4898 * x86_64.cc (Target_x86_64::got_section): Likewise.
4899 * testsuite/relro_script_test.t: Add .got.plt.
4902 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4903 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4904 (Layout::finalize): Call set_dynamic_symbol_size.
4905 (Layout::set_dynamic_symbol_size): New function.
4906 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4907 set_dynamic_symbol_size.
4910 * output.h (class Output_section): Add is_entsize_zero_ field.
4911 * output.cc (Output_section::Output_section): Initialize
4913 (Output_section::set_entsize): If two different entsizes are
4914 requested, force it to zero.
4915 (Output_section::add_input_section): Set flags for .debug_str
4916 before updating section flags. Set entsize.
4917 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4918 and SHF_STRING if all input sections have those flags.
4922 * main.cc (main): Fix the sys time reporting.
4923 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4928 * options.cc (General_options::parse_version): Allow -v to exit
4929 without an error if there is nothing to link.
4933 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4934 using a version of gcc before 4.1.
4935 * configure: Rebuild.
4939 * attributes.cc (Output_attributes_section_data::do_write): Use
4940 std::vector::front rather than std::vector::data.
4944 * symtab.h (class Symbol_table): Add enum Defined.
4945 * resolve.cc (Symbol_table::should_override): Add defined
4946 parameter. Change all callers. Test whether object is NULL
4947 before calling a method on it.
4948 (Symbol_table::report_resolve_problem): Add defined parameter.
4950 (Symbol_table::should_override_with_special): Likewise.
4951 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4952 parameter. Change all callers.
4953 (Symbol_table::do_define_in_output_data): Likewise.
4954 (Symbol_table::define_in_output_segment): Likewise.
4955 (Symbol_table::do_define_in_output_segment): Likewise.
4956 (Symbol_table::define_as_constant): Likewise.
4957 (Symbol_table::do_define_as_constant): Likewise.
4958 * script.h (class Symbol_assignment): Add is_defsym parameter to
4959 constructor; change all callers.
4960 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4961 parameter. Change all callers. Add is_defsym_ field.
4962 (class Parser_closure): Add parsing_defsym parameter to
4963 constructor; change all callers. Add parsing_defsym accessor
4964 function. Add parsing_defsym_ field.
4968 * gold.cc (queue_middle_tasks): Fix formatting.
4969 * object.cc (Relobj::is_section_name_included): Likewise.
4973 * i386.cc (Target_i386::do_calls_non_split): Recognize
4974 -fsplit-stack prologue for a function with a static chain.
4975 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4976 -fsplit-stack prologue when using %r11.
4980 * options.cc (General_options::parse_version): Make -v continue and do
4981 the link like GNU ld does.
4985 * Makefile.am (CCFILES): Add timer.cc.
4986 (HFILES): Add timer.h.
4987 * configure.ac: Check for sysconf and times.
4988 * main.cc: include timer.h.
4989 (main): Use Timer instead of get_run_time.
4992 * workqueue.cc: include timer.h.
4993 (Workqueue::find_and_run_task):
4994 Report user, sys and wall time.
4995 * Makefile.in: Regenerate.
4996 * config.in: Regenerate.
4997 * configure: Regenerate.
5001 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5003 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5004 relaxed input sections.
5005 * output.cc (Output_section::find_relaxed_input_section): Change
5006 return type to Output_relaxed_input_section pointer. Adjust code
5007 for new type of relaxed_input_section_map_.
5008 * output.h (Output_section::find_relaxed_input_section): Change
5009 return type to Output_relaxed_input_section pointer.
5010 (Output_section::Output_relaxed_input_section_by_input_section_map):
5012 (Output_section::relaxed_input_section_map_): Change type to
5013 Output_section::Output_relaxed_input_section_by_input_section_map.
5014 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5019 * layout.cc (Layout::create_shstrtab): Only write out after input
5020 sections if we are compressing debug sections.
5024 * archive.cc (Archive::add_symbols): Only look up a symbol without
5025 a version if there is, in fact, a version.
5029 Revert -Wshadow changes, all changes from:
5032 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5036 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5038 * attributes.cc (Object_attribute::size): Ditto.
5039 (Attributes_section_data::size): Ditto.
5040 (Attributes_section_data::Attributes_section_data): Ditto.
5041 (Output_attributes_section_data::do_write): Ditto.
5042 * attributes.h (Object_attribute::set_type): Ditto.
5043 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5047 * archive.cc: Fix shadowed variable warnings.
5049 * compressed_output.cc: Likewise.
5050 * compressed_output.h: Likewise.
5051 * configure: Likewise.
5052 * dwarf_reader.cc: Likewise.
5053 * dynobj.cc: Likewise.
5054 * dynobj.h: Likewise.
5055 * ehframe.cc: Likewise.
5056 * ehframe.h: Likewise.
5057 * errors.cc: Likewise.
5058 * expression.cc: Likewise.
5059 * fileread.cc: Likewise.
5060 * fileread.h: Likewise.
5061 * freebsd.h: Likewise.
5062 * i386.cc: Likewise.
5064 * incremental.h: Likewise.
5065 * layout.cc: Likewise.
5066 * layout.h: Likewise.
5067 * mapfile.cc: Likewise.
5068 * merge.cc: Likewise.
5069 * merge.h: Likewise.
5070 * object.cc: Likewise.
5071 * object.h: Likewise.
5072 * options.h: Likewise.
5073 * output.cc: Likewise.
5074 * output.h: Likewise.
5075 * parameters.cc: Likewise.
5076 * plugin.cc: Likewise.
5077 * powerpc.cc: Likewise.
5078 * reduced_debug_output.cc: Likewise.
5079 * reduced_debug_output.h: Likewise.
5080 * reloc.cc: Likewise.
5081 * reloc.h: Likewise.
5082 * resolve.cc: Likewise.
5083 * script-sections.cc: Likewise.
5084 * script.cc: Likewise.
5085 * script.h: Likewise.
5086 * sparc.cc: Likewise.
5087 * symtab.cc: Likewise.
5088 * symtab.h: Likewise.
5089 * target-select.cc: Likewise.
5090 * target-select.h: Likewise.
5091 * token.h: Likewise.
5092 * workqueue.cc: Likewise.
5093 * workqueue.h: Likewise.
5094 * x86_64.cc: Likewise.
5098 * arm.cc (attributes.h): New include.
5099 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5100 (Arm_relobj::~Arm_relobj): Delete object pointed by
5101 attributes_section_data_.
5102 (Arm_relobj::attributes_section_data): New method definition.
5103 (Arm_relobj::attributes_section_data_): New data member declaration.
5104 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5105 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5106 attributes_section_data_.
5107 (Arm_dynobj::attributes_section_data): New method definition.
5108 (Arm_dynobj::attributes_section_data_): New data member declaration.
5109 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5110 initialization value of may_use_blx_ to false.
5111 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5112 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5113 object attributes to compute results instead of hard-coding.
5114 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5115 Target_arm::get_secondary_compatible_arch,
5116 Target_arm::set_secondary_compatible_arch
5117 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5118 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5119 New method declarations.
5120 (Target_arm::get_aeabi_object_attribute): New method definition.
5121 (Target_arm::attributes_section_data_): New data member declaration.
5122 (read_arm_attributes_section): New template definition.
5123 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5124 (Arm_dynobj::do_read_symbols): Ditto.
5125 (Target_arm::do_finalize_sections): Merge attributes sections from
5126 input. Check for BLX use after attributes section merging.
5127 Fix __exidx_start and __exidx_end visibility. Create an
5128 .ARM.attributes section if necessary.
5129 (Target_arm::get_secondary_compatible_arch,
5130 Target_arm::set_secondary_compatible_arch,
5131 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5132 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5133 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5134 New method definitions.
5138 * plugin.cc (Plugin::load): Don't cast from void* to a function
5143 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5148 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5149 Replace two_file_shared_1.so with two_file_shared_2.so.
5150 * testsuite/Makefile.in: Regenerated.
5154 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5155 (HFILES): Add attributes.h and int_encoding.h.
5156 * Makefile.in: Regenerate.
5157 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5158 function definitions to int_encoding.cc
5159 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5160 prototypes to int_encoding.h
5161 * reduced_debug_output.cc (int_encoding.h): New include.
5162 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5163 function definitions to int_encoding.cc
5164 (insert_into_vector, read_from_pointer): Move template definitions to
5166 * attributes.cc: New file.
5167 * attributes.h: New file.
5168 * int_encoding.cc: New file.
5169 * int_encoding.h: New file.
5174 * incremental-dump.cc (dump_incremental_inputs): New.
5175 (main): Use dump_incremental_inputs.
5180 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5181 checking elfcpp::STT_FUNC.
5182 (Target_i386::Relocate::relocate): Likewise.
5183 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5185 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5186 symbols from shared libraries into normal FUNC symbols.
5188 * symtab.h (Symbol): Add is_func and use it.
5192 * arm.cc (Target_arm::arm_info): Initialize new fields
5193 attributes_section and attributes_vendor.
5194 * i386.cc (Target_i386::i386_info): Same.
5195 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5196 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5197 fields attributes_section and attributes_vendor.
5198 * sparc.cc (Target_sparc::sparc_info): Same.
5199 * target.h (Target::attributes_section, Target::attributes_vendor,
5200 Target::is_attributes_section, Target::attribute_arg_type,
5201 Target::attributes_order): New method definitions.
5202 (Target::Target_info::attributes_section,
5203 Target::Target_info::attributes_vendor): New fields.
5204 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5205 virtual method definitions.
5206 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5207 attributes_section and attributes_vendor.
5208 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5212 * arm.cc: Update comments about interworking and stub generation.
5213 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5214 considered as non-PIC.
5215 (Arm_relocate_functions::base_abs): Fix formatting.
5216 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5217 of function to use GOT entry address instead of offset.
5218 (Target_arm::Scan::global): Issue an error if a symbol would need a
5219 PLT does not get one because it is untyped. Remove code to create
5220 dynamic symbols for relative branches.
5221 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5222 takes unsigned integer instead of boolean.
5226 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5227 (two_file_test_LDADD): Likewise.
5228 (common_test_1_LDADD): Likewise.
5229 (exception_test_LDADD) Likewise.
5230 (weak_test_LDADD): Likewise.
5231 (many_sections_test_LDADD): Likewise.
5232 (initpri1_LDADD): Likewise.
5233 (script_test_1_LDADD): Likewise.
5234 (script_test_2_LDADD): Likewise.
5235 (justsyms_LDADD): Likewise.
5236 (binary_test_LDADD): Likewise.
5237 (large_LDADD): Likewise.
5238 * testsuite/Makefile.in: Regenerated.
5242 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5243 (Symbol_table::override_with_special): Likewise.
5244 (Symbol_table::add_from_object): Likewise.
5248 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5249 Don't set the data_offset twice.
5253 * testsuite/Makefile.in: Regenerate.
5257 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5258 (Target_arm::do_finalize_sections): Add parameter for symbol table
5259 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5260 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5261 parameter for symbol table pointer.
5262 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5263 an additional parameter for a pointer to symbol table.
5264 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5265 parameter for a symbol table pointer.
5266 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5267 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5269 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5270 parameter for a symbol table pointer.
5274 * incremental.cc (Incremental_inputs_header)
5275 (Incremental_inputs_header_write, Incremental_inputs_entry)
5276 (Incremental_inputs_entry_write): Move ...
5277 * incremental.h (Incremental_inputs_header)
5278 (Incremental_inputs_header_write, Incremental_inputs_entry)
5279 (Incremental_inputs_entry_write): here.
5283 * incremental.cc (make_sized_incremental_binary): Set the target.
5284 Error if it is incompatible.
5285 * output.h (Output_file): Add filename method.
5289 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5290 from the get_* methods.
5294 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5295 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5296 Write 0 for the data_offset of scripts.
5300 * testsuite/Makefile.am: Add the incremental_test.sh test.
5301 * testsuite/incremental_test.sh: New.
5302 * testsuite/incremental_test_1.c: New.
5303 * testsuite/incremental_test_2.c: New.
5307 * incremental-dump.cc (main): Fix typos.
5312 * incremental-dump.cc (main): Use llu to print 64 bit values.
5317 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5319 (incremental_dump_LDADD): Likewise.
5320 * Makefile.in: Regenerated.
5328 * arm.cc (Target_arm::Target_arm): Move method definition
5329 outside of class definition. Add code to handle
5330 --target1-rel, --target1-abs and --target2= options.
5331 (Target_arm::get_reloc_reloc_type): Change method to be
5332 non-static and const.
5333 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5334 New data member declaration.
5335 (Target_arm::Scan::local, Target_arm::Scan::global,
5336 Target_arm::Relocate::relocate,
5337 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5338 Adjust call to Target_arm::get_real_reloc_type.
5339 (Target_arm::get_real_reloc_type): Use command line options
5340 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5341 * options.h (--target1-rel, --target1-abs, --target2): New
5346 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5347 class definition. Add code to handle --target1-rel, --target1-abs
5348 and --target2= options.
5349 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5351 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5353 (Target_arm::Scan::local, Target_arm::Scan::global,
5354 Target_arm::Relocate::relocate,
5355 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5356 call to Target_arm::get_real_reloc_type.
5357 (Target_arm::get_real_reloc_type): Use command line options to
5358 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5359 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5364 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5365 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5366 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5368 (Arm_relocate_functions::thm_call): Replace body with a call to
5369 Arm_relocate_functions::thumb_branch_common.
5370 (Arm_relocate_functions::thm_jump24,
5371 Arm_relocate_functions::thm_xpc22): New method definitions.
5372 (Arm_relocate_functions::thumb_branch_common): New method definition.
5373 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5375 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5376 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5380 * Makefile.am: Build incremental-dump
5381 * Makefile.in: Regenerate.
5382 * incremental-dump.cc: New.
5383 * incremental.cc (Incremental_inputs_header_data,
5384 Incremental_inputs_entry_data): Move to incremental.h
5385 * incremental.h: (Incremental_inputs_header_data,
5386 Incremental_inputs_entry_data): Move from incremental.cc
5390 * incremental.cc (Incremental_inputs_header,
5391 Incremental_inputs_header_write, Incremental_inputs_entry,
5392 Incremental_inputs_entry_write): Add a typedef with the data type.
5396 * incremental.cc (Incremental_inputs_header,
5397 Incremental_inputs_header_write, Incremental_inputs_entry,
5398 Incremental_inputs_entry_write): Update comment about which
5399 type has the filed descriptions.
5403 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5404 (Arm_relocate_functions::arm_branch_common): Change method defintion
5405 in class definition to a method declaration and update list of formal
5407 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5408 Arm_relocation_functions::jump24): Adjust call to
5409 Arm_relocate_functions::arm_branch_common. Update list of formal
5411 (Arm_relocate_functions::xpc25): New method definition.
5412 (Arm_relocate_functions::arm_branch_common): Move method defintion
5413 out from class definition. Use stubs for mode-switching and extending
5415 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5416 specially. Change code to enable use of stubs in ARM branches.
5420 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5421 in method declaration.
5422 (Target_arm::relocate_stub): New method declaration.
5423 (Target_arm::default_target): Change to return a pointer instead of
5425 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5426 Target_arm::default_target.
5427 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5429 (Target_arm::relocate_section): Adjust view.
5430 (Target_arm::relocate_stub): New method definition.
5434 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5436 * incremental.cc (open_incremental_binary): Initialized local
5437 variables to avoid warnings.
5438 * object.cc (make_elf_object): Ditto.
5439 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5445 * testsuite/plugin_test.c: Include "config.h".
5449 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5450 (arm_symbol_value): Remove.
5451 (Arm_relocate_functions::arm_branch_common,
5452 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5453 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5454 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5455 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5456 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5457 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5458 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5459 Arm_relocate_functions::thm_mobw_abs_nc,
5460 Arm_relocate_functions::thm_mov_abs,
5461 Arm_relocate_functions::movw_prel_nc,
5462 Arm_relocate_functions::thm_movt_abs,
5463 Arm_relocate_functions::movt_prel,
5464 Arm_relocate_functions::thm_movw_prel_nc,
5465 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5466 (Target_arm::Relocate::relocate): Only decompose address into two
5467 parts if relocation type uses the thumb-bit and pass the actual
5468 bit instead of a flag indicating that the thumb-bit is used. Adjust
5469 calls to methods in Arm_relocate_functions for this change.
5474 * reloc.cc: Instantiate
5475 Sized_relobj::initialize_input_to_output_maps and
5476 Sized_relobj:free_input_to_output_maps.
5481 * defstd.cc (in_segment): Set only_if_ref true for "end".
5485 * arm.cc (class Reloc_stub): Correct a comment.
5486 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5487 (Target_arm::scan_section_for_stubs): New method declaration.
5488 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5489 Change methods from private to protected.
5490 (Target_arm::do_may_relax): New method definition.
5491 (Target_arm::do_relax, Target_arm::group_sections,
5492 Target_arm::scan_reloc_for_stub,
5493 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5494 (Target_arm::arm_input_section_map_): New data member declaration.
5495 (Target_arm::scan_reloc_for_stub,
5496 Target_arm::scan_reloc_section_for_stubs,
5497 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5498 Target_arm::do_relax): New method definitions.
5502 * configure.ac: Check for (struct stat)::st_mtim
5503 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5504 * config.in: Regenerate.
5505 * configure: Regenerate.
5510 * output.cc (Output_segment::add_output_section): Add missing
5516 * object.h (class Object): Add is_needed and set_is_needed
5517 methods. Add is_needed_ field. Make bool fields into bitfields.
5518 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5519 defined in a dynamic object and referenced by a regular object,
5520 set is_needed for the dynamic object.
5521 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5522 if the file is marked with as_needed and it is not needed.
5527 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5528 tags if data is discarded by linker script.
5529 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5530 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5531 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5532 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5536 * layout.cc (Layout::get_output_section): Add is_interp and
5537 is_dynamic_linker_section parameters. Change all callers.
5538 (Layout::choose_output_section): Likewise.
5539 (Layout::make_output_section): Likewise.
5540 (Layout::add_output_section_data): Add is_dynamic_linker_section
5541 parameter. Change all callers.
5542 * layout.h (class Layout): Update declarations.
5543 * output.h (class Output_section): Add is_interp, set_is_interp,
5544 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5545 Add is_interp_, is_dynamic_linker_section_ fields. Change
5546 generate_code_fills_at_write_ to a bitfield.
5547 * output.cc (Output_section::Output_sections): Initialize new
5549 (Output_segment::add_output_section): Add do_sort parameter.
5555 * options.h (class General_options): Add --warn-common.
5556 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5557 merging two common symbols.
5558 (Symbol_table::should_override): Handle --warn-common when merging
5559 a common symbol with a defined symbol. Use report_resolve_problem
5560 for multiple definitions.
5561 (Symbol_table::report_resolve_problem): New function.
5562 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5566 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5568 (Target_arm::stub_factory): New method definition.
5569 (Target_arm::new_arm_input_section,
5570 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5571 Target_arm::reloc_uses_thumb_bit): New method declarations.
5572 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5573 New type definitions.
5574 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5575 member declarations.
5576 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5577 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5578 New method definitions.
5582 * options.h (class General_options): Add --warn_constructors.
5587 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5588 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5593 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5594 --msgid-bugs-address.
5595 (install-pdf): New target.
5596 (install-data_yes): Look up one directory to find mkinstalldirs.
5600 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5605 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5609 * arm.cc (Stub_addend_reader): New struct template definition
5610 and partial specializations.
5611 (Stub_addend_reader::operator()): New method definition for a
5612 partially specialized template.
5616 * arm.cc (Arm_relobj::processor_specific_flags): New method
5618 (Arm_relobj::do_read_symbols): New method declaration.
5619 (Arm_relobj::processor_specific_flags_): New data member declaration.
5620 (Arm_dynobj): New class definition.
5621 (Target_arm::do_finalize_sections): Add input_objects parameter.
5622 (Target_arm::do_adjust_elf_header): New method declaration.
5623 (Target_arm::are_eabi_versions_compatible,
5624 (Target_arm::merge_processor_specific_flags): New method declaration.
5625 (Target_arm::do_make_elf_object): New overloaded method definitions
5627 (Arm_relobj::do_read_symbols): New method definition.
5628 (Arm_dynobj::do_read_symbols): Ditto.
5629 (Target_arm::do_finalize_sections): Add input_objects parameters.
5630 Merge processor-specific flags from all input objects.
5631 (Target_arm::are_eabi_versions_compatible,
5632 Target_arm::merge_processor_specific_flags,
5633 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5634 New method definitions.
5635 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5636 Input_objects pointer type parameter.
5637 * layout.cc (Layout::finalize): Pass input objects to target's.
5638 finalize_sections function.
5639 * output.cc (Output_file_header::do_sized_write): Set ELF file
5640 header's processor-specific flags.
5641 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5642 Input_objects pointer type parameter.
5643 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5644 * target.h (Input_objects): New forward class declaration.
5645 (Target::processor_specific_flags,
5646 Target::are_processor_specific_flags_sect): New method definitions.
5647 (Target::finalize_sections): Add input_objects parameter.
5648 (Target::Target): Initialize processor_specific_flags_ and
5649 are_processor_specific_flags_set_.
5650 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5652 (Target::set_processor_specific_flags): New method definition.
5653 (Target::processor_specific_flags_,
5654 Target::are_processor_specific_flags_set_): New data member
5656 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5657 Input_objects pointer type parameter.
5661 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5665 * object.h (class Relobj): Drop options parameter from
5666 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5667 do_scan_relocs, do_relocate. Change all callers.
5668 (class Sized_relobj): Drop options parameters from
5669 do_gc_process_relocs, do_scan_relocs, do_relocate,
5670 do_relocate_sections, relocate_sections, emit_relocs_scan,
5671 emit_relocs_scan_reltype. Change all callers.
5672 (struct Relocate_info): Remove options field and all references to
5674 * reloc.h (class Read_relocs): Remove options constructor
5675 parameter and options_ field. Change all callers.
5676 (class Gc_process_relocs, class Scan_relocs): Likewise.
5677 (class Relocate_task): Likewise.
5678 * target-reloc.h (scan_relocs): Remove options parameter. Change
5680 (scan_relocatable_relocs): Likewise.
5681 * target.h (class Sized_target): Remove options parameter from
5682 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5684 * gc.h (gc_process_relocs): Remove options parameter. Change all
5686 * arm.cc: Update functions to remove options parameters.
5687 * i386.cc: Likewise.
5688 * powerpc.cc: Likewise.
5689 * sparc.cc: Likewise.
5690 * x86_64.cc: Likewise.
5691 * testsuite/testfile.cc: Likewise.
5695 * arm.cc (Arm_relobj): New class definition.
5696 (Arm_relobj::scan_sections_for_stubs,
5697 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5698 New method definitions.
5702 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5703 (Plugin::cleanup_done_): New member.
5704 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5705 (Plugin_manager::cleanup_done_): Remove.
5706 (Plugin_manager::add_input_file): Edit error message.
5707 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5708 (Plugin_manager::cleanup): Remove use of cleanup_done_.
5712 * fileread.cc: (File_read::View::~View): Use the new
5713 data_ownership_ filed.
5714 (File_read::~File_read): Dispose the new whole_file_view_.
5715 (File_read::open): Mmap the whole file if needed.
5716 (File_read::open): Use whole_file_view_ instead of contents_.
5717 (File_read::find_view): Use whole_file_view_ if applicable.
5718 (File_read::do_read): Use whole_file_view_ instead of contents_.
5719 (File_read::make_view): Use whole_file_view_ instead of contents_,
5720 update File_read::View::View call.
5721 (File_read::find_or_make_view): Update File_read::View::View
5723 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5725 (File_read::View::Data_ownership): New enum.
5726 (File_read::View::View): Replace bool mapped_ with Data_ownership
5728 (File_read::View::mapped_): Remove (replaced by data_ownership_).
5729 (File_read::View::data_ownership_): New field.
5730 (File_read::contents_): Remove (replaced by whole_file_view_).
5731 (File_read::whole_file_view_): New field.
5732 * options.h (class General_options): Add --keep-files-mapped.
5736 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5737 * testsuite/Makefile.am (plugin_test_5): New test case.
5738 * testsuite/Makefile.in: Regenerate.
5742 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5743 from private to protected to allow access by child class.
5744 (Sized_relobj::do_relocate_sections): New method declaration.
5745 (Sized_relobj::relocate_sections): Virtualize.
5746 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5747 Sized_relobj::relocate_sections. Instantiate template explicitly
5748 for different target sizes and endianity.
5752 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5753 (Arm_input_section::as_arm_input_section): New method.
5754 (Arm_output_section): New class definition.
5755 (Arm_output_section::create_stub_group,
5756 Arm_output_section::group_sections): New method definitions.
5760 * arm.cc (Arm_input_section): New class definition.
5761 (Arm_input_section::init, Arm_input_section:do_write,
5762 Arm_input_section::set_final_data_size,
5763 Arm_input_section::do_reset_address_and_file_offset): New method
5768 * arm.cc (Stub_table, Arm_input_section): New forward class
5770 (Stub_table): New class defintion.
5771 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5772 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5773 New method definition.
5777 * arm.cc: Update copyright comments.
5778 (Target_arm): New forward class template declaration.
5779 (Arm_address): New type.
5780 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5781 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5782 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5784 (Insn_template): Same.
5785 (DEF_STUBS): New macro.
5786 (Stub_type): New enum type.
5787 (Stub_template): New class definition.
5790 (Stub_factory): Same.
5791 (Target_arm::Target_arm): Initialize may_use_blx_ and
5792 should_force_pic_veneer_.
5793 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5794 Target_arm::should_force_pic_veneer,
5795 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5796 Target_arm::using_thumb_only, Target_arm:;default_target): New
5798 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5799 New data member declarations.
5800 (Insn_template::size, Insn_template::alignment): New method defintions.
5801 (Stub_template::Stub_template): New method definition.
5802 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5803 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5804 (Stub_factory::Stub_factory): New method definition.
5805 * gold.h (string_hash): New template.
5806 * output.h (Input_section_specifier::hash_value): Use
5808 (Input_section_specifier::string_hash): Remove.
5809 * stringpool.cc (Stringpool_template::string_hash): Use
5814 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5815 symbols of relaxed input sections.
5816 * output.h (Output_section::find_relaxed_input_section): Make
5821 * dynobj.cc (Versions::Versions): Initialize version_script_.
5822 Only insert base version symbol definition for a shared object
5823 if version script defines any version versions.
5824 (Versions::define_base_version): New method definition.
5825 (Versions::add_def): Check that base version is not needed.
5826 (Versions::add_need): Define base version lazily.
5827 * dynobj.h (Versions::define_base_version): New method declaration.
5828 (Versions::needs_base_version_): New data member declaration.
5829 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5830 (check_DATA): Add no_version_test.stdout.
5831 (libno_version_test.so, no_version_test.o no_version_test.stdout):
5833 * testsuite/Makefile.in: Regenerate.
5834 * testsuite/no_version_test.c: New file.
5835 * testsuite/no_version_test.sh: Ditto.
5839 * expression.cc (class Segment_start_expression): New class definition.
5840 (Segment_start_expression::value): New method definition.
5841 (script_exp_function_segment_start): Return a new
5842 Segment_start_expression.
5843 * gold/script-c.h (script_saw_segment_start_expression): New function
5845 * script-sections.cc (Script_sections::Script_sections): Initialize
5846 SAW_SEGMENT_START_EXPRESSION_ to false.
5847 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5848 and -Tbbs options to specify section addresses if given in
5849 command line and no SEGMENT_START expression is seen in a script.
5850 * script-sections.h (Script_sections::saw_segment_start_expression,
5851 Script_sections::set_saw_segment_start_expression): New method
5853 (Script_sections::saw_segment_start_expression_): New data member
5855 * script.cc (script_saw_segment_start_expression): New function.
5856 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5857 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5858 script_test_7.sh and script_test_8.sh.
5859 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5860 script_test_8.stdout.
5861 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5862 (script_test_6, script_test_6.stdout, script_test_7,
5863 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5864 * Makefile.in: Regenerate.
5865 * testsuite/script_test_6.sh: New file.
5866 * testsuite/script_test_6.t: Same.
5867 * testsuite/script_test_7.sh: Same.
5868 * testsuite/script_test_7.t: Same.
5869 * testsuite/script_test_8.sh: Same.
5873 * output.cc (Output_segment::set_section_list_address): Cast
5874 expressions to unsigned long long type to avoid format warnings.
5878 * script.cc (Script_options::add_symbol_assignment): Always add a
5879 dot assignment to script_sections_.
5880 * script-sections.cc (Script_sections::add_dot_assignment):
5881 Initialize if necessary.
5883 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5884 program headers with no load segment if there is a linker script.
5886 * layout.cc (Layout::set_segment_offsets): Align the file offset
5887 to the segment aligment for -N or -n with no load segment.
5888 * output.cc (Output_segment::add_output_section): Don't crash if
5889 the first section is a TLS section.
5890 (Output_segment::set_section_list_addresses): Print an error
5891 message if the address moves backward in a linker script.
5892 * script-sections.cc
5893 (Output_section_element_input::set_section_addresses): Don't
5894 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5895 (Orphan_output_section::set_section_addresses): Likewise.
5899 * layout.cc (Layout::finish_dynamic_section): Generate tags
5900 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5901 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5902 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5906 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5908 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5909 data_shdr fields of relinfo.
5910 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5911 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5912 R_386_TLS_LDO_32, adjust based on section flags.
5913 (Target_i386::Relocate::fix_up_ldo): Remove.
5917 Add support for -pie.
5918 * options.h (class General_options): Add -pie and
5920 (General_options::output_is_position_independent): Test -pie.
5921 (General_options::output_is_executable): Return true if not shared
5922 and not relocatable.
5923 (General_options::output_is_pie): Remove.
5924 * options.cc (General_options::finalize): Reject incompatible uses
5926 * gold.cc (queue_middle_tasks): A -pie link is not static.
5927 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5928 * symtab.cc (Symbol::final_value_is_known): Return false if
5929 output_is_position_independent.
5930 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5931 output_is_position_independent.
5932 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5933 output_is_position_independent.
5934 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5935 output_is_position_independent.
5936 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5938 (basic_pie_test.o, basic_pie_test): New targets.
5939 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5940 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5941 (two_file_pie_test): New target.
5942 * testsuite/Makefile.in: Rebuild.
5943 * README: Remove note saying that -pie is not supported.
5947 * options.h (class General_options): Add -init and -fini.
5948 * layout.cc (Layout::finish_dynamic_section): Emit
5949 given init and fini functions.
5953 * gc.h (gc_process_relocs): Check if icf is enabled using new
5955 * gold.cc (queue_initial_tasks): Likewise.
5956 (queue_middle_tasks): Likewise.
5957 * object.cc (do_layout): Likewise.
5958 * symtab.cc (is_section_folded): Likewise.
5959 * main.cc (main): Likewise.
5960 * reloc.cc (Read_relocs::run): Likewise.
5961 (Sized_relobj::do_scan_relocs): Likewise.
5962 * icf.cc (is_function_ctor_or_dtor): New function.
5963 (Icf::find_identical_sections): Check if function is ctor or dtor when
5965 * options.h (General_options::icf): Change option to be an enum.
5966 (Icf_status): New enum.
5967 (icf_enabled): New method.
5968 (icf_safe_folding): New method.
5969 (set_icf_status): New method.
5970 (icf_status_): New variable.
5971 * (options.cc) (General_options::finalize): Set icf_status_.
5972 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5973 icf_test and icf_keep_unique_test to use the --icf enum flag.
5974 * testsuite/icf_safe_test.sh: New file.
5975 * testsuite/icf_safe_test.cc: New file.
5979 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5980 includes to gc.h and icf.h.
5981 * arm.cc: Include gc.h.
5982 * gold.cc: Likewise.
5983 * i386.cc: Likewise.
5984 * powerpc.cc: Likewise.
5985 * sparc.cc: Likewise.
5986 * x86_64.cc: Likewise.
5987 * gc.h: Include icf.h.
5991 * plugin.cc: Include "gold.h" before other header files.
5995 * options.h (Input_file_argument::Input_file_type): New enum.
5996 (Input_file_argument::is_lib_): Replace with...
5997 (Input_file_argument::type_): New member.
5998 (Input_file_argument::Input_file_argument): Take Input_file_type
5999 'type' rather than boolean 'is_lib' as second argument.
6000 (Input_file_argument::is_lib): Use type_.
6001 (Input_file_argument::is_searched_file): New function.
6002 (Input_file_argument::may_need_search): Handle is_searched_file.
6003 * options.cc (General_options::parse_library): Support -l:filename.
6004 (General_options::parse_just_symbols): Update for Input_file_argument
6006 (Command_line::process): Likewise.
6007 * archive.cc (Archive::get_file_and_offset): Likewise.
6008 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6009 * script.cc (read_script_file, script_add_file): Likewise.
6010 * fileread.cc (Input_file::Input_file): Likewise.
6011 (Input_file::will_search_for): Handle is_searched_file.
6012 (Input_file::open): Likewise.
6013 * readsyms.cc (Read_symbols::get_name): Likewise.
6014 * testsuite/Makefile.am (searched_file_test): New test.
6015 * testsuite/Makefile.in: Regenerate.
6016 * testsuite/searched_file_test.cc: New file.
6017 * testsuite/searched_file_test_lib.cc: New file.
6022 * descriptor.cc: Include <cstdio> and "binary-io.h".
6023 (Descriptors::open): Open the files in binary mode always.
6024 * script.cc (Lex::get_token): Treat \r as whitespace.
6028 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6033 * configure.ac: Check for readv function also.
6034 * fileread.cc (readv): Define if not HAVE_READV.
6035 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6037 * config.in: Regenerate.
6038 * configure: Regenerate.
6042 * layout.cc (Layout::make_output_section): Call target hook to make
6043 ordinary output section.
6044 (Layout::finalize): Adjust parameter list of call the
6045 Target::may_relax().
6046 * layout.h (class Layout::section_list): New method.
6047 * merge.h (Output_merge_base::entsize): Change visibility to public.
6048 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6050 (Output_merge_string::do_is_string): New method.
6051 * object.cc (Sized_relobj::do_setup): renamed from
6052 Sized_relobj::set_up.
6053 * object.h (Sized_relobj::adjust_shndx,
6054 Sized_relobj::initializ_input_to_output_maps,
6055 Sized_relobj::free_input_to_output_maps): Change visibilities to
6057 (Sized_relobj::setup): Virtualize.
6058 (Sized_relobj::do_setup): New method declaration.
6059 (Sized_relobj::invalidate_section_offset,
6060 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6061 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6062 * options.cc (parse_int): New function.
6063 * options.h (parse_int): New declaration.
6064 (DEFINE_int): New macro.
6065 (stub_group_size): New option.
6066 * output.cc (Output_section::Output_section): Initialize memebers
6067 merge_section_map_, merge_section_by_properties_map_,
6068 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6069 (Output_section::add_input_section): Handled deferred code-fill
6070 generation and remove an old comment.
6071 (Output_section::add_relaxed_input_section): New method definition.
6072 (Output_section::add_merge_input_section): Use merge section by
6073 properties map to speed to search. Update merge section maps
6075 (Output_section::build_relaxation_map): New method definition.
6076 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6078 (Output_section::relax_input_section): Renamed to
6079 Output_section::convert_input_sections_to_relaxed_sections and change
6080 interface to take a vector of pointers to relaxed sections.
6081 (Output_section::find_merge_section,
6082 Output_section::find_relaxed_input_section): New method definitions.
6083 (Output_section::is_input_address_mapped,
6084 Output_section::output_offset, Output_section::output_address):
6085 Use output section data maps to speed up searching.
6086 (Output_section::find_starting_output_address): Add comments.
6087 (Output_section::do_write,
6088 Output_section::write_to_postprocessing_buffer): Do code-fill
6089 generation as appropriate.
6090 (Output_section::get_input_sections): Invalidate relaxed input section
6092 (Output_section::restore_states): Adjust type of checkpoint .
6093 Invalidate relaxed input section map.
6094 * output.h (Output_merge_base): New class declaration.
6095 (Input_section_specifier): New class defintion.
6096 (class Output_relaxed_input_section) Change base class to
6097 Output_section_data_build.
6098 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6099 base class initializer.
6100 (Output_section::add_relaxed_input_section): New method declaration.
6101 (Output_section::Input_section): Change visibility to protected.
6102 (Output_section::Input_section::relobj,
6103 Output_section::Input_section::shndx): Handle relaxed input sections.
6104 Output_section::input_sections) Change visibility to protected. Also
6105 define overload to return a non-const pointer.
6106 (Output_section::Merge_section_properties): New class defintion.
6107 (Output_section::Merge_section_by_properties_map,
6108 Output_section::Output_section_data_by_input_section_map,
6109 Output_section::Relaxation_map): New types.
6110 (Output_section::relax_input_section): Rename method to
6111 Output_section::convert_input_sections_to_relaxed_sections and change
6112 interface to take a vector of relaxed section pointers.
6113 (Output_section::find_merge_section,
6114 Output_section::find_relaxed_input_section,
6115 Output_section::build_relaxation_map,
6116 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6117 New method declarations.
6118 (Output_section::merge_section_map_
6119 Output_section::merge_section_by_properties_map_,
6120 Output_section::relaxed_input_section_map_,
6121 Output_section::is_relaxed_input_section_map_valid_,
6122 Output_section::generate_code_fills_at_write_): New data members.
6123 * script-sections.cc
6124 (Output_section_element_input::set_section_addresses): Call
6125 current_data_size and addralign methods of relaxed input sections.
6126 (Orphan_output_section::set_section_addresses): Call current_data_size
6127 and addralign methods of relaxed input sections.
6128 * symtab.cc (Symbol_table::compute_final_value): Extract template
6129 from the body of Symbol_table::sized_finalize_symbol.
6130 (Symbol_table::sized_finalized_symbol): Call
6131 Symbol_table::compute_final_value.
6132 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6133 (Symbol_table::compute_final_value): New templated method declaration.
6134 * target.cc (Target::do_make_output_section): New method defintion.
6135 * target.h (Target::make_output_section): New method declaration.
6136 (Target::relax): Add more parameters for input objects, symbol table
6137 and layout. Adjust call to do_relax.
6138 (Target::do_make_output_section): New method declaration.
6139 (Target::do_relax): Add parameters for input objects, symbol table
6144 * pread.c: Include stdio.h.
6148 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6153 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6154 Change read_shndx type to unsigned int.
6155 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6157 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6158 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6159 Change read_shndx type to unsigned int.
6160 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6162 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6163 * layout.cc (Layout::create_symtab_sections): Cast the result of
6164 local_symcount * symsize to off_t in the gold_assert.
6168 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6169 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6171 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6172 (Arm_relocate_functions::thm_abs5): New function.
6173 (Arm_relocate_functions::abs12): New function.
6174 (Arm_relocate_functions::abs16): New function.
6175 (Arm_relocate_functions::base_abs): New function.
6176 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6177 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6178 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6180 (Scan::global): Likewise.
6181 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6182 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6183 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6184 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6189 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6190 (Arm_relocate_functions::movt_prel): New function.
6191 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6192 (Arm_relocate_functions::thm_movt_prel): New function.
6193 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6194 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6195 (Scan::global, Relocate::relocate): Likewise.
6196 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6200 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6201 Incremental_checker.
6202 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6204 (class Incremental_inputs_header): New class.
6205 (Incremental_inputs_header_writer): Edit comment.
6206 (Incremental_inputs_entry): New class.
6207 (Incremental_inputs_entry_writer): Edit comment.
6208 (Sized_incremental_binary::do_find_incremental_inputs_section):
6209 Add *strtab_shndx parameter, fill it.
6210 (Sized_incremental_binary::do_check_inputs): New method.
6211 (Incremental_checker::can_incrementally_link_output_file): Use
6212 Sized_incremental_binary::check_inputs.
6213 (Incremental_inputs::report_command_line): Save command line in
6216 (Incremental_binary::find_incremental_inputs_section): New
6218 (Incremental_binary::do_find_incremental_inputs_section): Add
6219 strtab_shndx parameter.
6220 (Incremental_binary::do_check_inputs): New pure virtual method.
6221 (Sized_incremental_binary::do_check_inputs): Declare.
6222 (Incremental_checker::Incremental_checker): Add incremental_inputs
6223 parameter, use it to initialize incremental_inputs_.
6224 (Incremental_checker::incremental_inputs_): New field.
6225 (Incremental_checker::command_line): New method.
6226 (Incremental_checker::inputs): New method.
6227 (Incremental_checker::command_line_): New field.
6231 * incremental.cc: Include <cstdarg> and "target-select.h".
6232 (vexplain_no_incremental): New function.
6233 (explain_no_incremental): New function.
6234 (Incremental_binary::error): New method.
6235 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6237 (make_sized_incremental_binary): New function.
6238 (open_incremental_binary): New function.
6239 (can_incrementally_link_file): Add checks if output is ELF and has
6241 * incremental.h: Include "elfcpp_file.h" and "output.h".
6242 (Incremental_binary): New class.
6243 (Sized_incremental_binary): New class.
6244 (open_incremental_binary): Declare.
6245 * object.cc (is_elf_object): Use
6246 elfcpp::Elf_recognizer::is_elf_file.
6247 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6248 * output.h (Output_file::filesize): New method.
6252 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6254 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6255 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6257 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6259 (Arm_relocate_functions::movw_abs_nc): New function.
6260 (Arm_relocate_functions::movt_abs): New function.
6261 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6262 (Arm_relocate_functions::thm_movt_abs): New function.
6263 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6264 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6265 (Scan::global): Likewise.
6266 (Relocate::relocate): Likewise.
6267 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6271 * arm.cc (Arm_relocate_functions::got_prel) New function.
6272 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6273 (Relocate::relocate): Likewise.
6274 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6278 * options.h (class General_options): Define
6279 split_stack_adjust_size parameter.
6280 * object.h (class Object): Add uses_split_stack_ and
6281 has_no_split_stack_ fields. Add uses_split_stack and
6282 has_no_split_stack accessor functions. Declare
6283 handle_split_stack_section.
6284 (class Reloc_symbol_changes): Define.
6285 (class Sized_relobj): Define Function_offsets. Declare
6286 split_stack_adjust, split_stack_adjust_reltype, and
6288 * object.cc (Object::handle_split_stack_section): New function.
6289 (Sized_relobj::do_layout): Call handle_split_stack_section.
6290 * dynobj.cc (Sized_dynobj::do_layout): Call
6291 handle_split_stack_section.
6292 * reloc.cc (Sized_relobj::relocate_sections): Call
6293 split_stack_adjust for executable sections in split_stack
6294 objects. Pass reloc_map to relocate_section.
6295 (Sized_relobj::split_stack_adjust): New function.
6296 (Sized_relobj::split_stack_adjust_reltype): New function.
6297 (Sized_relobj::find_functions): New function.
6298 * target-reloc.h: Include "object.h".
6299 (relocate_section): Add reloc_symbol_changes parameter. Change
6301 * target.h (class Target): Add calls_non_split method. Declare
6302 do_calls_non_split virtual method. Declare match_view and
6304 * target.cc: Include "elfcpp.h".
6305 (Target::do_calls_non_split): New function.
6306 (Target::match_view): New function.
6307 (Target::set_view_to_nop): New function.
6308 * gold.cc (queue_middle_tasks): Give an error if mixing
6309 split-stack and non-split-stack objects with -r.
6310 * i386.cc (Target_i386::relocate_section): Add
6311 reloc_symbol_changes parameter.
6312 (Target_i386::do_calls_non_split): New function.
6313 * x86_64.cc (Target_x86_64::relocate_section): Add
6314 reloc_symbol_changes parameter.
6315 (Target_x86_64::do_calls_non_split): New function.
6316 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6318 * powerpc.cc (Target_powerpc::relocate_section): Add
6319 reloc_symbol_changes parameter.
6320 * sparc.cc (Target_sparc::relocate_section): Add
6321 reloc_symbol_changes parameter.
6322 * configure.ac: Call AM_CONDITIONAL for the default target.
6323 * configure: Rebuild.
6324 * testsuite/Makefile.am (TEST_AS): New variable.
6325 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6326 (check_DATA): Add split_i386 and split_x86_64 files.
6327 (SPLIT_DEFSYMS): Define.
6328 (split_i386_[1234n].o): New targets.
6329 (split_i386_[124]): New targets.
6330 (split_i386_[1234r].stdout): New targets.
6331 (split_x86_64_[1234n].o): New targets.
6332 (split_x86_64_[124]): New targets.
6333 (split_x86_64_[1234r].stdout): New targets.
6334 (MOSTLYCLEANFILES): Add new executables.
6335 * testsuite/split_i386.sh: New file.
6336 * testsuite/split_x86_64.sh: New file.
6337 * testsuite/split_i386_1.s: New file.
6338 * testsuite/split_i386_2.s: New file.
6339 * testsuite/split_i386_3.s: New file.
6340 * testsuite/split_i386_4.s: New file.
6341 * testsuite/split_i386_n.s: New file.
6342 * testsuite/split_x86_64_1.s: New file.
6343 * testsuite/split_x86_64_2.s: New file.
6344 * testsuite/split_x86_64_3.s: New file.
6345 * testsuite/split_x86_64_4.s: New file.
6346 * testsuite/split_x86_64_n.s: New file.
6347 * testsuite/testfile.cc (Target_test): Update relocation_section
6349 * testsuite/Makefile.in: Rebuild.
6353 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6354 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6355 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6356 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6357 the address on ldo_addrs_.
6358 (Target_i386::Relocate::fix_up_ldo): New function.
6362 * plugin.cc (add_input_library): New.
6363 (Plugin::load): Add add_input_library to tv.
6364 (Plugin_manager::add_input_file): Add the is_lib argument.
6365 (add_input_file): Update call to Plugin_manager::add_input_file.
6366 (add_input_library): New.
6367 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6371 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6372 symbol and call Symbol::may_need_copy_reloc to determine if
6373 a copy reloc is needed.
6374 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6375 nocopyreloc is given in command line.
6376 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6377 given in command line.
6378 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6379 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6380 of the removed Target_i386::may_need_copy_reloc.
6381 * options.h (copyreloc): New option with default value false.
6382 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6383 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6384 instead of the removed Target_powerpc::may_need_copy_reloc.
6385 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6386 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6387 instead of the removed Target_sparc::may_need_copy_reloc.
6388 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6389 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6390 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6391 instead of the removed Target_x86_64::may_need_copy_reloc.
6395 * object.h (class Object): Remove target_ field, and target,
6396 sized_target, and set_target methods.
6397 (Object::sized_target): Remove.
6398 (class Sized_relobj): Update declarations. Remove sized_target.
6399 * object.cc (Sized_relobj::setup): Remove target parameter.
6401 (Input_objects::add_object): Don't do anything with the target.
6402 (make_elf_sized_object): Add punconfigured parameter. Change all
6403 callers. Set or test parameter target.
6404 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6406 * parameters.cc (Parameters::set_target): Change parameter type to
6408 (Parameters::default_target): Remove.
6409 (set_parameters_target): Change parameter type to be non-const.
6410 (parameters_force_valid_target): New function.
6411 (parameters_clear_target): New function.
6412 * parameters.h (class Parameters): Update declarations. Remove
6413 default_target method. Add sized_target and clear_target
6414 methods. Change target_ to be non-const.
6415 (set_parameters_target): Update declaration.
6416 (parameters_force_valid_target): Declare.
6417 (parameters_clear_target): Declare.
6418 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6419 as NULL if we aren't searching.
6420 (Add_symbols::run): Don't check for compatible target.
6421 * fileread.cc (Input_file::open_binary): Call
6422 parameters_force_valid_target.
6423 * gold.cc (queue_middle_tasks): Likewise.
6424 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6425 set_target on object.
6426 * dynobj.h (class Sized_dynobj): Update declarations.
6427 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6428 make_elf_object returns NULL.
6429 (Archive::include_member): Don't check whether object target is
6431 * output.cc (Output_section::add_input_section): Get target from
6433 (Output_section::relax_input_section): Likewise.
6434 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6436 (Sized_relobj::do_scan_relocs): Likewise.
6437 (Sized_relobj::relocate_sections): Likewise.
6438 * resolve.cc (Symbol_table::resolve): Likewise.
6439 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6440 parameter. Change all callers.
6441 (Symbol_table::add_from_object): Get target from parameters.
6442 (Symbol_table::add_from_relobj): Don't check object target.
6443 (Symbol_table::add_from_dynobj): Likewise.
6444 (Symbol_table::define_special_symbol): Get target from
6446 * symtab.h (class Symbol_table): Update declaration.
6447 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6448 parameter. Change all callers. Clear parameter target.
6449 (Binary_test): Test target here.
6450 * testsuite/object_unittest.cc (gold_testsuite): Remove
6451 target_test_pointer parameter. Change all callers.
6452 (Object_test): Test target here.
6456 * testsuite/initpri1.c: Don't try to use constructor priorities if
6457 compiling with gcc before 4.3.
6461 * testsuite/retain_symbols_file_test.sh (check_present): Change
6462 output file name to retain_symbols_file_test.stdout.
6463 (check_absent): Likewise.
6467 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6468 * options.cc: Include <cerrno> and <fstream>.
6469 (General_options::finalize): Parse -retain-symbols-file tag.
6470 * options.h: New flag.
6471 (General_options): New method should_retain_symbol, new
6472 variable symbols_to_retain.
6473 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6474 should_retain_symbol map.
6475 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6476 * testsuite/Makefile.in: Regenerate.
6477 * testsuite/retain_symbols_file_test.sh: New file.
6481 * po/es.po: Updated Spanish translation.
6485 * debug.h (DEBUG_RELAXATION): New constant.
6486 (DEBUG_ALL): Add DEBUG_RELAXATION.
6487 (debug_string_to_enum): Add relaxation debug option.
6489 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6490 Layout::Relaxation_debug_check::read_sections,
6491 Layout::Relaxation_debug_check::read_sections): New method definitions.
6492 (Layout::Layout): Initialize data members
6493 record_output_section_data_from_scrips_,
6494 script_output_section_data_list_ and relaxation_debug_check_.
6495 (Layout::save_segments, Layout::restore_segments,
6496 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6497 Layout::relaxation_loop_body): New method definitions.
6498 (Layout::finalize): Support relaxation. Move section layout code to
6499 Layout::relaxation_loop_body.
6500 (Layout::set_asection_address_from_script): Move code for orphan
6501 section placement out.
6502 (Layout::place_orphan_sections_in_script): New method definition.
6503 * layout.h (Output_segment_headers, Output_file_header):
6504 New forward class declarations.
6505 (Layout::~Layout): Define.
6506 (Layout::new_output_section_data_from_script): New method definition.
6507 (Layout::place_orphan_sections_in_script): New method declaration.
6508 (Layout::Segment_states): New type declaration.
6509 (Layout::save_segments, Layout::restore_segments,
6510 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6511 Layout::relaxation_loop_body): New method declarations.
6512 (Layout::Output_section_data_list): New type declaration.
6513 (Layout::Relaxation_debug_check): New class definition.
6514 (Layout::record_output_section_data_from_script_,
6515 Layout::script_output_section_data_list_, Layout::segment_states_,
6516 Layout::relaxation_debug_check_): New data members.
6517 * output.cc: (Output_section_headers::do_size): New method definition.
6518 (Output_section_headers::Output_section_headers): Move size
6519 computation to Output_section_headers::do_size.
6520 (Output_segment_headers::do_size): New method definition.
6521 (Output_file_header::Output_file_header): Move size computation to
6522 Output_file_header::do_size and call it.
6523 (Output_file_header::do_size): New method definition.
6524 (Output_data_group::Output_data_group): Adjust call to
6525 Output_section_data.
6526 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6527 (Output_symtab_xindex::do_write): Add array bound check.
6528 (Output_section::Input_section::print_to_mapfile): Handle
6529 RELAXED_INPUT_SECTION_CODE.
6530 (Output_section::Output_section): Initialize data member checkpoint_.
6531 (Output_section::~Output_section): Delete checkpoint object pointed
6533 (Output_section::add_input_section): Always add an Input_section if
6535 (Output_section::add_merge_input_section): Add assert.
6536 (Output_section::relax_input_section): New method definition.
6537 (Output_section::set_final_data_size): Set load address to zero for
6538 an unallocated section.
6539 (Output_section::do_address_and_file_offset_have_reset_values):
6540 New method definition.
6541 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6542 Handle relaxed input section.
6543 (Output_section::sort_attached_input_sections): Checkpoint input
6544 section list lazily.
6545 (Output_section::get_input_sections): Change type of input_sections to
6546 list of Simple_input_section pointers. Checkpoint input section list
6547 lazily. Also handle relaxed input sections.
6548 (Output_section::add_input_section_for_script): Take a reference to
6549 a Simple_input_section object instead of Relobj pointer and section
6550 index as parameter. Handle relaxed input sections.
6551 (Output_section::save_states, Output_section::restore_states): New
6553 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6554 (Output_data::is_data_size_fixed): New method definition.
6555 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6557 (Output_data::address_and_file_offset_have_reset_values): New method
6559 (Output_data::do_address_and_file_offset_have_reset_values): New method
6561 (Output_data::set_data_size): Check that data size is not fixed.
6562 (Output_data::fix_data_size): New method definition.
6563 (Output_data::is_data_size_fixed_): New data member.
6564 (Output_section_headers::set_final_data_size): New method definition.
6565 (Output_section_headers::do_size): New method declaration.
6566 (Output_segment_headers::set_final_data_size): New method definition.
6567 (Output_segment_headers::do_size): New method declaration.
6568 (Output_file_header::set_final_data_size)::New method definition.
6569 (Output_file_header::do_size)::New method declaration.
6570 (Output_section_data::Output_section_data): Add new parameter
6571 is_data_size_fixed and use it to fix data size.
6572 (Output_data_const::Output_data_const): Adjust call to base class
6573 constructor and fix data size.
6574 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6575 base class constructor and fix data size.
6576 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6577 base class constructor and fix data size.
6578 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6579 class constructor and fix data size.
6580 (Output_data_group::set_final_data_size): New method definition.
6581 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6582 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6583 class constructor and fix data size.
6584 (Output_relaxed_input_section): New class definition.
6585 (Output_section::Simple_input_section): New class definition.
6586 (Output_section::get_input_sections): Adjust parameter list.
6587 (Output_section::add_input_section_for_script): Same.
6588 (Output_section::save_states, Output_section::restore_states,
6589 Output_section::do_address_and_file_offset_have_reset_values,
6590 (Output_section::Input_section::Input_section): Handle
6591 RELAXED_INPUT_SECTION_CODE. Add new overload for
6592 Output_relaxed_input_section.
6593 (Output_section::Input_section::is_input_section,
6594 Output_section::Input_section::set_output_section): Handle relaxed
6596 (Output_section::Input_section::is_relaxed_input_section,
6597 Output_section::Input_section::output_section_data,
6598 Output_section::Input_section::relaxed_input_section): New method
6600 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6602 (Output_section::Input_section::u1_): Update comments.
6603 (Output_section::Input_section::u2_): Add new union member poris.
6604 (Output_section::Checkpoint_output_section): New classs definition.
6605 (Output_section::relax_input_section): New method declaration.
6606 (Output_section::checkpoint_): New data member.
6607 (Output_segment): Update comments.
6608 (Output_segment::Output_segment): Un-privatize copy constructor.
6609 (Output_segment::operator=): Un-privatize.
6610 * script-sections.cc (Output_section_element::Input_section_list):
6611 Change element type to Output_section::Simple_input_section.
6612 (Output_section_element_dot_assignment::set_section_addresses):
6613 Register output section data for relaxation clean up.
6614 (Output_data_exression::Output_data_expression): Adjust call to base
6615 constructor to fix data size.
6616 (Output_section_element_data::set_section_addresses): Register
6617 Output_data_expression object for relaxation clean up.
6618 (struct Input_section_info): Replace Relobj pointer and section index
6619 pair with Output_section::Simple_input_section and Convert struct to a
6621 (Input_section_sorter::operator()): Adjust access to
6622 Input_section_info data member to use accessors.
6623 (Output_section_element_input::set_section_addresses): Use layout
6624 parameter. Adjust code to use Output_section::Simple_input_section
6625 and Input_secction_info classes. Register filler for relaxation
6627 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6628 and section index pair with Output_section::Simple_input_section
6629 class. Adjust code accordingly.
6630 (Phdrs_element::release_segment): New method definition.
6631 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6633 (Script_sections::release_segments): New method definition.
6634 * gold/script-sections.h (Script_sections::release_segments): New
6636 * gold/target.h (Target::may_relax, Target::relax,
6637 Target::do_may_relax, Target::do_relax): New method definitions.
6641 * arm.cc (has_signed_unsigned_overflow): New function.
6642 (Arm_relocate_functions::abs8): New function.
6643 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6644 (Target_arm::Scan::global): Likewise.
6645 (Target_arm::relocate::relocate): Likewise.
6646 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6651 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6652 * testsuite/Makefile.in: Regenerate.
6656 * po/gold.pot: Updated by the Translation project.
6660 * output.cc (Output_file::open): Add execute permission to empty file.
6661 * testsuite/Makefile.am (permission_test): New test.
6662 * testsuite/Makefile.in: Regenerate.
6666 * output.cc (Output_file::resize): Call map_no_anonymous rather
6671 * gold.cc: Include "incremental.h".
6672 (queue_initial_tasks): Call Incremental_checker methods.
6673 * incremental.cc: Include "output.h".
6674 (Incremental_checker::can_incrementally_link_output_file): New
6676 * incremental.h (Incremental_checker): New class.
6678 * output.cc (Output_file::open_for_modification): New method.
6679 (Output_file::map_anonymous): Changed return type to bool. Record
6681 (Output_file::map_no_anonymous): New method, broken out of map.
6682 (Output_file::map): Use map_no_anonymous and map_anonymous.
6683 * output.h (class Output_file): Update declarations.
6687 * options.h (Command_line::Pre_options): New class.
6688 (Command_line::pre_options): New member.
6689 * options.cc (gold::options::ready_to_register): New variable.
6690 (One_option::register_option): Do nothing if not registering options.
6691 Assert if same short option registered twice.
6692 (General_options::General_options): Turn off option registration when
6694 (Command_line::Pre_options::Pre_options): New constructor.
6698 * options.h (General_options::no_keep_memory): Remove incorrect
6703 * Makefile.am (am__skiplex, am__skipyacc): New.
6704 * Makefile.in: Regenerate.
6708 * Makefile.am (AM_CPPFLAGS): Renamed from ...
6709 (INCLUDES): ... this.
6710 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6711 (AM_CPPFLAGS): Renamed from ...
6712 (INCLUDE): ... this.
6713 * Makefile.in, testsuite/Makefile.in: Regenerate.
6715 * Makefile.in: Regenerate.
6716 * aclocal.m4: Likewise.
6717 * config.in: Likewise.
6718 * configure: Likewise.
6719 * testsuite/Makefile.in: Likewise.
6721 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6722 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6723 * Makefile.in: Regenerate.
6724 * testsuite/Makefile.in: Regenerate.
6728 * resolve.cc (Symbol_table::resolve): Don't complain about defined
6729 symbols in shared libraries overridden by hidden or internal symbols
6730 in the main program.
6734 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6735 checking source file names in error messages.
6739 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6740 an elcpp::Ehdr as parameter. Adjust call to set_target.
6741 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6742 an elfcpp::Ehdr as parameter.
6743 * object.cc (Object::set_target): Remove the version that looks up
6744 a target and sets it.
6745 (Sized_relobj::setup): Take a Target object instead of
6746 an elfcpp::Ehdr as parameter. Adjust call to set_target.
6747 (make_elf_sized_object): Find target and ask target to
6749 * object.h: (Object::set_target): Remove the version that looks up
6750 a target and sets it.
6751 (Sized_relobj::setup): Take a Target object instead of
6752 an elfcpp:Ehdr as parameter.
6753 * target.cc: Include dynobj.h.
6754 (Target::do_make_elf_object_implementation): New.
6755 (Target::do_make_elf_object): New.
6756 * target.h (Target::make_elf_object): New template declaration.
6757 (Target::do_make_elf_object): New method declarations.
6758 (Target::do_make_elf_object_implementation): New template declaration.
6762 * gold.h (FUNCTION_NAME): Define.
6763 (gold_unreachable): Use FUNCTION_NAME.
6767 * icf.cc (Icf::find_identical_sections): Issue a warning when a
6768 symbol in the --keep-unique list is not found.
6772 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6773 been maked as --keep-unique.
6774 (Icf::unfold_section): New function.
6775 * icf.h (Icf::unfold_section): New function.
6776 * options.h (General_options::keep_unique): New option.
6777 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6778 * testsuite/Makefile.in: Regenerate.
6779 * testsuite/icf_keep_unique_test.sh: New file.
6780 * testsuite/icf_keep_unique_test.cc: New file.
6785 * resolve.cc (Symbol_table::resolve): Check for references from
6786 dynamic objects to hidden and internal symbols.
6787 * testsuite/Makefile.am (hidden_test.sh): New test.
6788 * testsuite/Makefile.in: Regenerate.
6789 * testsuite/hidden_test.sh: New script.
6790 * testsuite/hidden_test_1.c: New test source.
6791 * testsuite/hidden_test_main.c: New test source.
6795 * arm.cc: Update comments.
6796 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6797 segment to locate the .ARM.exidx section if present.
6801 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6805 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6810 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6811 valid tls_segment only for non-debug-section relocations.
6812 * testsuite/Makefile.am: Add gc_tls_test.
6813 * testsuite/Makefile.in: Regenerate.
6814 * testsuite/gc_tls_test.cc: New file.
6815 * testsuite/gc_tls_test.sh: New file.
6821 * Makefile.am (CCFILES): Add icf.cc.
6823 * Makefile.in: Regenerate.
6824 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6825 * gc.h (gc_process_relocs): Populate lists used by icf to contain
6826 section, symbol and addend information for the relocs.
6827 * gold.cc (queue_middle_tasks): Call identical code folding.
6828 * gold.h: Add defines for multimap.
6829 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6830 to the call of finalize_local_symbols.
6831 * main.cc (main): Create object of class Icf.
6832 * object.cc (Sized_relobj::do_layout): Allow this function to be
6833 called twice during icf.
6834 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6835 to sections marked as identical by icf.
6836 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6838 (Sized_relobj::do_section_entsize): New function.
6839 * object.h (Object::section_entsize): New function.
6840 (Object::do_section_entsize): New pure virtual function.
6841 (Relobj::finalize_local_symbols): Add new parameter.
6842 (Relobj::do_section_entsize): New function.
6843 * options.h (General_options::icf): New option.
6844 (General_options::icf_iterations): New option.
6845 (General_options::print_icf_sections): New option.
6846 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6847 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6848 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6850 * symtab.cc (Symbol_table::is_section_folded): New function.
6851 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6852 to sections marked as identical by icf.
6853 * symtab.h (Symbol_table::set_icf): New function.
6854 (Symbol_table::icf): New function.
6855 (Symbol_table::is_section_folded): New function.
6856 (Symbol_table::icf_): New data member.
6857 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6858 * testsuite/Makefile.am: Add commands to build icf_test.
6859 * testsuite/Makefile.in: Regenerate.
6860 * testsuite/icf_test.sh: New file.
6861 * testsuite/icf_test.cc: New file.
6865 * layout.cc (is_compressible_debug_section): Fix incorrect
6866 comment about compressed section names.
6871 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6876 * layout.h: #include <map>.
6877 (class Kept_section): Change from struct to class. Add accessors
6878 and setters. Add section size to Comdat_group mapping. Change
6879 Comdat_group to std::map. Add is_comdat_ field. Add
6880 linkonce_size field in union.
6881 (class Layout): Update declaration of find_or_add_kept_section.
6882 Don't declare find_kept_object.
6883 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6884 parameter. Add object, shndx, is_comdat, and is_group_name
6885 parameters. Change all callers. Adjust for new Kept_section.
6886 (Layout::find_kept_object): Remove.
6887 * object.cc (Sized_relobj::include_section_group): Update use of
6888 Kept_section. Rename secnum to shndx. Only record
6889 Kept_comdat_section if sections are the same size.
6890 (Sized_relobj::include_linkonce_section): Update use of
6891 Kept_section. Only record Kept_comdat_section if sections are the
6892 same size. Set size of linkonce section.
6893 (Sized_relobj::map_to_kept_section): Update call to
6894 get_kept_comdat_section.
6895 * object.h (class Sized_relobj): Rename fields in
6896 Kept_comdat_section to drop trailing underscores; change object
6897 field to Relobj*. Change Kept_comdat_section_table to store
6898 struct rather than pointer.
6899 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6900 Add kept_object and kept_shndx parameters. Change all callers.
6901 (Sized_relobj::get_kept_comdat_section): Change return type to
6902 bool. Add kept_object and kept_shndx parameters. Change all
6904 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6905 Layout::find_or_add_kept_section.
6909 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6910 Reserve space in the hash table.
6914 * fileread.cc (File_read::get_mtime): New method.
6915 * fileread.h (Timespec): New structure.
6916 (File_read::get_mtime): New method.
6917 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6918 Renamed from timestamp_nsec.
6919 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6921 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6923 (Incremental_inputs::report_archive): Save mtime; style fix.
6924 (Incremental_inputs::report_obejct): Save mtime; style fix.
6925 (Incremental_inputs::report_script): Save mtime; style fix.
6926 (Incremental_inputs::finalize_inputs): Style fix.
6927 (Incremental_inputs::finalize): Style fix.
6928 (Incremental_inputs::create_input_section_data): Store inputs
6930 * incremental.h (Incremental_inputs::report_script): Add mtime
6932 (Incremental_inputs::Input_info::Input_info): Intialize only one
6934 (Incremental_inputs::Input_info::archive): Move to nameless
6936 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6937 (Incremental_inputs::Input_info::script): Move to nameless union.
6938 (Incremental_inputs::mtime): New field.
6939 * script.cc (read_input_script): Pass file mtime to
6941 * script.h (Script_info::inputs): Style fix.
6945 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6951 * layout.cc (Layout::choose_output_section): If we find an
6952 existing section, update the flags.
6953 (Layout::create_notes): New function, broken out of
6955 (Layout::finalize): Don't create note sections.
6956 (Layout::create_note): Don't crash if linker script discards
6958 (Layout::create_gold_note): Likewise.
6959 (Layout::create_build_id): Likewise. Don't set
6960 after_input_sections on the section.
6961 (Layout::create_executable_stack_info): Remove target parameter.
6963 * layout.h (class Layout): Declare create_notes. Update
6964 declaration of create_executable_stack_info.
6965 * gold.cc (queue_middle_tasks): Call create_notes.
6966 * output.cc (Output_section::update_flags_for_input_section): Move
6967 here from output.h. If SHF_ALLOC flag is newly set, mark address
6969 * output.h (Output_data::mark_address_invalid): New function.
6970 (class Output_section): Only declare, not define,
6971 update_flags_for_input_section. Remove set_flags.
6975 * script-sections.cc (Output_section_definition::
6976 set_section_addresses): Rename shadowing local load_address to
6982 * reloc.cc (relocate_sections): Skip empty relocation sections.
6987 * layout.cc (Layout::create_note): Use choose_output_section
6988 rather than make_output_section.
6993 * options.cc (General_options::parse_V): Set printed_version_.
6994 (General_options::General_options): Initialize printed_version_.
6995 * options.h (class General_options): Add printed_version_ field.
6996 * gold.cc (queue_initial_tasks): If there are no input files,
6997 don't give a fatal error if we printed the version information.
6998 (queue_middle_tasks): If using -r with a shared object, give a
6999 fatal error rather than an ordinary error.
7004 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7005 (Layout::make_output_section): Set have_stabstr_section_ if we see
7006 a .stab*str section.
7007 (Layout::finalize): Call link_stabs_sections.
7008 (Layout::link_stabs_sections): New file.
7009 * layout.h (class Layout): Add have_stabstr_section_ field.
7010 Declare link_stabs_sections.
7014 * Makefile.am (libgold_a_LIBADD): New.
7015 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7016 * Makefile.in: Regenerate.
7017 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7018 * configure: Regenerate.
7019 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7020 * fileread.cc: Include sys/state.h
7021 * gold.h: Declare memmem and strndup if found missing.
7022 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7026 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7027 * configure: Rebuild.
7032 * object.cc (Object::section_contents): Don't try to get a view if
7033 the section has length zero.
7034 (Object::handle_gnu_warning_section): If the section is empty, use
7035 the name of the section as the warning.
7040 * stringpool.h (class Stringpool_template): Add optimize_ field.
7041 (Stringpool_template::set_optimize): New function.
7042 * stringpool.cc (Stringpool_template::Stringpool_template):
7043 Initialize optimize_ field.
7044 (Stringpool_template::set_string_offsets): Test local optimize
7045 fild rather than parameter.
7046 * layout.cc (Layout::Layout): Call set_optimize on the section
7052 * yyscript.y: Parse TARGET.
7053 * script.cc (script_set_target): New function.
7054 * script-c.h (script_set_target): Declare.
7055 * options.cc (General_options::string_to_object_format): Rename
7056 from string_to_object_format in anonymous namespace. Change
7058 * options.h (class General_options): Declare
7059 string_to_object_format.
7063 * script-sections.cc (Script_sections::create_segments): Don't put
7064 program headers in a PT_LOAD segment if -n or -N.
7069 * options.h (class General_options): Add -z lazy and -z now. Sort
7070 -z options into alphabetical order.
7071 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7075 * layout.cc (Layout::make_output_section): Call
7076 Target::new_output_section.
7077 (Layout::attach_allocated_section_to_segment): Put large section
7078 sections in a separate load segment with the large segment flag
7080 (Layout::segment_precedes): Sort large data segments after other
7082 (align_file_offset): New static function.
7083 (Layout::set_segment_offsets): Use align_file_offset.
7084 * output.h (class Output_section): Add is_small_section_ and
7085 is_large_section_ fields.
7086 (Output_section::is_small_section): New function.
7087 (Output_section::set_is_small_section): New function.
7088 (Output_section::is_large_section): New function.
7089 (Output_section::set_is_large_section): New function.
7090 (Output_section::is_large_data_section): New function.
7091 (class Output_segment): Add is_large_data_segment_ field.
7092 (Output_segment::is_large_data_segment): New function.
7093 (Output_segment::set_is_large_data_segment): New function.
7094 * output.cc (Output_section::Output_section): Initialize new
7096 (Output_segment::Output_segment): Likewise.
7097 (Output_segment::add_output_section): Add assertion that large
7098 data sections always go in large data segments. Force small data
7099 sections to the end of the list of data sections. Force small BSS
7100 sections to the start of the list of BSS sections. For large BSS
7101 sections to the end of the list of BSS sections.
7102 * symtab.h (class Symbol): Declare is_common_shndx.
7103 (Symbol::is_defined): Check Symbol::is_common_shndx.
7104 (Symbol::is_common): Likewise.
7105 (class Symbol_table): Define enum Commons_section_type. Update
7106 declarations. Add small_commons_ and large_commons_ fields.
7107 * symtab.cc (Symbol::is_common_shndx): New function.
7108 (Symbol_table::Symbol_table): Initialize new fields.
7109 (Symbol_table::add_from_object): Put small and large common
7110 symbols in the right list.
7111 (Symbol_table::sized_finalized_symbol): Check
7112 Symbol::is_common_shndx.
7113 (Symbol_table::sized_write_globals): Likewise.
7114 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7115 common symbol lists. Don't call do_allocate_commons_list if the
7117 (Symbol_table::do_allocate_commons_list): Remove is_tls
7118 parameter. Add comons_section_type parameter. Change all
7119 callers. Handle small and large common symbols.
7120 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7121 Symbol::is_common_shndx.
7122 * resolve.cc (symbol_to_bits): Likewise.
7123 * target.h (Target::small_common_shndx): New function.
7124 (Target::small_common_section_flags): New function.
7125 (Target::large_common_shndx): New function.
7126 (Target::large_common_section_flags): New function.
7127 (Target::new_output_section): New function.
7128 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7129 small_common_section_flags, and large_common_section_flags
7131 (Target::do_new_output_section): New virtual function.
7132 * arm.cc (Target_arm::arm_info): Initialize new fields.
7133 * i386.cc (Target_i386::i386_info): Likewise.
7134 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7136 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7137 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7138 (Target_x86_64::do_new_output_section): New function.
7139 * configure.ac: Define conditional MCMODEL_MEDIUM.
7140 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7141 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7142 (large_LDFLAGS): Define.
7143 * testsuite/large.c: New file.
7144 * testsuite/testfile.cc (Target_test::test_target_info):
7145 Initialize new fields.
7146 * configure, testsuite/Makefile.in: Rebuild.
7150 * Makefile.am (CCFILES): Add target.cc.
7151 * Makefile.in: Regenerate.
7152 * i386.cc (class Target_i386): Define new virtual method to
7153 override do_is_local_label_name in parent.
7154 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7155 local symbols if --discard-locals or -X is given.
7156 * options.h (class General_options): Declare new options
7157 '--discard-locals' and '-X' for discarding locals.
7158 * target.h (class Target): Define new methods is_local_label_name.
7159 Declare new virtual method do_is_local_label_name.
7160 * target.cc: New file.
7161 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7162 (check_SCRIPTS): Add discard_locals_test.sh.
7163 (check_DATA): Add discard_local_tests.syms.
7164 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7165 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7166 * testsuite/Makefile.in: Regenerate.
7167 * testsuite/discard_locals_test.c: New file.
7168 * testsuite/discard_locals_test.sh: Same.
7172 * object.cc (Sized_relobj::Sized_relobj): Initialize
7173 discarded_eh_frame_shndx_ to -1U.
7174 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7176 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7177 a discarded .eh_frame section.
7178 (Sized_relobj::do_finalize_local_symbols): Ditto.
7179 * object.h (class Sized_relobj): Declare new member
7180 discarded_eh_frame_shndx_.
7181 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7182 (local_labels_test.o, local_labels_test): New rules.
7183 * testsuite/Makefile.in: Regenerate.
7187 * layout.cc (Layout::section_name_mapping): Add mapping for
7188 special ARM sections.
7192 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7193 (utils::has_overflow): Same.
7197 * layout.cc (Layout::section_name_mapping): New array, replacing
7198 Layout::linkonce_mapping.
7199 (Layout::section_name_mapping_count): New variable, replacing
7200 Layout::linkonce_mapping_count.
7201 (Layout::linkonce_output_name): Remove.
7202 (Layout::output_section_name): Rewrite.
7203 * layout.h (class Layout): Rename Linkonce_mapping to
7204 Section_name_mapping, linkonce_mapping to section_name_mapping,
7205 linkonce_mapping_count to section_name_mapping_count. Don't
7206 declare linkonce_output_name.
7210 * gold/arm.cc (namespace utils): New.
7211 (Target_arm::reloc_is_non_pic): Define new method.
7212 (class Arm_relocate_functions): New.
7213 (Target_arm::Relocate::relocate): Handle relocation types used by
7218 * arm.cc (Target_arm::scan::global): Use || instead of |.
7222 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7223 issued_non_pic_error_.
7224 (class Target_arm::Scan): Declare new method check_non_pic.
7225 Define new method symbol_needs_plt_entry.
7226 Declare new data member issued_non_pic_error_.
7227 (class Target_arm::Relocate): Declare new method
7228 should_apply_static_reloc.
7229 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7230 (Target_arm::Scan::check_non_pic): Define new method.
7231 (Target_arm::Scan::local): Handle a small subset of reloc types used
7233 (Target_arm::Scan::local): Same.
7234 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7238 * incremental.cc (Incremental_inputs::report_command_line): Filter
7239 out --incremental-* options.
7243 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7245 (class Target_arm): Update comment.
7246 (Target_arm::Target_arm): Initialize new data members GOT_,
7247 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7248 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7249 and Target_arm::rel_dyn_section.
7250 Declare new_enum Target_arm::Got_type.
7251 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7253 Update commments for member do_dynsym_value.
7254 (Target_arm::got_size, Target_arm::plt_section,
7255 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7256 new methods inside class defintion.
7257 (Target_arm::got_section): Define new method.
7258 (Target_arm::rel_dyn_section): Same.
7259 (Output_data_plt_arm): New template class.
7260 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7261 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7262 (Output_data_plt_arm::add_entry): Same.
7263 (Output_data_plt_arm::first_plt_entry): Define new
7264 static data member for PLT instruction template.
7265 (Output_data_plt_arm::plt_entry): Same.
7266 (Output_data_plt_arm::do_write): Define new method.
7267 (Target_arm::make_plt_entry): Same.
7268 (Target_arm::do_finalize_sections): Same.
7269 (Target_arm::do_dynsym_value): Same.
7273 * Makefile.am (TARGETSOURCES): Add arm.cc.
7274 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7275 * Makefile.in: Regenerate.
7277 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7281 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7282 (General_options::check_excluded_libs): Strip off directories in
7283 archive name before matching like GNU ld does.
7284 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7285 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7286 (exclude_libs_test_LDFLAGS): Add linker option
7287 -Wl,--exclude-libs,libexclude_libs_test_3
7288 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7289 an explicit archive without using -l.
7290 (alt/libexclude_libs_test_3.a): New make rule.
7291 * testsuite/Makefile.in: Regenerate.
7292 * testsuite/exclude_libs_test.c : Declare lib3_default().
7294 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7295 * exclude_libs_test_3.c: New file.
7299 * po/id.po: New Indonesian translation.
7300 * po/gold.pot: Updated template file.
7304 * testsuite/Makefile.am: Add -ffunction-sections to compile
7305 gc_comdat_test files. Add -Wl,--gc-sections to build
7307 * testsuite/Makefile.in: Regenerate.
7308 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7312 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7313 kept comdat section was garbage collected.
7314 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7315 * testsuite/Makefile.in: Regenerate.
7316 * testsuite/gc_comdat_test.sh: New file.
7317 * testsuite/gc_comdat_test_1.cc: New file.
7318 * testsuite/gc_comdat_test_2.cc: New file.
7322 * archive.cc (Archive::Archive): Move constructor from archive.h
7323 to here. Initialize no_export_.
7324 (Archive::get_elf_object_for_member): Set no_export flag of object.
7325 * archive.h (Archive::Archive): Move constructor body to
7327 (Archive::no_export): New method.
7328 (Archive::no_export_): New field.
7329 * object.h (Object::Object): Initialize no_export_ to false.
7330 (Object::no_export, Object::set_no_export): New methods.
7331 (Object::no_export_): New field.
7332 * options.cc (General_options::parse_exclude_libs): New method.
7333 (General_options::check_excluded_libs) Same.
7334 * options.h (exclude_libs): New option.
7335 (General_options::check_excluded_libs): New method declaration.
7336 (General_options::excluded_libs_): New field.
7337 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7338 default or protected visibility if an object has no-export flag set.
7339 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7340 (check_SCRIPTS): Add exclude_libs_test.sh.
7341 (check_DATA): Add exclude_libs_test.syms.
7342 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7343 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7344 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7345 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7346 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7347 libexclude_libs_test_2.a): New rules.
7348 * testsuite/Makefile.in: Regenerate.
7349 * testsuite/exclude_libs_test.c: New file.
7350 * testsuite/exclude_libs_test.sh: Ditto.
7351 * testsuite/exclude_libs_test_1.c: Ditto.
7352 * testsuite/exclude_libs_test_2.c: Ditto.
7356 * configure.ac: Check for declarations for cases where libiberty.h
7357 checks HAVE_DECL_xxx.
7358 * configure, config.in: Rebuild.
7362 * gold.h (Incremental_argument_list): Remove (invalid) forward
7364 * incremental.cc (Incremental_inputs::report_achive): New method.
7365 (Incremental_inputs::report_object): New method.
7366 (Incremental_inputs::report_script): New method.
7367 (Incremental_inputs::finalize_inputs): New method.
7368 (Incremental_inputs::finalize): Call finalize_inputs().
7369 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7370 Create inputs entries.
7371 * incremental.h (Incremental_input_type): New enum.
7372 (Incremental_inputs::Incremental_input): Initialize new fields.
7373 (Incremental_inputs::report_inputs): New method.
7374 (Incremental_inputs::report_achive): New method.
7375 (Incremental_inputs::report_object): New method.
7376 (Incremental_inputs::report_script): New method.
7377 (Incremental_inputs::finalize_inputs): New method.
7378 (Incremental_inputs::Input_info): New struct.
7379 (Incremental_inputs::Input_info_map): New typedef.
7380 (Incremental_inputs::lock_): New field.
7381 (Incremental_inputs::Inputs_): New field.
7382 (Incremental_inputs::Inputs_map): New field.
7383 * main.cc (main): Call Incremental_input::report_inputs.
7384 * options.h (Input_argument_list): Typedef moved from
7386 (Input_file_group::Files): Remove, use ::Input_argument_list.
7387 (Input_file_group::Input_argument_list): Remove, use
7388 ::Input_argument_list.
7389 * plugin.cc (Plugin_manager::add_input_file): Add error in
7391 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7393 * script.cc (read_input_script): Call
7394 Incremental_input::report_script.
7395 * script.h (Script_info): New class.
7399 * x86_64.cc (do_adjust_output_section): Set entsize to
7404 * output.cc (Output_file::close): After short writes, continue
7405 writing from the correct offset in the buffer being written.
7409 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7410 * configure: Regenerate.
7411 * config.in: Regenerate.
7412 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7413 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7417 * incremental.cc (Incremental_inputs_header_data): Renamed from
7418 Incremental_input_header_data.
7419 (Incremental_inputs_header_data::data_size): New field.
7420 (Incremental_inputs_header_data::put_input_file_count): Renamed
7421 from input_file_count.
7422 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7423 from command_line_offset.
7424 (Incremental_inputs_header_data::put_reserved): Renamed from
7426 (Incremental_inputs_entry_data): Renamed from
7427 Incremental_input_entry_data.
7428 (Incremental_inputs_entry_data::data_size): New field.
7429 (Incremental_inputs::report_command_line): New method.
7430 (Incremental_inputs::finalize): New method.
7431 (Incremental_inputs::create_incremental_inputs_data): New method.
7432 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7433 * incremental.h: New file.
7434 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7435 (Layout::finalize): Create incremental inputs section in
7437 (Layout::create_incremental_info_sections): New method.
7438 * layout.h (Layout::incremental_inputs): New method.
7439 (Layout::create_incremental_info_sections): New method.
7440 (Layout::incremental_inputs_): New field.
7441 * main.cc (main): Notify Incremental_input of the command line.
7446 * gold.h (reserve_unordered_map): Define, three versions, one for
7447 each version of Unordered_map.
7448 * layout.cc (Layout::Layout): Remove options parameter. Add
7449 number_of_input_files parameter. Don't initialize options_.
7450 Initialize number_of_input_files_ and resized_signatures_. Move
7451 sections_are_attached_.
7452 (Layout::layout_group): Reserve space for group_signatures_.
7453 (Layout::find_or_add_kept_section): Change name parameter to be a
7454 reference. Resize signatures_ map when it gets large enough.
7455 (Layout::layout_eh_frame): Use parameters->options() instead of
7457 (Layout::make_output_section): Likewise.
7458 (Layout::attach_allocated_section_to_segment): Likewise.
7459 (Layout::finalize, Layout::create_executable_stack): Likewise.
7460 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7461 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7462 * layout.h (class Layout): Update declarations. Remove options_
7463 field. Add number_of_input_files_ and resized_signatures_
7464 fields. Move sections_are_attached_ field.
7465 * main.cc (main): Pass number of input files to Layout
7466 constructor. Don't pass options.
7470 * ffsll.c (ffsll): Correct implementation.
7474 * ffsll.c: New file.
7475 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7476 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7477 * ftruncate.c (ftruncate): Declare before definition.
7478 * mremap.c (mremap): Likewise.
7479 * pread.c (pread): Likewise.
7480 * configure, Makefile.in, config.in: Rebuild.
7482 * mremap.c: New file.
7483 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7484 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7485 (mremap): Declare if HAVE_MREMAP is not defined.
7486 * configure, Makefile.in, config.in: Rebuild.
7490 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7491 position independent.
7492 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7493 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7497 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7499 (needs_dynamic_reloc): Likewise.
7503 * yyscript.y (file_cmd): Recognize EXTERN.
7504 (extern_name_list, extern_name_list_body): New nonterminals.
7505 * script.cc (script_add_extern): Define.
7506 * script-c.h (script_add_extern): Declare.
7510 * object.cc (is_elf_object): Define.
7511 * object.h (is_elf_object): Declare.
7512 * archive.cc (Archive::get_elf_object_for_member): Call
7514 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7518 * output.cc (Output_file::map_anonymous): Define.
7519 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7520 try an anonymous one. Report the size if the mmap fails.
7521 * output.h (class Output_file): Declare map_anonymous.
7525 * target-select.cc (instantiate_target): Don't acquire the lock if
7526 the instantiated_target_ field has already been set.
7530 * gold-threads.h (class Initialize_lock): Define.
7531 * gold-threads.cc (class Initialize_lock_once): Define.
7532 (initialize_lock_control): New static variable.
7533 (initialize_lock_pointer): New static variable.
7534 (initialize_lock_once): New static function.
7535 (Initialize_lock::Initialize_lock): Define.
7536 (Initialize_lock::initialize): Define.
7537 * target-select.h: Include "gold-threads.h".
7538 (class Target_selector): Add lock_ and initialize_lock_ fields.
7539 Don't define instantiate_target, just declare it.
7540 * target-select.cc (Target_selector::Target_selector): Initialize
7542 (Target_selector::instantiate_target): Define.
7543 * descriptors.h: Include "gold-threads.h".
7544 (class Descriptors): Add initialize_lock_ field.
7545 * descriptors.cc (Descriptors::Descriptors): Initialize new
7547 (Descriptors::open): Use initialize_lock_ field
7548 * errors.h (class Errors): Add initialize_lock_ field.
7549 * errors.cc (Errors::Errors): Initialize new field.
7550 (Errors::initialize_lock): Use initialize_lock_ field.
7551 * powerpc.cc (class Target_selector_powerpc): Remove
7552 instantiated_target_ field. In do_recognize call
7553 instantiate_target rather than do_instantiate_target. In
7554 do_instantiate_target just allocate a new target.
7555 * sparc.cc (class Target_selector_sparc): Likewise.
7557 * freebsd.h: New file.
7558 * i386.cc: Include "freebsd.h".
7559 (Target_i386): Derive from Target_freebsd rather than
7561 (Target_selector_i386): Derive from Target_selector_freebsd rather
7562 than Target_selector.
7563 * x86_64.cc: Include "freebsd.h".
7564 (Target_x86_64): Derive from Target_freebsd rather than
7566 (Target_selector_x86_64): Derive from Target_selector_freebsd
7567 rather than Target_selector.
7568 * target.h (class Target): Add adjust_elf_header and
7569 do_adjust_elf_header.
7570 * output.cc (Output_file_header:: do_sized_write): Call target
7571 adjust_elf_header routine.
7572 * configure.tgt: Set targ_osabi.
7573 * configure.ac: Define GOLD_DEFAULT_OSABI.
7574 * parameters.cc (Parameters::default_target): Pass
7575 GOLD_DEFAULT_OSABI to select_target.
7576 * target-select.h (class Target_selector): Make instantiate_target
7577 protected rather than private.
7578 * Makefile.am (HFILES): Add freebsd.h.
7579 * configure, Makefile.in, config.in: Rebuild.
7581 * merge.cc (do_add_input_section): Correct pend value. Change
7582 message about last entry not being null terminated from error to
7587 * incremental.cc: New file.
7588 * Makefile.am (CCFILES): Add incremental.cc.
7589 * Makefile.in: Rebuild.
7593 * layout.cc (Layout::output_section_name): Preserve names
7594 of '.note.' sections.
7598 * descriptors.cc (Descriptors::open): Check that the options are
7599 valid before using them.
7603 * script-sections.h: Include <list>.
7604 (class Script_sections): Change Sections_elements from std::vector
7605 to std::list. Typedef public Elements_iterator. Add
7606 orphan_section_placement_, data_segment_align_start_, and
7607 saw_data_segment_align_ fields. Remove data_segment_align_index_
7609 * script-sections.cc (class Orphan_section_placement): New class.
7610 (class Sections_element): Add virtual functions is_relro and
7611 orphan_section_init. Remove virtual function place_orphan_here.
7612 (class Output_section_definition): Add is_relro and
7613 orphan_section_init. Remove place_orphan_here.
7614 (class Orphan_output_section): Likewise.
7615 (Script_sections::Script_sections): Update for field changes.
7616 (Script_sections::data_segment_align): Set saw_data_segment_align_
7617 and data_segment_align_start_, not data_segment_align_index.
7618 (Script_sections::data_segment_relro_end): Check
7619 saw_data_segment_align_. Use data_segment_align_start_ rather
7620 than data_segment_align_index_.
7621 (Script_sections::place_orphan): Rewrite to use
7622 Orphan_section_placement.
7626 * archive.cc (Archive::add_symbols): Check for a version attached
7627 to the symbol name in the archive map.
7628 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7629 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7630 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7631 (ver_test_11.a): New target.
7632 * testsuite/Makefile.in: Rebuild.
7634 * configure.ac: Check for chsize and posix_fallocate. Replace
7636 * ftruncate.c: New file, from gnulib.
7637 * output.cc (posix_fallocate): Define dummy version if not
7638 HAVE_POSIX_FALLOCATE.
7639 (Output_file::map): Call posix_fallocate rather than lseek and
7641 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7642 * configure, Makefile.in, config.in: Rebuild.
7646 * layout.h (Layout::create_note): Add section_name parameter.
7647 * layout.cc (Layout::create_note): Likewise.
7648 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7652 * descriptors.cc: Include "options.h".
7653 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7654 (Descriptors::open): Always use O_CLOEXEC when opening a new
7655 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7656 then set FD_CLOEXEC.
7658 * sparc.cc (class Target_sparc): Add has_got_section.
7659 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7660 make sure we have a GOT section.
7662 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7663 (Target_sparc::Scan::local): Likewise.
7664 (Target_sparc::Scan::global): Likewise.
7665 (Target_sparc::Relocate::relocate): Likewise.
7666 (Target_sparc::Relocate::relocate_tls): Likewise.
7668 * symtab.cc (Symbol_table::define_default_version): New function,
7669 broken out of add_from_object.
7670 (Symbol_table::add_from_object): Call define_default_version.
7671 (Symbol_table::define_special_symbol): Add resolve_oldsym
7672 parameter. Change all callers. If the version for a symbol comes
7673 from a version script, resolve it with the symbol with the same
7674 name with no version. Also add the symbol without a version if
7676 (do_define_in_output_data): If resolving with oldsym, don't delete
7678 (do_define_in_output_segment): Likewise.
7679 (do_define_as_constant): Likewise.
7680 * symtab.h (class Symbol_table): Update declarations.
7684 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7685 (Read_symbols::requeue): New function.
7686 (Read_symbols::do_read_symbols): If make_elf_object fails because
7687 the target type is not configured, and the file was searched for,
7688 issue a warning and retry with the next directory.
7689 (Add_symbols::run): If the file has an incompatible format, and
7690 it was searched for, requeue the Read_symbols task. On error,
7692 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
7693 dirindex parameter to constructor. Change all callers. Declare
7694 incompatible_warning and requeue.
7695 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7696 input_argument_ and input_group_ fields. Add them to
7697 constructor. Change all callers.
7698 (class Read_script): Add dirindex_ field. Add it to constructor.
7700 * archive.cc (Archive::setup): Remove input_objects parameter.
7702 (Archive::get_file_and_offset): Likewise.
7703 (Archive::read_all_symbols): Likewise.
7704 (Archive::read_symbols): Likewise.
7705 (Archive::get_elf_object_for_member): Remove input_objects
7706 parameter. Add punconfigured parameter. Change all callers.
7707 (Archive::add_symbols): Change return type to bool. Check return
7708 value of include_member.
7709 (Archive::include_all_members): Likewise.
7710 (Archive::include_member): Change return type to bool. Return
7711 false if first included object has incompatible target. Set
7712 included_member_ field.
7713 (Add_archive_symbols::run): If add_symbols returns false, requeue
7715 * archive.h (class Archive): Add included_member_ field.
7716 Initialize it in constructor. Add input_file and searched_for
7717 methods. Update declarations.
7718 (class Add_archive_symbols): Add dirpath_, dirindex_, and
7719 input_argument_ fields. Add them to constructor. Change all
7721 * script.cc: Include "target-select.h".
7722 (class Parser_closure): Add skip_on_incompatible_target_ and
7723 found_incompatible_target_ fields. Add
7724 skip_on_incompatible_target parameter to constructor. Change all
7725 callers. Add methods skip_on_incompatible_target,
7726 clear_skip_on_incompatible_target, found_incompatible_target, and
7727 set_found_incompatible_target.
7728 (read_input_script): Add dirindex parameter. Change all callers.
7729 If parser finds an incompatible target, requeue Read_symbols
7731 (script_set_symbol): Clear skip_on_incompatible_target in
7733 (script_add_assertion, script_parse_option): Likewise.
7734 (script_start_sections, script_add_phdr): Likewise.
7735 (script_check_output_format): New function.
7736 * script.h (read_input_script): Update declaration.
7737 * script-c.h (script_check_output_format): Declare.
7738 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7739 (ignore_cmd): Remove OUTPUT_FORMAT.
7740 * fileread.cc (Input_file::Input_file): Add explicit this.
7741 (Input_file::will_search_for): New function.
7742 (Input_file::open): Add pindex parameter. Change all callers.
7743 * fileread.h (class Input_file): Add input_file_argument method.
7744 Declare will_search_for. Update declarations.
7745 * object.cc (make_elf_object): Add punconfigured parameter.
7747 * object.h (class Object): Make input_file public. Add
7748 searched_for method.
7749 (make_elf_object): Update declaration.
7750 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
7752 * dirsearch.h (class Dirsearch): Update declaration.
7753 * options.h (class General_options): Add --warn-search-mismatch.
7754 * parameters.cc (Parameters::is_compatible_target): New function.
7755 * parameters.h (class Parameters): Declare is_compatible_target.
7756 * workqueue.cc (Workqueue::add_blocker): New function.
7757 * workqueue.h (class Workqueue): Declare add_blocker.
7759 * fileread.cc (Input_file::open): Remove options parameter.
7761 (Input_file::open_binary): Likewise.
7762 * script.cc (read_input_script): Likewise.
7763 * readsyms.h (class Read_symbols): Remove options_ field. Remove
7764 options parameter from constructor. Change all callers.
7765 (class Read_script): Likewise.
7766 * fileread.h (class Input_file): Update declarations.
7767 * script.h (read_input_script): Update declaration.
7771 * po/es.po: New Spanish translation.
7775 * options.cc (parse_short_option): Keep dash_z from registering itself.
7780 * target-reloc.h (relocate_section): Pass output_section to
7782 * i386.cc (Target_i386::should_apply_static_reloc): Add
7783 output_section parameter. Change all callers.
7784 (Target_i386::Relocate::relocate): Add output_section parameter.
7785 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7786 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7787 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7788 * testsuite/two_file_shared.sh: New script.
7789 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7790 (check_DATA): Add two_file_shared.dbg.
7791 (two_file_shared.dbg): New target.
7792 * testsuite/Makefile.in: Rebuild.
7796 * configure.ac: Check for byteswap.h.
7797 * configure: Rebuild.
7798 * config.in: Rebuild.
7802 * layout.cc (Layout::find_or_add_kept_section): New function.
7803 (Layout::add_comdat): Removed.
7804 * layout.h (struct Kept_section): Move out of class Layout.
7805 Remove trailing underscores from field names. Add group_sections
7806 field. Rename group_ field to is_group. Change all uses.
7807 (class Layout): Declare find_or_add_kept_section, not add_comdat.
7808 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7809 comdat_groups_ field.
7810 (Sized_relobj::include_section_group): Use
7811 find_or_add_kept_section and Kept_section::group_sections.
7812 (Sized_relobj::include_linkonce_section): Likewise.
7813 * object.cc (class Sized_relobj): Don't define Comdat_group or
7814 Comdat_group_table. Remove find_comdat_group and
7815 add_comdat_group. Remove comdat_groups_ field.
7816 * plugin.cc (include_comdat_group): Use
7817 Layout::find_or_add_kept_section.
7821 * README: --gc-sections and map files are now supported. Document
7822 some build requirements.
7825 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7826 relocatable link set the value of the section symbol to zero.
7827 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7828 relocatable link don't include the section address in the local
7834 * options.h (class Search_directory): Add is_system_directory.
7835 (class General_options): Declare is_in_system_directory.
7836 * options.cc (get_relative_sysroot): Make static.
7837 (get_default_sysroot): Make static.
7838 (General_optoins::is_in_system_directory): New function.
7839 * fileread.cc (Input_file::is_in_system_directory): New function.
7840 * fileread.h (class Input_file): Declare is_in_system_directory.
7841 * object.h (class Object): Add is_in_system_directory.
7842 (class Input_objects): Remove system_library_directory_ field.
7843 * object.cc (Input_objects::add_object): Don't set
7844 system_library_directory_.
7845 (input_objects::found_in_system_library_directory): Remove.
7846 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7847 parameter. Change all callers.
7848 (Symbol_table::sized_write_globals): Likewise.
7849 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7850 Call Object::is_in_system_directory.
7851 * symtab.h (class Symbol_table): Update declarations.
7854 * descriptors.h (Open_descriptor): Add is_on_stack field.
7855 * descriptors.cc (Descriptors::open): If the descriptor is on the
7856 top of the stack, remove it. Initialize is_on_stack field.
7857 (Descriptors::release): Only add pod to stack if it is not on the
7859 (Descriptors::close_some_descriptor): Clear stack_next and
7863 * output.cc (Output_section::find_starting_output_address): Rename
7864 from starting_output_address; add PADDR parameter; change return
7866 * output.h (class Output_section): Declare
7867 find_starting_output_address instead of starting_output_address.
7868 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7869 section symbol for which we can't find a merge section.
7872 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7873 hidden or internal, force the symbol to be local.
7874 * resolve.cc (Symbol::override_visibility): Define.
7875 (Symbol::override_base): Use override_visibility.
7876 (Symbol_table::resolve): Likewise.
7877 (Symbol::override_base_with_special): Likewise.
7878 (Symbol_table::override_with_special): If the visibility is hidden
7879 or internal, force the symbol to be local.
7880 * symtab.h (class Symbol): Add set_visibility and
7881 override_visibility.
7882 * testsuite/ver_test_1.sh: New file.
7883 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7884 (check_DATA): Add ver_test_1.syms.
7885 (ver_test_1.syms): New target.
7886 * testsuite/Makefile.in: Rebuild.
7890 * layout.cc (Layout::choose_output_section): Don't rename sections
7891 when using a linker script that has a SECTIONS clause.
7892 * Makefile.in: Regenerate.
7894 * testsuite/Makefile.am (script_test_5.sh): New test case.
7895 * testsuite/Makefile.in: Regenerate.
7896 * testsuite/script_test_5.cc: New file.
7897 * testsuite/script_test_5.sh: New file.
7898 * testsuite/script_test_5.t: New file.
7902 * archive.cc (Archive::include_member): Update calls to add_symbols.
7903 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7904 the Layout argument.
7905 * dynobj.h (do_add_symbols): Add the Layout argument.
7906 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7908 * object.h (Object::add_symbols): Add the Layout argument.
7909 (Object::do_add_symbols): Add the Layout argument.
7910 (Sized_relobj::do_add_symbols): Add the Layout argument.
7911 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7912 Unify the two versions.
7913 (Add_plugin_symbols): Remove.
7914 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7915 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7916 (Add_plugin_symbols): Remove.
7917 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7918 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7919 (Add_symbols::run): Make it work with Pulginobj.
7923 * object.cc (Sized_relobj::do_layout): Make info message start
7924 with lower case letter.
7928 * binary.cc: Fix file comment.
7930 * options.h (enum Incremental_disposition): Define.
7931 (class General_options): Add new options: --incremental,
7932 --incremental_changed, --incremental_unchanged,
7933 --incremental_unknown. Add incremental_disposition_ and
7934 implicit_incremental_ fields.
7935 (General_options::incremental_disposition): New function.
7936 (class Position_dependent_options): Add incremental_disposition
7938 (Position_dependent_options::copy_from_options): Set incremental
7940 * options.cc (General_options::parse_incremental_changed): New
7942 (General_options::parse_incremental_unchanged): New function.
7943 (General_options::parse_incremental_unknown): New function.
7944 (General_options::General_options): Initialize new fields
7945 incremental_disposition_ and implicit_incremental_.
7946 (General_options::finalize): Check for uasge of --incremental-*
7947 without --incremental.
7951 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7952 pointer and to report location as the file name associated with
7954 (gold_undefined_symbol_at_location): New function to replace the
7955 old gold_undefined_symbol functionality.
7956 * target-reloc.h (relocate_section): Update to use
7957 gold_undefined_symbol_at_location.
7958 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7959 Call gold_undefined_symbol function rather than gold_error.
7960 * errors.h (Errors::undefined_symbol): Take location as a
7961 string, rather than calculating it from a relocation.
7962 * errors.cc (Errors::fatal): Print "fatal error:" before the
7964 (Errors::error, Errors::error_at_location): Print "error: "
7965 before the formatted message.
7966 (Errors::undefined_symbol): Take location as a string, rather
7967 than calculating it from a relocation.
7968 (gold_undefined_symbol_at_location): New function akin to
7969 old gold_undefined_symbol, calculates location from relocation.
7970 (gold_undefined_symbol): Change to take only a Symbol pointer
7971 and to report location as the file name associated with the symbol.
7972 * testsuite/debug_msg.sh: Update for changed error messages.
7973 * testsuite/undef_symbol.sh: Likewise.
7978 * reduced_debug_output.h
7979 (Output_reduced_debug_abbrev_section::failed): Use format for
7981 (Output_reduced_debug_info_section::faild): Likewise.
7985 * script.cc (Lazy_demangler): New class.
7986 (Version_script_info::get_symbol_version_helper): Demangle a
7991 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7993 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7997 * version.cc (version_string): Bump to 1.9.
7999 * gold.h: Include <cstring> and <stdint.h>.
8000 * version.cc: Include <cstdio>.
8001 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8003 * reduced_debug_output.cc (insert_into_vector): Rename from
8004 Insert_into_vector; change all callers. Use Swap_unaligned to
8005 avoid aliasing issue; remove union since it is unnecessary.
8009 * Makefile.am (CCFILES): Add gc.cc.
8011 * Makefile.in: Regenerate.
8012 * gold.cc (Gc_runner): New class.
8013 (queue_initial_tasks): Call garbage collection related tasks
8014 when corresponding options are invoked.
8015 (queue_middle_gc_tasks): New function.
8016 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8017 processed early before laying out sections during garbage collection.
8018 * gold.h (queue_middle_gc_tasks): New function.
8019 (is_prefix_of): Move from "layout.cc".
8020 * i386.cc (Target_i386::gc_process_relocs): New function.
8021 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8022 * main.cc (main): Create object of class "Garbage_collection".
8023 * object.cc (Relobj::copy_symbols_data): New function.
8024 (Relobj::is_section_name_included): New function.
8025 (Sized_relobj::do_layout): Allow this function to be called twice
8026 during garbage collection and defer layout of section during the
8028 * object.h (Relobj::get_symbols_data): New function.
8029 (Relobj::is_section_name_included): New function.
8030 (Relobj::copy_symbols_data): New function.
8031 (Relobj::set_symbols_data): New function.
8032 (Relobj::get_relocs_data): New function.
8033 (Relobj::set_relocs_data): New function.
8034 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8035 (Relobj::gc_process_relocs): New function.
8036 (Relobj::do_gc_process_relocs): New pure virtual function.
8037 (Relobj::sd_): New data member.
8038 (Sized_relobj::is_output_section_offset_invalid): New function.
8039 (Sized_relobj::do_gc_process_relocs): New function.
8040 * options.h (General_options::gc_sections): Modify to not be a no-op.
8041 (General_options::print_gc_sections): New option.
8042 * plugin.cc (Plugin_finish::run): Remove function call to
8043 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8044 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8045 * reloc.cc (Read_relocs::run): Add task to process relocs and
8046 determine unreferenced sections when doing garbage collection.
8047 (Gc_process_relocs): New class.
8048 (Sized_relobj::do_gc_process_relocs): New function.
8049 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8050 sections that are garbage collected.
8051 * reloc.h (Gc_process_relocs): New class.
8052 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8053 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8054 symbols whose corresponding sections are garbage collected.
8055 (Symbol_table::Symbol_table): Add new parameter for the garbage
8057 (Symbol_table::gc_mark_undef_symbols): New function.
8058 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8059 (Symbol_table::gc_mark_dyn_syms): New function.
8060 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8062 (Symbol_table::add_from_object): Likewise.
8063 (Symbol_table::add_from_relobj): When building shared objects, do not
8064 treat externally visible symbols as garbage.
8065 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8066 table information for static and relocatable links.
8067 * symtab.h (Symbol_table::set_gc): New function.
8068 (Symbol_table::gc): New function.
8069 (Symbol_table::gc_mark_undef_symbols): New function.
8070 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8071 (Symbol_table::gc_mark_dyn_syms): New function.
8072 (Symbol_table::gc_): New data member.
8073 * target.h (Sized_target::gc_process_relocs): New pure virtual
8075 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8076 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8080 * options.h (General_options::gc_sections): Define as a no-op for now.
8081 (General_options::no_keep_memory): Ditto.
8082 (General_options::Bshareable): Define.
8083 * options.cc (General_options::finalize): Honor -Bshareable.
8087 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8088 read the value in the contents, since we don't use it. Use the
8089 template endianness when writing.
8090 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8094 * configure.tgt (powerpc64-*): Fix targ_obj.
8098 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8099 local symbols when stripping all symbols.
8103 * output.cc (Output_reloc): Add explicit instantiations.
8107 * archive.cc (Archive::get_elf_object_for_member): Remove call
8108 to File_read::claim_for_plugin.
8109 * descriptors.cc (Descriptors::open): Remove reference to
8111 (Descriptors::claim_for_plugin): Remove.
8112 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8113 (Descriptors::is_claimed): Remove.
8114 (claim_descriptor_for_plugin): Remove.
8115 * fileread.cc (File_read::claim_for_plugin): Remove.
8116 * fileread.h (File_read::claim_for_plugin): Remove.
8117 (File_read::descriptor): Reopen descriptor if necessary.
8118 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8119 (Plugin_manager::all_symbols_read): Add task parameter. Change
8121 (Plugin_manager::get_input_file): New function.
8122 (Plugin_manager::release_input_file): New function.
8123 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8124 corresponding data member.
8125 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8126 and pass to base constructor. Change all callers.
8127 (get_input_file, release_input_file): New functions.
8128 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8129 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8130 (Plugin_manager::all_symbols_read): Add task parameter.
8131 (Plugin_manager::get_input_file): New function.
8132 (Plugin_manager::release_input_file): New function.
8133 (Plugin_manager::task_): New data member.
8134 (Pluginobj::Pluginobj): Add filesize parameter.
8135 (Pluginobj::filename): New function.
8136 (Pluginobj::descriptor): New function.
8137 (Pluginobj::filesize): New function.
8138 (Pluginobj::filesize_): New data member.
8139 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8140 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8141 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8143 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8144 with archive libraries.
8145 * testsuite/Makefile.in: Regenerate.
8146 * testsuite/plugin_test.c (struct sym_info): New type.
8147 (get_input_file, release_input_file): New static variables.
8148 (onload): Capture new transfer vector entries.
8149 (claim_file_hook): Stop reading at end of file according to filesize.
8150 Factor out parsing of readelf output into separate function.
8151 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8152 APIs and get the source file name from the symbol table. Convert
8153 source file name to corresponding object file name. Print info
8154 message when adding new input files.
8155 (parse_readelf_line): New function.
8156 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8157 * testsuite/plugin_test_2.sh: Likewise.
8158 * testsuite/plugin_test_3.sh: Likewise.
8159 * testsuite/plugin_test_4.sh: New test case.
8163 * version.cc (version_string): Bump to 1.8.
8167 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8168 * plugin.cc (Plugin_manager::finish): Rename as
8169 layout_deferred_objects. Move cleanup to separate function.
8170 (Plugin_manager::cleanup): New function.
8171 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8173 * plugin.h (Plugin_manager::finish): Rename as
8174 layout_deferred_objects.
8175 (Plugin_manager::cleanup): New function.
8176 (Plugin_manager::cleanup_done): New field.
8180 * plugin.cc (is_visible_from_outside): New function.
8181 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8182 so we don't return "IR only" status for exported symbols or -r links.
8184 * testsuite/Makefile.am (plugin_test_3): New test case.
8185 * testsuite/Makefile.in: Regenerate.
8186 * testsuite/plugin_test_3.sh: New file.
8190 * object.cc (Sized_relobj::layout_section): New function.
8191 (Sized_relobj::do_layout): Defer layout of input sections until after
8192 plugin has provided replacement files.
8193 (Sized_relobj::do_layout_deferred_sections): New function.
8194 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8195 (Relobj::layout_deferred_sections): New function.
8196 (Relobj::do_layout_deferred_sections): New function.
8197 (Sized_relobj::do_layout_deferred_sections): New function.
8198 (Sized_relobj::layout_section): New function.
8199 (Sized_relobj::Deferred_layout): New structure.
8200 (Sized_relobj::deferred_layout_): New field.
8201 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8202 Change all callers. Layout deferred sections.
8203 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8205 (Plugin_hook::run): Move code from do_plugin_hook inline.
8206 (Plugin_hook::do_plugin_hook): Remove.
8207 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8208 (Plugin_manager::finish): Renamed, was cleanup.
8209 (Plugin_manager::should_defer_layout): New function.
8210 (Plugin_manager::add_deferred_layout_object): New function.
8211 (Plugin_manager::Deferred_layout_list): New type.
8212 (Plugin_manager::deferred_layout_objects_): New field.
8213 (Plugin_hook::do_plugin_hook): Remove.
8217 * options.h (class General_options): Add --no case for
8222 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8224 (Plugin_manager::claim_file): Create plugin object even if
8225 plugin did not call the add_symbols callback.
8226 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8227 asking for more symbols than were added.
8228 * testsuite/Makefile.am (plugin_test_1): Add test case with
8230 (empty.syms): New target.
8231 * testsuite/Makefile.in: Regenerate.
8232 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8233 message. Don't call add_symbols if no globals.
8234 (all_symbols_read_hook): Don't provide replacement for empty
8239 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8240 r_type == 0 for a local symbol with r_sym == 0.
8241 (scan_relocatable_relocs): Pass r_sym to
8242 local_non_section_strategy.
8243 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8246 * configure.ac: Update test for TLS descriptors: they are
8247 supported as of glibc 2.9.
8248 * configure: Rebuild.
8253 * target-reloc.h (Default_scan_relocatable_relocs): For each
8254 function, map r_type == 0 to RELOC_DISCARD.
8258 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8259 object to override a kept COMDAT group from a plugin object.
8264 * yyscript.y (file_cmd): Handle INPUT.
8266 * testsuite/initpri1.c: Change all declarations to be full
8267 prototypes by adding void, to avoid compiler warnings.
8271 * options.cc (General_options::parse_plugin_opt): New.
8272 (General_options::add_plugin): The argument now is just the filename.
8273 (General_options::add_plugin_option): New.
8274 * options.h (plugin_opt): New.
8275 (add_plugin): Change argument name.
8276 (add_plugin_option): New.
8277 * plugin.cc (Plugin::load): Don't parse the plugin option.
8278 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8279 (Plugin::add_option): New.
8280 (Plugin::args_): Change type.
8281 (Plugin::filename_): New.
8282 (Plugin_manager::add_plugin_option): New.
8283 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8284 * testsuite/Makefile.in: Regenerate.
8288 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8289 Handle --strip-lto-sections option.
8290 * options.h (strip_lto_sections): New option.
8294 * plugin.cc (ld_plugin_message): Change format parameter to const.
8295 Fix mismatch between new[] and delete.
8299 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8304 * options.cc (General_options::parse_dynamic_list): New function.
8305 * options.h (General_options): New flags dynamic_list,
8306 dynamic_list_data, dynamic_list_cpp_new, and
8307 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8308 (General_options::in_dynamic_list): New function.
8309 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8310 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8311 (Lex::can_continue_name): Likewise.
8313 (read_script_file): New parameter script_options.
8314 (read_dynamic_list): New function.
8315 (Script_options::define_dynamic_list): New function.
8316 (dynamic_list_keyword_parsecodes): New variable.
8317 (dynamic_list_keywords): New variable.
8318 * script.h (Script_options::define_dynamic_list): New function
8320 (read_dynamic_list): New function prototype.
8321 * symtab.cc (strprefix): New macro.
8322 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8323 dynamic_list_data, dynamic_list_cpp_new, and
8324 dynamic_list_cpp_typeinfo.
8325 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8326 (dynamic_list_expr): New rule.
8327 (dynamic_list_nodes): Likewise.
8328 (dynamic_list_node): Likewise.
8329 * testsuite/Makefile.am (dynamic_list): New test.
8330 * testsuite/Makefile.in: Regenerated.
8331 * testsuite/dynamic_list.t: New file.
8332 * testsuite/dynamic_list.sh: New file.
8336 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8337 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8338 (t11_last): Likewise.
8339 * testsuite/ver_test_6.c (main): Likewise.
8343 * options.c (General_options::finalize): Add check for -static and
8345 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8350 * plugin.cc (make_sized_plugin_object): Fix conditional
8351 compilation to work when not all targets are enabled.
8355 * archive.cc (Archive::get_file_and_offset): Use filename instead
8356 of name to get library path.
8357 (Archive::include_member): Unlock external member of a thin archive.
8359 * testsuite/Makefile.am (TEST_AR): New variable.
8360 (thin_archive_test_1): New test.
8361 (thin_archive_test_2): New test.
8362 * testsuite/Makefile.in: Regenerate.
8363 * testsuite/thin_archive_main.cc: New file.
8364 * testsuite/thin_archive_test_1.cc: New file.
8365 * testsuite/thin_archive_test_2.cc: New file.
8366 * testsuite/thin_archive_test_3.cc: New file.
8367 * testsuite/thin_archive_test_4.cc: New file.
8371 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8372 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8374 (Sized_relobj::do_finalize_local_symbols): Likewise.
8375 (Sized_relobj::map_to_kept_section): Likewise.
8376 * object.h (Sized_relobj::invalid_address): New constant.
8377 (Sized_relobj::do_output_section_offset): Check for invalid_address
8379 * output.cc (Output_reloc::local_section_offset): Use constant
8380 invalid_address instead of -1U.
8381 (Output_reloc::get_address): Likewise.
8382 (Output_section::output_address): Change -1U to -1ULL.
8383 * output.h (Output_reloc::invalid_address): New constant.
8384 * reloc.cc (Sized_relobj::write_sections): Use constant
8385 invalid_address instead of -1U.
8386 (Sized_relobj::relocate_sections): Likewise.
8387 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8388 values for merge sections.
8389 * target-reloc.h (relocate_for_relocatable): Use constant
8390 invalid_address instead of -1U.
8394 Add plugin functionality for link-time optimization (LTO).
8395 * configure.ac (plugins): Add --enable-plugins option.
8396 * configure: Regenerate.
8397 * config.in: Regenerate.
8398 * Makefile.am (LIBDL): New variable.
8399 (CCFILES): Add plugin.cc.
8400 (HFILES): Add plugin.h.
8401 (ldadd_var): Add LIBDL.
8402 * Makefile.in: Regenerate.
8404 * archive.cc: Include "plugin.h".
8405 (Archive::setup): Don't preread archive symbols when using a plugin.
8406 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8407 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8409 (Archive::include_member): Add symbols from plugin objects.
8410 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8411 * descriptors.cc (Descriptors::open): Check for file descriptors
8412 abandoned by plugins.
8413 (Descriptors::claim_for_plugin): New function.
8414 * descriptors.h (Descriptors::claim_for_plugin): New function.
8415 (Open_descriptor::is_claimed): New field.
8416 (claim_descriptor_for_plugin): New function.
8417 * fileread.cc (File_read::claim_for_plugin): New function.
8418 * fileread.h (File_read::claim_for_plugin): New function.
8419 (File_read::descriptor): New function.
8420 * gold.cc: Include "plugin.h".
8421 (queue_initial_tasks): Add task to call plugin hooks for generating
8423 * main.cc: Include "plugin.h".
8424 (main): Load plugin libraries.
8425 * object.h (Pluginobj): Declare.
8426 (Object::pluginobj): New function.
8427 (Object::do_pluginobj): New function.
8428 (Object::set_target): New function.
8429 * options.cc: Include "plugin.h".
8430 (General_options::parse_plugin): New function.
8431 (General_options::General_options): Initialize plugins_ field.
8432 (General_options::add_plugin): New function.
8433 * options.h (Plugin_manager): Declare.
8434 (General_options): Add --plugin option.
8435 (General_options::has_plugins): New function.
8436 (General_options::plugins): New function.
8437 (General_options::add_plugin): New function.
8438 (General_options::plugins_): New field.
8439 * plugin.cc: New file.
8440 * plugin.h: New file.
8441 * readsyms.cc: Include "plugin.h".
8442 (Read_symbols::do_read_symbols): Check for archive before checking
8443 for ELF file. Call plugin hooks to claim files.
8444 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8445 from a real object file; force override when processing replacement
8447 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8448 (Symbol::init_base_object): Likewise.
8449 (Symbol::init_base_output_data): Likewise.
8450 (Symbol::init_base_output_segment): Likewise.
8451 (Symbol::init_base_constant): Likewise.
8452 (Symbol::init_base_undefined): Likewise.
8453 (Symbol::output_section): Assert that object is not a plugin.
8454 (Symbol_table::add_from_pluginobj): New function.
8455 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8457 (Symbol_table::sized_write_globals): Likewise.
8458 (Symbol_table::add_from_pluginobj): Instantiate template.
8459 * symtab.h (Sized_pluginobj): Declare.
8460 (Symbol::in_real_elf): New function.
8461 (Symbol::set_in_real_elf): New function.
8462 (Symbol::in_real_elf_): New field.
8463 (Symbol_table::add_from_pluginobj): New function.
8465 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8466 (LIBDL): New variable.
8468 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8469 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8470 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8471 (MOSTLYCLEANFILES): Likewise.
8472 * testsuite/Makefile.in: Regenerate.
8473 * testsuite/plugin_test.c: New file.
8474 * testsuite/plugin_test_1.sh: New file.
8475 * testsuite/plugin_test_2.sh: New file.
8479 * target-reloc.h (relocate_section): Check whether a symbol is
8480 defined by the ABI before reporting an undefined symbol error.
8481 * target.h (Target::is_defined_by_abi): Make parameter const.
8482 (Target::do_is_defined_by_abi): Likewise.
8483 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8484 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8485 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8486 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8487 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8488 * testsuite/Makefile.in: Rebuild.
8490 * fileread.cc (make_view): Add casts to avoid warning.
8494 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8495 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8499 * options.h (General_options::output_is_executable): New.
8500 (General_options::output_is_pie): New.
8501 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8502 for shared libraries.
8503 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8507 * options.h (origin): New -z option.
8508 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8509 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8514 * fileread.cc (File_read::make_view): Add check for attempt to map
8519 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8520 explicit instantiations.
8525 * options.cc (General_options::finalize): Allow undefined symbols
8526 in shlibs if linking -shared.
8529 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8530 symbols as not needing a dynsym entry.
8534 * fileread.cc (File_read::open): Do not lock the file unless it
8535 was successfully opened.
8539 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8540 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8541 * testsuite/tls_test.cc (struct int128): 128-bit struct
8542 for testing TLS relocs with non-zero addend.
8543 (v12): New TLS variable.
8545 (t_last): Add check for v12.
8546 * testsuite/tls_test.h (t12): New function.
8547 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8551 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8552 set tls_segment_ or relro_segment_.
8553 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8555 * output.h (Output_section::clear_is_relro): New function.
8556 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8557 sections specially even when output_data_ is empty.
8558 (Output_segment::maximum_alignment): When first section is relro,
8559 only force alignment for PT_LOAD segments.
8560 * script.cc (script_data_segment_align): New function.
8561 (script_data_segment_relro_end): New function.
8562 * script-c.h (script_data_segment_align): Declare.
8563 (script_data_segment_relro_end): Declare.
8564 * script-sections.h (class Script_sections): Declare
8565 data_segment_align and data_segment_relro_end. Add fields
8566 segment_align_index_ and saw_relro_end_.
8567 * script-sections.cc (class Sections_element): Add set_is_relro
8568 virtual function. Add new bool* parameter to place_orphan_here.
8569 Add get_output_section virtual function.
8570 (class Output_section_definition): Add set_is_relro. Add new
8571 bool* parameter to place_orphan_here. Add get_output_section.
8572 Add is_relro_ field.
8573 (Output_section_definition::Output_section_definition): Initialize
8574 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8575 and is_relro_ fields.
8576 (Output_section_definition::place_orphan_here): Add is_relro
8578 (Output_section_definition::set_section_addresses): Set relro for
8580 (Output_section_definition::alternate_constraint): Likewise.
8581 (class Orphan_output_section): Add new bool* parameter to
8582 place_orphan_here. Add get_output_section.
8583 (Orphan_output_section::place_orphan_here): Add is_relro
8585 (Script_sections::Script_sections): Initialize
8586 data_segment_align_index_ and saw_relro_end_.
8587 (Script_sections::data_segment_align): New function.
8588 (Script_sections::data_segment_relro_end): New function.
8589 (Script_sections::place_orphan): Set or clear is_relro.
8590 (Script_sections::set_section_addresses): Force alignment of first
8592 * yyscript.y (exp): Call script_data_segment_align and
8593 script_data_segment_relro_end.
8594 * testsuite/relro_script_test.t: New file.
8595 * testsuite/relro_test.cc (using_script): Declare.
8596 (t1, t2): Test using_script.
8597 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8598 (relro_script_test_SOURCES): Define.
8599 (relro_script_test_DEPENDENCIES): Define.
8600 (relro_script_test_LDFLAGS): Define.
8601 (relro_script_test_LDADD): Define.
8602 (relro_script_test.so): New target.
8603 * testsuite/Makefile.in: Rebuild.
8607 * archive.cc (Archive::total_archives, Archive::total_members)
8608 (Archive::total_members_loaded): New variables.
8609 (Archive::setup): Add parameter. Add option to preread
8611 (Archive::read_armap): Add counter.
8612 (Archive::get_file_and_offset): New function.
8613 (Archive::get_elf_object_for_member): New function.
8614 (Archive::read_all_symbols): New function.
8615 (Archive::read_symbols): New function.
8616 (Archive::add_symbols): Add counters.
8617 (Archive::include_all_members): Use armap to find members if it's
8619 (Archive::include_member): Skip reading symbols if already read.
8620 Factored code into Archive::get_file_and_offset and
8621 Archive::get_elf_object_for_member. Changed call to
8622 Mapfile::report_include_archive_member.
8623 (Archive::print_stats): New function.
8624 * archive.h: Declare Object and Read_symbols_data classes.
8625 (Archive::Archive): Add initializers for new members.
8626 (Archive::setup): Add parameter.
8627 (Archive::print_stats): New function.
8628 (Archive::total_archives, Archive::total_members)
8629 (Archive::total_members_loaded): New variables.
8630 (Archive::get_file_and_offset): New function.
8631 (Archive::get_elf_object_for_member): New function.
8632 (Archive::read_all_symbols): New function.
8633 (Archive::read_symbols): New function.
8634 (Archive::Archive_member): New class.
8635 (Archive::members_): New member.
8636 (Archive::num_members_): New member.
8637 * main.cc: Include archive.h.
8638 (main): Call Archive::print_stats.
8639 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8640 archive parameter; member_name is now the fully-decorated name.
8641 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8642 * options.h: (General_options): Add --preread-archive-symbols option.
8643 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8648 * symtab.h (Symbol::use_plt_offset): New function.
8649 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8650 * powerpc.cc (Relocate::relocate): Likewise.
8651 * sparc.cc (Relocate::relocate): Likewise.
8652 * x86_64.cc (Relocate::relocate): Likewise.
8653 * testsuite/weak_plt.sh: New test.
8654 * testsuite/weak_plt_main.cc: New test.
8655 * testsuite/weak_plt_shared.cc: New test.
8656 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8657 (check_PROGRAMS): Add weak_plt.
8658 (check_DATA): Add weak_plt_shared.so.
8659 (weak_plt_main_pic.o, weak_plt): New targets.
8660 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8661 * testsuite/Makefile.in: Rebuild.
8663 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8665 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8666 * testsuite/Makefile.in: Rebuild.
8670 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8671 * Makefile.in: Regenerate.
8672 * po/POTFILES.in: Regenerate.
8676 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8677 symbols before other symbols.
8678 * testsuite/script_test_2.cc (test_addr): Declare.
8679 (test_addr_alias): Declare.
8680 (main): Check that test_addr and test_addr_alias have the right
8682 * testsuite/script_test_2.t: Define test_addr_alias and
8688 * descriptors.cc: New file.
8689 * descriptors.h: New file.
8690 * gold-threads.h (class Hold_optional_lock): New class.
8691 * fileread.cc: Include "descriptors.h".
8692 (File_read::~File_read): Release descriptor rather than closing
8694 (File_read::open) [file]: Call open_descriptor rather than open.
8695 Set is_descriptor_opened_.
8696 (File_read::open) [memory]: Assert that descriptor is not open.
8697 (File_read::reopen_descriptor): New function.
8698 (File_read::release): Release descriptor.
8699 (File_read::do_read): Make non-const. Reopen descriptor.
8700 (File_read::read): Make non-const.
8701 (File_read::make_view): Reopen descriptor.
8702 (File_read::do_readv): Likewise.
8703 * fileread.h (class File_read): Add is_descriptor_opened_ field.
8704 Update declarations.
8705 * layout.cc: Include "descriptors.h".
8706 (Layout::create_build_id): Use open_descriptor rather than open.
8707 * output.cc: Include "descriptors.h".
8708 (Output_file::open): Use open_descriptor rather than open.
8709 * archive.cc (Archive::const_iterator): Change Archive to be
8711 (Archive::begin, Archive::end): Make non-const.
8712 (Archive::count_members): Likewise.
8713 * archive.h (class Archive): Update declarations.
8714 * object.h (Object::read): Make non-const.
8715 * Makefile.am (CCFILES): Add descriptors.cc.
8716 (HFILES): Add descriptors.h.
8717 * Makefile.in: Rebuild.
8720 * gold.h: Always include <clocale>. Add Solaris workarounds
8721 following code in binutils/sysdep.h.
8724 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8725 this->eh_frame_hdr_ is NULL before using it.
8727 * dynobj.cc (Versions::Versions): Update comment.
8729 * dynobj.cc (Versions::Versions): If there is an soname, use it as
8730 the base version name.
8732 * stringpool.cc (Stringpool_template::add_with_length): Set key to
8733 array size plus one.
8734 (Stringpool_template::set_string_offsets): Subtract one from key
8735 before using it as an array index.
8736 (Stringpool_template::get_offset_with_length): Likewise.
8737 (Stringpool_template::write_to_buffer): Likewise.
8738 * stringpool.h (Stringpool_template::get_offset_from_key):
8744 * object.h (Merged_symbol_value::value): Do our best to handle a
8748 * script.cc (Version_script_info::get_versions): Don't add empty
8749 version tag to return value.
8750 (Version_script_info::get_symbol_version_helper): Change return
8751 type to bool. Add pversion parameter. Change all callers.
8752 (script_register_vers_node): Don't require a non-NULL tag.
8753 * script.h (class Version_script_info): Update declarations.
8754 (Version_script_info::get_symbol_version): Change return type to
8755 bool. Add version parameter. Change all callers.
8756 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8757 handling. Handle an empty version from a version script.
8758 (Symbol_table::define_special_symbol): Likewise.
8759 * testsuite/ver_test_10.script: New file.
8760 * testsuite/ver_test_10.sh: New file.
8761 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8762 (check_DATA): Add ver_test_10.syms.
8763 (ver_test_10.syms, ver_test_10.so): New target.
8764 * testsuite/Makefile.in: Rebuild.
8768 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8769 to zero for undefined symbols from dynamic libraries.
8773 * symtab.cc (Symbol_table::resolve): Remove version parameter.
8775 * symtab.h (class Symbol_table): Update declaration.
8776 * testsuite/ver_test_9.cc: New file.
8777 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8778 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8779 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8780 (ver_test_9.so, ver_test_9.o): New targets.
8781 * testsuite/Makefile.in: Rebuild.
8785 * options.h (class General_options): Define --check-sections.
8786 * layout.cc (Layout::set_segment_offsets): Handle
8789 * options.h (class General_options): Define -n/--nmagic and
8791 * options.cc (General_options::finalize): For -n/--nmagic or
8792 -N/--omagic, set -static.
8793 * layout.cc (Layout::attach_allocated_section_to_segment): If
8794 -N/--omagic, don't put read-only and read-write sections in
8796 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8797 finding a read-only segment.
8798 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8799 don't set the minimum segment alignment to the common page size,
8800 and don't set the file offset to the address modulo the page size.
8801 * script-sections.cc (Script_sections::create_segments): If
8802 -n/--omagic, don't put read-only and read-write sections in
8805 * cref.cc: New file.
8807 * options.h (class General_options): Add --print-symbol-counts.
8808 * main.cc (main): Issue defined symbol report if requested.
8809 * archive.cc (Archive::interpret_header): Make into a const member
8811 (Archive::add_symbols): Call Input_objects::archive_start and
8813 (Archive::const_iterator): Define new class.
8814 (Archive::begin, Archive::end): New functions.
8815 (Archive::include_all_members): Rewrite to use iterator.
8816 (Archive::count_members): New function.
8817 * archive.h (class Archive): Update declarations.
8818 (Archive::filename): New function.
8819 * object.cc: Include "cref.h".
8820 (Sized_relobj::Sized_relobj): Initialize defined_count_.
8821 (Sized_relobj::do_get_global_symbol_counts): New function.
8822 (Input_objects::add_object): Add object to cross-referencer.
8823 (Input_objects::archive_start): New function.
8824 (Input_objects::archive_stop): New function.
8825 (Input_objects::print_symbol_counts): New function.
8826 * object.h: Declare Cref and Archive.
8827 (Object::get_global_symbol_counts): New function.
8828 (Object::do_get_global_symbol_counts): New pure virtual function.
8829 (class Sized_relobj): Add defined_count_ field. Update
8831 (class Input_objects): Add cref_ field. Update constructor.
8832 Update declarations.
8833 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8835 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8837 (Sized_dynobj::do_get_global_symbol_counts): New function.
8838 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8839 defined_count_. Update declarations. Define Symbols typedef.
8840 * symtab.cc (Symbol_table::add_from_relobj): Add defined
8841 parameter. Change all callers.
8842 (Symbol_table::add_from_dynobj): Add sympointers and defined
8843 parameters. Change all callers.
8844 * symtab.h (class Symbol_table): Update declarations.
8845 * Makefile.am (CCFILES): Add cref.cc.
8846 (HFILES): Add cref.h.
8847 * Makefile.in: Rebuild.
8851 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8852 to zero when writing undefined symbols.
8856 * output.cc (Output_section::add_input_section): Don't try to
8857 merge empty merge sections.
8861 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8862 Include symbol version in error message.
8866 * configure.ac (gold_cv_c_random_seed): New configured variable.
8867 (RANDOM_SEED_CFLAGS): New substituted variable.
8868 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8869 * configure: Rebuild.
8870 * Makefile.in: Likewise.
8871 * testsuite/Makefile.in: Likewise.
8875 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8876 where we see NAME/NULL and NAME/VERSION as separate symbols.
8877 * testsuite/ver_test_main.cc (main): Call t4.
8878 (t4, t4_2a): Define.
8879 * testsuite/ver_test_2.cc (t4_2): Define.
8880 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8881 * testsuite/ver_test_4.cc (t4_2a): Define.
8882 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8883 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8887 * dynobj.cc (Versions::add_def): If we give an error about a
8888 missing version, go ahead and create the version anyhow.
8892 Handle output sections with more than 0x7fffffff bytes.
8893 * object.h (class Relobj): Change map_to_output_ to
8894 output_sections_, and just keep a section pointer. Change all
8895 uses. Move comdat group support to Sized_relobj.
8896 (Relobj::is_section_specially_mapped): Remove.
8897 (Relobj::output_section): Remove poff parameter. Change all
8899 (Relobj::output_section_offset): New function.
8900 (Relobj::set_section_offset): Rewrite.
8901 (Relobj::map_to_output): Remove.
8902 (Relobj::output_sections): New function.
8903 (Relobj::do_output_section_offset): New pure virtual function.
8904 (Relobj::do_set_section_offset): Likewise.
8905 (class Sized_relobj): Add section_offsets_ field. Add comdat
8906 group support from Relobj. Update declarations.
8907 (Sized_relobj::get_output_section_offset): New function.
8908 (Sized_relobj::do_output_section_offset): New function.
8909 (Sized_relobj::do_set_section_offset): New function.
8910 * object.cc (Relobj::output_section_address): Remove.
8911 (Sized_relobj::Sized_relobj): Initialize new fields.
8912 (Sized_relobj::include_section_group): Cast find_kept_object to
8914 (Sized_relobj::include_linkonce_section): Likewise.
8915 (Sized_relobj::do_layout): Use separate arrays for output section
8917 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8919 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8920 output_sections and section_offsets.
8921 (Sized_relobj::write_local_symbols): Likewise.
8922 (map_to_kept_section): Compute output address directly.
8923 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8924 output_sections and section_offsets.
8925 (Sized_relobj::write_sections): Likewise.
8926 (Sized_relobj::relocate_sections): Likewise.
8927 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8928 * output.h (class Output_reloc): Update declarations. Change
8929 u2_.relobj to Sized_relobj*.
8930 (class Output_data_reloc): Change add functions to use
8932 * output.cc (Output_reloc::Output_reloc): Change relobj to
8934 (Output_reloc::local_section_offset): Change return type to
8935 Elf_Addr. Use get_output_section_offset.
8936 (Output_reloc::get_address): Likewise.
8937 (Output_section::is_input_address_mapped): Don't call
8938 is_section_specially_mapped.
8939 (Output_section::output_offset): Likewise.
8940 (Output_section::output_address): Likewise.
8941 (Output_section::starting_output_address): Likewise.
8942 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8943 parameter to Sized_relobj*.
8944 (Copy_relocs::need_copy_reloc): Likewise.
8945 (Copy_relocs::save): Likewise.
8946 * copy-relocs.h (class Copy_relocs): Update declarations.
8947 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8948 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8949 * target-reloc.h (relocate_for_relocatable): Change
8950 offset_in_output_section type to Elf_Addr. Change code that uses
8952 * layout.cc (Layout::layout): Always set *off.
8953 * mapfile.cc (Mapfile::print_input_section): Use
8954 output_section_offset.
8955 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8957 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8958 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8959 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8963 * layout.cc (Layout::include_section): Do not discard unrecognized
8964 SHT_STRTAB sections.
8968 * script.cc (Lex::can_continue_name): Make '?' allowable in
8969 version-script names.
8970 * testsuite/version_script.map: Change glob pattern to use '?'
8975 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8982 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8983 versions]: Don't try to read the value in the contents, since we
8984 don't use it. Use the template endianness when writing.
8988 * fileread.cc (File_read::make_view): Assert on zero-length view.
8989 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8990 symbol table when there are no symbols to read.
8994 * version.cc (version_string): Bump to 1.7
8998 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8999 constant 0xFFFF to type Valtype.
9000 (Powerpc_relocate_functions::rel16_ha): Likewise.
9004 * output.h (Output_section::Input_section): Initialize p2align_ to
9005 zero for Output_section_data constructors.
9006 (Output_section::Input_section::addralign): If not an input
9007 section, return the alignment of the Output_section_data.
9008 * testsuite/copy_test.cc: New file.
9009 * testsuite/copy_test_1.cc: New file.
9010 * testsuite/copy_test_2.cc: New file.
9011 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9012 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9013 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9014 (copy_test_1_pic.o, copy_test_1.so): New targets.
9015 (copy_test_2_pic.o, copy_test_2.so): New targets.
9016 * testsuite/Makefile.in: Rebuild.
9018 * script-sections.cc (Script_sections::place_orphan): Initialize
9019 local variable exact.
9023 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9028 * powerpc.cc: New file.
9029 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9030 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9031 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9032 * Makefile.in: Rebuild.
9036 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9038 (throwing, orig_terminate): New static variables.
9039 (terminate_handler): New static function.
9040 (t2): Set terminate handler.
9045 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9050 * archive.cc (Archive::include_all_members) Correct to step
9051 over symbol table and extended name table in thin archives.
9056 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9061 * reduced_debug_output.cc: New file.
9062 * reduced_debug_output.h: New file.
9063 * options.h (class General_options): Add --strip-debug-non-line.
9064 * options.cc (General_options::finalize): Add strip_debug_non_line
9065 to the strip heirarchy.
9066 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9068 * layout.cc: Include "reduced_debug_output.h".
9069 (Layout::Layout): Initialize new fields.
9070 (line_only_debug_sections): New static array.
9071 (is_lines_only_debug_sections): New static inline function.
9072 (Layout::include_section): Handle --strip-debug-non-line.
9073 (Layout::make_output_section): If --strip-debug-non-line, build
9074 new output sections for .debug_abbrev and .debug_info.
9075 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9076 gold. Warn about possible overflow.
9077 (read_signed_LEB_128): Likewise.
9078 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9079 (read_signed_LEB_128): Declare.
9080 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9081 (HFILES): Add reduced_debug_output.h.
9082 * Makefile.in: Rebuild.
9086 * mapfile.cc: New file.
9087 * mapfile.h: New file.
9088 * options.h (class General_options): Add -M/--print-map and -Map.
9089 * options.cc (General_options::finalize): Make -M equivalent to
9091 * main.cc: Include <cstdio> and "mapfile.h".
9092 (main): Open mapfile if requested.
9093 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9094 constructor. Change caller.
9095 (queue_initial_tasks): Add mapfile parameter. Change caller.
9096 (queue_middle_tasks): Likewise.
9097 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9099 * archive.cc: Include "mapfile.h".
9100 (Archive::add_symbols): Add mapfile parameter. Change all
9101 callers. Pass mapfile, symbol, and reason to include_member.
9102 (Archive::include_all_members): Add mapfile parameter. Change all
9104 (Archive::include_member): Add mapfile, sym, and why parameters.
9105 Change all callers. Report inclusion to map file.
9106 * archive.h: Include "fileread.h".
9107 (class Archive): Update declarations.
9108 (Archive::file): New const method.
9109 (class Add_archive_symbols): Add mapfile_ field. Update
9110 constructor. Change all callers.
9111 * readsyms.h (class Read_symbols): Likewise.
9112 (class Finish_group): Likewise.
9113 (class Read_script): Likewise.
9114 * common.cc: Include "mapfile.h".
9115 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9117 (Symbol_table::do_allocate_commons): Likewise.
9118 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9119 symbol allocation to mapfile.
9120 * common.h (class Allocate_commons_task): Add mapfile_ field.
9121 Update constructor. Change all callers.
9122 * symtab.h (class Symbol_table): Update declarations.
9123 * layout.cc: Include "mapfile.h".
9124 (Layout_task_runner::run): Print information to mapfile.
9125 (Layout::create_gold_note): Change Output_data_fixed_space to
9126 Output_data_zero_fill.
9127 (Layout::create_build_id): Likewise.
9128 (Layout::print_to_mapfile): New function.
9129 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9130 constructor. Change caller.
9131 (class Layout): Declare print_to_mapfile.
9132 * output.cc (Output_section::Input_section::print_to_mapfile): New
9134 (Output_section::add_input_section): If producing a map, always
9135 add to input_sections_ list.
9136 (Output_section::do_print_to_mapfile): New function.
9137 (Output_segment::print_sections_to_mapfile): New function.
9138 (Output_segment::print_section_list_to_mapfile): New function.
9139 * output.h: Include "mapfile.h".
9140 (Output_data::print_to_mapfile): New function.
9141 (Output_data::do_print_to_mapfile): New virtual function.
9142 (Output_segment_headers::do_print_to_mapfile): New function.
9143 (Output_file_header::do_print_to_mapfile): New function.
9144 (Output_data_const::do_print_to_mapfile): New function.
9145 (class Output_data_const_buffer): Add map_name_ field. Update
9146 constructor. Change all callers. Add do_print_to_mapfile
9148 (class Output_data_fixed_space): Likewise.
9149 (class Output_data_space): Likewise.
9150 (class Output_data_zero_fill): New class.
9151 (Output_data_strtab::do_print_to_mapfile): New function.
9152 (Output_data_reloc_base::do_print_to_mapfile): New function.
9153 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9154 (Output_data_group::do_print_to_mapfile): New function.
9155 (Output_data_got::do_print_to_mapfile): New function.
9156 (Output_data_dynamic::do_print_to_mapfile): New function.
9157 (Output_symtab_xindex::do_print_to_mapfile): New function.
9158 (class Output_section): Declare do_print_to_mapflie. Declare
9159 print_to_mapfile in Input_section.
9160 (class Output_segment): Declare new functions.
9161 * object.h (Sized_relobj::symbol_count): New function.
9162 * script-sections.cc
9163 (Output_section_element_dot_assignment::set_section_addresses):
9164 Change Output_data_fixed_space to Output_data_zero_fill.
9165 (Output_data_expression::do_print_to_mapfile): New function.
9166 * script.cc (read_input_script): Add mapfile parameter. Change
9168 * script.h (read_input_script): Update declaration.
9169 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9170 (Eh_frame::do_print_to_mapfile): New function.
9171 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9172 (Output_merge_string::do_print_to_mapfile): New function.
9173 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9175 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9177 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9179 * Makefile.am (CCFILES): Add mapfile.cc.
9180 (HFILES): Add mapfile.h.
9181 * Makefile.in: Rebuild.
9185 * options.h (class General_options): Add -z relro.
9186 * layout.cc (Layout::Layout): Initialize relro_segment_.
9187 (Layout::add_output_section_data): Return the output section.
9188 (Layout::make_output_section): Rcognize relro sections and mark
9190 (Layout::attach_allocated_section_to_segment): Put relro sections
9191 in a PT_GNU_RELRO segment.
9192 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9194 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9196 (Layout::linkonce_mapping): Map d.rel.ro.local to
9198 (Layout::output_section_name): Us .data.rel.ro.local for any
9199 section which begins with that.
9200 * layout.h (class Layout): Update add_output_section_data
9201 declaration. Add relro_segment_ field.
9202 * output.cc (Output_section::Output_section): Initialize is_relro_
9203 and is_relro_local_ fields.
9204 (Output_segment::add_output_section): Group relro sections.
9205 (Output_segment::is_first_section_relro): New function.
9206 (Output_segment::maximum_alignment): If there is a relro section,
9207 align the segment to the common page size.
9208 (Output_segment::set_section_addresses): Track whether we are
9209 looking at relro sections. If the last section is a relro
9210 section, align to the common page size.
9211 (Output_segment::set_section_list_addresses): Add in_relro
9212 parameter. Change all callers. Align to the page size when
9213 moving from relro to non-relro section.
9214 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9216 * output.h (class Output_section): Add is_relro_ and
9217 is_relro_local_ fields.
9218 (Output_section::is_relro): New function.
9219 (Output_section::set_is_relro): New function.
9220 (Output_section::is_relro_local): New function.
9221 (Output_section::set_is_relro_local): New function.
9222 (class Output_segment): Update declarations.
9223 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9224 * sparc.cc (Target_sparc::got_section): Likewise.
9225 * x86_64.cc (Target_x86_64::got_section): Likewise.
9226 * testsuite/relro_test_main.cc: New file.
9227 * testsuite/relro_test.cc: New file.
9228 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9229 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9230 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9231 (relro_test.so, relro_test_pic.o): New targets.
9232 * testsuite/Makefile.in: Rebuild.
9236 * output.cc (Output_segment::add_output_section): Remove front
9238 * output.h (class Output_segment): Remove
9239 add_initial_output_section and overloaded add_output_section.
9240 Update declaration of remaining add_output_section.
9241 * layout.cc (Layout::create_interp): Call add_output_section
9242 rather than add_initial_output_section.
9243 (Layout::finish_dynamic_section): Likewise.
9245 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9246 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9247 know the dynamic type.
9248 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9249 field. Initialize it in constructor.
9250 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9251 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9252 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9255 * output.cc (Output_reloc::get_address): Change return type to
9257 * output.h (class Output_reloc): Update get_address declaration.
9258 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9259 for section addresses.
9264 * gold.cc (gold_nomem): Use return value of write.
9268 * symtab.c (Symbol::init_base_output_data): Add version
9269 parameter. Change all callers.
9270 (Symbol::init_base_output_segment): Likewise.
9271 (Symbol::init_base_constant): Likewise.
9272 (Symbol::init_base_undefined): Likewise.
9273 (Sized_symbol::init_output_data): Likewise.
9274 (Sized_symbol::init_output_segment): Likewise.
9275 (Sized_symbol::init_constant): Likewise.
9276 (Sized_symbol::init_undefined): Likewise.
9277 (Symbol_table::do_define_in_output_data): If the new symbol has a
9278 version, mark it as the default.
9279 (Symbol_table::do_define_in_output_segment): Likewise.
9280 (Symbol_table::do_define_as_constant): Likewise.
9281 * symtab.h (class Symbol): Update declarations.
9282 (class Sized_symbol): Likewise.
9283 * resolve.cc (Symbol::override_version): New function.
9284 (Symbol::override_base): Call override_version.
9285 (Symbol::override_base_with_special): Likewise.
9286 * testsuite/ver_script_8.script: New file.
9287 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9288 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9289 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9290 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9295 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9297 (class General_options): Remove existing --undefined, and add
9298 --no-undefined instead. Add new --undefined as synonym for -u.
9299 * archive.cc (Archive::add_symbols): Check whether symbol was
9301 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9302 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9303 all uses. Add IS_UNDEFINED. Update declarations to split
9304 different versions of init_base. Declare init_base_undefined.
9305 (Symbol::is_defined): Handle IS_UNDEFINED.
9306 (Symbol::is_undefined): Likewise.
9307 (Symbol::is_weak_undefined): Call is_undefined.
9308 (Symbol::is_absolute): Handle IS_CONSTANT.
9309 (class Sized_symbol): Update declarations to split different
9310 versions of init. Declare init_undefined.
9311 (class Symbol_table): Declare new functions.
9312 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9314 (Symbol::init_base_output_data): Likewise.
9315 (Symbol::init_base_output_segment): Likewise.
9316 (Symbol::init_base_constant): Likewise.
9317 (Symbol::init_base_undefined): New function.
9318 (Sized_symbol::init_object): Rename from init. Change all
9320 (Sized_symbol::init_output_data): Likewise.
9321 (Sized_symbol::init_output_segment): Likewise.
9322 (Sized_symbol::init_constant): Likewise.
9323 (Sized_symbol::init_undefined): New function.
9324 (Symbol_table::add_undefined_symbols_from_command_line): New
9326 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9328 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9329 (Symbol::output_section): Likewise.
9330 (Symbol::set_output_section): Likewise.
9331 (Symbol_table::sized_finalize_symbol): Likewise.
9332 (Symbol_table::sized_write_globals): Likewise.
9333 * resolve.cc (Symbol_table::should_override): Likewise.
9334 (Symbol::override_base_with_special): Likewise.
9336 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9337 symbol, change it to have default visibility.
9338 * testsuite/protected_1.cc: New file.
9339 * testsuite/protected_2.cc: New file.
9340 * testsuite/protected_3.cc: New file.
9341 * testsuite/protected_main_1.cc: New file.
9342 * testsuite/protected_main_2.cc: New file.
9343 * testsuite/protected_main_3.cc: New file.
9344 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9345 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9346 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9347 (protected_1.so): New target.
9348 (protected_1_pic.o, protected_2_pic.o): New targets.
9349 (protected_3_pic.o): New target.
9350 (check_PROGRAMS): Add protected_2.
9351 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9352 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9353 * testsuite/Makefile.in: Rebuild.
9355 * options.h (DEFINE_var): Add set_user_set_##varname__.
9356 (DEFINE_bool_alias): New macro.
9357 (class General_options): Define -Bstatic using DEFINE_bool_alias
9358 rather than DEFINE_special. Add --undefined as an alias for -z
9360 * options.cc (General_options::parse_Bstatic): Remove.
9362 * options.h (class General_options): Add --fatal-warnings.
9363 * main.cc (main): Implement --fatal-warnings.
9364 * errors.h (Errors::warning_count): New function.
9366 * options.h (class General_options): Add -Bsymbolic-functions.
9367 * symtab.h (Symbol::is_preemptible): Check for
9368 -Bsymbolic-functions.
9372 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9373 as noVARNAME rather than no-VARNAME.
9374 (class General_options): Add option -z combreloc.
9375 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9377 (Output_reloc::sort_before) [SHT_REL]: New function.
9378 (Output_reloc::sort_before) [SHT_RELA]: New function.
9379 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9380 Sort_relocs_comparison.
9381 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9382 parameter. Change all callers.
9383 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9384 sort_relocs parameter. Change all callers.
9385 * output.cc (Output_reloc::get_address): New function, broken out
9387 (Output_reloc::write_rel): Call it.
9388 (Output_reloc::compare): New function.
9389 (Output_data_reloc_base::do_write): Optionally sort relocs.
9391 * configure.ac: If targ_extra_obj is set, link it in.
9392 * configure.tgt: Initialize all variables.
9393 (x86_64*): Set targ_extra_obj and targ_extra_size.
9394 * configure: Rebuild.
9396 * object.cc (Sized_relobj::include_section_group): Adjust section
9397 indexes read from group data. Build vector to pass to
9399 * layout.cc (Layout::layout_group): Add flags and shndxes
9400 parameters. Remove contents parameter. Change caller. Update
9401 explicit instantiations.
9402 * layout.h (class Layout): Update layout_group declaration.
9403 * output.cc (Output_data_group::Output_data_group): Add flags and
9404 input_shndxes parameters. Remove contents parameter. Change
9406 (Output_data_group::do_write): Change input_sections_ to
9408 * output.h (class Output_data_group): Update constructor
9409 declaration. Rename input_sections_ to input_shndxes_.
9410 * testsuite/many_sections_test.cc: Add template.
9414 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9416 * layout.cc (Layout::include_section): Refactored check for debug
9418 (Layout::add_comdat): Add new parameters. Change type
9419 of signature parameter. Add object and shndx to signatures table.
9420 (Layout::find_kept_object): New function.
9421 * layout.h: Include <cstring>.
9422 (Layout::is_debug_info_section): New function.
9423 (Layout::add_comdat): Add new parameters.
9424 (Layout::find_kept_object): New function.
9425 (Layout::Kept_section): New struct.
9426 (Layout::Signatures): Change type of map range.
9427 * object.cc (Relobj::output_section_address): New function.
9428 (Sized_relobj::include_section_group): Add new parameters. Change
9429 calls to Layout::add_comdat. Change to build table of kept comdat
9430 groups and table mapping discarded sections to kept sections.
9431 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9432 (Sized_relobj::do_layout): Change calls to include_section_group and
9433 include_linkonce_section.
9434 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9435 value to zero when section is discarded.
9436 (Sized_relobj::map_to_kept_section): New function.
9437 * object.h (Relobj::output_section_address): New function.
9438 (Relobj::Comdat_group): New type.
9439 (Relobj::find_comdat_group): New function.
9440 (Relobj::Comdat_group_table): New type.
9441 (Relobj::Kept_comdat_section): New type.
9442 (Relobj::Kept_comdat_section_table): New type.
9443 (Relobj::add_comdat_group): New function.
9444 (Relobj::set_kept_comdat_section): New function.
9445 (Relobj::get_kept_comdat_section): New function.
9446 (Relobj::comdat_groups_): New field.
9447 (Relobj::kept_comdat_sections_): New field.
9448 (Symbol_value::input_value): Update comment.
9449 (Sized_relobj::map_to_kept_section) New function.
9450 (Sized_relobj::include_linkonce_section): Add new parameter.
9451 * target-reloc.h (Comdat_behavior): New type.
9452 (get_comdat_behavior): New function.
9453 (relocate_section): Add code to map a discarded section to the
9454 corresponding kept section when applying a relocation.
9458 * dwarf_reader.cc (next_generation_count): New static var.
9459 (Addr2line_cache_entry): New struct.
9460 (addr2line_cache): New static var.
9461 (Dwarf_line_info::one_addr2line): Added caching.
9462 (Dwarf_line_info::clear_addr2line_cache): New function.
9463 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9464 cache-size parameter.
9465 (Dwarf_line_info::one_addr2line_cache): New function.
9466 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9467 new cache-size argument to one_addr2line(), and clear cache.
9471 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9472 R_386_PC8 relocations.
9476 * object.cc (Sized_relobj::include_section_group): Check for
9477 invalid section group.
9479 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9482 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9483 than read for file header.
9484 * archive.cc (Archive::include_member): Likewise.
9488 * aclocal.m4: Regenerate.
9489 * configure: Regenerate.
9493 * version.cc (version_string): Bump to 1.6.
9495 * testsuite/Makefile.am (many_sections_r_test): New target.
9496 (many_sections_r_test_SOURCES): Remove.
9497 (many_sections_r_test_DEPENDENCIES): Remove.
9498 (many_sections_r_test_LDFLAGS): Remove.
9499 (many_sections_r_test_LDADD): Remove.
9501 * object.cc (Sized_relobj::do_add_symbols): Always pass
9502 local_symbol_count_ to add_from_relobj.
9504 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9505 every thousand variables.
9506 * testsuite/Makefile.in: Rebuild.
9508 * object.cc (Xindex::initialize_symtab_xindex): New function.
9509 (Xindex::read_symtab_xindex): New function.
9510 (Xindex::sym_xindex_to_shndx): New function.
9511 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9513 (Sized_relobj::do_initialize_xindex): New function.
9514 (Sized_relobj::do_read_symbols): Adjust section links.
9515 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9516 parameter. Change all callers.
9517 (Sized_relobj::include_section_group): Adjust section links and
9518 symbol section indexes.
9519 (Sized_relobj::do_layout): Adjust section links.
9520 (Sized_relobj::do_count_local_symbols): Adjust section links and
9521 symbol section indexes.
9522 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9523 ordinary and special symbols.
9524 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9525 dynsym_xindex parameters. Change all callers. Adjust section
9526 links. Use SHN_XINDEX when needed.
9527 (Sized_relobj::get_symbol_location_info): Adjust section links.
9528 Don't get fooled by special symbols.
9529 * object.h (class Xindex): Define.
9530 (class Object): Add xindex_ parameter. Declare virtual functoin
9531 do_initialize_xindex.
9532 (Object::adjust_sym_shndx): New function.
9533 (Object::set_xindex): New protected function.
9534 (class Symbol_value): Add is_ordinary_shndx_ field.
9535 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9536 (Symbol_value::value): Assert ordinary section.
9537 (Symbol_value::initialize_input_to_output_map): Likewise.
9538 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9540 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9542 (class Sized_relobj): Update declarations.
9543 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9544 parameter. Change all callers.
9545 (Sized_relobj::adjust_shndx): New function.
9546 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9548 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9549 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9550 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9551 (Sized_dynobj::read_dynsym_section): Adjust section links.
9552 (Sized_dynobj::read_dynamic): Likewise.
9553 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9555 (Sized_dynobj::do_initialize_xindex): New function.
9556 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9557 do_initialize_xindex.
9558 (Sized_dynobj::adjust_shndx): New function.
9559 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9560 dynsym_xindex_ fields.
9561 (Layout::finalize): Add a call to set_section_indexes before
9562 creating the symtab sections.
9563 (Layout::set_section_indexes): Don't do anything if the section
9564 already has a section index.
9565 (Layout::create_symtab_sections): Add shnum parameter. Change
9566 caller. Create .symtab_shndx section if needed.
9567 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9569 (Layout::allocated_output_section_count): New function.
9570 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9572 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9573 fields. Update declarations.
9574 (Layout::symtab_xindex): New function.
9575 (Layout::dynsym_xindex): New function.
9576 (class Write_symbols_task): Add layout_ field.
9577 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9579 * output.cc (Output_section_headers::Output_section_headers): Add
9580 shstrtab_section parameter. Change all callers.
9581 (Output_section_headers::do_sized_write): Store overflow values
9582 for section count and section string table section index in
9583 section header zero.
9584 (Output_file_header::do_sized_write): Check for overflow of
9585 section count and section string table section index.
9586 (Output_symtab_xindex::do_write): New function.
9587 (Output_symtab_xindex::endian_do_write): New function.
9588 * output.h (class Output_section_headers): Add shstrtab_section_.
9589 Update declarations.
9590 (class Output_symtab_xindex): Define.
9591 (Output_section::has_out_shndx): New function.
9592 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9594 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9596 (Sized_symbol::init): Likewise.
9597 (Symbol::output_section): Check for ordinary symbol.
9598 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9599 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9601 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9602 Change all callers. Simplify handling of symbols from sections
9603 not included in the link.
9604 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9606 (Weak_alias_sorter::operator()): Assert that symbols are
9608 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9610 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9611 parameters. Change all callers.
9612 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9613 symbol distinction. Use SHN_XINDEX when needed.
9614 (Symbol_table::write_section_symbol): Add symtab_xindex
9615 parameter. Change all callers.
9616 (Symbol_table::sized_write_section_symbol): Likewise. Use
9617 SHN_XINDEX when needed.
9618 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9620 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9621 (Symbol::is_defined): Check is_ordinary.
9622 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9623 (Symbol::is_absolute, Symbol::is_common): Likewise.
9624 (class Sized_symbol): Update declarations.
9625 (class Symbol_table): Update declarations.
9626 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9627 parameters. Change all callers.
9628 (Sized_symbol::override): Likewise.
9629 (Symbol_table::override): Likewise.
9630 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9631 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9632 is_ordinary, and orig_st_shndx parameters. Change all callers.
9633 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9634 to be in an ordinary section.
9635 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9636 object and is_ordinary parameters. Change all callers.
9637 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9638 Change all callers. Don't add undefined or non-ordinary symbols
9640 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9642 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9644 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9645 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9646 (Sized_relobj::relocate_sections): Likewise.
9647 * target-reloc.h (scan_relocs): Adjust section symbol index.
9648 (scan_relocatable_relocs): Likewise.
9649 * i386.cc (Scan::local): Check for ordinary symbols.
9650 * sparc.cc (Scan::local): Likewise.
9651 * x86_64.cc (Scan::local): Likewise.
9652 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9653 to symbol_section_and_value.
9654 * testsuite/many_sections_test.cc: New file.
9655 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9656 (check_PROGRAMS): Add many_sections_test.
9657 (many_sections_test_SOURCES): Define.
9658 (many_sections_test_DEPENDENCIES): Define.
9659 (many_sections_test_LDFLAGS): Define.
9660 (BUILT_SOURCES): Add many_sections_define.h.
9661 (many_sections_define.h): New target.
9662 (BUILT_SOURCES): Add many_sections_check.h.
9663 (many_sections_check.h): New target.
9664 (check_PROGRAMS): Add many_sections_r_test.
9665 (many_sections_r_test_SOURCES): Define.
9666 (many_sections_r_test_DEPENDENCIES): Define.
9667 (many_sections_r_test_LDFLAGS): Define.
9668 (many_sections_r_test_LDADD): Define.
9669 (many_sections_r_test.o): New target.
9670 * testsuite/Makefile.in: Rebuild.
9674 * errors.cc (Errors::info): New function.
9675 (gold_info): New function.
9676 * errors.h (Errors::info): New function.
9677 * gold.h (gold_info): New function.
9678 * object.cc (Input_objects::add_object): Print trace output.
9679 * options.cc (options::parse_set): New function.
9680 (General_options::parse_wrap): Deleted.
9681 (General_options::General_options): Deleted initializer.
9682 * options.h (options::String_set): New typedef.
9683 (options::parse_set): New function.
9684 (DEFINE_set): New macro.
9685 (General_options::wrap): Changed to use DEFINE_set. Changed
9686 callers of any_wrap_symbols and is_wrap_symbol.
9687 (General_options::trace, General_options::trace_symbol):
9689 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9690 (General_options::wrap_symbols_): Deleted.
9691 * symtab.cc (Symbol_table::add_from_object): Print trace output.
9695 * options.cc (General_options::parse_V): New function.
9696 * options.h: Add entries for -V and -Qy.
9700 * common.cc (Symbol_table::allocate_commons): Remove options
9701 parameter. Change caller.
9702 (Symbol_table::do_allocate_commons): Remove options parameter.
9703 Change caller. Just call do_allocate_commons_list twice.
9704 (Symbol_table::do_allocate_commons_list): New function, broken out
9705 of do_allocate_commons.
9706 * common.h (class Allocate_commons_task): Remove options_ field.
9708 * symtab.cc (Symbol_table::Symbol_table): Initialize
9710 (Symbol_table::add_from_object): Put TLS common symbols on
9712 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9713 which are IN_OUTPUT_DATA.
9714 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
9715 allocate_commons and do_allocate_commons declarations. Declare
9716 do_allocate_commons_list.
9717 * gold.cc (queue_middle_tasks): Update creation of
9718 Allocate_commons_task to not pass options.
9719 * testsuite/Makefile.am (INCLUDES): Add -I.. .
9720 (TLS_TEST_C_FLAGS): New variable.
9721 (tls_test_c_pic.o): New target.
9722 (tls_test_shared.so): Link in tls_test_c_pic.o.
9723 (tls_test_c_pic_ie.o): New target.
9724 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9725 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9726 (tls_test_c.o): New target.
9727 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9728 (tls_pic_test_LDADD): Likewise.
9729 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9730 (tls_shared_gd_to_ie_test_LDADD): Likewise.
9731 (tls_test_c_gnu2.o): New target.
9732 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9734 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9735 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9736 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9737 * testsuite/tls_test.cc: Include "config.h".
9738 (t_last): Call t11_last.
9739 * testsuite/tls_test.h (t11, t11_last): Declare.
9740 * testsuite/tls_test_c.c: New file.
9741 * testsuite/tls_test_main.cc (thread_routine): Call t11.
9742 * configure.ac: Check for OpenMP support.
9743 * configure, config.in, Makefile.in: Rebuild.
9744 * testsuite/Makefile.in: Rebuild.
9748 * i386.cc (Target_i386::define_tls_base_symbol): New function.
9749 (Target_i386::tls_base_symbol_defined_): New field.
9750 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9751 (Target_i386::Scan::global): Likewise.
9752 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9753 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9754 (Target_x86_64::tls_base_symbol_defined_): New field.
9755 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9756 (Target_x86_64::Scan::global): Likewise.
9760 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9761 (Symbol::needs_plt_entry): Allow weak undefined symbols.
9762 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9763 building shared libraries.
9764 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9765 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9766 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9767 * testsuite/Makefile.in: Rebuild.
9768 * testsuite/weak_undef.h: New file.
9769 * testsuite/weak_undef_file1.cc: Add extra test cases.
9770 * testsuite/weak_undef_file2.cc: Likewise.
9771 * testsuite/weak_undef_test.cc: Likewise.
9775 * sparc.cc (Target_sparc::Scan): Change from struct to class.
9776 Add issued_non_pic_error_ field. Declare check_non_pic.
9777 (Target_sparc::Scan::check_non_pic): New function.
9778 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9779 (Target_sparc::Scan::global): Likewise.
9781 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9782 * configure: Rebuild.
9784 * options.h (DEFINE_enable): New macro.
9785 (new_dtags): New enable option.
9786 (initfirst, interpose, loadfltr, nodefaultlib,
9787 nodelete, nodlopen, nodump): New -z options.
9788 * layout.cc (Layout:finish_dynamic_section): If new
9789 dtags enabled, emit DT_RUNPATH. Also, emit a
9790 DT_FLAGS_1 containing any specified -z flags.
9794 * copy-relocs.cc: New file.
9795 * copy-relocs.h: New file.
9796 * reloc.cc: Remove Copy_relocs code.
9797 * reloc.h: Likewise.
9798 * reloc-types.h (struct Reloc_types) [both versions]: Add
9799 get_reloc_addend_noerror.
9800 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9801 variants of add_global which take an addend which must be zero.
9802 * i386.cc: Include "copy-relocs.h".
9803 (class Target_i386): Change type of copy_relocs_ to variable,
9805 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9807 (Target_i386::do_finalize_sections): Change handling of
9809 * sparc.cc: Include "copy-relocs.h".
9810 (class Target_sparc): Change type of copy_relocs_ to variable,
9812 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9814 (Target_sparc::do_finalize_sections): Change handling of
9816 * x86_64.cc: Include "copy-relocs.h".
9817 (class Target_x86_64): Change type of copy_relocs_ to variable,
9819 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9820 class. Change all callers.
9821 (Target_x86_64::do_finalize_sections): Change handling of
9823 * Makefile.am (CCFILES): Add copy-relocs.cc.
9824 (HFILES): Add copy-relocs.h.
9826 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9828 * testsuite/script_test_4.sh: Permit leading zeroes.
9832 * script-sections.cc (Script_sections::create_segments): Use
9833 header_size_adjustment even when there is enough room for the
9835 * testsuite/script_test_4.sh: New file.
9836 * testsuite/script_test_4.t: New file.
9837 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9838 (check_DATA): Add script_test_4.stdout.
9839 (MOSTLYCLEANFILES): Likewise.
9840 (script_test_4): New target.
9841 (script_test_4.stdout): New target.
9842 * testsuite/Makefile.in: Rebuild.
9844 * sparc.cc: Add definitions for Output_data_plt_sparc class
9849 * sparc.cc: New file.
9850 * Makefile.am (TARGETSOURCES): Add sparc.cc
9851 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9852 * configure.tgt: Document targ_extra_size and
9853 targ_extra_big_endian. Add entries for sparc-* and
9855 * configure.ac: Handle targ_extra_size and
9856 targ_extra_big_endian.
9857 * Makefile.in: Rebuild.
9858 * configure: Likewise.
9859 * po/POTFILES.in: Likewise.
9860 * po/gold.pot: Likewise.
9864 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9865 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9866 in the name/type/flags to section mapping. Don't call
9867 allocate_output_section.
9868 (Layout::choose_output_section): Change parameter from adjust_name
9869 to is_input_section. Don't permit input sections after sections
9870 are attached to segments. Don't call allocate_output_section.
9871 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9872 not write_enable_output_section.
9873 (Layout::make_output_section): Don't push to
9874 unattached_section_list_ nor call attach_to_segment. Call
9875 attach_section_to_segment if sections are attached.
9876 (Layout::attach_sections_to_segments): New function.
9877 (Layout::attach_section_to_segment): New function.
9878 (Layout::attach_allocated_section_to_segment): Rename from
9879 attach_to_segment. Remove flags parameter.
9880 (Layout::allocate_output_section): Remove function.
9881 (Layout::write_enable_output_section): Remove function.
9882 * layout.h (class Layout): Update for above changes. Add new
9883 field sections_are_attached_.
9884 * output.h (Output_section::update_flags_for_input_section): New
9886 * output.cc (Output_section::add_input_section): Call
9887 update_flags_for_input_section.
9888 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9892 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9893 thought unnecessary.
9894 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9898 * output.h (class Output_section_data): Remove inline definition
9900 * output.cc (Output_section_data::set_addralign): New function.
9904 Add support for TLS descriptors for i386 and x86_64.
9905 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9906 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9907 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9909 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9910 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9911 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9913 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9914 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9915 Fix problem with initial-exec relocations.
9916 (Target_i386::Relocate::relocate_tls): Likewise.
9917 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9919 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9920 support for section-plus-offset dynamic table entries.
9921 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9922 (Output_data_dynamic::Dynamic_entry): Add support for
9923 section-plus-offset dynamic table entries.
9924 (Output_data_dynamic::Classification): Likewise.
9925 (Output_data_dynamic::classification_): Renamed offset_.
9926 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9927 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9928 (Target_x86_64::make_plt_section): New function.
9929 (Target_x86_64::reserve_tlsdesc_entries): New function.
9930 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9931 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9932 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9933 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9934 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9935 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9936 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9937 add extra PLT entry for TLS descriptors.
9938 (Output_data_plt_x86_64::got_): New field.
9939 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9940 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9942 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9944 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9945 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9946 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9947 R_386_TLS_DESC_CALL relocations.
9948 (Target_x86_64::Scan::global): Likewise.
9949 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9950 for TLS descriptors.
9951 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9952 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9953 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9954 GD-to-IE relaxation.
9955 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9956 and TLS_DESCRIPTORS.
9957 * Makefile.in: Rebuild.
9958 * configure: Rebuild.
9959 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9960 (tls_test_shared2.so): New target.
9961 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9962 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9963 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9964 (tls_shared_gd_to_ie_test_LDADD): New variable.
9965 (tls_shared_gnu2_gd_to_ie_test): New target.
9966 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9968 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9969 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9970 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9971 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9972 (tls_shared_gnu2_test): New target.
9973 (tls_test_gnu2_shared.so): New target.
9974 (tls_shared_gnu2_test_SOURCES): New variable.
9975 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9976 (tls_shared_gnu2_test_LDFLAGS): New variable.
9977 (tls_shared_gnu2_test_LDADD): New variable.
9978 * testsuite/Makefile.in: Rebuild.
9979 * testsuite/Makefile.
9983 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9985 * testsuite/Makefile.in: Rebuild.
9987 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9989 * testsuite/script_test_2.cc (main): Adjust test.
9994 * options.h (General_options): Add entries for '-Y' and
9996 * options.cc (General_options:finalize): If -Y was used, add those
9997 entries to the library path instead of the default "/lib" and
10002 * testsuite/justsyms.t: Start at 0x100.
10003 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10004 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10006 * testsuite/script_test_2.cc: Adjust string and section length
10012 * script-sections.cc (Sections_element::allocate_to_segment): Add
10014 (Output_section_definition::allocate_to_segment): Likewise.
10015 (Orphan_output_section::allocate_to_segment): Likewise.
10016 (Script_sections::attach_sections_using_phdrs_clause): Don't
10017 propagate non-PT_LOAD segments to orphan sections.
10018 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10019 readelf rather than objdump.
10020 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10021 .interp section and PT_INTERP segment are the same size.
10022 * testsuite/Makefile.in: Rebuild.
10024 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10025 aliases for symbols defined in the same object.
10026 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10027 (weak_alias_test_SOURCES): New variable.
10028 (weak_alias_test_DEPENDENCIES): New variable.
10029 (weak_alias_test_LDFLAGS): New variable.
10030 (weak_alias_test_LDADD): New variable.
10031 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10032 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10033 (weak_alias_test_3.o): New target.
10034 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10035 * testsuite/weak_alias_test_main.cc: New file.
10036 * testsuite/weak_alias_test_1.cc: New file.
10037 * testsuite/weak_alias_test_2.cc: New file.
10038 * testsuite/weak_alias_test_3.cc: New file.
10042 * options.h (class General_options): Add --noinhibit-exec option.
10043 * main.cc (main): Check --noinhibit-exec.
10045 * options.h (class General_options): Define --wrap as a special
10046 option. Add wrap_symbols_ field.
10047 (General_options::any_wrap_symbols): New function.
10048 (General_options::is_wrap_symbol): New function.
10049 * options.cc (General_options::parse_wrap): New function.
10050 (General_options::General_options): Initialize wrap_symbols_.
10051 * symtab.cc (Symbol_table::wrap_symbol): New function.
10052 (Symbol_table::add_from_object): Handle --wrap.
10053 * symtab.h (class Symbol_table): Declare wrap_symbol.
10054 * target.h (Target::wrap_char): New function.
10055 (Target::Target_info): Add wrap_char field.
10056 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10057 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10058 * testsuite/testfile.cc (Target_test::test_target_info):
10061 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10064 * layout.h (class Layout): Add added_eh_frame_data_ field.
10065 * layout.cc (Layout::Layout): Initialize new field.
10066 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10067 output section until we find a section we merged successfully.
10068 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10069 that the size be non-zero.
10071 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10076 * configure.ac: Export new conditional variable HAVE_ZLIB.
10077 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10079 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10080 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10084 * version.cc (version_string): Set to "1.5".
10086 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10087 Add issued_non_pic_error_ field. Declare check_non_pic.
10088 (Target_x86_64::Scan::check_non_pic): New function.
10089 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10090 (Target_x86_64::Scan::global): Likewise.
10092 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10093 addend parameter. Change caller. Handle merge sections.
10094 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10095 Address to Addend. Don't add in the result of
10096 local_section_offset, pass down the addend and use the returned
10098 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10099 Update declarations of local_section_offset and symbol_value.
10100 * testsuite/two_file_test_1.cc (t18): New function.
10101 * testsuite/two_file_test_2.cc (f18): New function.
10102 * testsuite/two_file_test_main.cc (main): Call t18.
10103 * testsuite/two_file_test.h (t18, f18): Declare.
10105 * configure.ac: Don't test for objdump, c++filt, or readelf.
10106 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10108 (TEST_READELF): New variable.
10109 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10110 (check_PROGRAMS): Add two_file_strip_test.
10111 (two_file_strip_test): New target.
10112 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10113 (two_file_same_shared_strip_test_SOURCES): New variable.
10114 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10115 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10116 (two_file_same_shared_strip_test_LDADD): New variable.
10117 (two_file_shared_strip.so): New target.
10118 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10119 (ver_test_5.syms, ver_test_7.syms): Likewise.
10120 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10121 (strip_test_3.stdout): Use TEST_OBJDUMP.
10122 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10126 * symtab.h (Symbol::is_weak_undefined): New function.
10127 (Symbol::is_strong_undefined): New function.
10128 (Symbol::is_absolute): New function.
10129 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10130 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10132 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10133 (weak_undef_test): New target.
10134 * testsuite/Makefile.in: Rebuild.
10135 * testsuite/weak_undef_file1.cc: New file.
10136 * testsuite/weak_undef_file2.cc: New file.
10137 * testsuite/weak_undef_test.cc: New file.
10141 * compressed_output.h (class Output_compressed_section): Use
10143 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10145 (zlib_compressed_suffix): Removed.
10146 (Output_compressed_section::set_final_data_size): Use unsigned
10148 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10149 Fix linker invocation.
10150 (flagstest_o_specialfile_and_compress_debug_sections):
10152 * testsuite/Makefile.in: Regenerated.
10156 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10157 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10165 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10166 parameters. Update for new key type to views_. Change all
10168 (File_read::read): Adjust for byteshift in returned view.
10169 (File_read::add_view): New function, broken out of
10170 find_and_make_view.
10171 (File_read::make_view): New function, broken out of
10172 find_and_make_view.
10173 (File_read::find_or_make_view): Add offset and aligned
10174 parameters. Rewrite accordingly. Change all callers.
10175 (File_read::get_view): Add offset and aligned parameters. Adjust
10176 for byteshift in return value.
10177 (File_read::get_lasting_view): Likewise.
10178 * fileread.h (class File_read): Update declarations.
10179 (class File_read::View): Add byteshift_ field. Add byteshift to
10180 constructor. Add byteshift method.
10181 * archive.h (Archive::clear_uncached_views): New function.
10182 (Archive::get_view): Add aligned parameter. Change all callers.
10183 * object.h (Object::get_view): Add aligned parameter. Change all
10185 (Object::get_lasting_view): Likewise.
10187 * fileread.cc (File_read::release): Don't call clear_views if
10188 there are multiple objects.
10189 * fileread.h (File_read::clear_uncached_views): New function.
10190 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10195 Add thin archive support.
10196 * archive.cc (Archive::armagt): New const.
10197 (Archive::setup): Remove task parameter and calls to unlock.
10198 (Archive::unlock_nested_archives): New function.
10199 (Archive::read_header): Add nested_off parameter. Change
10201 (Archive::interpret_header): Likewise.
10202 (Archive::include_all_members): Change to handle thin
10204 (Archive::include_member): Likewise.
10205 * archive.h (Archive::Archive): Add new parameters and
10207 (Archive::armagt): New const.
10208 (Archive::setup): Remove task parameter.
10209 (Archive::unlock_nested_archives): New function.
10210 (Archive::read_header): Add nested_off parameter.
10211 (Archive::interpret_header): Likewise.
10212 (Archive::Nested_archive_table): New typedef.
10213 (Archive::is_thin_archive_): New field.
10214 (Archive::nested_archives_): New field.
10215 (Archive::options_): New field.
10216 (Archive::dirpath_): New field.
10217 (Archive::task_): New field.
10218 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10219 for thin archives. Pass additional parameters to
10220 Archive::Archive. Unlock the archive file after calling
10225 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10226 version symbol to be local.
10227 * testsuite/ver_test_4.sh: New file.
10228 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10229 (check_DATA): Add ver_test_4.syms.
10230 (ver_test_4.syms): New target.
10231 * testsuite/Makefile.in: Rebuild.
10234 (Output_section::Input_section_sort_entry::has_priority): New
10236 (Output_section::Input_section_sort_entry::match_file_name): New
10238 (Output_section::Input_section_sort_entry::match_section_name):
10240 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10242 (Output_section::Input_section_sort_entry::match_section_file):
10244 (Output_section::Input_section_sort_compare::operator()): Rewrite
10245 using new Input_section_sort_entry functions. Sort crtbegin and
10246 crtend first. Sort sections with no priority before sections with
10248 * testsuite/initpri1.c (d3): Check j != 4.
10249 (cd5): New constructor/destructor function.
10250 (main): Check j != 2.
10252 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10253 new symbol when resolving, don't call set_is_default.
10254 * testsuite/ver_test_7.cc: New file.
10255 * testsuite/ver_test_7.sh: New file.
10256 * testsuite/Makefile.am (ver_test_7.so): New target.
10257 (ver_test_7.o): New target.
10258 (check_SCRIPTS): Add ver_test_7.sh.
10259 (check_DATA): Add ver_test_7.syms.
10260 (ver_test_7.syms): New target.
10264 * layout.cc (Layout::layout): If we see an input section with a
10265 name that needs sorting, set the must_sort flag for the output
10267 (Layout::make_output_section): If the name of the output section
10268 indicates that it might require sorting, set the may_sort flag.
10269 * output.h (Output_section::may_sort_attached_input_sections): New
10271 (Output_section::set_may_sort_attached_input_sections): New
10273 (Output_section::must_sort_attached_input_sections): New
10275 (Output_section::set_must_sort_attached_input_sections): New
10277 (class Output_section): Declare Input_section_sort_entry. Define
10278 Input_section_sort_compare. Declare
10279 sort_attached_input_sections. Add new fields:
10280 may_sort_attached_input_sections_,
10281 must_sort_attached_input_sections_,
10282 attached_input_sections_are_sorted_.
10283 * output.cc (Output_section::Output_section): Initialize new
10285 (Output_section::add_input_section): Add an entry to
10286 input_sections_ if may_sort or must_sort are true.
10287 (Output_section::set_final_data_size): Call
10288 sort_attached_input_sections if necessary.
10289 (Output_section::Input_section_sort_entry): Define new class.
10290 (Output_section::Input_section_sort_compare::operator()): New
10292 (Output_section::sort_attached_input_sections): New function.
10293 * configure.ac: Check whether the compiler supports constructor
10294 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10295 * testsuite/initpri1.c: New file.
10296 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10297 CONSTRUCTOR_PRIORITY.
10298 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10299 (initpri1_LDFLAGS): New variable.
10300 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10304 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10305 * testsuite/common_test_1.c: New file.
10306 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10307 (common_test_1_SOURCES): New variable.
10308 (common_test_1_DEPENDENCIES): New variable.
10309 (common_test_1_LDFLAGS): New variable.
10311 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10312 and commons_ correctly when NAME/VERSION does not override
10314 * testsuite/ver_test_6.c: New file.
10315 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10316 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10317 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10321 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10322 of an undefined symbol from a version script.
10323 * testsuite/Makefile.am (ver_test_5.so): New target.
10324 (ver_test_5.o): New target.
10325 (check_SCRIPTS): Add ver_test_5.sh.
10326 (check_DATA): Add ver_test_5.syms.
10327 (ver_test_5.syms): New target.
10328 * testsuite/ver_test_5.cc: New file.
10329 * testsuite/ver_test_5.script: New file.
10330 * testsuite/ver_test_5.sh: New file.
10331 * Makefile.in, testsuite/Makefile.in: Rebuild.
10334 Fix problems building gold with gcc 4.3.0.
10335 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10336 (gold_error_at_location, gold_warning_at_location): Use it.
10337 * configure.ac: Check whether we can compile and use a template
10338 function with a printf attribute.
10339 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10340 when jumping over bytes.
10341 * object.cc: Instantiate Object::read_section_data.
10342 * debug.h: Include <cstring>
10343 * dwarf_reader.cc: Include <algorithm>
10344 * main.cc: Include <cstring>.
10345 * options.cc: Include <cstring>.
10346 * output.cc: Include <cstring>.
10347 * script.cc: Include <cstring>.
10348 * script.h: Include <string>.
10349 * symtab.cc: Include <cstring> and <algorithm>.
10350 * target-select.cc: Include <cstring>.
10351 * version.cc: Include <string>.
10352 * testsuite/testmain.cc: Include <cstdlib>.
10353 * configure, config.in: Rebuild.
10357 * options.cc: Include "../bfd/bfdver.h".
10358 (options::help): Print bug reporting address.
10360 * version.cc (print_version): Adjust output for current value of
10361 BFD_VERSION_STRING.
10365 * options.cc (options::help): Print list of supported targets.
10366 * target-select.h: Include <vector>.
10367 (class Target_selector): Make machine_, size_, and is_big_endian_
10368 fields const. Add bfd_name_ and instantiated_target_ fields.
10369 (Target_selector::Target_selector): Add bfd_name parameter.
10370 (Target_selector::recognize): Make non-virtual, call
10372 (Target_selector::recognize_by_name): Make non-virtual, call
10373 do_recognize_by_name.
10374 (Target_selector::supported_names): New function.
10375 (Target_selector::bfd_name): New function.
10376 (Target_selector::do_instantiate_target): New pure virtual
10378 (Target_selector::do_recognize): New virtual function.
10379 (Target_selector::do_recognize_by_name): New virtual function.
10380 (Target_selector::instantiate_target): New private function.
10381 (supported_target_names): Declare.
10382 * target-select.cc (Target_selector::Target_selector): Update for
10383 new parameter and fields.
10384 (select_target_by_name): Check that the name matches before
10385 calling recognize_by_name.
10386 (supported_target_names): New function.
10387 * i386.cc (class Target_selector_i386): Update Target_selector
10388 constructor call. Remove recognize and recognize_by_name. Add
10389 do_instantiate_target.
10390 * x86_64.cc (class Target_selector_x86_64): Likewise.
10391 * testsuite/testfile.cc (class Target_selector_test): Update for
10392 changes to Target_selector.
10394 * README: Rewrite, with some notes on unsupported features.
10398 * i386.cc (Target_i386::Got_type): New enum declaration.
10399 (Target_i386::Scan::local): Updated callers of Output_data_got
10401 (Target_i386::Scan::global): Likewise.
10402 (Target_i386::Relocate::relocate): Likewise.
10403 (Target_i386::Relocate::relocate_tls): Likewise.
10404 * object.h (Got_offset_list): New class.
10405 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10406 (Sized_relobj::local_got_offset): Likewise.
10407 (Sized_relobj::set_local_got_offset): Likewise.
10408 (Sized_relobj::local_has_tls_got_offset): Removed.
10409 (Sized_relobj::local_tls_got_offset): Removed.
10410 (Sized_relobj::set_local_tls_got_offset): Removed.
10411 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10412 * output.cc (Output_data_got::add_global): Added got_type parameter.
10413 (Output_data_got::add_global_with_rel): Likewise.
10414 (Output_data_got::add_global_with_rela): Likewise.
10415 (Output_data_got::add_global_pair_with_rel): New function.
10416 (Output_data_got::add_global_pair_with_rela): New function.
10417 (Output_data_got::add_local): Added got_type parameter.
10418 (Output_data_got::add_local_with_rel): Likewise.
10419 (Output_data_got::add_local_with_rela): Likewise.
10420 (Output_data_got::add_local_pair_with_rel): New function.
10421 (Output_data_got::add_local_pair_with_rela): New function.
10422 (Output_data_got::add_global_tls): Removed.
10423 (Output_data_got::add_global_tls_with_rel): Removed.
10424 (Output_data_got::add_global_tls_with_rela): Removed.
10425 (Output_data_got::add_local_tls): Removed.
10426 (Output_data_got::add_local_tls_with_rel): Removed.
10427 (Output_data_got::add_local_tls_with_rela): Removed.
10428 * output.h (Output_data_got::add_global): Added got_type parameter.
10429 (Output_data_got::add_global_with_rel): Likewise.
10430 (Output_data_got::add_global_with_rela): Likewise.
10431 (Output_data_got::add_global_pair_with_rel): New function.
10432 (Output_data_got::add_global_pair_with_rela): New function.
10433 (Output_data_got::add_local): Added got_type parameter.
10434 (Output_data_got::add_local_with_rel): Likewise.
10435 (Output_data_got::add_local_with_rela): Likewise.
10436 (Output_data_got::add_local_pair_with_rel): New function.
10437 (Output_data_got::add_local_pair_with_rela): New function.
10438 (Output_data_got::add_global_tls): Removed.
10439 (Output_data_got::add_global_tls_with_rel): Removed.
10440 (Output_data_got::add_global_tls_with_rela): Removed.
10441 (Output_data_got::add_local_tls): Removed.
10442 (Output_data_got::add_local_tls_with_rel): Removed.
10443 (Output_data_got::add_local_tls_with_rela): Removed.
10444 * resolve.cc (Symbol::override_base_with_special): Removed
10445 reference to has_got_offset_ field.
10446 * symtab.cc (Symbol::init_fields): Replaced initialization
10447 of got_offset_ with got_offsets_. Removed initialization
10449 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10450 (Symbol::got_offset): Likewise.
10451 (Symbol::set_got_offset): Likewise.
10452 (Symbol::has_tls_got_offset): Removed.
10453 (Symbol::tls_got_offset): Removed.
10454 (Symbol::set_tls_got_offset): Removed.
10455 (Symbol::got_offset_): Removed.
10456 (Symbol::tls_mod_got_offset_): Removed.
10457 (Symbol::tls_pair_got_offset_): Removed.
10458 (Symbol::got_offsets_): New field.
10459 (Symbol::has_got_offset): Removed.
10460 (Symbol::has_tls_mod_got_offset): Removed.
10461 (Symbol::has_tls_pair_got_offset): Removed.
10462 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10463 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10465 (Target_x86_64::Scan::global): Likewise.
10466 (Target_x86_64::Relocate::relocate): Likewise.
10467 (Target_x86_64::Relocate::relocate_tls): Likewise.
10471 * yyscript.y: Fix spelling error in comment.
10475 * options.h (class General_options): Define build_id option.
10476 * layout.h (class Layout): Declare write_build_id, create_note,
10477 create_build_id. Add build_id_note_ member.
10478 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10479 "libiberty.h", "md5.h", "sha1.h".
10480 (Layout::Layout): Initialize eh_frame_data_,
10481 eh_frame_hdr_section_, and build_id_note_.
10482 (Layout::finalize): Call create_build_id.
10483 (Layout::create_note): New function, broken out of
10484 Layout::create_gold_note.
10485 (Layout::create_gold_note): Call create_note.
10486 (Layout::create_build_id): New function.
10487 (Layout::write_build_id): New function.
10488 (Close_task_runner::run): Call write_build_id.
10490 * x86_64.cc: Correct license to GPLv3.
10494 * options.cc: Include "demangle.h".
10495 (parse_optional_string): New function.
10496 (parse_long_option): Handle takes_optional_argument.
10497 (parse_short_option): Update dash_z initializer. Handle
10498 takes_optional_argument.
10499 (General_options::General_options): Initialize do_demangle_.
10500 (General_options::finalize): Set do_demangle_. Handle demangling
10502 * options.h (parse_optional_string): Declare.
10503 (struct One_option): Add optional_arg field. Update constructor.
10504 Update call constructor calls. Add takes_optional_argument
10506 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10507 (DEFINE_optional_string): Define.
10508 (General_options::demangle): Change from DEFINE_bool to
10509 DEFINE_optional_string.
10510 (General_options::no_demangle): New function.
10511 (General_options::do_demangle): New function.
10512 (General_options::set_do_demangle): New function.
10513 (General_options::execstack_status_): Move definition to end of
10515 (General_options::static_): Likewise.
10516 (General_options::do_demangle_): New field.
10517 * object.cc (big_endian>::get_symbol_location_info): Call
10518 Options::do_demangle, not Options::demangle.
10519 * symtab.cc (demangle): Likewise.
10523 * gold.h: Include <cstddef> and <sys/types.h>
10524 * options.h: Include <cstring>.
10528 * Added source code to GNU binutils.