4 * options.h (class General_options): Add --ctors-in-init-array.
5 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6 friends as SHT_PROGBITS for merging sections.
7 (Layout::layout): Remove special handling of .init_array and
8 friends. Don't sort if doing relocatable link. Sort for .ctors
9 and .dtors if ctors_in_init_array.
10 (Layout::make_output_section): Force correct section types for
11 .init_array and friends. Don't sort if doing relocatable link,
12 Don't sort .ctors and .dtors if ctors_in_init_array.
13 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
14 (Layout::output_section_name): Add relobj parameter. Change all
15 callers. Handle .ctors. and .dtors. in code rather than table.
16 Handle .ctors and .dtors if ctors_in_init_array.
17 (Layout::match_file_name): New function, moved from output.cc.
18 * layout.h (class Layout): Update declarations.
19 * output.cc: Include "layout.h".
20 (Input_section_sort_entry::get_priority): New function.
21 (Input_section_sort_entry::match_file_name): Just call
22 Layout::match_file_name.
23 (Output_section::Input_section_sort_init_fini_compare::operator()):
24 Handle .ctors and .dtors. Sort by explicit priority rather than
26 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
27 * testsuite/initpri2.c: New test.
28 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
29 (check_PROGRAMS): Add initpri2.
30 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
31 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
32 * configure, testsuite/Makefile.in: Rebuild.
37 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
38 .interp section to a PT_INTERP segment even if we have seen a
39 --dynamic-linker option. Don't do it if we have seen a PHDRS
40 clause in a linker script.
41 (Layout::finalize): Don't create a .interp section if we've
42 already create a PT_INTERP segment.
43 (Layout::create_interp): Always call choose_output_section (revert
44 patch of 2011-06-17). Don't create PT_INTERP segment.
46 (Script_sections::create_note_and_tls_segments): Add a .interp
47 section to a PT_INTERP segment even if we have seen a
48 --dynamic-linker option.
52 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
53 merely because a non-PT_LOAD segment has a dynamic reloc.
57 * layout.cc (Layout::finish_dynamic_section): Don't create
58 DT_FLAGS entry if not needed.
63 * layout.cc (Layout::layout_eh_frame): Correct handling of
64 writable .eh_frame section.
69 * resolve.cc (Symbol_table::resolve): Don't give an error if a
70 symbol is redefined with the exact same object and value.
75 * layout.h (class Layout): Add interp_segment_ field.
76 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
77 (Layout::attach_allocated_section_to_segment): If making shared
78 library, put .interp section in PT_INTERP segment.
79 (Layout::finalize): Also call create_interp if -dynamic-linker
81 (Layout::create_interp): Assert that there is no PT_INTERP
82 segment. If not using a SECTIONS clause, use make_output_section.
83 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
85 (Script_sections::create_note_and_tls_segments): If making shared
86 library, put .interp section in PT_INTERP segment.
90 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
91 when making a shared library.
95 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
96 parameter. Change all callers. Don't issue warning about PC32
97 against locally defined symbol.
101 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
102 occurs in same object.
106 * po/POTFILES.in: Regenerate.
111 (Orphan_output_section::set_section_addresses): For a relocatable
112 link set address to 0.
117 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
118 used with --compress-debug-sections.
119 * gold/object.cc (Sized_relobj_file::do_layout): Report
120 uncompressed size of compressed input sections.
125 * testsuite/two_file_test_2_v1.cc: Change initialization of
126 v2 to keep it in .data.
130 * common.cc (Symbol_table::do_allocate_commons_list): Call
132 * errors.cc (Errors::fatal): Adjust call to gold_exit.
133 (Errors::fallback): New function.
134 (gold_fallback): New function.
135 * errors.h (Errors::fallback): New function.
136 * gold.cc (gold_exit): Change status parameter to enum; adjust
138 (queue_initial_tasks): Call gold_fallback.
139 * gold.h: Include cstdlib.
140 (Exit_status): New enum type.
141 (gold_exit): Change status parameter to enum.
142 (gold_fallback): New function.
143 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
144 (Layout::create_symtab_sections): Likewise.
145 (Layout::create_shdrs): Likewise.
146 * main.cc (main): Adjust call to gold_exit.
147 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
148 (Output_data_got::add_got_entry_pair): Likewise.
149 (Output_section::add_input_section): Likewise.
150 (Output_section::add_output_section_data): Likewise.
151 (Output_segment::set_section_list_addresses): Likewise.
152 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
156 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
157 for incremental links.
158 * output.cc (Output_segment::set_section_list_addresses): Remove
159 FIXME and test for TLS or BSS.
163 * testsuite/Makefile.am: Add incremental_copy_test,
164 incremental_common_test_1.
165 * testsuite/Makefile.in: Regenerate.
166 * testsuite/common_test_1_v1.c: New source file.
167 * testsuite/common_test_1_v2.c: New source file.
168 * testsuite/copy_test_v1.cc: New source file.
172 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
173 update, allocate common from bss section's free list.
174 * incremental-dump.cc (dump_incremental_inputs): Print flag for
175 linker-defined symbols.
176 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
177 Skip GOT and PLT entries that are no longer referenced.
178 (Output_section_incremental_inputs::write_info_blocks): Mark
179 linker-defined symbols.
180 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
181 * output.cc (Output_section::allocate): New function.
182 * output.h (Output_section::allocate): New function.
183 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
184 linker-defined symbols.
185 (Symbol::override_base_with_special): Copy is_predefined_ flag.
186 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
187 (Symbol::init_base_output_data): Likewise.
188 (Symbol::init_base_output_segment): Likewise.
189 (Symbol::init_base_constant): Likewise.
190 (Sized_symbol::init_output_data): Likewise.
191 (Sized_symbol::init_output_segment): Likewise.
192 (Sized_symbol::init_constant): Likewise.
193 (Symbol_table::do_define_in_output_data): Likewise.
194 (Symbol_table::do_define_in_output_segment): Likewise.
195 (Symbol_table::do_define_as_constant): Likewise.
196 * symtab.h (Symbol::is_predefined): New function.
197 (Symbol::init_base_output_data): Add is_predefined parameter.
198 (Symbol::init_base_output_segment): Likewise.
199 (Symbol::init_base_constant): Likewise.
200 (Symbol::is_predefined_): New data member.
201 (Sized_symbol::init_output_data): Add is_predefined parameter.
202 (Sized_symbol::init_output_segment): Likewise.
203 (Sized_symbol::init_constant): Likewise.
204 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
208 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
209 instead of emit_copy_reloc.
210 (Copy_relocs::emit_copy_reloc): Refactor.
211 (Copy_relocs::make_copy_reloc): New function.
212 (Copy_relocs::add_copy_reloc): Remove.
213 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
215 (Copy_relocs::make_copy_reloc): New function.
216 (Copy_relocs::add_copy_reloc): Remove.
217 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
218 unchanged input files.
219 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
220 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
221 Reserve BSS space for COPY relocations.
222 (Sized_incremental_binary::do_emit_copy_relocs): New function.
223 (Output_section_incremental_inputs::write_info_blocks): Record
224 whether a symbol is copied from a shared object.
225 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
226 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
227 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
228 (Incremental_input_entry_reader::get_output_symbol_index): Add
230 (Incremental_binary::emit_copy_relocs): New function.
231 (Incremental_binary::do_emit_copy_relocs): New function.
232 (Sized_incremental_binary::Sized_incremental_binary): Initialize
234 (Sized_incremental_binary::add_copy_reloc): New function.
235 (Sized_incremental_binary::do_emit_copy_relocs): New function.
236 (Sized_incremental_binary::Copy_reloc): New struct.
237 (Sized_incremental_binary::Copy_relocs): New typedef.
238 (Sized_incremental_binary::copy_relocs_): New data member.
239 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
240 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
241 * target.h (Sized_target::emit_copy_reloc): New function.
242 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
247 * gold/archive.cc (Archive::Archive): Initialize new data member.
248 (Archive::include_all_members): Return if archive has already been
250 * gold/archive.h (Archive::include_all_members_): New data member.
254 * dynobj.h: Fix spelling mistake in comment.
255 * output.cc: Likewise.
261 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
262 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
263 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
264 redundant arm_exidx_test.so.
265 * testsuite/Makefile.in: Regenerate.
266 (check_SCRIPTS): Add pr12826.sh
267 (check_DATA): Add pr12826.stdout
268 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
269 * testsuite/pr12826.sh: New file.
270 * testsuite/pr12826_1.s: Ditto.
271 * testsuite/pr12826_1.s: Ditto.
275 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
281 * testsuite/Makefile.am: Use different file name for two_file_test
282 temporary file for each incremental test.
283 * testsuite/Makefile.in: Rebuild.
287 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
288 binary input file is empty.
292 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
293 (ver_test_9.so): Likewise.
294 * testsuite/Makefile.in: Rebuild.
298 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
299 * incremental.cc (Incremental_inputs::report_input_section): Fix
300 comment, indentation.
301 (Incremental_inputs::report_comdat_group): New function.
302 (Output_section_incremental_inputs::set_final_data_size): Adjust size
303 of data for incremental input file entry.
304 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
305 group count, COMDAT group signatures.
306 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
307 an unchanged input file.
308 * incremental.h (Incremental_object_entry::Incremental_object_entry):
309 Initialize new data member.
310 (Incremental_object_entry::add_comdat_group): New function.
311 (Incremental_object_entry::get_comdat_group_count): New function.
312 (Incremental_object_entry::get_comdat_signature_key): New function.
313 (Incremental_object_entry::groups_): New data member.
314 (Incremental_inputs::report_comdat_group): New function.
315 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
316 data for incremental input file entry.
317 (Incremental_input_entry_reader::get_comdat_group_count): New function.
318 (Incremental_input_entry_reader::get_input_section): Adjust size of
319 data for incremental input file entry.
320 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
321 (Incremental_input_entry_reader::get_comdat_group_signature): New
323 * object.cc (Sized_relobj::include_section_group): Report kept
324 COMDAT groups for incremental links.
328 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
329 with name parameter. Add found_name parameter.
330 * fileread.cc (Input_file::find_file): Adjust code accordingly.
331 * dirsearch.h (class Dirsearch): Update declaration.
335 * archive.cc (Library_base::should_include_member): Pull in object
336 from archive if it defines the entry symbol.
337 * parameters.cc (Parameters::entry): New function.
338 * parameters.h (class Parameters): Declare entry.
339 * output.h (class Output_file_header): Remove entry_ field.
340 * output.cc (Output_file_header::Output_file_header): Remove entry
341 parameter. Change all callers.
342 (Output_file_header::entry): Use parameters->entry.
343 * gold.cc (queue_middle_tasks): Likewise.
344 * plugin.cc (Plugin_hook::run): Likewise.
348 * gold.cc (queue_initial_tasks): Pass incremental base filename
349 to Output_file::open_base_file; don't print error message.
350 * incremental-dump.cc (main): Adjust call to
351 Output_file::open_for_modification.
352 * incremental-dump.cc (main): Likewise.
353 * incremental.cc (Incremental_inputs::report_command_line):
354 Ignore --incremental-base option when comparing command lines.
355 Ignore parameter when given as separate argument.
356 * options.h (class General_options): Add --incremental-base.
357 * output.cc (Output_file::Output_file):
358 (Output_file::open_base_file): Add base_name and writable parameters;
359 read base file into new file; print error message here.
360 (Output_file::map_no_anonymous): Add writable parameter; adjust all
362 * output.h (Output_file::open_for_modification): Rename to...
363 (Output_file::open_base_file): ...this; add base_name and
364 writable parameters; adjust all callers.
365 (Output_file::map_no_anonymous): Add writable parameter; adjust all
367 * testsuite/Makefile.am (incremental_test_4): Test
369 * testsuite/Makefile.in: Regenerate.
373 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
375 * testsuite/Makefile.in: Regenerate.
376 * testsuite/two_file_test_1_v1.cc: New test source file.
377 * testsuite/two_file_test_1b_v1.cc: New test source file.
378 * testsuite/two_file_test_2_v1.cc: New test source file.
382 * dynobj.h (Dynobj::do_dynobj): New function.
383 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
384 flag and soname for shared objects.
385 * incremental.cc (Incremental_inputs::report_object): Make
386 either Incremental_object_entry or Incremental_dynobj_entry; add
387 soname to string table.
388 (Incremental_inputs::report_input_section): Add assertion.
389 (Output_section_incremental_inputs::set_final_data_size): Adjust
390 type of input file entry for shared libraries; adjust size of
391 shared library info entry.
392 (Output_section_incremental_inputs::write_input_files): Write
393 as_needed flag for shared libraries.
394 (Output_section_incremental_inputs::write_info_blocks): Adjust type
395 of input file entry for shared libraries; write soname.
396 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
397 soname from incremental info.
398 * incremental.h (enum Incremental_input_flags): Add
399 INCREMENTAL_INPUT_AS_NEEDED.
400 (Incremental_input_entry::Incremental_input_entry): Initialize new
402 (Incremental_input_entry::set_as_needed): New function.
403 (Incremental_input_entry::as_needed): New function.
404 (Incremental_input_entry::do_dynobj_entry): New function.
405 (Incremental_input_entry::as_needed_): New data member.
406 (Incremental_object_entry::Incremental_object_entry): Don't check
408 (Incremental_object_entry::do_type): Likewise.
409 (class Incremental_dynobj_entry): New class.
410 (Incremental_input_entry_reader::as_needed): New function.
411 (Incremental_input_entry_reader::get_soname): New function.
412 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
413 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
414 size of shared library info entry.
415 * layout.cc (Layout::finish_dynamic_section): Don't test for
416 incremental link when adding DT_NEEDED entries.
417 * object.h (Object::Object): Initialize new data member.
418 (Object::dynobj): New function.
419 (Object::set_as_needed): New function.
420 (Object::as_needed): New function.
421 (Object::do_dynobj): New function.
422 (Object::as_needed_): New data member.
426 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
427 info; adjust display of GOT entries.
428 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
429 vector of input objects; remove file_status_.
430 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
431 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
432 got_plt reader; call target hooks to reserve GOT entries.
433 (Output_section_incremental_inputs::set_final_data_size): Adjust size
434 of input file info header and GOT info entry.
435 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
437 (Got_plt_view_info::got_descriptor): Remove.
438 (Got_plt_view_info::sym_index): New data member.
439 (Got_plt_view_info::input_index): New data member.
440 (Local_got_offset_visitor::visit): Write input file index.
441 (Global_got_offset_visitor::visit): Write 0 for input file index.
442 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
443 with sym_index and input_index.
444 (Output_section_incremental_inputs::write_got_plt): Adjust size of
445 incremental info GOT entry; replace got_descriptor with input_index.
446 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
447 map from input file index to object.
448 (Sized_relobj_incr::do_layout): Replace direct data member reference
449 with accessor function.
450 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
451 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
452 Adjust size of input file info header.
453 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
454 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
455 (Incremental_input_entry_reader::get_input_section): Adjust size of
456 input file info header.
457 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
458 of incremental info GOT entry.
459 (Incremental_got_plt_reader::get_got_desc): Remove.
460 (Incremental_got_plt_reader::get_got_symndx): New function.
461 (Incremental_got_plt_reader::get_got_input_index): New function.
462 (Sized_incremental_binary::Sized_incremental_binary): Remove
463 file_status_; add input_objects_.
464 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
465 (Sized_incremental_binary::set_file_is_unchanged): Remove.
466 (Sized_incremental_binary::file_is_unchanged): Remove.
467 (Sized_incremental_binary::set_input_object): New function.
468 (Sized_incremental_binary::input_object): New function.
469 (Sized_incremental_binary::file_status_): Remove.
470 (Sized_incremental_binary::input_objects_): New data member.
471 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
473 (Sized_relobj_incr::invalid_address): Move to base class.
474 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
476 (Sized_relobj_incr::do_output_section_offset): Likewise.
477 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
478 (Sized_relobj_incr::section_offsets_): Likewise.
479 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
481 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
482 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
483 with accessor function.
484 (Sized_relobj_file::do_layout): Likewise.
485 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
486 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
487 (Sized_relobj_file::compute_final_local_value): Replace refs to
488 section_offsets_ with accessor function.
489 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
490 * object.h (Relobj::Relobj): Initialize new data members.
491 (Relobj::add_dyn_reloc): New function.
492 (Relobj::first_dyn_reloc): New function.
493 (Relobj::dyn_reloc_count): New function.
494 (Relobj::first_dyn_reloc_): New data member.
495 (Relobj::dyn_reloc_count_): New data member.
496 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
498 (Sized_relobj::Address): New typedef.
499 (Sized_relobj::invalid_address): Move here from child class.
500 (Sized_relobj::Sized_relobj): Initialize new data members.
501 (Sized_relobj::sized_relobj): New function.
502 (Sized_relobj::is_output_section_offset_invalid): Move here from
504 (Sized_relobj::get_output_section_offset): Likewise.
505 (Sized_relobj::local_has_got_offset): Likewise.
506 (Sized_relobj::local_got_offset): Likewise.
507 (Sized_relobj::set_local_got_offset): Likewise.
508 (Sized_relobj::do_for_all_local_got_entries): Likewise.
509 (Sized_relobj::clear_got_offsets): New function.
510 (Sized_relobj::section_offsets): Move here from child class.
511 (Sized_relobj::do_output_section_offset): Likewise.
512 (Sized_relobj::do_set_section_offset): Likewise.
513 (Sized_relobj::Local_got_offsets): Likewise.
514 (Sized_relobj::local_got_offsets_): Likewise.
515 (Sized_relobj::section_offsets_): Likewise.
516 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
518 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
520 (Sized_relobj_file::sized_relobj): New function
521 (Sized_relobj_file::local_has_got_offset): Move to base class.
522 (Sized_relobj_file::local_got_offset): Likewise.
523 (Sized_relobj_file::set_local_got_offset): Likewise.
524 (Sized_relobj_file::get_output_section_offset): Likewise.
525 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
526 (Sized_relobj_file::do_output_section_offset): Likewise.
527 (Sized_relobj_file::do_set_section_offset): Likewise.
528 (Sized_relobj_file::Local_got_offsets): Likewise.
529 (Sized_relobj_file::local_got_offsets_): Likewise.
530 (Sized_relobj_file::section_offsets_): Likewise.
531 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
533 (set_needs_dynsym_index): Convert relobj to derived class pointer.
534 (Output_reloc::get_symbol_index): Likewise.
535 (Output_reloc::local_section_offset): Likewise.
536 (Output_reloc::get_address): Likewise.
537 (Output_reloc::symbol_value): Likewise.
538 (Output_data_got::reserve_slot): Move to class definition.
539 (Output_data_got::reserve_local): New function.
540 (Output_data_got::reserve_slot_for_global): Remove.
541 (Output_data_got::reserve_global): New function.
542 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
543 (all constructors, two instantiations).
544 (Output_reloc::get_relobj): New function (two instantiations).
545 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
546 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
547 (Output_data_reloc::add_global): Adjust type of relobj.
548 (Output_data_reloc::add_global_relative): Likewise.
549 (Output_data_reloc::add_symbolless_global_addend): Likewise.
550 (Output_data_reloc::add_local): Likewise.
551 (Output_data_reloc::add_local_relative): Likewise.
552 (Output_data_reloc::add_symbolless_local_addend): Likewise.
553 (Output_data_reloc::add_local_section): Likewise.
554 (Output_data_reloc::add_output_section): Likewise.
555 (Output_data_reloc::add_absolute): Likewise.
556 (Output_data_reloc::add_target_specific): Likewise.
557 (Output_data_got::reserve_slot): Move definition here.
558 (Output_data_got::reserve_local): New function.
559 (Output_data_got::reserve_global): New function.
560 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
561 section_offsets_ with accessor function.
562 (Sized_relobj_file::write_sections): Likewise.
563 (Sized_relobj_file::do_relocate_sections): Likewise.
564 * target.h (Sized_target::reserve_local_got_entry): New function.
565 (Sized_target::reserve_global_got_entry): New function.
566 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
567 (Target_x86_64::reserve_global_got_entry): New function.
568 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
572 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
573 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
574 bit when checking got_type.
575 * incremental.cc (Sized_incremental_binary::setup_readers):
576 Store symbol table and string table locations; initialize bit vector
577 of file status flags.
578 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
580 (Sized_incremental_binary::do_process_got_plt): New function.
581 (Sized_incremental_binary::get_symtab_view): Use stored locations.
582 (Output_section_incremental_inputs::set_final_data_size): Record
583 file index for each input file.
584 (Output_section_incremental_inputs::write_got_plt): Store file index
585 instead of input entry offset for each GOT entry.
587 (Incremental_input_entry::Incremental_input_entry): Initialize new
589 (Incremental_input_entry::set_offset): Store file index.
590 (Incremental_input_entry::get_file_index): New function.
591 (Incremental_input_entry::file_index_): New data member.
592 (Incremental_binary::process_got_plt): New function.
593 (Incremental_binary::do_process_got_plt): New function.
594 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
596 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
597 (Sized_incremental_binary::set_file_is_unchanged): New function.
598 (Sized_incremental_binary::file_is_unchanged): New function.
599 (Sized_incremental_binary::do_process_got_plt): New function.
600 (Sized_incremental_binary::file_status_): New data member.
601 (Sized_incremental_binary::main_symtab_loc_): New data member.
602 (Sized_incremental_binary::main_strtab_loc_): New data member.
603 * output.cc (Output_data_got::Got_entry::write): Add case
605 (Output_data_got::add_global): Call add_got_entry.
606 (Output_data_got::add_global_plt): Likewise.
607 (Output_data_got::add_global_with_rel): Likewise.
608 (Output_data_got::add_global_with_rela): Likewise.
609 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
610 (Output_data_got::add_global_pair_with_rela): Likewise.
611 (Output_data_got::add_local): Call add_got_entry.
612 (Output_data_got::add_local_plt): Likewise.
613 (Output_data_got::add_local_with_rel): Likewise.
614 (Output_data_got::add_local_with_rela): Likewise.
615 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
616 (Output_data_got::add_local_pair_with_rela): Likewise.
617 (Output_data_got::reserve_slot): New function.
618 (Output_data_got::reserve_slot_for_global): New function.
619 (Output_data_got::add_got_entry): New function.
620 (Output_data_got::add_got_entry_pair): New function.
621 (Output_section::add_output_section_data): Edit FIXME.
623 (Output_section_data_build::Output_section_data_build): New
624 constructor with size parameter.
625 (Output_data_space::Output_data_space): Likewise.
626 (Output_data_got::Output_data_got): Initialize new data member; new
627 constructor with size parameter.
628 (Output_data_got::add_constant): Call add_got_entry.
629 (Output_data_got::reserve_slot): New function.
630 (Output_data_got::reserve_slot_for_global): New function.
631 (class Output_data_got::Got_entry): Add RESERVED_CODE.
632 (Output_data_got::add_got_entry): New function.
633 (Output_data_got::add_got_entry_pair): New function.
634 (Output_data_got::free_list_): New data member.
635 * target.h (Sized_target::init_got_plt_for_update): New function.
636 (Sized_target::register_global_plt_entry): New function.
637 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
638 Initialize new data member; call init; add constructor with PLT count.
639 (Output_data_plt_x86_64::init): New function.
640 (Output_data_plt_x86_64::add_relocation): New function.
641 (Output_data_plt_x86_64::reserve_slot): New function.
642 (Output_data_plt_x86_64::free_list_): New data member.
643 (Target_x86_64::init_got_plt_for_update): New function.
644 (Target_x86_64::register_global_plt_entry): New function.
645 (Output_data_plt_x86_64::add_entry): Allocate from free list for
647 (Output_data_plt_x86_64::add_relocation): New function.
648 * testsuite/object_unittest.cc (Object_test): Set default options.
652 * options.h (class General_options): Make -i a synonym for -r.
656 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
660 * object.cc (Sized_relobj::do_count_local_symbols): Check for
665 * layout.cc (Layout::layout): If the output section flags change,
670 * incremental-dump.cc (dump_incremental_inputs): Print local
671 symbol info for each input file.
673 (Output_section_incremental_inputs::set_final_data_size): Add local
674 symbol info to input file entries in incremental info.
675 (Output_section_incremental_inputs::write_info_blocks): Likewise.
676 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
677 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
678 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
680 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
681 (Sized_incr_relobj::do_relocate): Write the local symbols.
682 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
683 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
684 Adjust size of input file header.
685 (Incremental_inputs_reader::get_local_symbol_offset): New function.
686 (Incremental_inputs_reader::get_local_symbol_count): New function.
687 (Incremental_inputs_reader::get_input_section): Adjust size of input
689 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
690 (Sized_incr_relobj::This): New typedef.
691 (Sized_incr_relobj::sym_size): New const data member.
692 (Sized_incr_relobj::Local_symbol): New struct.
693 (Sized_incr_relobj::do_output_local_symbol_count): New function.
694 (Sized_incr_relobj::do_local_symbol_offset): New function.
695 (Sized_incr_relobj::local_symbol_count_): New data member.
696 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
697 (Sized_incr_relobj::local_symbol_index_): New data member.
698 (Sized_incr_relobj::local_symbol_offset_): New data member.
699 (Sized_incr_relobj::local_dynsym_offset_): New data member.
700 (Sized_incr_relobj::local_symbols_): New data member.
701 * object.h (Relobj::output_local_symbol_count): New function.
702 (Relobj::local_symbol_offset): New function.
703 (Relobj::do_output_local_symbol_count): New function.
704 (Relobj::do_local_symbol_offset): New function.
705 (Sized_relobj::do_output_local_symbol_count): New function.
706 (Sized_relobj::do_local_symbol_offset): New function.
710 * descriptors.cc (set_close_on_exec): New function.
711 (Descriptors::open): Use set_close_on_exec.
712 * output.cc (S_ISLNK): Define if not defined.
716 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
718 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
719 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
720 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
722 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
723 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
724 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
726 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
728 (Incremental_binary::apply_incremental_relocs): New function.
729 (Incremental_binary::do_apply_incremental_relocs): New function.
730 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
732 (Sized_incremental_binary::add_global_symbol): New function.
733 (Sized_incremental_binary::global_symbol): New function.
734 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
735 (Sized_incremental_binary::symbol_map_): New data member.
736 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
737 * target.h (Sized_target::apply_relocation): New function.
738 * target-reloc.h (apply_relocation): New function.
739 * x86_64.cc (Target_x86_64::apply_relocation): New function.
743 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
744 flag of a SHT_ARM_EXIDX section.
745 * testsuite/Makefile.am (arm_exidx_test): New test rules.
746 * testsuite/Makefile.in: Regenerate.
747 * testsuite/arm_exidx_test.s: New file.
748 * testsuite/arm_exidx_test.sh: Same.
753 * archive.h (Incremental_archive_entry::Archive_member):
754 Initialize arg_serial_ (second constructor).
758 * object.cc (Relocate_info::location): Simplify location string.
759 * errors.cc (Errors::error_at_location): Don't print program
761 (Errors::warning_at_location): Likewise.
762 (Errors::undefined_symbol): Likewise.
763 * testsuite/debug_msg.sh: Update accordingly.
767 * gold/layout.cc (Layout::symtab_section_offset): New function.
768 * gold/layout.h (Layout::symtab_section_offset): New function.
769 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
773 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
775 * output.h (class Output_file): Add map_is_allocated_ field.
776 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
777 not available, provide stubs. If mremap is not available, #define
779 (MREMAP_MAYMOVE): Define if not defined.
780 (Output_file::Output_file): Initialize map_is_allocated_.
781 (Output_file::resize): Check map_is_allocated_.
782 (Output_file::map_anonymous): If mmap fails, use malloc.
783 (Output_file::unmap): Don't do anything for an anonymous map.
784 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
785 is not available, provide stubs.
786 (File_read::View::~View): Use free rather than delete[].
787 (File_read::make_view): Use malloc rather than new[]. If mmap
789 (File_read::find_or_make_view): Use malloc rather than new[].
790 * gold.h: Remove HAVE_REMAP code.
791 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
792 exists. Rename mremap to gold_mremap. If mmap is not available
794 * configure, config.in: Rebuild.
798 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
799 initialize local variable v.
803 * archive.cc (Archive::include_member): Adjust call to
805 (Add_archive_symbols::run): Track argument serial numbers.
806 (Lib_group::include_member): Likewise.
807 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
808 * archive.h (Incremental_archive_entry::Archive_member):
809 Initialize arg_serial_.
810 (Archive_member::arg_serial_): New data member.
811 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
812 (Sized_dynobj::do_add_symbols): Track symbols when doing an
814 (Sized_dynobj::do_for_all_local_got_entries): New function.
815 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
817 * fileread.cc (get_mtime): New function.
818 * fileread.h (get_mtime): New function.
819 * gold.cc (queue_initial_tasks): Check for incremental update.
820 (process_incremental_input): New function.
821 (queue_middle_tasks): Don't force valid target for incremental
823 * incremental-dump.cc (find_input_containing_global): Adjust
824 size of symbol info entry.
825 (dump_incremental_inputs): Dump argument serial number and
826 in_system_directory flag; bias shndx by 1; print symbol names
827 when dumping per-file symbol lists; use new symbol info readers.
829 (Output_section_incremental_inputs:update_data_size): New function.
830 (Sized_incremental_binary::setup_readers): Setup input readers
831 for each input file; build maps for files added from libraries
833 (Sized_incremental_binary::check_input_args): New function.
834 (Sized_incremental_binary::do_check_inputs): Build map of argument
835 serial numbers to input arguments.
836 (Sized_incremental_binary::do_file_has_changed): Rename
837 do_file_is_unchanged to this; compare file modification times.
838 (Sized_incremental_binary::do_init_layout): New function.
839 (Sized_incremental_binary::do_reserve_layout): New function.
840 (Sized_incremental_binary::do_get_input_reader): Remove.
841 (Sized_incremental_binary::get_symtab_view): New function.
842 (Incremental_checker::can_incrementally_link_output_file): Remove.
843 (Incremental_inputs::report_command_line): Exclude --debug options.
844 (Incremental_inputs::report_archive_begin): Add parameter; track
845 argument serial numbers; don't put input file entry for archive
846 before archive members.
847 (Incremental_inputs::report_archive_end): Put input file entry
848 for archive after archive members.
849 (Incremental_inputs::report_object): Add parameter; track argument
850 serial numbers and in_system_directory flag.
851 (Incremental_inputs::report_script): Add parameter; track argument
853 (Output_section_incremental_inputs::set_final_data_size): Adjust
854 size of symbol info entry; check for forwarding symbols.
855 (Output_section_incremental_inputs::write_input_files): Write
856 in_system_directory flag and argument serial number.
857 (Output_section_incremental_inputs::write_info_blocks): Map section
858 indices between incremental info and original input file; store
859 input section index for each symbol.
860 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
861 change operator() to visit().
862 (class Global_got_offset_visitor): Likewise.
863 (class Global_symbol_visitor_got_plt):
864 (Output_section_incremental_inputs::write_got_plt): Use new visitor
866 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
867 (Sized_incr_relobj::do_read_symbols): New function.
868 (Sized_incr_relobj::do_layout): New function.
869 (Sized_incr_relobj::do_layout_deferred_sections): New function.
870 (Sized_incr_relobj::do_add_symbols): New function.
871 (Sized_incr_relobj::do_should_include_member): New function.
872 (Sized_incr_relobj::do_for_all_global_symbols): New function.
873 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
874 (Sized_incr_relobj::do_section_size): New function.
875 (Sized_incr_relobj::do_section_name): New function.
876 (Sized_incr_relobj::do_section_contents): New function.
877 (Sized_incr_relobj::do_section_flags): New function.
878 (Sized_incr_relobj::do_section_entsize): New function.
879 (Sized_incr_relobj::do_section_address): New function.
880 (Sized_incr_relobj::do_section_type): New function.
881 (Sized_incr_relobj::do_section_link): New function.
882 (Sized_incr_relobj::do_section_info): New function.
883 (Sized_incr_relobj::do_section_addralign): New function.
884 (Sized_incr_relobj::do_initialize_xindex): New function.
885 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
886 (Sized_incr_relobj::do_read_relocs): New function.
887 (Sized_incr_relobj::do_gc_process_relocs): New function.
888 (Sized_incr_relobj::do_scan_relocs): New function.
889 (Sized_incr_relobj::do_count_local_symbols): New function.
890 (Sized_incr_relobj::do_finalize_local_symbols): New function.
891 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
892 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
893 (Sized_incr_relobj::do_relocate): New function.
894 (Sized_incr_relobj::do_set_section_offset): New function.
895 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
896 (Sized_incr_dynobj::do_read_symbols): New function.
897 (Sized_incr_dynobj::do_layout): New function.
898 (Sized_incr_dynobj::do_add_symbols): New function.
899 (Sized_incr_dynobj::do_should_include_member): New function.
900 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
901 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
902 (Sized_incr_dynobj::do_section_size): New function.
903 (Sized_incr_dynobj::do_section_name): New function.
904 (Sized_incr_dynobj::do_section_contents): New function.
905 (Sized_incr_dynobj::do_section_flags): New function.
906 (Sized_incr_dynobj::do_section_entsize): New function.
907 (Sized_incr_dynobj::do_section_address): New function.
908 (Sized_incr_dynobj::do_section_type): New function.
909 (Sized_incr_dynobj::do_section_link): New function.
910 (Sized_incr_dynobj::do_section_info): New function.
911 (Sized_incr_dynobj::do_section_addralign): New function.
912 (Sized_incr_dynobj::do_initialize_xindex): New function.
913 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
914 (make_sized_incremental_object): New function.
915 (Incremental_library::copy_unused_symbols): New function.
916 (Incremental_library::do_for_all_unused_symbols): New function.
917 * incremental.h (enum Incremental_input_flags): New type.
918 (class Incremental_checker): Remove.
919 (Incremental_input_entry::Incremental_input_entry): Add argument
921 (Incremental_input_entry::arg_serial): New function.
922 (Incremental_input_entry::set_is_in_system_directory): New function.
923 (Incremental_input_entry::is_in_system_directory): New function.
924 (Incremental_input_entry::arg_serial_): New data member.
925 (Incremental_input_entry::is_in_system_directory_): New data member.
926 (class Script_info): Move here from script.h.
927 (Script_info::Script_info): Add filename parameter.
928 (Script_info::filename): New function.
929 (Script_info::filename_): New data member.
930 (Incremental_script_entry::Incremental_script_entry): Add argument
932 (Incremental_object_entry::Incremental_object_entry): Likewise.
933 (Incremental_object_entry::add_input_section): Build list of input
934 sections with map to original shndx.
935 (Incremental_object_entry::get_input_section_index): New function.
936 (Incremental_object_entry::shndx_): New data member.
937 (Incremental_object_entry::name_key_): Rename; adjust all refs.
938 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
939 (Incremental_archive_entry::Incremental_archive_entry): Add argument
941 (Incremental_inputs::report_archive_begin): Likewise.
942 (Incremental_inputs::report_object): Likewise.
943 (Incremental_inputs::report_script): Likewise.
944 (class Incremental_global_symbol_reader): New class.
945 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
946 and store flags and input file type.
947 (Incremental_input_entry_reader::arg_serial): New function.
948 (Incremental_input_entry_reader::type): Extract type from flags.
949 (Incremental_input_entry_reader::is_in_system_directory): New function.
950 (Incremental_input_entry_reader::get_input_section_count): Call
951 accessor function for type.
952 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
953 function for type; adjust size of global symbol entry.
954 (Incremental_input_entry_reader::get_global_symbol_count): Call
955 accessor function for type.
956 (Incremental_input_entry_reader::get_object_count): Likewise.
957 (Incremental_input_entry_reader::get_object_offset): Likewise.
958 (Incremental_input_entry_reader::get_member_count): Likewise.
959 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
960 (Incremental_input_entry_reader::get_member_offset): Likewise.
961 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
962 (Incremental_input_entry_reader::Global_symbol_info): Remove.
963 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
964 (Incremental_input_entry_reader::get_global_symbol_reader): New
966 (Incremental_input_entry_reader::get_output_symbol_index): New
968 (Incremental_input_entry_reader::type_): Remove.
969 (Incremental_input_entry_reader::flags_): New data member.
970 (Incremental_inputs_reader::input_file_offset): New function.
971 (Incremental_inputs_reader::input_file_index): New function.
972 (Incremental_inputs_reader::input_file): Call input_file_offset.
973 (Incremental_inputs_reader::input_file_at_offset): New function.
974 (Incremental_relocs_reader::get_r_type): Reformat.
975 (Incremental_relocs_reader::get_r_shndx): Reformat.
976 (Incremental_relocs_reader::get_r_offset): Reformat.
977 (Incremental_relocs_reader::data): New function.
978 (Incremental_binary::Incremental_binary): Initialize new data members.
979 (Incremental_binary::check_inputs): Add cmdline parameter.
980 (Incremental_binary::file_is_unchanged): Remove.
981 (Input_reader::arg_serial): New function.
982 (Input_reader::get_unused_symbol_count): New function.
983 (Input_reader::get_unused_symbol): New function.
984 (Input_reader::do_arg_serial): New function.
985 (Input_reader::do_get_unused_symbol_count): New function.
986 (Input_reader::do_get_unused_symbol): New function.
987 (Incremental_binary::input_file_count): New function.
988 (Incremental_binary::get_input_reader): Change signature to use
989 index instead of filename.
990 (Incremental_binary::file_has_changed): New function.
991 (Incremental_binary::get_input_argument): New function.
992 (Incremental_binary::get_library): New function.
993 (Incremental_binary::get_script_info): New function.
994 (Incremental_binary::init_layout): New function.
995 (Incremental_binary::reserve_layout): New function.
996 (Incremental_binary::output_file): New function.
997 (Incremental_binary::do_check_inputs): New function.
998 (Incremental_binary::do_file_is_unchanged): Remove.
999 (Incremental_binary::do_file_has_changed): New function.
1000 (Incremental_binary::do_init_layout): New function.
1001 (Incremental_binary::do_reserve_layout): New function.
1002 (Incremental_binary::do_input_file_count): New function.
1003 (Incremental_binary::do_get_input_reader): Change signature.
1004 (Incremental_binary::input_args_map_): New data member.
1005 (Incremental_binary::library_map_): New data member.
1006 (Incremental_binary::script_map_): New data member.
1007 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1009 (Sized_incremental_binary::output_section): New function.
1010 (Sized_incremental_binary::inputs_reader): Add const.
1011 (Sized_incremental_binary::symtab_reader): Add const.
1012 (Sized_incremental_binary::relocs_reader): Add const.
1013 (Sized_incremental_binary::got_plt_reader): Add const.
1014 (Sized_incremental_binary::get_symtab_view): New function.
1015 (Sized_incremental_binary::Inputs_reader): New typedef.
1016 (Sized_incremental_binary::Input_entry_reader): New typedef.
1017 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1018 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1019 (Sized_incremental_binary::do_file_has_changed): New function.
1020 (Sized_incremental_binary::do_init_layout): New function.
1021 (Sized_incremental_binary::do_reserve_layout): New function.
1022 (Sized_input_reader::Inputs_reader): Remove.
1023 (Sized_input_reader::Input_entry_reader): Remove.
1024 (Sized_input_reader::do_arg_serial): New function.
1025 (Sized_input_reader::do_get_unused_symbol_count): New function.
1026 (Sized_input_reader::do_get_unused_symbol): New function.
1027 (Sized_incremental_binary::do_input_file_count): New function.
1028 (Sized_incremental_binary::do_get_input_reader): Change signature;
1029 use index instead of filename.
1030 (Sized_incremental_binary::section_map_): New data member.
1031 (Sized_incremental_binary::input_entry_readers_): New data member.
1032 (class Sized_incr_relobj): New class.
1033 (class Sized_incr_dynobj): New class.
1034 (make_sized_incremental_object): New function.
1035 (class Incremental_library): New class.
1036 * layout.cc (Free_list::num_lists): New static data member.
1037 (Free_list::num_nodes): New static data member.
1038 (Free_list::num_removes): New static data member.
1039 (Free_list::num_remove_visits): New static data member.
1040 (Free_list::num_allocates): New static data member.
1041 (Free_list::num_allocate_visits): New static data member.
1042 (Free_list::init): New function.
1043 (Free_list::remove): New function.
1044 (Free_list::allocate): New function.
1045 (Free_list::dump): New function.
1046 (Free_list::print_stats): New function.
1047 (Layout_task_runner::run): Resize output file for incremental updates.
1048 (Layout::Layout): Initialize new data members.
1049 (Layout::set_incremental_base): New function.
1050 (Layout::init_fixed_output_section): New function.
1051 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1052 incremental updates.
1053 (Layout::create_gold_note): Do not create gold note section for
1054 incremental updates.
1055 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1056 for incremental updates.
1057 (Layout::set_section_offsets): For incremental updates, allocate space
1059 (Layout::create_symtab_sections): Layout with offsets relative to
1060 start of section; for incremental updates, allocate space from free
1062 (Layout::create_shdrs): For incremental updates, allocate space from
1064 (Layout::finish_dynamic_section): For incremental updates, do not
1065 check --as-needed (fixed in subsequent patch).
1066 * layout.h (class Free_list): New class.
1067 (Layout::set_incremental_base): New function.
1068 (Layout::incremental_base): New function.
1069 (Layout::init_fixed_output_section): New function.
1070 (Layout::allocate): New function.
1071 (Layout::incremental_base_): New data member.
1072 (Layout::free_list_): New data member.
1073 * main.cc (main): Print Free_list statistics.
1074 * object.cc (Relobj::finalize_incremental_relocs): Add
1075 clear_counts parameter; clear counts only when clear_counts is set.
1076 (Sized_relobj::Sized_relobj): Initialize new base class.
1077 (Sized_relobj::do_layout): Don't report special sections.
1078 (Sized_relobj::do_for_all_local_got_entries): New function.
1079 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1080 symtab_off to all symbol table offsets.
1081 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1082 * object.h (class Got_offset_list): Move to top of file.
1083 (Object::Object): Allow case where input_file == NULL.
1084 (Object::~Object): Likewise.
1085 (Object::input_file): Assert that input_file != NULL.
1086 (Object::lock): Allow case where input_file == NULL.
1087 (Object::unlock): Likewise.
1088 (Object::is_locked): Likewise.
1089 (Object::token): Likewise.
1090 (Object::release): Likewise.
1091 (Object::is_incremental): New function.
1092 (Object::get_mtime): New function.
1093 (Object::for_all_local_got_entries): New function.
1094 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1095 (Object::set_is_in_system_directory): New function.
1096 (Object::is_in_system_directory): New function.
1097 (Object::do_is_incremental): New function.
1098 (Object::do_get_mtime): New function.
1099 (Object::do_for_all_local_got_entries): New function.
1100 (Object::is_in_system_directory_): New data member.
1101 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1102 (class Sized_relobj_base): New class.
1103 (class Sized_relobj): Derive from Sized_relobj_base.
1104 (class Sized_relobj::Symbols): Redeclare from base class.
1105 (class Sized_relobj::local_got_offset_list): Remove.
1106 (class Sized_relobj::Output_sections): Redeclare from base class.
1107 (class Sized_relobj::do_for_all_local_got_entries): New function.
1108 (class Sized_relobj::write_local_symbols): Add offset parameter.
1109 (class Sized_relobj::local_symbol_offset_): Update comment.
1110 (class Sized_relobj::local_dynsym_offset_): Update comment.
1111 * options.cc (Input_arguments::add_file): Remove const.
1112 * options.h (Input_file_argument::Input_file_argument):
1113 Initialize arg_serial_ (all constructors).
1114 (Input_file_argument::set_arg_serial): New function.
1115 (Input_file_argument::arg_serial): New function.
1116 (Input_file_argument::arg_serial_): New data member.
1117 (Input_arguments::Input_arguments): Initialize file_count_.
1118 (Input_arguments::add_file): Remove const.
1119 (Input_arguments::number_of_input_files): New function.
1120 (Input_arguments::file_count_): New data member.
1121 (Command_line::number_of_input_files): Call
1122 Input_arguments::number_of_input_files.
1123 * output.cc (Output_segment_headers::Output_segment_headers):
1125 (Output_section::Input_section::current_data_size): New function.
1126 (Output_section::Output_section): Initialize new data members.
1127 (Output_section::add_input_section): Don't do merge sections for
1128 an incremental link; allocate space from free list for an
1130 (Output_section::add_output_section_data): Allocate space from
1131 free list for an incremental update.
1132 (Output_section::update_data_size): New function.
1133 (Output_section::set_fixed_layout): New function.
1134 (Output_section::reserve): New function.
1135 (Output_segment::set_section_addresses): Remove const.
1136 (Output_segment::set_section_list_addresses): Remove const; allocate
1137 space from free list for an incremental update.
1138 (Output_segment::set_offset): Adjust size of RELRO segment for an
1140 * output.h (Output_data::current_data_size): Move here from
1142 (Output_data::pre_finalize_data_size): New function.
1143 (Output_data::update_data_size): New function.
1144 (Output_section_headers::update_data_size): new function.
1145 (Output_section_data_build::current_data_size): Move to Output_data.
1146 (Output_data_strtab::update_data_size): New function.
1147 (Output_section::current_data_size): Move to Output_data.
1148 (Output_section::set_fixed_layout): New function.
1149 (Output_section::has_fixed_layout): New function.
1150 (Output_section::reserve): New function.
1151 (Output_section::update_data_size): New function.
1152 (Output_section::has_fixed_layout_): New data member.
1153 (Output_section::free_list_): New data member.
1154 (Output_segment::set_section_addresses): Remove const.
1155 (Output_segment::set_section_list_addresses): Remove const.
1156 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1158 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1160 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1161 parameter when calling Add_symbols constructor; store argument
1162 serial number for members of a lib group.
1163 (Add_symbols::locks): Allow case where token == NULL.
1164 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1165 (Read_member::~Read_member): New function.
1166 (Read_member::is_runnable): New function.
1167 (Read_member::locks): New function.
1168 (Read_member::run): New function.
1169 (Check_script::~Check_script): New function.
1170 (Check_script::is_runnable): New function.
1171 (Check_script::locks): New function.
1172 (Check_script::run): New function.
1173 (Check_library::~Check_library): New function.
1174 (Check_library::is_runnable): New function.
1175 (Check_library::locks): New function.
1176 (Check_library::run): New function.
1177 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1178 (Add_symbols::library_): New data member.
1179 (class Read_member): New class.
1180 (class Check_script): New class.
1181 (class Check_library): New class.
1182 * reloc.cc (Read_relocs::is_runnable): Allow case where
1184 (Read_relocs::locks): Likewise.
1185 (Scan_relocs::locks): Likewise.
1186 (Relocate_task::locks): Likewise.
1187 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1189 (Sized_relobj::incremental_relocs_scan): Fix comment.
1190 (Sized_relobj::do_relocate): Pass output file offset to
1191 write_local_symbols.
1192 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1193 from class declaration.
1194 * script.cc (read_input_script): Allocate Script_info; pass
1195 argument serial number to report_script.
1196 * script.h (class Script_info): Move to incremental.h.
1197 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1198 * symtab.h (Symbol_table::add_from_incrobj): New function.
1199 (Symbol_table::set_file_offset): New function.
1203 * incremental-dump.cc (dump_incremental_inputs): Change signature
1204 to take a Sized_incremental_binary; change caller. Use readers
1205 in Sized_incremental_binary.
1207 (Sized_incremental_binary::find_incremental_inputs_sections):
1208 Rename do_find_incremental_inputs_sections to this.
1209 (Sized_incremental_binary::setup_readers): New function.
1210 (Sized_incremental_binary::do_check_inputs): Check
1211 has_incremental_info_ flag; move setup code to setup_readers;
1213 (Sized_incremental_binary::do_file_is_unchanged): New function.
1214 (Sized_incremental_binary::do_get_input_reader): New function.
1215 * incremental.h (class Incremental_binary): Move to end of file.
1216 (Incremental_binary::file_is_unchanged): New function.
1217 (Incremental_binary::do_file_is_unchanged): New function.
1218 (Incremental_binary::Input_reader): New class.
1219 (Incremental_binary::get_input_reader): New function.
1220 (class Sized_incremental_binary): Move to end of file.
1221 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1222 input section reader classes.
1223 (Sized_incremental_binary::has_incremental_info): New function.
1224 (Sized_incremental_binary::inputs_reader): New function.
1225 (Sized_incremental_binary::symtab_reader): New function.
1226 (Sized_incremental_binary::relocs_reader): New function.
1227 (Sized_incremental_binary::got_plt_reader): New function.
1228 (Sized_incremental_binary::do_file_is_unchanged): New function.
1229 (Sized_incremental_binary::Sized_input_reader): New class.
1230 (Sized_incremental_binary::get_input_reader): New function.
1231 (Sized_incremental_binary::find_incremental_inputs_sections):
1232 Rename do_find_incremental_inputs_sections to this.
1233 (Sized_incremental_binary::setup_readers): New function.
1234 (Sized_incremental_binary::has_incremental_info_): New data member.
1235 (Sized_incremental_binary::inputs_reader_): New data member.
1236 (Sized_incremental_binary::symtab_reader_): New data member.
1237 (Sized_incremental_binary::relocs_reader_): New data member.
1238 (Sized_incremental_binary::got_plt_reader_): New data member.
1239 (Sized_incremental_binary::current_input_file_): New data member.
1244 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1249 * archive.cc (Archive::include_member): Adjust call to report_object.
1250 (Add_archive_symbols::run): Add script_info to call to
1251 report_archive_begin.
1252 (Lib_group::include_member): Adjust call to report_object.
1253 (Add_lib_group_symbols::run): Adjust call to report_object.
1254 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1255 blocks. Add object count for script input files.
1256 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1257 script_info parameter; change all callers.
1258 (Incremental_inputs::report_object): Add script_info parameter;
1260 (Incremental_inputs::report_script): Store backpointer to
1261 incremental info entry.
1262 (Output_section_incremental_inputs::set_final_data_size): Record
1263 additional information for scripts.
1264 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1265 * incremental.h (Incremental_script_entry::add_object): New function.
1266 (Incremental_script_entry::get_object_count): New function.
1267 (Incremental_script_entry::get_object): New function.
1268 (Incremental_script_entry::objects_): New data member; adjust
1270 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1271 (Incremental_inputs::report_object): Add script_info parameter.
1272 (Incremental_inputs_reader::get_object_count): New function.
1273 (Incremental_inputs_reader::get_object_offset): New function.
1274 * options.cc (Input_arguments::add_file): Return reference to
1276 * options.h (Input_argument::set_script_info): New function.
1277 (Input_argument::script_info): New function.
1278 (Input_argument::script_info_): New data member; adjust all
1280 (Input_file_group::add_file): Return reference to new input argument.
1281 (Input_file_lib::add_file): Likewise.
1282 (Input_arguments::add_file): Likewise.
1283 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1284 * script.cc (Parser_closure::Parser_closure): Add script_info
1285 parameter; adjust all callers.
1286 (Parser_closure::script_info): New function.
1287 (Parser_closure::script_info_): New data member.
1288 (read_input_script): Report scripts earlier to incremental info.
1289 (script_add_file): Set script_info in Input_argument.
1290 (script_add_library): Likewise.
1291 * script.h (Script_options::Script_info): Rewrite class.
1295 * archive.cc (Library_base::should_include_member): Move
1296 method here from class Archive.
1297 (Archive::Archive): Initialize base class.
1298 (Archive::should_include_member): Move to base class.
1299 (Archive::do_for_all_unused_symbols): New function.
1300 (Add_archive_symbols::run): Remove redundant access to
1302 (Lib_group::Lib_group): Initialize base class.
1303 (Lib_group::do_filename): New function.
1304 (Lib_group::include_member): Pass pointer to Lib_group to
1306 (Lib_group::do_for_all_unused_symbols): New function.
1307 (Add_lib_group_symbols::run): Report archive information for
1309 * archive.h (class Library_base): New base class.
1310 (class Archive): Derive from Library_base.
1311 (Archive::filename): Move to base class.
1312 (Archive::set_incremental_info): Likewise.
1313 (Archive::incremental_info): Likewise.
1314 (Archive::Should_include): Likewise.
1315 (Archive::should_include_member): Likewise.
1316 (Archive::Armap_entry): Remove.
1317 (Archive::Unused_symbol_iterator): Remove.
1318 (Archive::unused_symbols_begin): Remove.
1319 (Archive::unused_symbols_end): Remove.
1320 (Archive::do_filename): New function.
1321 (Archive::do_get_mtime): New function.
1322 (Archive::do_for_all_unused_symbols): New function.
1323 (Archive::task_): Move to base class.
1324 (Archive::incremental_info_): Likewise.
1325 (class Lib_group): Derive from Library_base.
1326 (Lib_group::do_filename): New function.
1327 (Lib_group::do_get_mtime): New function.
1328 (Lib_group::do_for_all_unused_symbols): New function.
1329 (Lib_group::task_): Move to base class.
1330 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1332 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1334 * incremental.cc (Incremental_inputs::report_archive_begin):
1335 Use Library_base; call library's get_mtime; add incremental inputs
1336 entry before members.
1337 (class Unused_symbol_visitor): New class.
1338 (Incremental_inputs::report_archive_end): Use Library_base; use
1339 visitor class to record unused symbols; don't add incremental inputs
1340 entry after members.
1341 (Incremental_inputs::report_object): Use Library_base.
1343 (Incremental_archive_entry::Incremental_archive_entry): Remove
1344 unused Archive parameter.
1345 (Incremental_inputs::report_archive_begin): Use Library_base.
1346 (Incremental_inputs::report_archive_end): Likewise.
1347 (Incremental_inputs::report_object): Likewise.
1348 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1350 * object.h (Object::for_all_global_symbols): New function.
1351 (Object::do_for_all_global_symbols): New function.
1352 (Sized_relobj::do_for_all_global_symbols): New function.
1353 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1355 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1360 * archive.cc (Archive::interpret_header): Return -1 if something
1361 goes wrong. Change callers accordingly.
1365 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1366 * testsuite/Makefile.in: Regenerate.
1370 * plugin.cc (get_view): New.
1371 (Plugin::load): Pass get_view to the plugin.
1372 (Plugin_manager::get_view): New.
1376 * testsuite/final_layout.sh: Rewrite to not use dc.
1377 * testsuite/relro_test.sh: Fail if dc is not present.
1381 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1383 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1384 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1386 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1387 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1391 * script-sections.cc (Sort_output_sections::script_compare):
1392 Rename from is_before, change return type.
1393 (Sort_output_sections::operator()): Adjust accordingly.
1398 * testsuite/odr_violation2.cc: Add comment to make all error line
1399 numbers double digits.
1400 * testsuite/debug_msg.sh: Adjust expected errors.
1404 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1405 but mark earlier ones as non-canonical
1406 (offset_to_iterator): Update search target and example
1407 (do_addr2line): Return extra lines in a vector*
1408 (format_file_lineno): Extract from do_addr2line
1409 (one_addr2line): Add vector* out-param
1410 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1411 when a lineno entry appeared last for its instruction
1412 (Dwarf_line_info): Add vector* out-param
1413 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1414 * symtab.cc (Odr_violation_compare): Include the lineno in the
1416 (linenos_from_loc): New. Combine the canonical line for an
1417 address with its other lines.
1418 (True_if_intersect): New. Helper functor to make
1419 std::set_intersection a query.
1420 (detect_odr_violations): Compare sets of lines instead of just
1421 one line for each function. This became less deterministic, but
1422 has fewer false positives.
1423 * symtab.h: Declarations.
1424 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1425 mix an optimized and non-optimized object in the same binary
1426 (odr_violation2.so): Same.
1427 * testsuite/Makefile.in: Regenerate from Makefile.am.
1428 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1429 * testsuite/debug_msg.sh: Update line numbers and add
1431 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1432 non-optimized context.
1433 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1434 isn't inlined, and use OdrDerived in an optimized context.
1435 * testsuite/odr_header1.h: Defines OdrDerived, where
1436 optimization will change the
1437 first-instruction-in-the-destructor's file and line number.
1438 * testsuite/odr_header2.h: Defines OdrBase.
1442 * fileread.cc (File_read::clear_views): Don't delete the whole
1448 * fileread.cc: #include <climits>.
1449 (GOLD_IOV_MAX): Define.
1450 (File_read::read_multiple): Limit number of entries by iov_max.
1451 * fileread.h (class File_read): Always set max_readv_entries to
1457 * options.h (class General_options): Add -dy and -dn.
1461 * testsuite/script_test_9.t: Add TLS segment.
1465 * configure.ac: Add check for gnu_indirect_function support in
1466 the toolchain building binutils.
1467 * configure: Rebuild.
1471 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1472 plugin only symbols.
1473 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1474 in plugin files as not needed in the symbol table.
1478 * output.cc (Output_section::add_input_section): Delay fill
1479 generation for section ordering.
1484 * object.h (class Sized_relobj): Remove clear_local_symbols.
1485 * reloc.cc (Sized_relobj::do_relocate): Don't call
1486 clear_local_symbols.
1490 * plugin.cc (is_visible_from_outside): Return true for symbols
1495 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1500 * icf.h (is_section_foldable_candidate): Change type of parameter
1502 * icf.cc (Icf::find_identical_sections): Change type of local variable
1503 section_name to be std::string.
1504 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1508 * script.cc (script_add_extern): Rewrite to use
1509 add_symbol_reference.
1513 * icf.cc (get_section_contents): Always lock section's object.
1517 * options.h (class General_options): Accept
1518 --no-detect-odr-violations.
1522 * version.cc (version_string): Bump to 1.11.
1526 * plugin.cc (class Plugin_rescan): Define new class.
1527 (Plugin_manager::claim_file): Set any_claimed_.
1528 (Plugin_manager::save_archive): New function.
1529 (Plugin_manager::save_input_group): New function.
1530 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1532 (Plugin_manager::new_undefined_symbol): New function.
1533 (Plugin_manager::rescan): New function.
1534 (Plugin_manager::rescannable_defines): New function.
1535 (Plugin_manager::add_input_file): Set any_added_.
1536 * plugin.h (class Plugin_manager): define new fields rescannable_,
1537 undefined_symbols_, any_claimed_, and any_added_. Declare
1538 Plugin_rescan as friend. Declare new functions.
1539 (Plugin_manager::Rescannable): Define type.
1540 (Plugin_manager::Rescannable_list): Define type.
1541 (Plugin_manager::Undefined_symbol_list): Define type.
1542 (Plugin_manager::Plugin_manager): Initialize new fields.
1543 * archive.cc (Archive::defines_symbol): New function.
1544 (Add_archive_symbols::run): Pass archive to plugins if any.
1545 * archive.h (class Archive): Declare defines_symbol.
1546 * readsyms.cc (Input_group::~Input_group): New function.
1547 (Finish_group::run): Pass input_group to plugins if any.
1548 * readsyms.h (class Input_group): Declare destructor.
1549 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1554 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1556 (Layout::set_segment_offsets): Reset increase_relro before calling
1557 set_section_addresses a second time.
1561 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1562 sections before NOBITS sections.
1566 * version.cc (print_version): Update copyright to 2011.
1570 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1571 of OS to this->add. Add OD parameter to second form of the function.
1575 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1576 second of two consecutive entries with same offset.
1580 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1581 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1582 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1583 to avoid unneeded links against $(LDADD).
1584 * testsuite/Makefile.in: Regenerate.
1589 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1590 for R_X86_64_32 and R_X86_64_PC32.
1591 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1592 ver_matching_def_pic.o.
1593 (ver_matching_def_pic.o): New target.
1597 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1598 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1599 Move definition before File_read::View member definitions.
1600 (File_read::View::~View): Initialize and hold lock before
1601 updating current_mapped_bytes.
1605 * dwarf_reader.cc: Remove outdated comment.
1606 * gold-threads.cc: Fix typo in error message.
1607 * archive.cc: Fix typos in comments.
1608 * archive.h: Likewise.
1609 * arm-reloc-property.cc: Likewise.
1610 * arm-reloc-property.h: Likewise.
1611 * arm-reloc.def: Likewise.
1613 * attributes.h: Likewise.
1614 * cref.cc: Likewise.
1615 * ehframe.cc: Likewise.
1616 * fileread.h: Likewise.
1618 * i386.cc: Likewise.
1620 * incremental.h: Likewise.
1621 * int_encoding.cc: Likewise.
1622 * layout.h: Likewise.
1623 * main.cc: Likewise.
1624 * merge.h: Likewise.
1625 * object.cc: Likewise.
1626 * object.h: Likewise.
1627 * options.cc: Likewise.
1628 * readsyms.cc: Likewise.
1629 * reduced_debug_output.cc: Likewise.
1630 * reloc.cc: Likewise.
1631 * script-sections.cc: Likewise.
1632 * sparc.cc: Likewise.
1633 * symtab.h: Likewise.
1634 * target-reloc.h: Likewise.
1635 * target.cc: Likewise.
1636 * target.h: Likewise.
1637 * timer.cc: Likewise.
1638 * timer.h: Likewise.
1639 * x86_64.cc: Likewise.
1643 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1645 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1646 parameter; change all callers.
1647 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1648 * options.h (warn_execstack): New option.
1652 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1653 like function call relocations.
1657 * archive.cc (Archive::get_elf_object_for_member): Permit
1658 punconfigured to be NULL.
1659 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1660 (Archive::include_member): Pass NULL to get_elf_object_for_member
1661 if we searched for the archive and this is the first included
1666 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1667 track_relocs_type_ field.
1668 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1669 Set track_relocs_type_.
1670 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1671 contents when using RELA relocs.
1672 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1674 * reloc.cc (Track_relocs::next_addend): New function.
1675 * reloc.h (class Track_relocs): Declare next_addend.
1679 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1684 * README: Update compilers known to work and fail.
1688 * configure.in: For --enable-gold, handle value `default' instead of
1689 `both*'. Always install ld as ld.bfd, install as ld if gold is
1691 * configure: Regenerate.
1695 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1696 and right_alignment to be zero. Store result alignment only if it is
1697 greater than existing alignment.
1702 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1703 Check for ".zdebug_line".
1708 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1709 by reference; adjust all callers.
1710 * output.cc (Output_segment::set_section_addresses): Adjust references
1711 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1713 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1714 end at page boundary.
1719 * layout.cc (Layout::choose_output_section): Transform names of
1720 compressed sections even when using a script with a SECTIONS clause.
1721 (Layout::output_section_name): Remove code to transform
1722 compressed debug section names.
1723 * output.cc (Output_section::add_input_section): Use uncompressed
1724 section size when tracking input sections.
1728 * symtab.h (Symbol::NON_PIC_REF): Remove.
1729 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1730 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1731 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1732 (Symbol::use_plt_offset): Take a flags argument and pass it
1733 directly to needs_dynamic_reloc. Restrict check for undefined
1734 weak symbols to function calls.
1735 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1736 (Target_arm::Scan::global): Use it.
1737 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1738 (Target_arm::Relocate::relocate): Likewise.
1739 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1740 parameter with an r_type parameter. Use get_reference_flags
1742 (Target_arm::Relocate::relocate): Update accordingly.
1743 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1744 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1745 (Target_i386::Scan::global): Likewise.
1746 (Target_i386::Relocate::relocate): Likewise.
1747 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1748 parameter with an r_type parameter. Use get_reference_flags
1750 (Target_i386::Relocate::relocate): Update accordingly.
1751 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1752 (Target_powerpc::Scan::global): Use it.
1753 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1754 (Target_powerpc::Relocate::relocate): Likewise.
1755 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1756 (Target_sparc::Scan::global): Use it.
1757 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1758 (Target_sparc::Relocate::relocate): Likewise.
1759 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1760 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1761 (Target_x86_64::Scan::global): Likewise.
1762 (Target_x86_64::Relocate::relocate): Likewise.
1767 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1768 (Arm_exidx_merge_section::section_contents_): New data member.
1769 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1770 (Arm_input_section::~Arm_input_section): De-allocate memory.
1771 (Arm_input_section::original_contents_): New data member.
1772 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1773 in parameters instead of calling Object::section_contents without
1775 (Arm_output_section::group_section): New parameter TASK. Pass it
1776 to callees that need locking objects.
1777 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1778 to lock EXIDX input sections. Fix a formatting issue. Call
1779 Arm_exidx_merged_section::build_contents to create merged section
1781 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1782 to lock object of stub table owner.
1783 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1784 TEXT_SIZE to initialize data member TEXT_SIZE_.
1785 (Arm_exidx_input_section::addralign): Fix typo in comment.
1786 (Arm_exidx_input_section::text_size): New method.
1787 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1788 that require locking objects. Lock objects before scanning for stubs
1789 and updating local symbols.
1790 (Arm_input_section<big_endian>::init): Copy contents of original
1792 (Arm_input_section<big_endian>::do_write): Use saved contents of
1793 original input section instead of calling Object::section_contents
1795 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1796 size without calling Object::section_size().
1797 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1798 for size. Allocate a buffer for merged EXIDX entries.
1799 (Arm_exidx_merged_section::build_contents): New method.
1800 (Arm_exidx_merged_section::do_write): Move merge section contents
1801 building code to Arm_exidx_merged_section::build_contetns. Write
1802 out contetns in buffer instead of building it on the fly.
1803 (Arm_relobj::make_exidx_input_section): Also pass text section size
1804 to Arm_exidx_input_section constructor.
1805 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1806 (Arm_dynobj::do_read_symbols): Fix memory leak.
1807 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1808 * target.h: (class Task): Add forward declaration.
1809 (Target::relax): Add new parameter TASK and pass it to
1811 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1816 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1817 object when reading from the file.
1818 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1820 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1821 when reading section contents.
1822 (get_section_contents): Likewise.
1823 (icf::find_identical_sections): Likewise.
1824 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1825 object when reading from the file.
1826 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1827 the object when doing deferred section layout.
1832 * script.h (class Symbol_assignment: name): New member. Returns
1833 the name of the symbol.
1834 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1835 Returns true if the given symbol name is on the list of
1836 assignments wating to be processed.
1837 * archive.cc (should_incldue_member): If the symbol is undefined,
1838 check to see if it is on the list of symbols pending assignment.
1842 * script-sections.cc (Script_sections::find_memory_region): Check
1843 for a NULL output section pointer.
1847 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1848 Output_section::add_relaxed_input_section.
1849 * output.cc (Output_section::add_relaxed_input_section): Add new
1850 arguments LAYOUT and NAME. Set section order index.
1851 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1852 Copy section order index.
1853 * output.h (Output_section::add_relaxed_input_section): Add new
1854 arguments LAYOUT and NAME.
1858 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1859 NATIVE_OR_CROSS_LINKER.
1860 * testsuite/Makefile.in: Regenerate.
1864 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1865 without SHF_LINK_ORDER flags.
1866 * layout.cc (Layout::choose_output_section): Do not filter
1867 SHF_LINK_ORDER flag in a relocatable link.
1871 * output.h (Output_segment::set_section_addresses): Change function
1872 signature. Update all callers.
1873 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1875 (Output_segment::set_section_addresses): Align after last TLS
1876 section. Add padding before last relro section instead of after.
1880 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1881 GOT output section to be writable.
1885 * debug.h (DEBUG_INCREMENTAL): New flag.
1886 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1887 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1889 * incremental.cc (report_command_line): Ignore all forms of
1891 * layout.cc (Layout::Layout): Check parameters for incremental link
1893 * options.cc (General_options::parse_incremental): New function.
1894 (General_options::parse_no_incremental): New function.
1895 (General_options::parse_incremental_full): New function.
1896 (General_options::parse_incremental_update): New function.
1897 (General_options::incremental_mode_): New data member.
1898 (General_options::finalize): Check incremental_mode_.
1899 * options.h (General_options): Update help text for --incremental.
1900 Add --no-incremental, --incremental-full, --incremental-update.
1901 (General_options::Incremental_mode): New enum type.
1902 (General_options::incremental_mode): New function.
1903 (General_options::incremental_mode_): New data member.
1904 * parameters.cc (Parameters::incremental_mode_): New data member.
1905 (Parameters::set_options): Set incremental_mode_.
1906 (Parameters::set_incremental_full): New function.
1907 (Parameters::incremental): New function.
1908 (Parameters::incremental_update): New function.
1909 (set_parameters_incremental_full): New function.
1910 * parameters.h (Parameters::set_incremental_full): New function.
1911 (Parameters::incremental): New function.
1912 (Parameters::incremental_update): New function.
1913 (Parameters::incremental_mode_): New data member.
1914 (set_parameters_incremental_full): New function.
1915 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1916 incremental link mode.
1917 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1918 (Sized_relobj::do_relocate_sections): Likewise.
1919 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1921 * testsuite/Makefile.in: Regenerate.
1922 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1926 * script-sections.h (class Script_sections): Make
1927 Sections_elements typedef public.
1928 * script-sections.cc (class Sort_output_sections): Add elements_
1929 field. Add constructor which sets it; change all callers.
1930 (Sort_output_sections::is_before): New function.
1931 (Sort_output_sections::operator()): Call is_before.
1932 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1934 * testsuite/script_test_10.sh: New test. Test script section
1936 * testsuite/script_test_10.t: Likewise.
1937 * testsuite/script_test_10.s: Likewise.
1938 * testsuite/Makefile.am: Wrap the cross linker tests and the
1939 common tests into NATIVE_OR_CROSS_LINKER.
1940 (check_SCRIPTS): Add script_test_10.sh.
1941 (check_DATA): Add script_test_10.stdout.
1942 (script_test_10.o, script_test_10): New targets.
1943 (script_test_10.stdout): New target.
1944 * configure, testsuite/Makefile.in: Regenerate.
1948 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1949 error for the deprecated relocations.
1950 (Target_arm::Scan::global): Likewise.
1951 (Target_arm::Relocate::relocate): Likewise.
1955 * fileread.cc (Input_file::find_file): Initialize *found_name
1956 and *namep when using the fallback search for case 4.
1960 * options.h (class General_options): Redefine -z lazy as an alias for
1961 the negation of -z now.
1965 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1970 * script-sections.cc(class Memory_region): Remove
1971 current_lma_offset_ field. Rename current_vma_offset_ to
1972 current_offset_. Add last_section_ field.
1973 (Memory_region::get_current_vma_address): Rename to
1974 get_current_address.
1975 (Memory_region::get_current_lma_address): Delete.
1976 (Memory_region::increment_vma_offset): Rename to
1978 (Memory_region::increment_lma_offset): Delete.
1979 (Memory_region::attributes_compatible): New method. Returns
1980 true if the provided section is compatible with the region.
1981 (Memory_region::get_last_section): New method. Returns the last
1982 section to use the region.
1983 (Memory_region::set_last_section): New method. Stores the last
1984 section to use the region.
1985 (Script_sections::block_in_region): New method. Returns true if
1986 a block of memory is contained within a region.
1987 (Script_sections::find_memory_region): New method. Locates a
1988 memory region to be used to set a VMA or LMA address.
1989 (Output_section_definition::set_section_addresses): Add code to
1990 check for addresses set by memory regions.
1991 (Output_segment::set_section_addresses): Remove memory region
1993 (Script_sections::create_segment): Add a warning if a header
1994 segment is created outside of any region.
1995 * script-sections.h (class Script_sections): Add prototypes for
1996 find_memory_region and block_in_region methods.
1997 * testsuite/memory_test.s: Use .long instead of .word.
1998 * testsuite/memory_test.t: Add some more output sections.
1999 * testsuite/memory_test.sh: Update expected output.
2003 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2004 defintion to symtab.h
2005 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2006 declaration to defintion.
2010 * expression.cc (eval): Replace dummy argument with NULL.
2011 (eval_maybe_dot): Check for a NULL result section pointer.
2012 (Symbol_expression::value): Likewise.
2013 (Dot_expression::value): Likewise.
2014 (BINARY_EXPRESSION): Likewise.
2015 (Max_expression::value): Likewise.
2016 (Min_expression::value): Likewise.
2017 (Absolute_expression::value): Likewise.
2018 (Addr_expression::value_from_output_section): Likewise.
2019 (Loaddddr_expression::value_from_output_section): Likewise.
2020 (Segment_start_expression::value): Likewise.
2021 * script-sections.cc
2022 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2024 (Sections_elememt_dot_assignment::set_section_addresses):
2026 (Output_data_expression::do_write_to_buffer): Likewise.
2027 (Output_section_definition::finalize_symbols): Likewise.
2028 (Output_section_definition::set_section_addresses): Likewise.
2032 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2036 * target.h (Target::can_icf_inline_merge_sections): New virtual
2038 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2040 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2042 * icf.cc (get_section_contents): Inline merge sections only when
2047 * configure: Regenerate.
2051 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2052 * testsuite/Makefile.am (memory_test.o): New target.
2053 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2055 * testsuite/Makefile.in: Rebuild.
2059 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2060 defintion if relocation uses GOT entries of the symbol.
2061 * testsuite/icf_safe_test.sh: Fix test.
2062 * testsuite/icf_safe_so_test.sh: Fix test.
2066 * script_sections.cc (class Memory_region): Remove "NULL" from
2067 vector initializations.
2071 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2072 Resolve forwarding symbols.
2076 * gold/testsuite/script_test_3.t: Add ARM special sections.
2077 * gold/testsuite/script_test_4.t: Same.
2078 * gold/testsuite/script_test_5.t: Same.
2079 * gold/testsuite/script_test_6.t: Same.
2080 * gold/testsuite/script_test_7.t: Same.
2081 * gold/testsuite/script_test_7.t: Same.
2082 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2086 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2087 (Target_x86_64::Relocate::relocate_tls): Replace check for
2088 saw_tls_block_reloc_ with test for executable section.
2092 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2093 position-independent executables to shared libraries need dynamic
2095 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2096 position-independent executables.
2097 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2098 * testsuite/Makefile.in: Regenerate.
2103 * testsuite/memory_test.t: Discard any sections that are not
2109 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2110 "This::" to work around a bug in gcc 4.2.
2112 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2116 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2117 sections with different PF_X flags in the same segment.
2118 (Layout::find_first_load_seg): Search all segments to find the first
2120 * options.h (rosegment): New.
2124 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2128 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2129 (Arm_relobj::do_relocate_sections): Add new parameter for output
2130 file to match the parent.
2131 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2132 of local symbols instead of input values. Update code to track
2133 changes in gold::relocate_section.
2134 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2135 (Sized_relobj::compute_final_local_value_internal): New methods.
2136 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2137 body into private version of Sized_relobj::compute_final_local_value.
2138 Call the inline method.
2139 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2140 merged symbol value if there is one.
2141 (Symbol_value::has_output_value): New method defintiion.
2142 (Sized_relobj::Compute_final_local_value_status): New enum type.
2143 (Sized_relobj::compute_final_local_value): New methods.
2144 (Sized_relobj::compute_final_local_value_internal): New methods.
2145 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2146 and arm_cortex_a8.sh.
2147 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2148 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2150 * Makefile.in: Regenerate.
2151 * testsuite/arm_bl_out_of_range.s: Update test.
2152 * testsuite/thumb_bl_out_of_range.s: Ditto.
2153 * testsuite/thumb_blx_out_of_range.s: Ditto.
2154 * testsuite/arm_branch_out_of_range.sh: New file.
2155 * testsuite/arm_cortex_a8.sh: Ditto.
2156 * testsuite/arm_cortex_a8_b.s: Ditto.
2157 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2158 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2159 * testsuite/arm_cortex_a8_bl.s: Ditto.
2160 * testsuite/arm_cortex_a8_blx.s: Ditto.
2161 * testsuite/arm_cortex_a8_local.s: Ditto.
2162 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2163 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2167 * Makefile.am (memory_test.stdout): Run readelf with -W.
2168 * Makefile.in: Regenerate.
2169 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2174 * script-sections.cc (Script_sections::add_memory_region): Convert
2175 field precision to int.
2176 * script.cc (script_set_section_region, script_set_section_region):
2177 Convert field precision to int.
2181 * arm.cc (do_finalize_sections): Create the __exidx_start and
2182 __exdix_end symbols even when the section is missing.
2186 * README: Remove claim that MEMORY is not supported.
2187 * expression.cc (script_exp_function_origin)
2188 (script_exp_function_length): Move from here to ...
2189 * script.cc: ... here.
2190 (script_set_section_region, script_add_memory)
2191 (script_parse_memory_attr, script_include_directive): New
2193 * script-sections.cc
2194 (class Memory_region): New class.
2195 (class Output_section_definition): Add set_memory_region,
2196 set_section_vma, set_section_lma and get_section_name methods.
2197 (class Script_Sections): Add add_memory_region,
2198 find_memory_region, find_memory_region_origin,
2199 find_memory_region_length and set_memory_region methods.
2200 Have set_section_addresses method walk the list of set memory
2202 Extend the print methos to display memory regions.
2203 * script-sections.h: Add prototypes for new methods.
2204 Add enum for MEMORY region attributes.
2205 * yyscript.y: Add support for parsing MEMORY regions.
2206 * script-c.h: Add prototypes for new functions.
2207 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2208 * testsuite/Makefile.in: Regenerate.
2209 * testsuite/memory_test.sh: New script.
2210 * testsuite/memory_test.s: New assembler source file.
2211 * testsuite/memory_test.t: New linker script.
2215 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2216 reference override an existing dynamic weak reference.
2217 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2218 * testsuite/Makefile.in: Regenerate.
2219 * testsuite/dyn_weak_ref.sh: New file.
2220 * testsuite/dyn_weak_ref_1.c: Ditto.
2221 * testsuite/dyn_weak_ref_2.c: Ditto.
2225 * incremental.h (class Incremental_input_entry): Add virtual
2230 * testsuite/start_lib_test_3.c: Mark t3 as used.
2234 * options.cc (version_script): Fix small typo in previous
2239 * archive.cc: Formatting fixes: Remove whitespace between
2240 typename and following asterisk. Remove whitespace between
2241 function name and opening parenthesis.
2242 * archive.h: Likewise.
2244 * attributes.cc: Likewise.
2245 * attributes.h: Likewise.
2246 * common.cc: Likewise.
2247 * copy-relocs.cc: Likewise.
2248 * dirsearch.h: Likewise.
2249 * dynobj.cc: Likewise.
2250 * ehframe.cc: Likewise.
2251 * ehframe.h: Likewise.
2252 * expression.cc: Likewise.
2253 * fileread.cc: Likewise.
2254 * fileread.h: Likewise.
2256 * gold-threads.cc: Likewise.
2257 * gold.cc: Likewise.
2258 * i386.cc: Likewise.
2260 * incremental-dump.cc: Likewise.
2261 * incremental.cc: Likewise.
2262 * layout.cc: Likewise.
2263 * layout.h: Likewise.
2264 * main.cc: Likewise.
2265 * merge.cc: Likewise.
2266 * merge.h: Likewise.
2267 * object.cc: Likewise.
2268 * object.h: Likewise.
2269 * options.cc: Likewise.
2270 * options.h: Likewise.
2271 * output.cc: Likewise.
2272 * output.h: Likewise.
2273 * plugin.cc: Likewise.
2274 * plugin.h: Likewise.
2275 * powerpc.cc: Likewise.
2276 * reloc.cc: Likewise.
2277 * script-c.h: Likewise.
2278 * script-sections.cc: Likewise.
2279 * script.cc: Likewise.
2280 * stringpool.cc: Likewise.
2281 * symtab.cc: Likewise.
2282 * symtab.h: Likewise.
2283 * target.cc: Likewise.
2284 * timer.cc: Likewise.
2285 * timer.h: Likewise.
2286 * version.cc: Likewise.
2287 * x86_64.cc: Likewise.
2292 * layout.cc (segment_precedes): Sort segments by their physical
2293 addresses, if they have been set.
2297 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2299 (Lib_group::include_member): Unlock object after deleting its
2301 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2307 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2308 constructor, and set_blocker.
2309 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2311 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2312 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2313 * testsuite/Makefile.am (start_lib_test): New test case.
2314 * testsuite/Makefile.in: Regenerate.
2315 * testsuite/start_lib_test_main.c: New file.
2316 * testsuite/start_lib_test_1.c: New file.
2317 * testsuite/start_lib_test_2.c: New file.
2318 * testsuite/start_lib_test_3.c: New file.
2322 * Makefile.in: Rebuild with automake 1.11.1.
2323 * aclocal.m4: Likewise.
2324 * testsuite/Makefile.in: Likewise.
2329 * i386.cc (class Output_data_plt_i386): Update declarations.
2330 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2331 local_ifuncs_ fields.
2332 (Target_i386::do_plt_section_for_global): New function.
2333 (Target_i386::do_plt_section_for_local): New function.
2334 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2335 parameter; change all callers. Initialize global_ifuncs_ and
2336 local_ifuncs_. If doing a static link define __rel_iplt_start and
2338 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2339 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2340 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2342 (Target_i386::make_plt_section): New function, broken out of
2343 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2344 (Target_i386::make_plt_entry): Call make_plt_section.
2345 (Target_i386::make_local_ifunc_plt_entry): New function.
2346 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2347 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2348 R_386_IRELATIVE to switch.
2349 (Target_i386::Scan::global): Likewise.
2350 (Target_i386::Relocate::relocate): Likewise.
2351 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2353 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2354 (Target_x86_64::do_plt_section_for_global): New function.
2355 (Target_x86_64::do_plt_section_for_local): New function.
2356 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2357 parameter; change all callers. If doing a static link define
2358 __rela_iplt_start and __rela_iplt_end.
2359 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2360 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2361 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2363 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2364 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2366 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2367 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2368 R_X86_64_IRELATIVE to switch.
2369 (Target_x86_64::Scan::global): Likewise.
2370 (Target_x86_64::Relocate::relocate): Likewise.
2371 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2373 * target.h (class Target): Add plt_section_for_global and
2374 plt_section_for_local functions. Add do_plt_section_for_global
2375 and do_plt_section_for_local virtual functions.
2376 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2377 clarifying comments.
2378 (Symbol::use_plt_offset): Handle IFUNC symbol.
2379 * object.cc (Sized_relobj::Sized_relobj): Initialize
2381 (Sized_relobj::local_has_plt_offset): New function.
2382 (Sized_relobj::local_plt_offset): New function.
2383 (Sized_relobj::set_local_plt_offset): New function.
2384 (Sized_relobj::do_count): Handle IFUNC symbol.
2385 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2386 a bit away from input_shndx_ field. Add set_is_func_symbol and
2387 is_ifunc_symbol functions.
2388 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2389 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2390 local_plt_offsets_ field.
2391 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2392 * output.h (class Output_section_data): Add non-const
2393 output_section function.
2394 (class Output_data_got): Update declarations.
2395 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2396 Add use_plt_offset parameter to global and local constructors.
2397 Change all callers. Change local_sym_index_ field to 31 bits.
2398 Change GSYM_CODE and CONSTANT_CODE accordingly.
2399 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2400 doing a static link don't set sh_link field.
2401 (Output_data_got::Got_entry::write): Use PLT offset if
2403 (Output_data_got::add_global_plt): New function.
2404 (Output_data_got::add_local_plt): New function.
2405 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2406 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2407 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2408 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2409 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2411 * testsuite/ifunc-sel.h: New file.
2412 * testsuite/ifuncmain1.c: New file.
2413 * testsuite/ifuncmain1vis.c: New file.
2414 * testsuite/ifuncmod1.c: New file.
2415 * testsuite/ifuncdep2.c: New file.
2416 * testsuite/ifuncmain2.c: New file.
2417 * testsuite/ifuncmain3.c: New file.
2418 * testsuite/ifuncmod3.c: New file.
2419 * testsuite/ifuncmain4.c: New file.
2420 * testsuite/ifuncmain5.c: New file.
2421 * testsuite/ifuncmod5.c: New file.
2422 * testsuite/ifuncmain6pie.c: New file.
2423 * testsuite/ifuncmod6.c: New file.
2424 * testsuite/ifuncmain7.c: New file.
2425 * configure, testsuite/Makefile.in: Rebuild.
2430 (Output_section_incremental_inputs::write_input_files): Add cast
2431 to avoid signed/unsigned comparison warning.
2432 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2436 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2440 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2445 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2446 defintion overrides non-weak undef, remember that the original undef
2448 * symtab.cc (Symbol_table::sized_write_global): For undef without
2449 an original weak binding, set binding to global in output.
2450 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2451 * testsuite/Makefile.in: Regenerate.
2452 * testsuite/strong_ref_weak_def.sh: New file.
2453 * testsuite/strong_ref_weak_def_1.c: Ditto.
2454 * testsuite/strong_ref_weak_def_2.c: Ditto.
2458 * testsuite/incremental_test.sh: Rewrite.
2459 * testsuite/incremental_test_1.c: Rewrite.
2460 * testsuite/incremental_test_2.c: Rewrite.
2464 * arm.cc (Target_arm::got_size): Add const.
2465 (Target_arm::got_entry_count): New function.
2466 (Target_arm::plt_entry_count): New function.
2467 (Target_arm::first_plt_entry_offset): New function.
2468 (Target_arm::plt_entry_size): New function.
2469 (Output_data_plt_arm::entry_count): New function.
2470 (Output_data_plt_arm::first_plt_entry_offset): New function.
2471 (Output_data_plt_arm::get_plt_entry_size): New function.
2472 * i386.cc (Target_i386::got_size): Add const.
2473 (Target_i386::got_entry_count): New function.
2474 (Target_i386::plt_entry_count): New function.
2475 (Target_i386::first_plt_entry_offset): New function.
2476 (Target_i386::plt_entry_size): New function.
2477 (Output_data_plt_i386::entry_count): New function.
2478 (Output_data_plt_i386::first_plt_entry_offset): New function.
2479 (Output_data_plt_i386::get_plt_entry_size): New function.
2480 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2481 find_incremental_inputs_sections. Dump incremental_got_plt section.
2482 * incremental.cc: Include target.h.
2483 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2484 parameter. Adjust all callers. Find incremental_got_plt section.
2485 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2487 (Output_section_incremental_inputs::set_final_data_size): Calculate
2488 size of incremental_got_plt section.
2489 (Output_section_incremental_inputs::do_write): Write the
2490 incremental_got_plt section.
2491 (Got_plt_view_info): New struct.
2492 (Local_got_offset_visitor): New class.
2493 (Global_got_offset_visitor): New class.
2494 (Global_symbol_visitor_got_plt): New class.
2495 (Output_section_incremental_inputs::write_got_plt): New function.
2496 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2497 Add parameter. Adjust all callers.
2498 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2499 (Incremental_inputs::got_plt_section): New function.
2500 (Incremental_inputs::got_plt_section_): New data member.
2501 (Incremental_got_plt_reader): New class.
2502 * layout.cc (Layout::create_incremental_info_sections): Add the
2503 incremental_got_plt section.
2504 * object.h (Got_offset_list::get_list): New function.
2505 (Got offset_list::for_all_got_offsets): New function.
2506 (Sized_relobj::local_got_offset_list): New function.
2507 * powerpc.cc (Target_powerpc::got_size): Add const.
2508 (Target_powerpc::got_entry_count): New function.
2509 (Target_powerpc::plt_entry_count): New function.
2510 (Target_powerpc::first_plt_entry_offset): New function.
2511 (Target_powerpc::plt_entry_size): New function.
2512 (Output_data_plt_powerpc::entry_count): New function.
2513 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2514 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2515 * sparc.cc (Target_sparc::got_size): Add const.
2516 (Target_sparc::got_entry_count): New function.
2517 (Target_sparc::plt_entry_count): New function.
2518 (Target_sparc::first_plt_entry_offset): New function.
2519 (Target_sparc::plt_entry_size): New function.
2520 (Output_data_plt_sparc::entry_count): New function.
2521 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2522 (Output_data_plt_sparc::get_plt_entry_size): New function.
2523 * symtab.h (Symbol::got_offset_list): New function.
2524 (Symbol_table::for_all_symbols): New function.
2525 * target.h (Sized_target::got_entry_count): New function.
2526 (Sized_target::plt_entry_count): New function.
2527 (Sized_target::plt_entry_size): New function.
2528 * x86_64.cc (Target_x86_64::got_size): Add const.
2529 (Target_x86_64::got_entry_count): New function.
2530 (Target_x86_64::plt_entry_count): New function.
2531 (Target_x86_64::first_plt_entry_offset): New function.
2532 (Target_x86_64::plt_entry_size): New function.
2533 (Output_data_plt_x86_64::entry_count): New function.
2534 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2535 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2539 * archive.cc: Include incremental.h.
2540 (Archive::Archive): Initialize incremental_info_.
2541 (Archive::include_member): Record archive members in incremental info.
2542 (Add_archive_symbols::run): Record begin and end of an archive in
2544 (Lib_group::include_member): Record objects in incremental info.
2545 * archive.h (Incremental_archive_entry): Forward declaration.
2546 (Archive::set_incremental_info): New member function.
2547 (Archive::incremental_info): New member function.
2548 (Archive::Unused_symbol_iterator): New class.
2549 (Archive::unused_symbols_begin): New member function.
2550 (Archive::unused_symbols_end): New member function.
2551 (Archive::incremental_info_): New data member.
2552 * incremental-dump.cc (find_input_containing_global): New function.
2553 (dump_incremental_inputs): Dump new incremental info sections.
2554 * incremental.cc: Include symtab.h.
2555 (Output_section_incremental_inputs): New class.
2556 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2557 new incremental info sections.
2558 (Sized_incremental_binary::do_check_inputs): Likewise.
2559 (Incremental_inputs::report_archive): Remove.
2560 (Incremental_inputs::report_archive_begin): New function.
2561 (Incremental_inputs::report_archive_end): New function.
2562 (Incremental_inputs::report_object): New function.
2563 (Incremental_inputs::finalize_inputs): Remove.
2564 (Incremental_inputs::report_input_section): New function.
2565 (Incremental_inputs::report_script): Rewrite.
2566 (Incremental_inputs::finalize): Do nothing but finalize string table.
2567 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2568 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2569 (Incremental_inputs::create_data_sections): New function.
2570 (Incremental_inputs::relocs_entsize): New function.
2571 (Output_section_incremental_inputs::set_final_data_size): New function.
2572 (Output_section_incremental_inputs::do_write): New function.
2573 (Output_section_incremental_inputs::write_header): New function.
2574 (Output_section_incremental_inputs::write_input_files): New function.
2575 (Output_section_incremental_inputs::write_info_blocks): New function.
2576 (Output_section_incremental_inputs::write_symtab): New function.
2577 * incremental.h (Incremental_script_entry): Forward declaration.
2578 (Incremental_object_entry): Forward declaration.
2579 (Incremental_archive_entry): Forward declaration.
2580 (Incremental_inputs): Forward declaration.
2581 (Incremental_inputs_header_data): Remove.
2582 (Incremental_inputs_header): Remove.
2583 (Incremental_inputs_header_write): Remove.
2584 (Incremental_inputs_entry_data): Remove.
2585 (Incremental_inputs_entry): Remove.
2586 (Incremental_inputs_entry_write): Remove.
2587 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2588 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2589 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2590 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2592 (Incremental_input_entry): New class.
2593 (Incremental_script_entry): New class.
2594 (Incremental_object_entry): New class.
2595 (Incremental_archive_entry): New class.
2596 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2597 (Incremental_inputs::report_inputs): Remove.
2598 (Incremental_inputs::report_archive): Remove.
2599 (Incremental_inputs::report_archive_begin): New function.
2600 (Incremental_inputs::report_archive_end): New function.
2601 (Incremental_inputs::report_object): Change prototype.
2602 (Incremental_inputs::report_input_section): New function.
2603 (Incremental_inputs::report_script): Change prototype.
2604 (Incremental_inputs::get_reloc_count): New function.
2605 (Incremental_inputs::set_reloc_count): New function.
2606 (Incremental_inputs::create_data_sections): New function.
2607 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2608 (Incremental_inputs::inputs_section): New function.
2609 (Incremental_inputs::symtab_section): New function.
2610 (Incremental_inputs::relocs_section): New function.
2611 (Incremental_inputs::get_stringpool): Add const.
2612 (Incremental_inputs::command_line): Add const.
2613 (Incremental_inputs::inputs): Remove.
2614 (Incremental_inputs::command_line_key): New function.
2615 (Incremental_inputs::input_file_count): New function.
2616 (Incremental_inputs::input_files): New function.
2617 (Incremental_inputs::relocs_entsize): New function.
2618 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2619 (Incremental_inputs::finalize_inputs): Remove.
2620 (Incremental_inputs::Input_info): Remove.
2621 (Incremental_inputs::lock_): Remove.
2622 (Incremental_inputs::inputs_): Change type.
2623 (Incremental_inputs::inputs_map_): Remove.
2624 (Incremental_inputs::current_object_entry_): New data member.
2625 (Incremental_inputs::inputs_section_): New data member.
2626 (Incremental_inputs::symtab_section_): New data member.
2627 (Incremental_inputs::relocs_section_): New data member.
2628 (Incremental_inputs::reloc_count_): New data member.
2629 (Incremental_inputs_reader): New class.
2630 (Incremental_symtab_reader): New class.
2631 (Incremental_relocs_reader): New class.
2632 * layout.cc (Layout::finalize): Move finalization of incremental info
2633 and creation of incremental info sections to follow finalization of
2634 symbol table. Set offsets for postprocessing sections.
2635 (Layout::create_incremental_info_sections): Call
2636 Incremental_inputs::create_data_sections. Add incremental symtab
2637 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2638 sections to layout after input sections.
2639 * layout.h (struct Timespec): Forward declaration.
2640 (Layout::incremental_inputs): Add const.
2641 (Layout::create_incremental_info_sections): Add parameter.
2642 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2643 * object.cc: Include incremental.h.
2644 (Relobj::finalize_incremental_relocs): New function.
2645 (Sized_relobj::do_layout): Record input sections in incremental info.
2646 * object.h (Object::output_section): New function.
2647 (Object::output_section_offset): Moved from Relobj.
2648 (Object::get_incremental_reloc_base): New function.
2649 (Object::get_incremental_reloc_count): New function.
2650 (Object::do_output_section): New function.
2651 (Object::do_output_section_offset): Moved from Relobj.
2652 (Object::do_get_incremental_reloc_base): New function.
2653 (Object::do_get_incremental_reloc_count): New function.
2654 (Object::Object): Initialize new data members.
2655 (Relobj::output_section): Renamed do_output_section and moved to
2657 (Relobj::output_section_offset): Moved to Object.
2658 (Relobj::do_get_incremental_reloc_base): New function.
2659 (Relobj::do_get_incremental_reloc_count): New function.
2660 (Relobj::allocate_incremental_reloc_counts): New function.
2661 (Relobj::count_incremental_reloc): New function.
2662 (Relobj::finalize_incremental_relocs): New function.
2663 (Relobj::next_incremental_reloc_index): New function.
2664 (Relobj::reloc_counts_): New data member.
2665 (Relobj::reloc_bases_): New data member.
2666 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2667 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2668 (Sized_relobj::incremental_relocs_scan): New function.
2669 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2670 (Sized_relobj::incremental_relocs_write): New function.
2671 (Sized_relobj::incremental_relocs_write_reltype): New function.
2672 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2674 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2675 archives and object files elsewhere.
2676 (Add_symbols::run): Report object files here.
2677 (Finish_group::run): Report end of archive at end of group.
2678 * reloc.cc: Include layout.h, incremental.h.
2679 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2680 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2681 (Sized_relobj::incremental_relocs_scan): New function.
2682 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2683 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2684 (Sized_relobj::incremental_relocs_write): New function.
2685 (Sized_relobj::incremental_relocs_write_reltype): New function.
2686 * script.cc (read_input_script): Rewrite test for incremental link.
2687 Change call to Incremental_inputs::report_script.
2688 * symtab.h (Symbol_table::first_global_index): New function.
2689 (Symbol_table::output_count): New function.
2693 * arm.cc (Target_arm::merge_object_attributes): Check command line
2694 options --no-wchar-size-warning and --no-enum-size-warning.
2695 * options.h (General_options): Add ld-compatible options
2696 --no-enum-size-warning and --no-wchar-size-warning.
2700 * x86_64.cc (Target_x86_64::Scan::local): Use
2701 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2702 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2703 (Target_x86_64::Scan::global): Likewise.
2704 (Target_x86_64::Relocate::relocate): Likewise.
2705 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2710 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2711 to reserve space in merged_strings vector. Keep total input size
2713 (Output_merge_string::do_print_merge_stats): Print total input size.
2714 * merge.h (Output_merge_string): Add input_size_ field.
2715 * stringpool.cc (Stringpool_template::string_length): Move
2716 implementations out of Stringpool_template class and place in
2718 * stringpool.h (string_length): Move out of Stringpool_template.
2723 * layout.cc (relaxation_loop_body): If address of load segment is
2724 set, adjust address to include headers if possible.
2728 * version.cc (version_string): Bump to 1.10.
2733 * layout.h (enum Output_section_order): Define.
2734 (class Layout): Update declarations.
2735 * layout.cc (Layout::get_output_section): Add order parameter.
2736 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2737 is_first_non_relro parameters. Change all callers.
2738 (Layout::choose_output_section): Likewise.
2739 (Layout::add_output_section_data): Likewise.
2740 (Layout::make_output_section): Likewise. Set order.
2741 (Layout::default_section_order): New function.
2742 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2743 * output.cc (Output_section::Output_section): Initialize order_.
2744 Don't initialize deleted fields.
2745 (Output_segment::Output_segment): Don't initialize deleted
2747 (Output_segment::add_output_section_to_load): New function
2748 replacing add_output_section. Change all callers to call this or
2749 add_output_section_to_nonload.
2750 (Output_segment::add_output_section_to_nonload): New function.
2751 (Output_segment::remove_output_section): Rewrite.
2752 (Output_segment::add_initial_output_data): Likewise.
2753 (Output_segment::has_any_data_sections): Likewise.
2754 (Output_segment::is_first_section_relro): Likewise.
2755 (Output_segment::maximum_alignment): Likewise.
2756 (Output_segment::has_dynamic_reloc): New function replacing
2757 dynamic_reloc_count. Change all callers.
2758 (Output_segment::has_dynamic_reloc_list): New function replacing
2759 dynamic_reloc_count_list. Change all callers.
2760 (Output_segment::set_section_addresses): Rewrite.
2761 (Output_segment::set_offset): Rewrite.
2762 (Output_segment::find_first_and_last_list): Remove.
2763 (Output_segment::set_tls_offsets): Rewrite.
2764 (Output_segment::first_section_load_address): Likewise.
2765 (Output_segment::output_section_count): Likewise.
2766 (Output_segment::section_with_lowest_load_address): Likewise.
2767 (Output_segment::write_section_headers): Likewise.
2768 (Output_segment::print_sections_to_map): Likewise.
2769 * output.h (class Output_data): Remove dynamic_reloc_count_
2770 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2771 (Output_data::add_dynamic_reloc): Rewrite.
2772 (Output_data::has_dynamic_reloc): New function.
2773 (Output_data::dynamic_reloc_count): Remove.
2774 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2775 is_last_relro_, is_first_non_relro_, is_interp_,
2776 is_dynamic_linker_section_ fields. Add order and set_order
2777 functions. Remove is_relro_local, set_is_relro_local,
2778 is_last_relro, set_is_last_relro, is_first_non_relro,
2779 set_is_first_non_relro functions, is_interp, set_is_interp,
2780 is_dynamic_linker_section, and set_is_dynamic_linker_section
2782 (class Output_segment): Change Output_data_list from std::list to
2783 std:;vector. Add output_lists_ field. Remove output_data_ and
2784 output_bss_ fields. Update declarations.
2788 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2789 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2790 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2795 * script.cc (Script_options::Script_options): Initialize
2796 symbol_definitions_ and symbol_references_.
2797 (Script_options::add_symbol_assignment): Update
2798 symbol_definitions_ and symbol_references_.
2799 (Script_options::add_symbol_reference): New function.
2800 (script_symbol): New function.
2801 * script.h (class Script_options): Add symbol_definitions_ and
2802 symbol_references_ fields.
2803 (Script_options::referenced_const_iterator): New type.
2804 (Script_options::referenced_begin): New function.
2805 (Script_options::referenced_end): New function.
2806 (Script_options::is_referenced): New function.
2807 (Script_options::any_unreferenced): New function.
2808 * script-c.h (script_symbol): Declare.
2809 * yyscript.y (exp): Call script_symbol.
2810 * symtab.cc: Include "script.h".
2811 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2812 Change all callers. Check symbols referenced by scripts.
2813 (Symbol_table::add_undefined_symbols_from_command_line): Add
2814 layout parameter. Change all callers.
2815 (Symbol_table::do_add_undefined_symbols_from_command_line):
2816 Likewise. Break out loop body. Check symbols referenced by
2818 (Symbol_table::add_undefined_symbol_from_command_line): New
2819 function broken out of
2820 do_add_undefined_symbols_from_command_line.
2821 * symtab.h (class Symbol_table): Update declarations.
2822 * archive.cc: Include "layout.h".
2823 (Archive::should_include_member): Add layout parameter. Change
2824 all callers. Check for symbol mentioned in expression.
2825 * archive.h (class Archive): Update declaration.
2826 * object.cc (Sized_relobj::do_should_include_member): Add layout
2828 * object.h (Object::should_include_member): Add layout parameter.
2830 (Object::do_should_include_member): Add layout parameter.
2831 (class Sized_relobj): Update declaration.
2832 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2834 * dynobj.h (class Sized_dynobj): Update declaration.
2835 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2837 * plugin.h (class Sized_pluginobj): Update declaration.
2842 * output.cc (Output_segment::set_offset): Search for the first and
2843 last sections rather than assuming that the list is in order.
2844 (Output_segment::find_first_and_last_list): New function.
2845 * output.h (class Output_segment): Update declarations.
2846 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2847 (relro_strip_test_SOURCES): New variable.
2848 (relro_strip_test_DEPENDENCIES): New variable.
2849 (relro_strip_test_LDFLAGS): New variable.
2850 (relro_strip_test_LDADD): New variable.
2851 (relro_strip_test.so): New target.
2855 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2856 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2857 (Target_i386::got_tlsdesc_section): New function.
2858 (Target_i386::got_section): Create space for GOT entries for
2859 TLSDESC relocations.
2860 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2862 (Target_i386::Scan::global): Likewise.
2863 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2865 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2866 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2867 (Target_x86_64::got_tlsdesc_section): New function.
2868 (Target_x86_64::got_section): Create space for GOT entries for
2869 TLSDESC relocations.
2870 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2872 (Target_x86_64::Scan::global): Likewise.
2873 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2878 * testsuite/final_layout.sh: Use dc to convert from hex to
2883 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2884 paramter to the call to gold::gc_process_relocs.
2885 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2886 paramter to the call to gold::gc_process_relocs.
2887 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2888 parameter to the call to gold::gc_process_relocs.
2889 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2890 template parameter to the call to gold::gc_process_relocs.
2891 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2892 paramter to the call to gold::gc_process_relocs.
2893 * gc.h (get_embedded_addend_size): New function.
2894 (gc_process_relocs): Save the size of the reloc for use by ICF.
2895 * icf.cc (get_section_contents): Get the addend from the text section
2896 for SHT_REL relocation sections.
2897 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2898 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2899 * int_encoding.h (read_from_pointer): New overloaded function.
2900 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2901 * testsuite/icf_sht_rel_addend_test.sh: New file.
2902 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2903 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2907 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2908 * Makefile.in: Regenerate.
2909 * testsuite/Makefile.in: Regenerate.
2913 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2914 * gold/testsuite/debug_msg.cc: Likewise.
2915 * gold/testsuite/odr_violation1.cc
2916 * gold/testsuite/odr_violation2.cc
2920 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2921 string, and length fields.
2922 (Output_merge_string::Merged_strings_list): New type.
2923 (Output_merge_string::Merged_strings_lists): New typedef.
2924 (Output_merge_string): Replace merged_strings_ with
2925 merged_strings_lists_.
2926 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2927 Merged_strings_list per input object and section. Don't store pointer
2928 to the string. Don't store length with each merged string entry.
2929 (Output_merge_string::finalize_merged_data): Loop over list of merged
2930 strings lists. Recompute length of each merged string.
2934 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2939 * descriptors.cc (Descriptors::open): Report correct name in error
2944 * arm.cc (Arm_input_section::Arm_input_section): For a
2945 SHT_ARM_EXIDX section, always keeps the input sections.
2946 (Arm_input_section::set_exidx_section_link): New method.
2947 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2948 has_errors_ to false.
2949 (Arm_exidx_input_section::has_errors,
2950 Arm_exidx_input_section::set_has_errors): New methods.
2951 (Arm_exidx_input_section::has_errors_): New data member.
2952 (Arm_relobj::get_exidx_shndx_list): New method.
2953 (Arm_output_section::append_text_sections_to_list): Do not skip
2954 section without SHF_EXECINSTR.
2955 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2957 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2958 section header. Make error messages more verbose. Check for
2959 a non-executable section linked to an EXIDX section.
2960 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2961 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2962 check that there is no deferred EXIDX section if we exit early.
2963 Instead of not making an EXIDX section in case of an error, make one
2964 and set the has_errors flag of it.
2965 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2966 in a relocatable link.
2967 (Target_arm::do_relax): Look for the EXIDX output section instead of
2968 assuming that it is called .ARM.exidx.
2969 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2970 section list. Do not check for SHF_EXECINSTR section flags but
2971 skip any input section with errors.
2972 * output.cc (Output_section::Output_section): Initialize
2973 always_keeps_input_sections_ to false.
2974 (Output_section::add_input_section): Check for
2975 always_keeps_input_sections_.
2976 * output.h (Output_section::always_keeps_input_sections,
2977 Output_section::set_always_keeps_input_sections): New methods.
2978 (Output_section::always_keeps_input_sections): New data member.
2982 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2983 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2988 * output.h (Output_section_lookup_maps::add_merge_section):
2989 Correct check of whether value was inserted.
2990 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2991 (Output_section_lookup_maps::add_relaxed_input_section):
2993 * arm.cc (Target_arm::got_section): Remove used local os.
2994 * i386.cc (Target_i386::got_section): Likewise.
2995 * x86_64.cc (Target_x86_64::got_section): Likewise.
2996 * sparc.cc (Target_sparc::got_section): Likewise.
2997 (Target_sparc::relocate): Remove unused local have_got_offset.
2998 * powerpc.cc (Target_powerpc::relocate): Likewise.
3002 * compressed_output.cc (zlib_decompress): Fix signature in
3005 * archive.cc (Archive::include_member): Unlock an external member
3006 of a thin archive. Don't bother to delete an object we know is
3011 * compressed_output.cc (zlib_decompress): New function.
3012 (get_uncompressed_size): New function.
3013 (decompress_input_section): New function.
3014 * compressed_output.h (get_uncompressed_size): New function.
3015 (decompress_input_section): New function.
3016 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3017 Handle compressed debug sections.
3018 * layout.cc (is_compressed_debug_section): New function.
3019 (Layout::output_section_name): Map compressed section names to
3021 * layout.h (is_compressed_debug_section): New function.
3022 (is_debug_info_section): Recognize compressed debug sections.
3023 * merge.cc: Include compressed_output.h.
3024 (Output_merge_data::do_add_input_section): Handle compressed
3026 (Output_merge_string::do_add_input_section): Handle compressed
3028 * object.cc: Include compressed_output.h.
3029 (Sized_relobj::Sized_relobj): Initialize new data members.
3030 (build_compressed_section_map): New function.
3031 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3032 * object.h (Object::section_is_compressed): New method.
3033 (Object::do_section_is_compressed): New method.
3034 (Sized_relobj::Compressed_section_map): New type.
3035 (Sized_relobj::do_section_is_compressed): New method.
3036 (Sized_relobj::compressed_sections_): New data member.
3037 * output.cc (Output_section::add_input_section): Handle compressed
3039 * reloc.cc: Include compressed_output.h.
3040 (Sized_relobj::write_sections): Handle compressed debug sections.
3044 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3045 weak when resolving to a dynamic def.
3046 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3047 for weak undef/dynamic def cases. Adjust callers.
3048 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3049 undef_binding_weak_.
3050 (Symbol_table::sized_write_globals): Adjust symbol binding.
3051 (Symbol_table::sized_write_symbol): Add binding parameter.
3052 * symtab.h (Symbol::set_undef_binding): New method.
3053 (Symbol::is_undef_binding_weak): New method.
3054 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3055 (Symbol_table::should_override): Add new parameter.
3056 (Symbol_table::sized_write_symbol): Add new parameter.
3058 * testsuite/weak_undef_file1.cc: Add new test case.
3059 * testsuite/weak_undef_file2.cc: Fix header comment.
3060 * testsuite/weak_undef_test.cc: Add new test case.
3064 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3065 Initialize USE_SYMBOL_.
3066 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3068 (Arm_reloc_property::uses_symbol_): New data member declaration.
3069 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3070 uses symbol value and symbol is undefined but not weakly undefined.
3074 * plugin.cc (Plugin::load): Use dlerror.
3078 * symtab.cc (detect_odr_violations): When reporting an ODR
3079 violation, report an object where the symbol is defined.
3083 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3084 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3086 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3087 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3088 target hook to detect function points.
3089 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3090 * icf.h (Icf::check_section_for_function_pointers): Change type of
3091 parameter SECTION_NAME to const reference to std::string. Use
3092 target hook to determine if section may have unsafe pointers.
3093 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3098 * fileread.cc (Input_file::find_fie): New
3099 (Input_file::open): Use Input_file::find_fie.
3100 * fileread.h (Input_file::find_fie): New
3101 * plugin.cc (set_extra_library_path): New.
3102 (Plugin::load): Add set_extra_library_path to the transfer vector.
3103 (Plugin_manager::set_extra_library_path): New.
3104 (Plugin_manager::add_input_file): Use the extra search path if set.
3105 (set_extra_library_path(): New.
3106 * plugin.h (Plugin_manager): Add set_extra_library_path and
3111 * layout.cc (gdb_sections): Add .debug_types.
3112 (lines_only_debug_sections): Likewise.
3116 * plugin.cc (add_input_file,add_input_library)
3117 (Plugin_manager::add_input_file): Make filename arguments const.
3118 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3123 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3124 .ARM.attributes section if we have not merged any input
3125 attributes sections.
3129 * arm.cc: Allow combining objects with no EABI version
3134 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3138 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3139 (struct iovec): Correct !HAVE_READV definition.
3143 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3144 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3146 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3149 * symtab.h (Symbol::is_placeholder): New member function.
3150 * target-reloc.h (relocate_section): Check for placeholder symbols.
3152 * testsuite/Makefile.am (plugin_test_8): New test.
3153 (plugin_test_9): New test.
3154 * testsuite/Makefile.in: Regenerate.
3158 * yyscript.y (input_list_element): Allow strings prefixed with
3159 the '-' character. Treat these as libraries.
3160 * script.cc (script_add_library): New function. Adds a library
3161 specified by "-l<name>" found in an input script.
3162 * script-c.h: Add prototype for script_add_library.
3166 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3167 Restrict stub-group size to be within long conditional branch
3168 range when working around cortex-A8 erratum.
3172 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3179 (Output_section::Input_section_sort_entry::compare_section_ordering):
3180 Change to return non-zero correctly.
3181 (Output_section::Input_section_sort_section_order_index_compare
3182 ::operator()): Change to fix ambiguity in comparisons.
3186 * gold.h (is_wildcard_string): New function.
3187 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3188 (Layout::layout_eh_frame): Ditto.
3189 (Layout::find_section_order_index): New method.
3190 (Layout::read_layout_from_file): New method.
3191 * layout.h (Layout::find_section_order_index): New method.
3192 (Layout::read_layout_from_file): New method.
3193 (Layout::input_section_position_): New private member.
3194 (Layout::input_section_glob_): New private member.
3195 * main.cc (main): Call read_layout_from_file here.
3196 * options.h (--section-ordering-file): New option.
3197 * output.cc (Output_section::input_section_order_specified_): New
3199 (Output_section::Output_section): Initialize new member.
3200 (Output_section::add_input_section): Add new parameter.
3201 Keep input sections when --section-ordering-file is used.
3202 (Output_section::set_final_data_size): Sort input sections when
3203 section ordering file is specified.
3204 (Output_section::Input_section_sort_entry): Add new parameter.
3206 (Output_section::Input_section_sort_entry::compare_section_ordering):
3208 (Output_section::Input_section_sort_compare::operator()): Change to
3209 consider section_order_index.
3210 (Output_section::Input_section_sort_init_fini_compare::operator()):
3211 Change to consider section_order_index.
3212 (Output_section::Input_section_sort_section_order_index_compare
3213 ::operator()): New method.
3214 (Output_section::sort_attached_input_sections): Change to sort
3215 according to section order when specified.
3216 (Output_section::add_input_section<32, true>): Add new parameter.
3217 (Output_section::add_input_section<64, true>): Add new parameter.
3218 (Output_section::add_input_section<32, false>): Add new parameter.
3219 (Output_section::add_input_section<64, false>): Add new parameter.
3220 * output.h (Output_section::add_input_section): Add new parameter.
3221 (Output_section::input_section_order_specified): New
3223 (Output_section::set_input_section_order_specified): New method.
3224 (Input_section::Input_section): Initialize section_order_index_.
3225 (Input_section::section_order_index): New method.
3226 (Input_section::set_section_order_index): New method.
3227 (Input_section::section_order_index_): New member.
3228 (Input_section::Input_section_sort_section_order_index_compare): New
3230 (Output_section::input_section_order_specified_): New member.
3231 * script-sections.cc (is_wildcard_string): Delete and move modified
3233 (Output_section_element_input::Output_section_element_input): Modify
3234 call to is_wildcard_string.
3235 (Output_section_element_input::Input_section_pattern
3236 ::Input_section_pattern): Ditto.
3237 (Output_section_element_input::Output_section_element_input): Ditto.
3238 * testsuite/Makefile.am (final_layout): New test case.
3239 * testsuite/Makefile.in: Regenerate.
3240 * testsuite/final_layout.cc: New file.
3241 * testsuite/final_layout.sh: New file.
3245 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3249 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3250 visibility of symbols.
3254 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3255 from start of output section instead of address for a local symbol
3256 in a merged or relaxed section when doing a relocatable link.
3261 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3262 adding sections the garbage collector removed.
3263 * gold/testsuite/Makefile.am: Add test.
3264 * gold/testsuite/Makefile.in: Regenerate.
3265 * gold/testsuite/plugin_test_7.sh: New.
3266 * gold/testsuite/plugin_test_7_1.c: New.
3267 * gold/testsuite/plugin_test_7_2.c: New.
3271 * script-sections.cc (Output_section_definition::set_section_addresses):
3272 Check for --section-start.
3276 * arm.cc (Arm_scan_relocatable_relocs): New class.
3277 (Target_arm::relocate_special_relocatable): New method.
3278 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3279 (Arm_relocate_functions::thumb_branch_common): Same.
3280 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3281 instead of Default_scan_relocatable_relocs.
3282 * target-reloc.h (relocate_for_relocatable): Let target handle
3283 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3284 * target.h (Sized_target::relocate_special_relocatable): New method.
3288 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3292 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3294 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3295 with a direct branch, not a conditional branch, to a stub.
3296 * merge.cc (Output_merge_base::record_input_section): New method
3298 (Output_merge_data::do_add_input_section): Record input section if
3299 keeps-input-sections flag is set.
3300 (Output_merge_string::do_add_input_section): Ditto.
3301 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3302 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3304 (Output_merge_base::keeps_input_sections,
3305 Output_merge_base::set_keeps_input_sections,
3306 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3308 (Output_merge_base::Input_sections): New type declaration.
3309 (Output_merge_base::input_sections_begin,
3310 Output_merge_base::input_sections_end,
3311 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3312 (Output_merge_base::bool keeps_input_sections_,
3313 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3314 Output_merge_base::input_sections_): New data members.
3315 (Output_merge_data::do_set_keeps_input_sections): New method
3317 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3318 * output.cc (Output_section::Input_section::relobj): Move method
3319 defintion from class declaration to here and handle merge sections.
3320 (Output_section::Input_section::shndx): Ditto.
3321 (Output_section::Output_section): Remove initializations of removed
3322 data members and initialize new data member LOOKUP_MAPS_.
3323 (Output_section::add_input_section): Set keeps-input-sections flag
3324 for a newly created merge output section as appropriate. Adjust code
3325 to use Output_section_lookup_maps class.
3326 (Output_section::add_relaxed_input_section): Adjst code for lookup
3327 maps code refactoring.
3328 (Output_section::add_merge_input_section): Add a new parameter
3329 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3330 class. If adding input section to a newly created merge output
3331 section fails, remove the new merge section.
3332 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3333 Adjust code for use of the Output_section_lookup_maps class.
3334 (Output_section::find_merge_section): Ditto.
3335 (Output_section::build_lookup_maps): New method defintion.
3336 (Output_section::find_relaxed_input_section): Adjust code to use
3337 Output_section_lookup_maps class.
3338 (Output_section::get_input_sections): Export merge sections. Adjust
3339 code to use Output_section_lookup_maps class.
3340 (Output_section:::add_script_input_section): Adjust code to use
3341 Output_section_lookup_maps class. Update lookup maps for merge
3343 (Output_section::discard_states): Use Output_section_lookup_maps.
3344 (Output_section::restore_states): Same.
3345 * output.h (Merge_section_properties): Move class defintion out of
3347 (Output_section_lookup_maps): New class.
3348 (Output_section::Input_section::is_merge_section): New method
3350 (Output_section::Input_section::relobj): Move defintion out of class
3351 defintion. Declare method only.
3352 (Output_section::Input_section::shndx): Ditto.
3353 (Output_section::Input_section::output_merge_base): New method defintion.
3354 (Output_section::Input_section::u2_.pomb): New union field.
3355 (Output_section::Merge_section_by_properties_map,
3356 Output_section::Output_section_data_by_input_section_map,
3357 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3359 (Output_section::add_merge_input_section): Add new parameter
3360 KEEPS_INPUT_SECTIONS.
3361 (Output_section::build_lookup_maps): New method declaration.
3362 (Output_section::merge_section_map_,
3363 Output_section::merge_section_by_properties_map_,
3364 Output_section::relaxed_input_section_map_,
3365 Output_section::is_relaxed_input_section_map_valid_): Remove data
3367 (Output_section::lookup_maps_): New data member.
3372 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3373 avoid a compilation error.
3377 * script-sections.cc (Output_section_definition::allocate_to_segment):
3378 Update the phdrs_list even when the output section is NULL.
3379 * testsuite/Makefile.am: Add test.
3380 * testsuite/Makefile.in: Regenerate.
3381 * testsuite/script_test_9.cc: New.
3382 * testsuite/script_test_9.sh: New.
3383 * testsuite/script_test_9.t: New.
3387 * arm.cc (Arm_input_section::original_size): New method.
3388 (Arm_input_section::do_addralign): Add a cast.
3389 (Arm_input_section::do_output_offset): Remove static cast.
3390 (Arm_input_section::original_addralign,
3391 Arm_input_section::original_size_): Change type to uint32_t.
3392 (Arm_input_section::init): Add safe casts for section alignment
3394 (Arm_input_section::set_final_data_size): Do not set address and
3395 offset of stub table.
3396 (Arm_output_section::fix_exidx_coverage): Change use of of
3397 Output_section::Simple_input_section to that of
3398 Output_section::Input_section.
3399 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3400 except for the first pass.
3401 * output.cc (Output_section::get_input_sections): Change type of
3402 input_sections to std::list<Input_section>.
3403 (Output_section::add_script_input_section): Rename from
3404 Output_section::add_simple_input_section. Change type of SIS
3405 parameter from Simple_input_section to Input_section.
3406 * output.h (Output_section::Simple_input_section): Remove class.
3407 (Output_section::Input_section): Change class visibility to public.
3408 (Output_section::Input_section::addralign): Use stored alignments
3409 for special input sections if set.
3410 (Output_section::Input_section::set_addralign): New method.
3411 (Output_section::get_input_sections): Change parameter type from
3412 list of Simple_input_section to list of Input_section.
3413 (Output_section::add_script_input_section): Rename from
3414 Output_section::add_simple_input_section. Change first parameter's
3415 type from Simple_input_section to Input_section and remove the
3416 second and third parameters.
3417 * script-sections.cc (Input_section::Input_section_list): Change
3418 type to list of Output_section::Input_section/
3419 (Input_section_info::Input_section_info): Change parameter type of
3420 INPUT_SECTION to Output_section::Input_section.
3421 (Input_section_info::input_section): Change return type.
3422 (Input_section_info::input_section_): Change type to
3423 Output_section::Input_section.
3424 (Output_section_element_input::set_section_addresses): Adjust code
3425 to use Output_section::Input_section instead of
3426 Output_section::Simple_input_section. Adjust code for renaming
3427 of Output_section::add_simple_input_section.
3428 (Orphan_output_section::set_section_addresses): Ditto.
3432 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3433 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3437 * options.cc (General_options::finalize): Handle -nostdlib.
3438 * options.h (nostdlib): New option.
3439 * script.cc (script_add_search_dir): Handle -nostdlib.
3443 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3444 attributes section only if there no attributes section after merging.
3445 (Target_arm::merge_object_attributes): Move value of
3446 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3447 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3448 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3449 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3450 and arm_attr_merge_7.stdout.
3451 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3452 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3453 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3454 arm_attr_merge_7b.o): New rules.
3455 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3457 * testsuite/Makefile.in: Regenerate.
3458 * testsuite/arm_attr_merge.sh: New file.
3459 * testsuite/arm_attr_merge_[67][ab].s: Same.
3463 * po/es.po: Updated Spanish translation.
3467 * Makefile.am (install-exec-local): Properly install gold as
3468 default cross linker.
3469 * Makefile.in: Regenerated.
3474 * configure.ac (install_as_default): Define and set to false
3475 unless --enable-gold or --enable-gold=both/gold has been
3477 * configure: Regenerate.
3479 * Makefile.am (install-exec-local): Install the executable as
3480 'ld.gold'. If install_as_default is true then also install it as
3482 * Makefile.in: Regenerated.
3486 * layout.cc (Layout::layout_reloc): In relocatable link don't
3487 combine reloc sections for grouped sections.
3491 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3492 sections that are not ordinary to icf.
3493 * icf.cc (get_section_contents): Handle relocation pointing to section
3494 with no object or shndx information.
3495 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3496 * testsuite/Makefile.in: Regenerate.
3497 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3498 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3502 * expression.cc (Expression::Expression_eval_info): Add
3503 result_alignment_pointer field.
3504 (Expression::eval_with_dot): Add result_alignment_pointer
3505 parameter. Change all callers.
3506 (Expression::eval_maybe_dot): Likewise.
3507 (class Binary_expression): Add alignment_pointer parameter to
3508 left_value and right_value. Change all callers.
3509 (BINARY_EXPRESSION): Set result alignment.
3510 (class Trinary_expression): Add alignment_pointer parameter to
3511 arg2_value and arg3_value. Change all callers.
3512 (Trinary_cond::value): Set result alignment.
3513 (Max_expression::value, Min_expression::value): Likewise.
3514 (Align_expression::value): Likewise.
3515 * script-sections.cc (class Sections_element): Add dot_alignment
3516 parameter to set_section_addresses virtual function. Update
3518 (class Output_section_element): Likewise.
3519 (Script_sections::create_segments): Add dot_alignment parameter.
3521 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3522 (Script_sections::set_phdrs_clause_addresses): Likewise.
3523 * script-sections.h: Update declarations.
3524 * script.h: Update declarations.
3525 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3527 * testsuite/script_test_3.t: Set large alignment.
3528 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3529 segment has expected alignment.
3533 * po/gold.pot: Updated by the Translation project.
3534 * po/vi.po: Updated Vietnamese translation.
3538 * testsuite/Makefile.am (check_PROGRAMS): Add
3539 icf_virtual_function_folding_test.
3540 * testsuite/Makefile.in: Regenerated.
3544 * options.h (merge_exidx_entries): New option.
3545 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3546 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3547 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3548 (Target_arm::merge_exidx_entries): New function.
3549 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3550 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3551 to Arm_exidx_fixup constructor.
3552 Add new arg, merge_exidx_entries.
3553 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3554 Arm_output_section::fix_exidx_coverage.
3558 * icf.cc (get_section_contents): Check for preemptible functions.
3559 Ignore addend when appropriate.
3560 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3562 (add_from_relobj): Check for section folded.
3563 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3564 * symtab.h (should_add_dynsym_entry): Add new parameter.
3565 * target-reloc.h (scan_relocs): Check for section folded.
3566 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3567 Check reloc types for function pointers in shared objects.
3568 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3570 (icf_preemptible_functions_test): New test case.
3571 (icf_string_merge_test): New test case.
3572 * testsuite.Makefile.in: Regenerate.
3573 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3574 bar_glob. Refactor code.
3575 * testsuite/icf_preemptible_functions_test.cc: New file.
3576 * testsuite/icf_preemptible_functions_test.sh: New file.
3577 * testsuite/icf_string_merge_test.cc: New file.
3578 * testsuite/icf_string_merge_test.sh: New file.
3579 * testsuite/icf_virtual_function_folding_test.cc: New file.
3580 * testsuite/icf_virtual_function_folding_test.sh: New file.
3584 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3585 for local symbol recounting if we remove a section due to ICF.
3586 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3587 there are no regular objects in input.
3591 * arm.cc (Arm_input_section::set_final_data_size): Compute
3592 accurate final data size instead of using current data size.
3596 * layout.cc (Layout::choose_output_section): Handle script section
3598 (Layout::make_output_section_for_script): Add section type parameter.
3599 Handle script section types.
3600 * layout.h (Layout::make_output_section_for_script): Add section
3602 * output.cc (Output_section::Output_section): Initialize data member
3604 (Output_section::do_reset_address_and_file_offset): Do not set address
3605 to 0 if section is a NOLOAD section.
3606 * output.h (Output_section::is_noload): New method.
3607 (Output_section::set_is_noload): Ditto.
3608 (Output_section::is_noload_): New data member.
3609 * script-c.h (Script_section_type): New enum type.
3610 (struct Parser_output_section_header): Add new file section_type.
3611 * script-sections.cc (Sections_element::output_section_name): Add
3612 parameter for returning script section type.
3613 (Output_section_definition::output_section_name): Ditto.
3614 (Output_section_definition::section_type)P; New method.
3615 (Output_section_definiton::script_section_type_name): Ditto.
3616 (Output_section_definition::script_section_type_): New data member.
3617 (Output_section_definition::Output_section_definition): Initialize
3618 data member Output_section_definition::script_section_type_.
3619 (Output_section_definition::create_sections): Pass script section type
3620 to Layout::make_output_section_for_script.
3621 (Output_section_definition::output_section_name): Return script
3622 section type to caller.
3623 (Output_section_definition::set_section_address): Do not advance
3624 dot value and load address if section type is NOLOAD. Set address
3625 of NOLOAD sections regardless of section flags.
3626 (Output_section_definition::print): Print section type if it is
3627 not SCRIPT_SECTION_TYPE_NONE.
3628 (Output_section_definition::section_type): New method.
3629 (Output_section_definition::script_section_type_name): Ditto.
3630 (Script_sections::output_section_name): Add new parameter
3631 PSECTION_TYPE for returning script section type. Pass it to
3632 section elements. Handle discard sections.
3633 (Sort_output_sections::operator()): Handle NOLOAD sections.
3634 * script-sections.h (Script_sections::Section_type): New enum type.
3635 (Script_sections::output_section_name): Add a new parameter for
3636 returning script section type.
3637 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3639 * yyscript.y (union): Add new field SECTION_TYPE.
3640 (COPY, DSECT, INFO, NOLOAD): New tokens.
3641 (opt_address_and_section_type): Change type to output_section_header.
3642 (section_type): New non-terminal
3643 (section_header): Handle section type.
3644 (opt_address_and_section_type): Return section type value.
3648 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3649 * testsuite/plugin_common_test_2.c (foo): Likewise.
3653 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3655 * output.cc (Output_section::add_merge_input_section): Simplify
3656 code and return status of Output_merge_base::add_input_section.
3657 Update merge section map only if Output_merge_base::add_input_section
3662 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3663 if section is marked as containing instructions but has no mapping
3665 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3666 correct section index.
3667 (Arm_relobj::find_linked_text_section): Ditto.
3671 * archive.cc (include_member): Destroy Read_symbols_data object before
3673 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3674 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3675 (Read_symbols_data::~Read_symbols_data) New destructor.
3676 (Section_relocs::Section_relocs) New constructor.
3677 (Section_relocs::~Section_relocs) New destructor.
3678 (Read_relocs_data::Read_relocs_data) New constructor.
3679 (Read_relocs_data::~Read_relocs_data) New destructor.
3680 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3681 pointers to NULL after deleting.
3685 * arm.cc: Replace "endianity" with "endianness" in comments.
3686 (Arm_exidx_cantunwind): Ditto.
3687 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3688 (Arm_relobj::merge_flags_and_attributes): New method.
3689 (Arm_relobj::merge_flags_and_attributes_): New data member.
3690 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3691 (Arm_relobj::scan_sections_for_stubs): Ditto.
3692 (Arm_relobj::do_read_symbols): Check to see if we really want to
3693 merge processor-specific flags and attributes. Exit early if
3694 an object is empty except for section names and the undefined symbol.
3695 (Target_arm::do_finalize_sections): Move check for ELF format to
3696 Arm_relobj::do_read_symbols. Merge processor specific flags and
3697 attributes from a regular object only when we have determined that
3698 it is aapropriate. Do not create an .ARM.attributes section in
3699 output if there is no regular input object.
3700 (Target_arm::merge_processor_specific_flags): Check
3701 --warn-mismatch before printing any error.
3702 (Target_arm::merge_object_attributes): Ditto.
3703 * gold.cc (queue_middle_tasks): Handle the case in which there is
3704 no regular object in input.
3705 * options.cc (General_options::parse_EB): New method.
3706 (General_options::parse_EL): Same.
3707 (General_options::General_options): Initialize endianness_.
3708 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3710 (General_options::Endianness): New enum.
3711 (General_options::endianness): New method.
3712 (General_options::endianness_): New data member.
3713 * parameters.cc (Parameters::set_options): Check target endianness.
3714 (Parameters::set_target_once): Ditto.
3715 (Parameters::check_target_endianness): New method.
3716 (parameters_force_valid_target): If either -EL or -EB is specified,
3717 use it to define endianness of default target.
3718 * parameters.h (Parameters::check_target_endianness): New method
3720 * target.h (class Target): Change "endianity" to "endianness"
3725 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3726 * configure: Regenerate.
3727 * Makefile.in: Regenerate.
3728 * testsuite/Makefile.in: Regenerate.
3733 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3734 prevailing definitions of common symbols.
3735 * testsuite/plugin_test_6.sh: New test case.
3736 * testsuite/plugin_common_test_1.c: New test case.
3737 * testsuite/plugin_common_test_2.c: New test case.
3738 * testsuite/Makefile.am (plugin_test_6): New test case.
3739 * testsuite/Makefile.in: Regenerate.
3743 * po/vi.po: New Vietnamese translation.
3747 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3751 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3752 to avoid a conversion warning on a 32-bit host.
3756 * testsuite/script_test_3.t: Add a TLS segment.
3757 * testsuite/Makefile.am (check_PROGRAMS): Add
3758 tls_phdrs_script_test.
3759 (tls_phdrs_script_test_SOURCES): Define.
3760 (tls_phdrs_script_test_DEPENDENCIES): Define.
3761 (tls_phdrs_script_test_LDFLAGS): Define.
3762 (tls_phdrs_script_test_LDADD): Define.
3763 * testsuite/Makefile.in: Rebuild.
3767 * fileread.cc (find_or_make_view): Fix comment.
3771 * script-sections.cc (class Orphan_section_placement): Define
3772 PLACE_TLS and PLACE_TLS_BSS.
3773 (Orphan_section_placement::Orphan_section_placement): Initialize
3775 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3776 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3777 (tls_script_test_SOURCES): Define.
3778 (tls_script_test_DEPENDENCIES): Define.
3779 (tls_script_test_LDFLAGS): Define.
3780 (tls_script_test_LDADD): Define.
3781 * testsuite/Makefile.in: Rebuild.
3785 * arm.cc (Arm_relocate_functions::abs8,
3786 Arm_relocate_functions::abs16): Use correct check for overflow
3787 specified in the ARM ELF specs.
3788 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3789 target of a BLX instruction specially.
3790 (Reloc_stub::stub_type_for_reloc): Ditto.
3791 (Relocate::relocate): Use symbolic names instead of numeric relocation
3792 codes to report error.
3793 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3795 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3796 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3797 thumb2_blx_out_of_range.stdout
3798 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3799 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3800 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3801 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3802 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3803 thumb2_blx_in_range, thumb2_blx_in_range.o,
3804 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3805 thumb2_blx_out_of_range.o): New rules.
3806 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3807 thumb2_blx_in_range and thumb2_blx_out_of_range.
3808 * testsuite/Makefile.in: Regenerate.
3809 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3810 * testsuite/thumb_blx_in_range.s: New file.
3811 * testsuite/thumb_blx_out_of_range.s: New file.
3815 * archive.cc (Should_include): Move to archive.h.
3816 (should_include_member): Make it a member of Archive.
3818 (Add_lib_group_symbols): New.
3819 * archive.h: Include options.h.
3820 (Archive_member): Moved from Archive.
3821 (Should_include): Moved from archive.cc.
3823 (Add_lib_group_symbols): New.
3824 * dynobj.cc (do_should_include_member): New.
3825 * dynobj.h (do_should_include_member): New.
3826 * gold.cc (queue_initial_tasks): Update call to queue.
3827 * main.cc (main): Print lib group stats.
3828 * object.cc (do_should_include_member): New.
3829 * object.h: Include archive.h.
3830 (Object::should_include_member): New.
3831 (Object::do_should_include_member): New.
3832 (Sized_relobj::do_should_include_member): New.
3833 * options.cc (General_options::parse_start_lib): New.
3834 (General_options::parse_end_lib): New.
3835 (Input_arguments::add_file): Handle lib groups.
3836 (Input_arguments::start_group): Check we are not in a lib.
3837 (Input_arguments::start_lib): New.
3838 (Input_arguments::end_lib): New.
3839 * options.h (General_options): Add start_lib and end_lib.
3840 (Input_argument::lib_): New.
3841 (Input_argument::lib): New.
3842 (Input_argument::is_lib): New.
3843 (Input_file_lib): New.
3844 (Input_arguments::in_lib_): New.
3845 (Input_arguments::in_lib): New.
3846 (Input_arguments::start_lib): New.
3847 (Input_arguments::end_lib_): New.
3848 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3849 in unused members as preempted.
3850 (Sized_pluginobj::do_should_include_member): New.
3851 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3852 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3854 (Read_symbols::do_whole_lib_group): New.
3855 (Read_symbols::do_lib_group): New.
3856 (Read_symbols::do_read_symbols): Handle lib groups.
3857 (Read_symbols::get_name): Handle lib groups.
3858 * readsyms.h (Read_symbols): Add an archive member pointer.
3859 (Read_symbols::do_whole_lib_group): New.
3860 (Read_symbols::do_lib_group): New.
3861 (Read_symbols::member_): New.
3862 * script.cc (read_input_script): Update call to queue_soon.
3866 * arm.cc (Stub_table::Stub_table): Initialize new data members
3867 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3868 (Stub_table::add_reloc_stub): Assign stub offset and update
3869 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3870 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3872 (Stub_table::update_data_size_and_addralign): Use
3873 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3874 instead of going over all reloc stubs.
3875 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3876 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3877 Stringpool_template::offset_ to size of Stringpool_char.
3878 (Stringpool_template::new_key_offset): Remove code to initialize
3879 Stringpool_template::offset_.
3880 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3881 Stringpool_template::offset_ to zero.
3885 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3887 (Stringpool_template::new_key_offset): New method.
3888 (Stringpool_template::add_string): Assign offsets when adding new
3890 (Stringpool_template::set_string_offsets): Do not set string offsets
3891 when not optimizing.
3892 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3894 (Chunked_vector::clear): Clear size_.
3895 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3896 (Chunked_vector::size): Return size_.
3897 (Chunked_vector::push_back): Use size_ to find insert position.
3898 (Chunked_vector::size_): New data member.
3899 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3900 (Stringpool_template::new_key_offset): New method declaration.
3901 (Stringpool_template::offset_): New data member.
3905 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3906 Add_symbols' constructor.
3907 * readsyms.h (Add_symbols): Remove the input_group member.
3911 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3912 target to ask whether a reference to a symbol requires a stack
3914 * target.h (Target::is_call_to_non_split): New function.
3915 (Target::do_is_call_to_non_split): Declare virtual function.
3916 * target.cc: Include "symtab.h".
3917 (Target::do_is_call_to_non_split): New function.
3918 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3922 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3923 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3924 (File_read::open[2]): Add whole_file_view_ to list of views.
3925 (File_read::make_view): Remove test of whole_file_view_.
3926 (File_read::find_or_make_view): Create whole_file_view_ if
3928 (File_read::clear_views): Replace bool parameter with enum;
3929 adjust all callers. Don't delete views with permanent data;
3930 do delete cached views and views from archives if
3931 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3932 if clearing the corresponding view.
3933 * fileread.h (File_read::Clear_views_mode): New enum.
3934 (File_read::View::is_permanent_view): New method.
3935 (File_read::clear_views): Replace bool parameter
3936 with enum; adjust all callers.
3937 * options.h (General_options): Change keep_files_mapped option;
3938 add map_whole_files.
3939 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3941 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3946 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3950 * icf.cc (get_section_contents): Add '@' marker after processing the
3955 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3956 due to a conversion warning.
3957 (Arm_relobj::update_output_local_symbol_count): Check for local
3958 symbol with unset output index.
3962 * options.h (class General_options): Add --spare-dynamic-tags.
3963 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3964 --spare-dynamic-tags.
3968 * incremental.cc: Include "libiberty.h".
3972 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3973 function, is_info_ member.
3974 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3975 (Versions::Versions): Update caller.
3976 (Versions::define_base_version): Likewise.
3977 (Versions::add_def): Likewise.
3981 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3982 (Scan::possible_function_pointer_reloc): New function.
3983 (Scan::local_reloc_may_be_function_pointer): Change to call
3984 possible_function_pointer_reloc.
3985 (Scan::global_reloc_may_be_function_pointer): Ditto.
3986 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3987 relocations in ".data.rel.ro._ZTV" section.
3988 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3989 * testsuite/icf_safe_so_test.cc: Ditto.
3990 * testsuite/icf_safe_test.cc: Ditto.
3991 * testsuite/icf_safe_test.sh: Ditto.
3996 * target-reloc.h (relocate_section): Check the symbol table index
3997 for -1U before setting the local symbol index.
3998 (scan_relocatable_relocs): If copying the relocation, record that
3999 the local symbol is required.
4000 * object.h (Symbol_value::is_output_symtab_index_set): New
4002 (Symbol_value::may_be_discarded_from_output_symtab): New
4004 (Symbol_value::has_output_symtab_entry): New function.
4005 (Symbol_value::needs_output_symtab_entry): Remove.
4006 (Symbol_value::output_symtab_index): Make sure the symbol index is
4008 (Symbol_value::set_output_symtab_index): Make sure the symbol
4009 index is not set. Make sure the new index is valid.
4010 (Symbol_value::set_must_have_output_symtab_entry): New function.
4011 (Symbol_value::has_output_dynsym_entry): New function.
4012 (Symbol_value::set_output_dynsym_index): Make sure the new index
4014 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4015 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4016 local symbol if permitted.
4017 (Sized_relobj::do_finalize_local_symbols): Call
4018 is_output_symtab_index_set rather than needs_output_symtab_entry.
4019 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4020 rather than needs_output_symtab_entry. Call
4021 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4022 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4023 is_output_symtab_index_set rather than needs_output_symtab_entry.
4024 * testsuite/discard_locals_relocatable_test.c: New file.
4025 * testsuite/discard_locals_test.sh: Test -r.
4026 * testsuite/Makefile.am (check_DATA): Add
4027 discard_locals_relocatable_test1.syms,
4028 discard_local_relocatable_test2.syms.
4029 (MOSTLYCLEANFILES): Likewise. Also add
4030 discard_locals_relocatable_test1.lout and
4031 discard_locals_relocatable_test2.out.
4032 (discard_locals_relocatable_test1.syms): New target.
4033 (discard_locals_relocatable_test.o): New target.
4034 (discard_locals_relocatable_test1.out): New target.
4035 (discard_locals_relocatable_test2.syms): New target.
4036 (discard_locals_relocatable_test2.out): New target.
4037 (various): Add missing ../ld-new dependencies.
4038 * testsuite/Makefile.in: Rebuild.
4042 * po/fi.po: New Finnish translation.
4046 * layout.cc (Layout::Layout): Force section types of .init_array*,
4047 .preinit_array* and .fini_array* sections.
4048 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4049 Fix check of return value of std::string::find.().
4050 (Output_section::Input_section_sort_compare::operator()): Remove
4051 comment about .init_array.
4052 (Output_section::Input_section_sort_init_fini_compare::operator()):
4054 (Output_section::sort_attached_input_sections): Handle .init_array
4055 and .fini_array specially.
4056 * output.h (Output_section::Inut_section_sort_compare): Update
4058 (Output_section::Input_section_sort_init_fini_compare): New struct.
4062 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4063 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4064 * testsuite/debug_msg.sh: Avoid matching source line number for
4065 use of global variable undef_int.
4069 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4070 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4071 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4072 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4073 * options.cc (General_options::General_options): Initialize member
4075 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4076 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4077 and rm_no_fix_v4bx.stdout
4078 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4079 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4080 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4081 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4082 and arm_no_fix_v4bx.
4083 * Makefile.in: Regenerate.
4084 * testsuite/arm_fix_v4bx.s: New file.
4085 * testsuite/arm_fix_v4bx.sh: Ditto.
4089 * arm.cc (Target_arm::got_section): Make the .got section the first
4090 non RELRO section in the data segment.
4091 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4092 suffixes of section names.
4096 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4097 flags and attributes merging if an input file is a binary file.
4098 * fileread.cc (Input_file::open): Record format of original file.
4099 * fileread.h (Input_file::Format): New enum type.
4100 (Input_file::Input_file): Initialize data member format_.
4101 (Input_file::format): New method definition.
4102 (Input_file::format_):: New data member.
4106 * arm.cc (Arm_output_data_got): New class.
4107 (ARM_TCB_SIZE): New constant
4108 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4109 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4110 If user uses a script with a SECTIONS clause, issue only a warning
4111 for a misplaced EXIDX input section. Otherwise, issue an error.
4112 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4114 (Target_arm::got_mode_index_entry): Handle static linking.
4115 (Target_arm::Scan::local): Ditto.
4116 (Target_arm::Scan::global): Ditto.
4117 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4118 all incorrectly implemented relocations.
4119 (Target_arm::fix_exidx_coverage): Pass layout to
4120 Arm_output_section::fix_exidx_coverage.
4121 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4122 from ".ARM.exidx." and ".ARM.extab.".
4126 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4127 section if it does not already exist.
4128 * attributes.cc (Attributes_section_data::Attributes_section_data):
4129 Don't crash if size is zero.
4134 * gold.cc (queue_middle_tasks): If no input files were opened,
4136 * workqueue.h (Task_function::Task_function): Assert that there is
4141 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4142 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4143 types to avoid warnings due to different uint64_t implementations
4148 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4149 handling of the maximum backward branch offset.
4150 (Arm_relocate_functions::thumb_branch_common): Ditto.
4151 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4152 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4153 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4154 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4155 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4156 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4157 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4158 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4159 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4160 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4161 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4162 thumb2_bl_out_of_range.o): New rules.
4163 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4164 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4165 thumb2_bl_out_of_range
4166 * testsuite/Makefile.in: Regenerate.
4167 * testsuite/arm_bl_in_range.s: New file.
4168 * testsuite/arm_bl_out_of_range.s: Ditto.
4169 * testsuite/arm_branch_in_range.sh: Ditto.
4170 * testsuite/arm_branch_range.t: Ditto.
4171 * testsuite/thumb2_branch_range.t: Ditto.
4172 * testsuite/thumb_bl_in_range.s: Ditto.
4173 * testsuite/thumb_bl_out_of_range.s: Ditto.
4174 * testsuite/thumb_branch_range.t: Ditto.
4178 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4179 Add reloc offset information.
4180 * icf.cc (get_section_contents): Change iterators to point to the new
4181 vectors. Add reloc offset information to the contents.
4182 * icf.h (Icf::Sections_reachable_info): New typedef.
4183 (Icf::Sections_reachable_list): New typedef.
4184 (Icf::Offset_info): New typedef.
4185 (Icf::Reloc_info): New struct typedef.
4186 (Icf::Reloc_info_list): New typedef.
4187 (Icf::symbol_reloc_list): Delete method.
4188 (Icf::addend_reloc_list): Delete method.
4189 (Icf::section_reloc_list): Delete method.
4190 (Icf::reloc_info_list): New method.
4191 (Icf::reloc_info_list_): New member.
4195 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4196 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4197 * arm.cc (Arm_relocation_functions): New forward declaration.
4198 (Target_arm::Target_arm): Initialize new data members
4199 got_mod_index_offset_ and tls_base_symbol_defined_.
4200 (Target_arm::Relocate::relocate_tls): New method.
4201 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4202 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4204 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4205 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4206 (Target_arm::got_mod_index_offset_,
4207 Target_arm::tls_base_symbol_defined_): New data members.
4208 (Target_arm::Scan::local, Target::Scan::global,
4209 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4214 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4215 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4216 text section as a parameter becuase some broken tools may not set
4217 the link in section header.
4218 (Target_arm::has_got_section): New method.
4219 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4220 without any mapping symbol as data only. Remove warning.
4221 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4222 link in its section header, try to discover the link by inspecting the
4223 REL31 relocation at the beginning of the section.
4224 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4226 (Target_arm::Scan::global): Treat any reference to the symbol
4227 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4231 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4232 (Scan::global_reloc_may_be_function_pointer): New function.
4233 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4234 (Scan::global_reloc_may_be_function_pointer): New function.
4235 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4236 (Scan::global_reloc_may_be_function_pointer): New function.
4237 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4238 (Scan::global_reloc_may_be_function_pointer): New function.
4239 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4240 (Scan::global_reloc_may_be_function_pointer): New function.
4241 (Scan::possible_function_pointer_reloc): New function.
4242 (Target_x86_64::can_check_for_function_pointers): New function.
4243 * gc.h (gc_process_relocs): Scan relocation types to determine if
4244 function pointers were taken for targets that support it.
4245 * icf.cc (Icf::find_identical_sections): Include functions for
4246 folding in safe ICF whose pointer is not taken.
4247 * icf.h (Secn_fptr_taken_set): New typedef.
4248 (fptr_section_id_): New member.
4249 (section_has_function_pointers): New function.
4250 (set_section_has_function_pointers): New function.
4251 (check_section_for_function_pointers): New function.
4252 * options.h: Fix comment for safe ICF option.
4253 * target.h (can_check_for_function_pointers): New function.
4254 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4255 Modify icf_safe_test for X86-64.
4256 * testsuite/Makefile.in: Regenerate.
4257 * testsuite/icf_safe_so_test.cc: New file.
4258 * testsuite/icf_safe_so_test.sh: New file.
4259 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4260 (main): Change to take pointer to function kept_func_3.
4261 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4262 folding is done correctly for X86-64.
4266 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4267 is_symbolless parameter.
4268 (Output_reloc<SHT_REL>::is_symbolless): New.
4269 (Output_reloc<SHT_REL>::is_symbolless_): New.
4270 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4271 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4272 (Output_reloc<SHT_RELA>::is_symbolless): New.
4273 (Output_data_reloc::add_global): Handle is_symbolless.
4274 (Output_data_reloc::add_global_relative): Likewise.
4275 (Output_data_reloc::add_local): Likewise.
4276 (Output_data_reloc::add_local_relative): Likewise.
4277 (Output_data_reloc::add_symbolless_global_addend): New.
4278 (Output_data_reloc::add_symbolless_local_addend): New.
4279 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4281 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4282 instead of ->is_relative_
4283 (Output_reloc::write): Likewise.
4284 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4285 (Output_reloc::write_rel): Simplify.
4287 * sparc.cc (Target_sparc::Scan::local): Use
4288 ->add_symbolless_local_addend as needed.
4289 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4290 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4291 based upon relocation offset.
4295 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4296 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4297 beginning of function.
4298 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4299 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4300 parameter is_32bit in calls to should_apply_static_reloc.
4301 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4302 (check_DATA): Add arm_abs_global.stdout.
4303 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4304 arm_abs_global.stdout): New rules.
4305 (MOSTLLYCLEANFILES): Add arm_abs_global
4306 * Makefile.in: Regenerate.
4307 * testsuite/arm_abs_global.s: New file.
4308 * testsuite/arm_abs_global.sh: Ditto.
4309 * testsuite/arm_abs_lib.s: Ditto.
4313 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4315 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4316 Allocate_commons_task first.
4317 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4318 task, rather than symtab_lock_.
4319 (Gc_process_relocs::~Gc_process_relocs): New function.
4320 (Gc_process_relocs::is_runnable): Check this_blocker_.
4321 (Gc_process_relocs::locks): Use next_blocker_ rather than
4323 (Scan_relocs::~Scan_relocs): New function.
4324 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4326 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4328 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4329 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4330 constructor accordingly.
4331 (class Gc_process_relocs): Likewise.
4332 (class Scan_relocs): Likewise.
4333 * common.h (class Allocate_commons_task): Remove symtab_lock_
4334 field, and corresponding constructor parameter.
4335 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4337 (Allocate_commons_task::locks): Likewise.
4341 * gold-threads.h (class Once): Define.
4342 (class Initialize_lock): Rewrite as child of Once.
4343 * gold-threads.cc (class Once_initialize): Define.
4344 (once_pointer_control): New static variable.
4345 (once_pointer, once_arg): New static variables.
4346 (c_run_once): New static function.
4347 (Once::Once, Once::run_once, Once::internal_run): New functions.
4348 (class Initialize_lock_once): Remove.
4349 (initialize_lock_control): Remove.
4350 (initialize_lock_pointer): Remove.
4351 (initialize_lock_once): Remove.
4352 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4353 (Initialize_lock::initialize): Rewrite.
4354 (Initialize_lock::do_run_once): New function.
4355 * archive.cc (Archive::interpret_header): Only clear name if it is
4357 * fileread.cc: Include "gold-threads.h"
4358 (file_counts_lock): New static variable.
4359 (file_counts_initialize_lock): Likewise.
4360 (File_read::release): Only increment counts when using --stats.
4361 Use a lock around the increment.
4362 * parameters.cc (class Set_parameters_target_once): Define.
4363 (set_parameters_target_once): New static variable.
4364 (Parameters::Parameters): Move here from parameters.h.
4365 (Parameters::set_target): Rewrite.
4366 (Parameters::set_target_once): New function.
4367 (Parameters::clear_target): Move here and rewrite.
4368 * parameters.h (class Parameters): Update declarations. Add
4369 set_parameters_target_once_ field.
4370 (Parameters::Parameters): Move to parameters.cc.
4371 (Parameters::clear_target): Likewise.
4372 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4374 (Start_group::~Start_group): New function.
4375 (Start_group::is_runnable): New function.
4376 (Start_group::locks, Start_group::run): New functions.
4377 (Finish_group::run): Change saw_undefined to size_t.
4378 * readsyms.h (class Start_group): Define.
4379 (class Finish_group): Change saw_undefined_ field to size_t.
4380 (Finish_group::Finish_group): Remove saw_undefined and
4381 this_blocker parameters. Change all callers.
4382 (Finish_group::set_saw_undefined): New function.
4383 (Finish_group::set_blocker): New function.
4384 * symtab.h (class Symbol_table): Change saw_undefined to return
4385 size_t. Change saw_undefined_ field to size_t.
4386 * target-select.cc (Set_target_once::do_run_once): New function.
4387 (Target_selector::Target_selector): Initialize set_target_once_
4388 field. Don't initialize lock_ and initialize_lock_ fields.
4389 (Target_selector::instantiate_target): Rewrite.
4390 (Target_selector::set_target): New function.
4391 * target-select.h (class Set_target_once): Define.
4392 (class Target_selector): Update declarations. Make
4393 Set_target_once a friend. Remove lock_ and initialize_lock_
4394 fields. Add set_target_once_ field.
4398 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4400 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4401 (queue_middle_tasks): Add all blockers before queueing any tasks.
4402 (queue_final_tasks): Likewise.
4403 * token.h (Task_token::add_blockers): New function.
4404 * object.h (Input_objects::number_of_relobjs): New function.
4408 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4409 shared, not if not position independent.
4410 * x86_64.cc (Relocate::relocate_tls): Likewise.
4411 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4412 (tls_pie_pic_test): New target.
4413 * testsuite/Makefile.in: Rebuild.
4415 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4416 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4417 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4418 * testsuite/Makefile.in: Rebuild.
4422 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4423 R_SPARC_RELATIVE using ->add_local_relative().
4424 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4426 * output.h (Output_data_dynamic::add_section_size): New method
4427 that takes two Output_data objects.
4428 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4429 entry param. Handle it in initializers.
4430 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4431 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4432 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4434 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4435 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4436 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4437 for dynrel_includes_plt.
4438 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4439 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4440 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4442 (Target_sparc::do_finalize_sections): Update to pass true for
4443 dynrel_includes_plt.
4444 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4445 output before .rela.plt
4446 (Target_powerpc::do_finalize_sections): Update to pass true for
4447 dynrel_includes_plt when 32-bit.
4451 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4453 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4454 Arm_relobj::scan_section_for_cortex_a8_stubs,
4455 Arm_relobj::do_relocation_section): Instead of calling
4456 Output_section::output_address, use faster
4457 Arm_relobj::simple_input_section_output_address.
4461 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4462 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4463 relocation helper function.
4465 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4466 just like R_SPARC_GOT{10,13,22}.
4467 (Target_sparc::Scan::local): Likewise.
4468 (Target_sparc::Relocate:relocate): Likewise.
4472 * configure.ac: Rewrite targetobjs duplicate removal code to use
4473 only shell constructs.
4474 * configure: Rebuild.
4479 * arm.cc (Arm_relobj::section_is_scannable): New method.
4480 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4481 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4486 * arm-reloc-property.cc (cstdio): Include.
4487 * configure.ac (targetobjs): Remove duplicates.
4488 * configure: Regenerate.
4489 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4490 big and little endian version for a given address size.
4494 * arm-reloc-property.cc
4495 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4497 * arm-reloc-property.h
4498 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4499 New method definition.
4500 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4502 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4504 (GOT_PREL): Change implemented to Y.
4505 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4506 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4507 (Arm_relocate_functions::movw_abs_nc): Remove method.
4508 (Arm_relocate_functions::movt_abs): Ditto.
4509 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4510 (Arm_relocate_functions::thm_movt_abs): Ditto.
4511 (Arm_relocate_functions::movw_rel_nc): Ditto.
4512 (Arm_relocate_functions::movw_rel): Ditto.
4513 (Arm_relocate_functions::movt_rel): Ditto.
4514 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4515 (Arm_relocate_functions:thm_movw_rel): Ditto.
4516 (Arm_relocate_functions:thm_movt_rel): Ditto.
4517 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4518 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4519 New method definitions.
4520 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4521 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4522 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4523 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4524 (Target_arm::Relocate::relocate): Check for non-static or
4525 unimplemented relocation code and exit early. Change calls to
4526 Target_arm::reloc_uses_thumb_bit and
4527 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4528 instead. Refactor code to handle similar relocations to increase
4529 code sharing. Remove check for unsupported relocation code in switch
4531 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4532 relocation property table to find out size. Change error message to
4533 print out the name of a relocation code instead of the numeric value.
4534 (Target_arm::scan_reloc_for_stub): Use relocation property table
4535 instead of calling Target_arm::reloc_uses_thumb_bit().
4539 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4540 types of relaxed input section.
4544 * Makefile.am (HFILES): Add arm-reloc-property.h.
4546 (TARGETSOURCES): Add arm-reloc-property.cc
4547 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4548 (libgold_a_SOURCES): $(DEFFILES)
4549 * Makefile.in: Regenerate.
4550 * arm-reloc-property.cc: New file.
4551 * arm-reloc-property.h: New file.
4552 * arm-reloc.def: New file.
4553 * arm.cc: Update comments.
4554 (arm-reloc-property.h): New included header.
4555 (arm_reloc_property_table): New global variable.
4556 (Target_arm::do_select_as_default_target): New method definition.
4557 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4558 arm-reloc-property to targ_extra_obj.
4559 * parameters.cc (set_parameters_target): Call
4560 Target::select_as_default_target().
4561 * target.h (Target::select_as_default_target): New method definition.
4562 (Target::do_select_as_default_target): Same.
4566 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4567 first_output_text_section_.
4568 (Arm_exidx_fixup::first_output_text_section): New method definition.
4569 (Arm_exidx_fixup::first_output_text_section_): New data member.
4570 (Arm_exidx_fixup::process_exidx_section): Record the first text
4571 output section seen.
4572 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4573 and entsize in output section header.
4577 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4578 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4579 (Arm_relocate_functions::thm_alu11): New Method.
4580 (Arm_relocate_functions::thm_pc8): New Method.
4581 (Arm_relocate_functions::thm_pc12): New Method.
4582 (Target_arm::Scan::local): Handle the relocations.
4583 (Target_arm::Scan::global): Likewise.
4584 (Target_arm::Relocate::relocate): Likewise.
4585 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4589 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4590 of relocation types as ld.
4594 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4596 (Arm_relocate_functions::thumb_branch_common): Ditto.
4597 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4598 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4599 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4600 Arm_relocate_functions::jump24): Remove.
4601 (Target_arm::Relocate::relocate): Adjust code to call
4602 Arm_relocation_functions::arm_branch_common and
4603 Arm_relocation_functions::thumb_branch_common instead of their removed
4604 wrappers. Merge switch-cases together to reduce source code size.
4608 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4609 output_local_symbol_count_needs_update_.
4610 (Arm_relobj::output_local_symbol_count_needs_update,
4611 Arm_relobj::set_output_local_symbol_count_needs_update,
4612 Arm_relobj::update_output_local_symbol_count): New methods.
4613 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4615 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4616 of pointed function as in a R_ARM_PREL31 relocation.
4617 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4618 for output local symbol count updating.
4619 (Target_arm::do_relax): Update output local symbol counts in objects
4621 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4625 * arm.cc: Added support for the ARM relocations:
4626 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4627 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4628 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4630 (Arm_relocate_functions::movw_rel): New method.
4631 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4632 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4634 (Arm_relocate_functions::thm_movw_rel): New method.
4635 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4637 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4639 (Target_arm::Scan::global): Likewise.
4640 (Target_arm::Relocate::relocate): Likewise.
4641 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4646 * arm.cc: Added support for ARM group relocations.
4647 (Target_arm::reloc_needs_sym_origin): New method.
4648 (Arm_relocate_functions::calc_grp_kn): New method.
4649 (Arm_relocate_functions::calc_grp_residual): New method.
4650 (Arm_relocate_functions::calc_grp_gn): New method.
4651 (Arm_relocate_functions::arm_grp_alu): New Method.
4652 (Arm_relocate_functions::arm_grp_ldr): New Method.
4653 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4654 (Arm_relocate_functions::arm_grp_ldc): New Method.
4655 (Target_arm::Scan::local): Handle the ARM group relocations.
4656 (Target_arm::Scan::global): Likewise.
4657 (Target_arm::Relocate::relocate): Likewise.
4658 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4663 * arm.cc (set): Include.
4664 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4666 (Arm_output_section::Text_section_list): New type.
4667 (Arm_output_section::append_text_sections_to_list): New method.
4668 (Arm_output_section::fix_exidx_coverage): Ditto.
4669 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4670 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4671 Relobj::set_section_offset() instead of
4672 Sized_relobj::invalidate_section_offset().
4673 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4674 parameter for section headers. Ignore relocation sections for
4675 unallocated sections and EXIDX sections.
4676 (Target_arm::fix_exidx_coverage): New method.
4677 (Target_arm::output_section_address_less_than): New type.
4678 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4679 linked text section instead of the EXIDX section.
4680 (Arm_output_section::create_stub_group): Add an assertion to check
4681 that this is not an EXIDX output section.
4682 (Arm_output_section::append_text_sections_to_list): New method.
4683 (Arm_output_section::fix_exidx_coverage): Ditto.
4684 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4685 Arm_relobj::section_needs_reloc_stub_scanning.
4686 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4688 (Target_arm::fix_exidx_coverage): New method.
4689 * object.h (Relobj::set_output_section): New method.
4690 (Sized_relobj::invalidate_section_offset): Remove method.
4691 (Sized_relobj::do_invalidate_section_offset): Remove method.
4692 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4696 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4697 Fix warning due to signed and unsigned comparison on a 32-bit host.
4701 * arm.cc (Target_arm::do_relax): Record an output section for section
4702 offset adjustment it contains any stub table that has changed.
4703 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4704 offsets in an output section if necessary.
4705 * output.cc (Output_section::Output_section): Initialize
4706 section_offsets_need_adjustments_.
4707 (Output_section::add_input_section_for_script): Renamed to
4708 Output_section::add_simple_input_section.
4709 (Output_section::save_states): Add a comment.
4710 (Output_section::discard_states): New method defintion.
4711 (Output_section::adjust_section_offsets): Same.
4712 * output.h (Output_section::add_input_section_for_script): Renamed to
4713 Output_section::add_simple_input_section.
4714 (Output_section::discard_states): New method declaration.
4715 (Output_section::adjust_section_offsets): Same.
4716 (Output_section::section_offsets_need_adjustment,
4717 Output_section::set_section_offsets_need_adjustment): New method
4719 (Output_section::section_offsets_need_adjustment_): New data member.
4720 * script-sections.cc
4721 (Output_section_element_input::set_section_address): Adjust code for
4722 renaming of Output_section::add_input_section_for_script.
4723 (Orphan_output_section::set_section_address): Same.
4727 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4728 Fix_v4bx enum values .
4729 * gold/options.h (General_options): New option definitions.
4730 (General_options::fix_v4bx): New method.
4731 (General_options::Fix_v4bx): New enum.
4732 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4733 (General_options::parse_fix_v4bx_interworking): New method.
4737 * arm.cc (Arm_exidx_fixup): New class.
4741 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4743 (Arm_exidx_section_offset_map): New type.
4747 * arm.cc (Arm_exidx_input_section): New class.
4748 (Arm_relobj::exidx_input_section_by_link,
4749 Arm_relobj::exidx_input_section_by_shndx,
4750 Arm_relobj::make_exidx_input_section): New methods.
4751 (read_arm_attributes_section): Remove.
4752 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4753 information about them.
4754 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4759 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4760 Input_section_specifier to Section_id.
4761 (Target_arm::new_arm_input_section: Adjust code for change of key
4763 (Target_arm::find_arm_input_section): Ditto.
4764 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4765 (Section_id): Remove.
4766 (Garbage_collection::Section_id_hash): Remove.
4767 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4768 (Section_id): Remove.
4769 (Icf::Section_id_hash): Remove.
4770 * object.h (Section_id, Const_section_id, Section_id_hash,
4771 Const_section_id_hash): New type definitions.
4772 * output.cc (Output_section::add_relaxed_input_section): Change to
4773 use Const_section_id instead of Input_section_specifier as key type.
4774 (Output_section::add_merge_input_section): Ditto.
4775 (Output_section::build_relaxation_map): Change to use Section_id
4776 instead of Input_section_specifier as key type.
4777 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4779 (Output_section::convert_input_sections_to_relaxed_sections): Change
4780 to use Const_section_id instead of Input_section_specifier as key type.
4781 (Output_section::find_merge_section): Ditto.
4782 (Output_section::find_relaxed_input_section): Ditto.
4783 * output.h (Input_section_specifier): Remove class.
4784 (Output_section::Output_section_data_by_input_section_map): Change
4785 key type to Const_section_id.
4786 (Output_section::Output_relaxed_input_section_by_input_section_map):
4788 (Output_section::Relaxation_map): Change key type to Section_id.
4792 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4793 (class Arm_v4bx_stub): New class.
4794 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4795 (Stub_factory::make_arm_v4bx_stub): New method.
4796 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4797 (Stub_table::empty): Handle v4bx stubs.
4798 (Stub_table::add_arm_v4bx_stub): New method.
4799 (Stub_table::find_arm_v4bx_stub): New method.
4800 (Arm_relocate_functions::v4bx): New method.
4801 (Target_arm::fix_v4bx): New method.
4802 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4803 (Stub_table::relocate_stubs): Likewise.
4804 (Stub_table::do_write): Likewise.
4805 (Stub_table::update_data_size_and_addralign): Likewise.
4806 (Stub_table::finalize_stubs): Likewise.
4807 (Target_arm::Scan::local): Likewise.
4808 (Target_arm::Scan::global): Likewise.
4809 (Target_arm::do_finalize_sections): Likewise.
4810 (Target_arm::Relocate::relocate): Likewise.
4811 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4813 (Target_arm::scan_reloc_for_stub): Likewise.
4814 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4818 * output.cc (Output_section_headers::do_sized_write): Write large
4819 segment count to sh_info field.
4820 (Output_file_header::do_sized_write): For large segment count,
4821 write PN_XNUM to e_phnum field.
4825 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4826 (Arm_relocate_functions::thm_jump8): New function.
4827 (Arm_relocate_functions::thm_jump11): New function.
4828 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4830 (Target_arm::Scan::global): Likewise.
4831 (Target_arm::Relocate::relocate): Likewise.
4832 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4837 * arm.cc (map, utility): Include headers.
4838 (Target_arm::apply_cortex_a8_workaround): New method.
4839 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4840 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4841 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4842 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4843 the --[no-]fix-cortex-a8 command line options.
4844 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4845 (Target_arm::relocate_stub): Use addend in instruction template.
4846 * options.h (DEFINE_bool): Set the user-set flag.
4847 (General_options): Add --[no-]-fix-cortex options.
4848 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4849 : Update fast look-up map after conversion.
4853 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4854 in the first pass of do_layout.
4858 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4859 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4860 apparent compiler problem of not folding static constant integral
4861 data members of elfcpp::Elf_sizes<32>.
4865 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4866 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4867 Arm_relobj::scan_section_for_cortex_a8_erratum,
4868 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4869 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4870 sections to scan for relocation stubs into a new method
4871 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4872 relocation and Cortex-A8 stub scanning.
4873 (Target_arm::do_relax): Force stubs to be after stubbed sections
4874 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4875 the beginning of a new relaxation pass. Update a comment.
4876 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4880 * target-reloc.h (visibility_error): New inline function.
4881 (relocate_section): Call visibility_error.
4882 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4883 (MOSTLYCLEANFILES): Likewise.
4884 (protected_4_pic.o, protected_3.err): New targets.
4885 * testsuite/protected_4.cc: New file.
4889 * arm.cc (Cortex_a8_reloc): New class.
4890 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4891 and cortex_a8_relocs_info_.
4892 (Target_arm::fix_cortex_a8): New method definition.
4893 (Target_arm::Cortex_a8_relocs_info): New type.
4894 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4895 New data member declarations.
4896 (Target_arm::scan_reloc_for_stub): Record information about
4897 relocations for THUMB branches that might be exempted from the
4898 Cortex-A8 workaround.
4899 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4900 at the beginning of a relaxation pass.
4904 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4905 (Arm_relobj::Mapping_symbol_position,
4906 Arm_reloj::Mapping_symbol_position_less,
4907 Arm_relobj::Mapping_symbols_info): New types.
4908 (Target_arm::is_mapping_symbol_name): New method definition.
4909 (Arm_relobj::do_count_local_symbols): Save information about mapping
4914 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4915 Arm_relocate_functions::thumb32_branch_upper,
4916 Arm_relocate_functions::thumb32_branch_lower,
4917 Arm_relocate_functions::thumb32_cond_branch_offset,
4918 Arm_relocate_functions::thumb32_cond_branch_upper,
4919 Arm_relocate_functions::thumb32_cond_branch_lower,
4920 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4921 branch offset encoding.
4922 (Arm_relocate_functions::thumb_branch_common): Use new branch
4923 offset encoding methods to avoid code duplication.
4924 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4925 (Stub_addend_reader::operator()): Use new branch encoding method
4926 to avoid code duplication.
4930 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4931 (Target_arm::do_finalize_sections): Define special EXIDX section
4932 symbols only if referenced.
4933 * gc.h (Garbage_collection::add_reference): New method.
4934 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4939 * script.cc (Version_script_info::build_expression_list_lookup):
4940 Change complaing about duplicate wildcard match from error to
4943 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4945 (Version_script_info::Version_script_info): Initialize globs_,
4946 default_version_, default_is_global_, and exact_. Don't
4947 initialize globals_ or locals_.
4948 (Version_script_info::build_lookup_tables): Build local symbols
4950 (Version_script_info::unquote): New function.
4951 (Version_script_info::add_exact_match): New function.
4952 (Version_script_info::build_expression_list_lookup): Remove lookup
4953 parameter. Add is_global parameter. Change all callers. Handle
4954 wildcard pattern specially. Unquote pattern. Call
4956 (Version_script_info::get_name_to_match): New function.
4957 (Version_script_info::get_symbol_version): New function.
4958 (Version_script_info::get_symbol_version_helper): Remove.
4959 (Version_script_info::check_unmatched_names): Call unquote.
4960 * script.h (class Version_script_info): Change get_symbol_version
4961 to be non-inline and add is_global parameter; change all callers.
4962 Rewrite symbol_is_local. Update declarations. Define struct
4963 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4964 Remove globals_ and locals_ members. Add exact_, globs_,
4965 default_version_, is_global_.
4966 (Version_script_info::Glob): Remove pattern, add expression and
4967 is_global. Update constructor. Change all callers.
4968 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4970 (Versions::symbol_section_contents): If a symbol is undefined, or
4971 defined in a dynamic object, set the version index to
4973 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4975 (Symbol_table::add_from_pluginobj): Likewise.
4976 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4980 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4981 (incremental_dump_LDADD): Add linking option for libintl.
4982 * Makefile.in: Regenerate.
4987 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4989 * testsuite/Makefile.in: Regenerated.
4993 * options.h (DEFINE_var): Use parentheses around argument varname__
4994 in macro body to avoid any unintended subsequent substitutions.
4998 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4999 candidates before doing symbol resolution.
5001 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5002 ODR candidates if only one is weak.
5006 * script.cc (Version_script_info::build_expression_list_lookup):
5007 Don't warn about ambiguous version, just record the ambiguity.
5008 (Version_script_info::get_symbol_version_helper): Give error if
5009 version is ambiguous.
5013 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5014 prev_data_size_ and prev_addralign_. Remove initializer for
5015 deleted data member has_been_changed_.
5016 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5017 to determine if the table is empty.
5018 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5020 (Stub_table::add_reloc_stub): Define method in class definition
5021 instead of just declaring it there.
5022 (Stub_table::add_cortex_a8_stub): New method definition.
5023 (Stub_table::update_data_size_and_addralign): Ditto.
5024 (Stub_table::finalize_stubs): Ditto.
5025 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5026 (Stub_table::do_addralign_): Return address alignment in the
5027 (Stub_table::do_reset_address_and_file_offset): Define method in
5028 class definition instead of declaring it there. Set current data
5029 size to be the data size of the previous pass.
5030 (Stub_table::set_final_data_size): Use current data size as the
5032 (Stub_table::relocate_stub): Change parameter type of stub from
5033 Reloc_stub pointer to Stub pointer.
5034 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5035 (Stub_table::Cortex_a8_stub_list): New typedef.
5036 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5037 Stub_table::prev_addralign_): New data member.
5038 (Arm_relobj::Arm_relobj): Initialize data member
5039 section_has_cortex_a8_workaround_.
5040 (Arm_relobj::section_has_cortex_a8_workaround,
5041 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5043 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5045 (Target_arm::relocate_stub): Change parameter type of stub from
5046 Reloc_stub pointer to Stub pointer.
5047 (Insn_template::size, Insn_template::alignment): Handle
5048 THUMB16_SPECIAL_TYPE.
5049 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5050 Stub_table::update_data_size_and_addralign,
5051 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5053 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5054 (Stub_table::do_write): Ditto.
5055 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5060 * symtab.h (class Symbol): Remove fields is_target_special_ and
5061 has_plt_offset_. Add field is_defined_in_discarded_section_.
5062 (Symbol::is_defined_in_discarded_section): New function.
5063 (Symbol::set_is_defined_in_discarded_section): New function.
5064 (Symbol::has_plt_offset): Rewrite.
5065 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5066 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5067 Don't initialize is_target_special_ or has_plt_offset_.
5068 Initialize is_defined_in_discarded_section_.
5069 (Symbol_table::add_from_relobj): If appropriate, set
5070 is_defined_in_discarded_section.
5071 * resolve.cc (Symbol::override_base_with_special): Don't test
5072 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5073 * target-reloc.h (relocate_section): Do special handling for
5074 symbols defined in discarded sections for global symbols as well
5079 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5080 the SHT_SYMTAB case.
5084 * object.cc (Sized_relobj::do_layout): Don't get confused if
5085 layout_eh_frame returns NULL.
5090 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5091 dynamic symbol table, use the normal symbol table.
5092 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5098 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5103 * version.cc (print_version): Change to "Copyright 2010".
5109 * i386.cc (class Target_i386): Change return type of plt_section
5111 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5112 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5113 tls_desc_rel_ field.
5114 (Output_data_plt_i386::rel_tls_desc): New function.
5115 (Target_i386::rel_tls_desc_section): New function.
5116 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5117 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5118 R_386_TLS_DESC reloc in rel_tls_desc_section.
5119 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5120 Define struct Tlsdesc_info.
5121 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5122 (Target_x86_64::do_reloc_symbol_index): New function.
5123 (Target_x86_64::add_tlsdesc_info): New function.
5124 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5125 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5127 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5129 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5130 (Target_x86_64::rela_tlsdesc_section): New function.
5131 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5133 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5134 (Target_x86_64::do_reloc_addend): New function.
5135 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5136 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5137 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5138 (Output_reloc::type): New function.
5139 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5140 (Output_reloc::is_target_specific): New function.
5141 (Output_reloc::target_arg): New function.
5142 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5143 absolute relocs and target specific relocs.
5144 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5145 add_target_specific.
5146 (class Output_data_reloc) [SHT_RELA]: Likewise.
5147 * output.cc (Output_reloc::Output_reloc): Add four new versions
5148 for absolute relocs and target specific relocs.
5149 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5150 (Output_reloc::get_symbol_index): Likewise.
5151 (Output_reloc::local_section_offset): Check that local_sym_index_
5152 is not TARGET_CODE or 0.
5153 (Output_reloc::symbol_value): Likewise.
5154 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5156 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5157 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5159 * layout.cc (add_target_dynamic_tags): Use output section for
5160 DT_PLTRELSZ and DT_JMPREL.
5165 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5167 (class Output_data_reloc_generic): Define.
5168 (class Output_data_reloc_base): Change base class to
5169 Output_data_reloc_generic. Change add() method to call
5170 bump_relative_reloc_count for a relative reloc. Remove
5172 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5174 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5175 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5177 * layout.h (class Layout): Update declaration.
5181 * output.h (class Output_data): Add const version of
5182 output_section and do_output_section.
5183 (class Output_section_data): Add const version of
5185 (class Output_section): Likewise.
5186 * layout.cc (Layout::add_target_dynamic_tags): New function.
5187 * layout.h (class Layout): Update declarations.
5188 * arm.cc (Target_arm::do_finalize_sections): Use
5189 add_target_dynamic_tags.
5190 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5191 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5192 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5193 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5198 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5205 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5206 Xindex::read_symtab_xindex.
5210 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5211 (Insn_template::thumb16_bcond_insn): New method declaration.
5212 (Insn_template): Fix spelling.
5213 (Stub::thumb16_special): New method declaration.
5214 (Stub::do_write): Define virtual method which was previously pure
5216 (Stub::do_thumb16_special): New method declaration.
5217 (Stub::do_fixed_endian_write): New template member.
5218 (Reloc_stub::do_write): Remove.
5219 (Reloc_stub::do_fixed_endian_write): Remove.
5220 (Cortex_a8_stub): New class definition.
5221 (Stub_factory::make_cortex_a8_stub): New method definition.
5222 (Stub_factory::Stub_factory): Add missing static storage class
5223 qualifier for elf32_arm_stub_a8_veneer_blx.
5228 * options.h (class General_options): Add --warn-unresolved-symbols
5229 and --error-unresolved-symbols.
5230 * errors.cc (Errors::undefined_symbol): Implement
5231 --warn-unresolved-symbols.
5233 * options.h (class General_options): Add -z text and -z textoff.
5234 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5238 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5239 (Garbage_collection::cident_sections): New function.
5240 (Garbage_collection::add_cident_section): New function.
5241 (Garbage_collection::cident_sections_): New member.
5242 (gc_process_relocs): Add references to sections whose names are C
5244 * gold.h (cident_section_start_prefix): New constant.
5245 (cident_section_stop_prefix): New constant.
5246 (is_cident): New function.
5247 * layout.cc (Layout::define_section_symbols): Replace string constants
5248 with the newly defined constants.
5249 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5251 * testsuite/Makefile.am: Add gc_orphan_section_test.
5252 * testsuite/Makefile.in: Regenerate.
5253 * testsuite/gc_orphan_section_test.cc: New file.
5254 * testsuite/gc_orphan_section_test.sh: New file.
5259 * options.h (class General_options): Add --warn-shared-textrel.
5260 * layout.cc (Layout::finish_dynamic_section): Implement
5261 --warn-shared-textrel.
5264 * options.h (class General_options): Add --warn-multiple-gp.
5268 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5269 $(THREADSLIB) and $(LIBDL).
5270 * Makefile.in: Rebuild.
5275 * options.cc (General_options::parse_section_start): New function.
5276 (General_options::section_start): New function.
5277 (General_options::General_options): Initialize all members.
5278 * options.h: Include <map>
5279 (class General_options): Add --section-start. Add section_starts_
5281 * layout.cc (Layout::attach_allocated_section_to_segment): If
5282 --section-start was used, set the address of the segment. Remove
5283 local sort_sections.
5284 (Layout::relaxation_loop_body): If the address of the load segment
5285 has been set by --section-start, don't use it.
5286 * output.h (Output_segment::update_flags_for_output_section): New
5288 * output.cc (Output_segment::add_output_section): Call
5289 update_flags_for_output_section.
5294 * options.h (class General_options): Add --undefined-version.
5295 * script.cc (struct Version_expression): Add was_matched_by_symbol
5297 (Version_script_info::matched_symbol): New function.
5298 (Version_script_info::get_symbol_version_helper): Call
5300 (Version_script_info::check_unmatched_names): New function.
5301 * script.h (class Version_script_info): Update declarations.
5302 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5304 * options.h (class General_options): Use DEFINE_bool_alias for
5305 allow_multiple_definition.
5306 * resolve.cc (Symbol_table::should_override): Don't test
5307 allow_multiple_definition.
5310 * options.h (class General_options): Add --cref.
5311 * main.cc (main): Print cref table if --cref. Don't close mapfile
5312 until after printing cref table.
5313 * cref.cc: Include "symtab.h".
5314 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5315 (Cref_table_compare::operator()): New function.
5316 (Cref_inputs::gather_cref): New function.
5317 (filecol): New static const.
5318 (Cref_inputs::print_cref): New function.
5319 (Cref::print_cref): New function.
5320 * cref.h: Include <cstdio>.
5321 (class Cref): Update declarations.
5322 * mapfile.h (Mapfile::file): New function.
5323 * object.h (class Object): Define Symbols. Declare virtual
5324 do_get_global_symbols.
5325 (Object::get_global_symbols): New function.
5326 * object.cc (Input_objects::add_object): Pass object to cref_ if
5328 (Input_objects::archive_start): Likewise.
5329 (Input_objects::archive_stop): Likewise.
5330 (Input_objects::print_cref): New function.
5331 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5332 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5334 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5336 * plugin.h (class Sized_pluginobj): Update declarations.
5340 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5341 to is_default_version. Rename insdef to insdefault.
5342 (Symbol_table::add_from_relobj): Rename def to is_default_version
5343 and local to is_forced_local.
5344 (Symbol_table::add_from_pluginobj): Likewise.
5345 (Symbol_table::add_from_dynobj): Likewise.
5346 (Symbol_table::define_special_symbol): Rename insdef to
5352 * options.h (class General_options): Add
5353 --allow-multiple-definition and -z muldefs.
5354 * resolve.cc (Symbol_table::should_override): Don't warn about a
5355 multiple symbol definition if --allow-multiple-definition or -z
5359 * options.h (class General_options): Add --add-needed and
5360 --copy-dt-needed-entries. Tweak --as-needed help entry.
5361 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5362 error if --copy-dt-needed-entries aka --add-needed is used and
5363 would cause a change in behaviour.
5366 * options.h (class General_options): Add -G as a short version of
5367 --shared. Add no-op options -assert, -g, and -i.
5371 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5372 check for .text or .gnu.linkonce.t sections.
5373 * icf.cc (Icf::find_identical_sections): Ditto.
5374 Change the detection for mangled function name within the section
5376 * icf.h (is_section_foldable_candidate): New function.
5381 * options.h (class General_options): Permit two dashes with
5382 --retain-symbols-file.
5387 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5388 don't put the file header and segment headers in the text
5392 * common.cc (Sort_commons::operator()): Stabilize sort when both
5394 (Symbol_table::do_allocate_commons_list): When allocating common
5395 symbols, skip a symbol which is no longer common.
5396 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5397 an object before checking its type.
5398 * testsuite/common_test_2.c: New file.
5399 * testsuite/common_test_3.c: New file.
5400 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5401 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5402 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5403 (common_test_2_pic.o, common_test_2.so): New targets.
5404 (common_test_3_pic.o, common_test_3.so): New targets.
5405 * testsuite/Makefile.in: Rebuild.
5408 * script.cc (read_input_script): If we see a new SECTIONS clause,
5409 and we have added an input section, give an error.
5410 * layout.h (class Layout): Add have_added_input_section function.
5411 Add have_added_input_section_ field.
5412 * layout.cc (Layout::Layout): Initialize
5413 have_added_input_section_.
5414 (Layout::layout): Set have_added_input_section_.
5415 (Layout::layout_eh_frame): Likewise.
5420 * options.h (class General_options): Add --sort-common option.
5421 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5422 * common.cc (Sort_common): Add sort_order parameter to
5423 constructor. Add sort_order_ field.
5424 (Sort_commons::operator): Check sort_order_.
5425 (Symbol_table::allocate_commons): Determine the sort order.
5426 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5428 (Symbol_table::do_allocate_commons_list): Likewise.
5433 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5434 symbols from this object, don't change the visibility of an
5436 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5441 * script.h (class Version_script_info): Define Language enum.
5442 Update declarations. Define Glob, Exact, and Lookup types. Add
5443 new fields globals_, locals_, and is_finalized_.
5444 * script.cc: Various formatting fixes.
5445 (class Parser_closure): Change language_stack_ from a vector of
5446 std::string to one of Version_script_info::Language. Adjust all
5448 (class Lazy_demangler): Remove.
5449 (struct Version_expression): Change language from std::string to
5450 Version_script_info::Language.
5451 (Version_script_info::Version_script_info): New function.
5452 (Version_script_info::~Version_script_info): Don't call clear.
5453 (Version_script_info::finalize): New function.
5454 (Version_script_info::build_lookup_tables): New function.
5455 (Version_script_info::build_expression_list_lookup): New
5457 (Version_script_info::get_symbol_version_helper): Rewrite to use
5459 (Version_script_info::print_expression_list): Adjust to use
5460 Version_script_info::Language.
5461 (script_push_lex_into_version_mode): Check that the version script
5462 has not been finalized.
5463 (version_script_push_lang): Change language string to
5464 Version_script_info::Language.
5465 * options.cc (Command_line::version_script): New function.
5466 * options.h (class General_options): Add finalize_dynamic_list
5467 function. Change version_script from declaration to definition.
5468 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5469 * testsuite/version_script.map: Remove duplicate def of foo.
5470 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5472 * testsuite/Makefile.in: Rebuild.
5477 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5478 if the input symbol index is 0, make the output symbol index 0.
5483 * options.h (class General_options): Add -x/--discard-all.
5484 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5485 --discard-all. If the local symbol needs a dynamic entry, check
5486 that before handling --discard-locals.
5491 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5493 (Output_segment::add_output_section): Don't change the flags if
5497 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5498 GNU hash table if they need a dynamic value. Otherwise, don't add
5499 them if they are defined in a dynamic object or are forced local.
5504 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5505 .gnu.hash table for a 32-bit target.
5508 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5509 regular and a dynamic object only needs a dynamic symbol table
5510 entry if it is externally visible.
5513 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5514 constructor. Add global_offset_table_ field.
5515 (Target_i386::got_section): Set global_offset_table_.
5516 (Target_i386::do_finalize_sections): Set global_offset_table_
5518 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5519 in constructor. Add global_offset_table_ field.
5520 (Target_x86_64::got_section): Set global_offset_table_.
5521 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5524 * layout.cc (Layout::Layout): Initialize increase_relro_.
5525 (Layout::get_output_section): Add is_relro, is_last_relro, and
5526 is_first_non_relro parameters. Change all callers.
5527 (Layout::choose_output_section): Likewise.
5528 (Layout::add_output_section_data): Likewise.
5529 (Layout::make_output_section): Likewise.
5530 (Layout::set_segment_offsets): Clear increase_relro when using a
5532 * layout.h (class Layout): Add increase_relro method. Add
5533 increase_relro_ field. Update declarations.
5534 * output.cc (Output_section::Output_section): Initialize
5535 is_last_relro_ and is_first_non_relro_.
5536 (Output_segment::add_output_section): Group relro sections is
5537 do_sort is true. Handle is_last_relro and is_first_non_relro.
5538 (Output_segment::maximum_alignment): Remove relro handling.
5539 (Output_segment::set_section_addresses): Add increase_relro
5540 parameter. Change all callers. Add initial alignment to align
5541 relro sections on separate page. Remove old relro handling.
5542 (Output_segment::set_section_list_addresses): Remove in_relro
5543 parameter. Change all callers.
5544 (Output_segment::set_offset): Add increase parameter. Change all
5545 callers. Remove old relro handling.
5546 * output.h (class Output_section): Add new methods: is_last_relro,
5547 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5548 Add is_last_relro_ and is_first_non_relro_ fields.
5549 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5550 Create separate .got.plt section. Call increase_relro.
5551 * x86_64.cc (Target_x86_64::got_section): Likewise.
5552 * testsuite/relro_script_test.t: Add .got.plt.
5555 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5556 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5557 (Layout::finalize): Call set_dynamic_symbol_size.
5558 (Layout::set_dynamic_symbol_size): New function.
5559 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5560 set_dynamic_symbol_size.
5563 * output.h (class Output_section): Add is_entsize_zero_ field.
5564 * output.cc (Output_section::Output_section): Initialize
5566 (Output_section::set_entsize): If two different entsizes are
5567 requested, force it to zero.
5568 (Output_section::add_input_section): Set flags for .debug_str
5569 before updating section flags. Set entsize.
5570 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5571 and SHF_STRING if all input sections have those flags.
5575 * main.cc (main): Fix the sys time reporting.
5576 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5581 * options.cc (General_options::parse_version): Allow -v to exit
5582 without an error if there is nothing to link.
5586 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5587 using a version of gcc before 4.1.
5588 * configure: Rebuild.
5592 * attributes.cc (Output_attributes_section_data::do_write): Use
5593 std::vector::front rather than std::vector::data.
5597 * symtab.h (class Symbol_table): Add enum Defined.
5598 * resolve.cc (Symbol_table::should_override): Add defined
5599 parameter. Change all callers. Test whether object is NULL
5600 before calling a method on it.
5601 (Symbol_table::report_resolve_problem): Add defined parameter.
5603 (Symbol_table::should_override_with_special): Likewise.
5604 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5605 parameter. Change all callers.
5606 (Symbol_table::do_define_in_output_data): Likewise.
5607 (Symbol_table::define_in_output_segment): Likewise.
5608 (Symbol_table::do_define_in_output_segment): Likewise.
5609 (Symbol_table::define_as_constant): Likewise.
5610 (Symbol_table::do_define_as_constant): Likewise.
5611 * script.h (class Symbol_assignment): Add is_defsym parameter to
5612 constructor; change all callers.
5613 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5614 parameter. Change all callers. Add is_defsym_ field.
5615 (class Parser_closure): Add parsing_defsym parameter to
5616 constructor; change all callers. Add parsing_defsym accessor
5617 function. Add parsing_defsym_ field.
5621 * gold.cc (queue_middle_tasks): Fix formatting.
5622 * object.cc (Relobj::is_section_name_included): Likewise.
5626 * i386.cc (Target_i386::do_calls_non_split): Recognize
5627 -fsplit-stack prologue for a function with a static chain.
5628 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5629 -fsplit-stack prologue when using %r11.
5633 * options.cc (General_options::parse_version): Make -v continue and do
5634 the link like GNU ld does.
5638 * Makefile.am (CCFILES): Add timer.cc.
5639 (HFILES): Add timer.h.
5640 * configure.ac: Check for sysconf and times.
5641 * main.cc: include timer.h.
5642 (main): Use Timer instead of get_run_time.
5645 * workqueue.cc: include timer.h.
5646 (Workqueue::find_and_run_task):
5647 Report user, sys and wall time.
5648 * Makefile.in: Regenerate.
5649 * config.in: Regenerate.
5650 * configure: Regenerate.
5654 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5656 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5657 relaxed input sections.
5658 * output.cc (Output_section::find_relaxed_input_section): Change
5659 return type to Output_relaxed_input_section pointer. Adjust code
5660 for new type of relaxed_input_section_map_.
5661 * output.h (Output_section::find_relaxed_input_section): Change
5662 return type to Output_relaxed_input_section pointer.
5663 (Output_section::Output_relaxed_input_section_by_input_section_map):
5665 (Output_section::relaxed_input_section_map_): Change type to
5666 Output_section::Output_relaxed_input_section_by_input_section_map.
5667 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5672 * layout.cc (Layout::create_shstrtab): Only write out after input
5673 sections if we are compressing debug sections.
5677 * archive.cc (Archive::add_symbols): Only look up a symbol without
5678 a version if there is, in fact, a version.
5682 Revert -Wshadow changes, all changes from:
5685 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5689 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5691 * attributes.cc (Object_attribute::size): Ditto.
5692 (Attributes_section_data::size): Ditto.
5693 (Attributes_section_data::Attributes_section_data): Ditto.
5694 (Output_attributes_section_data::do_write): Ditto.
5695 * attributes.h (Object_attribute::set_type): Ditto.
5696 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5700 * archive.cc: Fix shadowed variable warnings.
5702 * compressed_output.cc: Likewise.
5703 * compressed_output.h: Likewise.
5704 * configure: Likewise.
5705 * dwarf_reader.cc: Likewise.
5706 * dynobj.cc: Likewise.
5707 * dynobj.h: Likewise.
5708 * ehframe.cc: Likewise.
5709 * ehframe.h: Likewise.
5710 * errors.cc: Likewise.
5711 * expression.cc: Likewise.
5712 * fileread.cc: Likewise.
5713 * fileread.h: Likewise.
5714 * freebsd.h: Likewise.
5715 * i386.cc: Likewise.
5717 * incremental.h: Likewise.
5718 * layout.cc: Likewise.
5719 * layout.h: Likewise.
5720 * mapfile.cc: Likewise.
5721 * merge.cc: Likewise.
5722 * merge.h: Likewise.
5723 * object.cc: Likewise.
5724 * object.h: Likewise.
5725 * options.h: Likewise.
5726 * output.cc: Likewise.
5727 * output.h: Likewise.
5728 * parameters.cc: Likewise.
5729 * plugin.cc: Likewise.
5730 * powerpc.cc: Likewise.
5731 * reduced_debug_output.cc: Likewise.
5732 * reduced_debug_output.h: Likewise.
5733 * reloc.cc: Likewise.
5734 * reloc.h: Likewise.
5735 * resolve.cc: Likewise.
5736 * script-sections.cc: Likewise.
5737 * script.cc: Likewise.
5738 * script.h: Likewise.
5739 * sparc.cc: Likewise.
5740 * symtab.cc: Likewise.
5741 * symtab.h: Likewise.
5742 * target-select.cc: Likewise.
5743 * target-select.h: Likewise.
5744 * token.h: Likewise.
5745 * workqueue.cc: Likewise.
5746 * workqueue.h: Likewise.
5747 * x86_64.cc: Likewise.
5751 * arm.cc (attributes.h): New include.
5752 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5753 (Arm_relobj::~Arm_relobj): Delete object pointed by
5754 attributes_section_data_.
5755 (Arm_relobj::attributes_section_data): New method definition.
5756 (Arm_relobj::attributes_section_data_): New data member declaration.
5757 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5758 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5759 attributes_section_data_.
5760 (Arm_dynobj::attributes_section_data): New method definition.
5761 (Arm_dynobj::attributes_section_data_): New data member declaration.
5762 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5763 initialization value of may_use_blx_ to false.
5764 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5765 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5766 object attributes to compute results instead of hard-coding.
5767 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5768 Target_arm::get_secondary_compatible_arch,
5769 Target_arm::set_secondary_compatible_arch
5770 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5771 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5772 New method declarations.
5773 (Target_arm::get_aeabi_object_attribute): New method definition.
5774 (Target_arm::attributes_section_data_): New data member declaration.
5775 (read_arm_attributes_section): New template definition.
5776 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5777 (Arm_dynobj::do_read_symbols): Ditto.
5778 (Target_arm::do_finalize_sections): Merge attributes sections from
5779 input. Check for BLX use after attributes section merging.
5780 Fix __exidx_start and __exidx_end visibility. Create an
5781 .ARM.attributes section if necessary.
5782 (Target_arm::get_secondary_compatible_arch,
5783 Target_arm::set_secondary_compatible_arch,
5784 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5785 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5786 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5787 New method definitions.
5791 * plugin.cc (Plugin::load): Don't cast from void* to a function
5796 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5801 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5802 Replace two_file_shared_1.so with two_file_shared_2.so.
5803 * testsuite/Makefile.in: Regenerated.
5807 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5808 (HFILES): Add attributes.h and int_encoding.h.
5809 * Makefile.in: Regenerate.
5810 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5811 function definitions to int_encoding.cc
5812 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5813 prototypes to int_encoding.h
5814 * reduced_debug_output.cc (int_encoding.h): New include.
5815 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5816 function definitions to int_encoding.cc
5817 (insert_into_vector, read_from_pointer): Move template definitions to
5819 * attributes.cc: New file.
5820 * attributes.h: New file.
5821 * int_encoding.cc: New file.
5822 * int_encoding.h: New file.
5827 * incremental-dump.cc (dump_incremental_inputs): New.
5828 (main): Use dump_incremental_inputs.
5833 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5834 checking elfcpp::STT_FUNC.
5835 (Target_i386::Relocate::relocate): Likewise.
5836 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5838 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5839 symbols from shared libraries into normal FUNC symbols.
5841 * symtab.h (Symbol): Add is_func and use it.
5845 * arm.cc (Target_arm::arm_info): Initialize new fields
5846 attributes_section and attributes_vendor.
5847 * i386.cc (Target_i386::i386_info): Same.
5848 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5849 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5850 fields attributes_section and attributes_vendor.
5851 * sparc.cc (Target_sparc::sparc_info): Same.
5852 * target.h (Target::attributes_section, Target::attributes_vendor,
5853 Target::is_attributes_section, Target::attribute_arg_type,
5854 Target::attributes_order): New method definitions.
5855 (Target::Target_info::attributes_section,
5856 Target::Target_info::attributes_vendor): New fields.
5857 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5858 virtual method definitions.
5859 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5860 attributes_section and attributes_vendor.
5861 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5865 * arm.cc: Update comments about interworking and stub generation.
5866 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5867 considered as non-PIC.
5868 (Arm_relocate_functions::base_abs): Fix formatting.
5869 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5870 of function to use GOT entry address instead of offset.
5871 (Target_arm::Scan::global): Issue an error if a symbol would need a
5872 PLT does not get one because it is untyped. Remove code to create
5873 dynamic symbols for relative branches.
5874 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5875 takes unsigned integer instead of boolean.
5879 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5880 (two_file_test_LDADD): Likewise.
5881 (common_test_1_LDADD): Likewise.
5882 (exception_test_LDADD) Likewise.
5883 (weak_test_LDADD): Likewise.
5884 (many_sections_test_LDADD): Likewise.
5885 (initpri1_LDADD): Likewise.
5886 (script_test_1_LDADD): Likewise.
5887 (script_test_2_LDADD): Likewise.
5888 (justsyms_LDADD): Likewise.
5889 (binary_test_LDADD): Likewise.
5890 (large_LDADD): Likewise.
5891 * testsuite/Makefile.in: Regenerated.
5895 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5896 (Symbol_table::override_with_special): Likewise.
5897 (Symbol_table::add_from_object): Likewise.
5901 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5902 Don't set the data_offset twice.
5906 * testsuite/Makefile.in: Regenerate.
5910 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5911 (Target_arm::do_finalize_sections): Add parameter for symbol table
5912 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5913 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5914 parameter for symbol table pointer.
5915 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5916 an additional parameter for a pointer to symbol table.
5917 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5918 parameter for a symbol table pointer.
5919 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5920 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5922 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5923 parameter for a symbol table pointer.
5927 * incremental.cc (Incremental_inputs_header)
5928 (Incremental_inputs_header_write, Incremental_inputs_entry)
5929 (Incremental_inputs_entry_write): Move ...
5930 * incremental.h (Incremental_inputs_header)
5931 (Incremental_inputs_header_write, Incremental_inputs_entry)
5932 (Incremental_inputs_entry_write): here.
5936 * incremental.cc (make_sized_incremental_binary): Set the target.
5937 Error if it is incompatible.
5938 * output.h (Output_file): Add filename method.
5942 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5943 from the get_* methods.
5947 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5948 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5949 Write 0 for the data_offset of scripts.
5953 * testsuite/Makefile.am: Add the incremental_test.sh test.
5954 * testsuite/incremental_test.sh: New.
5955 * testsuite/incremental_test_1.c: New.
5956 * testsuite/incremental_test_2.c: New.
5960 * incremental-dump.cc (main): Fix typos.
5965 * incremental-dump.cc (main): Use llu to print 64 bit values.
5970 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5972 (incremental_dump_LDADD): Likewise.
5973 * Makefile.in: Regenerated.
5981 * arm.cc (Target_arm::Target_arm): Move method definition
5982 outside of class definition. Add code to handle
5983 --target1-rel, --target1-abs and --target2= options.
5984 (Target_arm::get_reloc_reloc_type): Change method to be
5985 non-static and const.
5986 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5987 New data member declaration.
5988 (Target_arm::Scan::local, Target_arm::Scan::global,
5989 Target_arm::Relocate::relocate,
5990 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5991 Adjust call to Target_arm::get_real_reloc_type.
5992 (Target_arm::get_real_reloc_type): Use command line options
5993 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5994 * options.h (--target1-rel, --target1-abs, --target2): New
5999 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6000 class definition. Add code to handle --target1-rel, --target1-abs
6001 and --target2= options.
6002 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6004 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6006 (Target_arm::Scan::local, Target_arm::Scan::global,
6007 Target_arm::Relocate::relocate,
6008 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6009 call to Target_arm::get_real_reloc_type.
6010 (Target_arm::get_real_reloc_type): Use command line options to
6011 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6012 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6017 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6018 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6019 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6021 (Arm_relocate_functions::thm_call): Replace body with a call to
6022 Arm_relocate_functions::thumb_branch_common.
6023 (Arm_relocate_functions::thm_jump24,
6024 Arm_relocate_functions::thm_xpc22): New method definitions.
6025 (Arm_relocate_functions::thumb_branch_common): New method definition.
6026 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6028 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6029 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6033 * Makefile.am: Build incremental-dump
6034 * Makefile.in: Regenerate.
6035 * incremental-dump.cc: New.
6036 * incremental.cc (Incremental_inputs_header_data,
6037 Incremental_inputs_entry_data): Move to incremental.h
6038 * incremental.h: (Incremental_inputs_header_data,
6039 Incremental_inputs_entry_data): Move from incremental.cc
6043 * incremental.cc (Incremental_inputs_header,
6044 Incremental_inputs_header_write, Incremental_inputs_entry,
6045 Incremental_inputs_entry_write): Add a typedef with the data type.
6049 * incremental.cc (Incremental_inputs_header,
6050 Incremental_inputs_header_write, Incremental_inputs_entry,
6051 Incremental_inputs_entry_write): Update comment about which
6052 type has the filed descriptions.
6056 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6057 (Arm_relocate_functions::arm_branch_common): Change method defintion
6058 in class definition to a method declaration and update list of formal
6060 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6061 Arm_relocation_functions::jump24): Adjust call to
6062 Arm_relocate_functions::arm_branch_common. Update list of formal
6064 (Arm_relocate_functions::xpc25): New method definition.
6065 (Arm_relocate_functions::arm_branch_common): Move method defintion
6066 out from class definition. Use stubs for mode-switching and extending
6068 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6069 specially. Change code to enable use of stubs in ARM branches.
6073 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6074 in method declaration.
6075 (Target_arm::relocate_stub): New method declaration.
6076 (Target_arm::default_target): Change to return a pointer instead of
6078 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6079 Target_arm::default_target.
6080 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6082 (Target_arm::relocate_section): Adjust view.
6083 (Target_arm::relocate_stub): New method definition.
6087 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6089 * incremental.cc (open_incremental_binary): Initialized local
6090 variables to avoid warnings.
6091 * object.cc (make_elf_object): Ditto.
6092 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6098 * testsuite/plugin_test.c: Include "config.h".
6102 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6103 (arm_symbol_value): Remove.
6104 (Arm_relocate_functions::arm_branch_common,
6105 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6106 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6107 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6108 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6109 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6110 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6111 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6112 Arm_relocate_functions::thm_mobw_abs_nc,
6113 Arm_relocate_functions::thm_mov_abs,
6114 Arm_relocate_functions::movw_prel_nc,
6115 Arm_relocate_functions::thm_movt_abs,
6116 Arm_relocate_functions::movt_prel,
6117 Arm_relocate_functions::thm_movw_prel_nc,
6118 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6119 (Target_arm::Relocate::relocate): Only decompose address into two
6120 parts if relocation type uses the thumb-bit and pass the actual
6121 bit instead of a flag indicating that the thumb-bit is used. Adjust
6122 calls to methods in Arm_relocate_functions for this change.
6127 * reloc.cc: Instantiate
6128 Sized_relobj::initialize_input_to_output_maps and
6129 Sized_relobj:free_input_to_output_maps.
6134 * defstd.cc (in_segment): Set only_if_ref true for "end".
6138 * arm.cc (class Reloc_stub): Correct a comment.
6139 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6140 (Target_arm::scan_section_for_stubs): New method declaration.
6141 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6142 Change methods from private to protected.
6143 (Target_arm::do_may_relax): New method definition.
6144 (Target_arm::do_relax, Target_arm::group_sections,
6145 Target_arm::scan_reloc_for_stub,
6146 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6147 (Target_arm::arm_input_section_map_): New data member declaration.
6148 (Target_arm::scan_reloc_for_stub,
6149 Target_arm::scan_reloc_section_for_stubs,
6150 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6151 Target_arm::do_relax): New method definitions.
6155 * configure.ac: Check for (struct stat)::st_mtim
6156 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6157 * config.in: Regenerate.
6158 * configure: Regenerate.
6163 * output.cc (Output_segment::add_output_section): Add missing
6169 * object.h (class Object): Add is_needed and set_is_needed
6170 methods. Add is_needed_ field. Make bool fields into bitfields.
6171 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6172 defined in a dynamic object and referenced by a regular object,
6173 set is_needed for the dynamic object.
6174 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6175 if the file is marked with as_needed and it is not needed.
6180 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6181 tags if data is discarded by linker script.
6182 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6183 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6184 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6185 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6189 * layout.cc (Layout::get_output_section): Add is_interp and
6190 is_dynamic_linker_section parameters. Change all callers.
6191 (Layout::choose_output_section): Likewise.
6192 (Layout::make_output_section): Likewise.
6193 (Layout::add_output_section_data): Add is_dynamic_linker_section
6194 parameter. Change all callers.
6195 * layout.h (class Layout): Update declarations.
6196 * output.h (class Output_section): Add is_interp, set_is_interp,
6197 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6198 Add is_interp_, is_dynamic_linker_section_ fields. Change
6199 generate_code_fills_at_write_ to a bitfield.
6200 * output.cc (Output_section::Output_sections): Initialize new
6202 (Output_segment::add_output_section): Add do_sort parameter.
6208 * options.h (class General_options): Add --warn-common.
6209 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6210 merging two common symbols.
6211 (Symbol_table::should_override): Handle --warn-common when merging
6212 a common symbol with a defined symbol. Use report_resolve_problem
6213 for multiple definitions.
6214 (Symbol_table::report_resolve_problem): New function.
6215 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6219 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6221 (Target_arm::stub_factory): New method definition.
6222 (Target_arm::new_arm_input_section,
6223 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6224 Target_arm::reloc_uses_thumb_bit): New method declarations.
6225 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6226 New type definitions.
6227 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6228 member declarations.
6229 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6230 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6231 New method definitions.
6235 * options.h (class General_options): Add --warn_constructors.
6240 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6241 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6246 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6247 --msgid-bugs-address.
6248 (install-pdf): New target.
6249 (install-data_yes): Look up one directory to find mkinstalldirs.
6253 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6258 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6262 * arm.cc (Stub_addend_reader): New struct template definition
6263 and partial specializations.
6264 (Stub_addend_reader::operator()): New method definition for a
6265 partially specialized template.
6269 * arm.cc (Arm_relobj::processor_specific_flags): New method
6271 (Arm_relobj::do_read_symbols): New method declaration.
6272 (Arm_relobj::processor_specific_flags_): New data member declaration.
6273 (Arm_dynobj): New class definition.
6274 (Target_arm::do_finalize_sections): Add input_objects parameter.
6275 (Target_arm::do_adjust_elf_header): New method declaration.
6276 (Target_arm::are_eabi_versions_compatible,
6277 (Target_arm::merge_processor_specific_flags): New method declaration.
6278 (Target_arm::do_make_elf_object): New overloaded method definitions
6280 (Arm_relobj::do_read_symbols): New method definition.
6281 (Arm_dynobj::do_read_symbols): Ditto.
6282 (Target_arm::do_finalize_sections): Add input_objects parameters.
6283 Merge processor-specific flags from all input objects.
6284 (Target_arm::are_eabi_versions_compatible,
6285 Target_arm::merge_processor_specific_flags,
6286 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6287 New method definitions.
6288 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6289 Input_objects pointer type parameter.
6290 * layout.cc (Layout::finalize): Pass input objects to target's.
6291 finalize_sections function.
6292 * output.cc (Output_file_header::do_sized_write): Set ELF file
6293 header's processor-specific flags.
6294 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6295 Input_objects pointer type parameter.
6296 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6297 * target.h (Input_objects): New forward class declaration.
6298 (Target::processor_specific_flags,
6299 Target::are_processor_specific_flags_sect): New method definitions.
6300 (Target::finalize_sections): Add input_objects parameter.
6301 (Target::Target): Initialize processor_specific_flags_ and
6302 are_processor_specific_flags_set_.
6303 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6305 (Target::set_processor_specific_flags): New method definition.
6306 (Target::processor_specific_flags_,
6307 Target::are_processor_specific_flags_set_): New data member
6309 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6310 Input_objects pointer type parameter.
6314 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6318 * object.h (class Relobj): Drop options parameter from
6319 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6320 do_scan_relocs, do_relocate. Change all callers.
6321 (class Sized_relobj): Drop options parameters from
6322 do_gc_process_relocs, do_scan_relocs, do_relocate,
6323 do_relocate_sections, relocate_sections, emit_relocs_scan,
6324 emit_relocs_scan_reltype. Change all callers.
6325 (struct Relocate_info): Remove options field and all references to
6327 * reloc.h (class Read_relocs): Remove options constructor
6328 parameter and options_ field. Change all callers.
6329 (class Gc_process_relocs, class Scan_relocs): Likewise.
6330 (class Relocate_task): Likewise.
6331 * target-reloc.h (scan_relocs): Remove options parameter. Change
6333 (scan_relocatable_relocs): Likewise.
6334 * target.h (class Sized_target): Remove options parameter from
6335 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6337 * gc.h (gc_process_relocs): Remove options parameter. Change all
6339 * arm.cc: Update functions to remove options parameters.
6340 * i386.cc: Likewise.
6341 * powerpc.cc: Likewise.
6342 * sparc.cc: Likewise.
6343 * x86_64.cc: Likewise.
6344 * testsuite/testfile.cc: Likewise.
6348 * arm.cc (Arm_relobj): New class definition.
6349 (Arm_relobj::scan_sections_for_stubs,
6350 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6351 New method definitions.
6355 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6356 (Plugin::cleanup_done_): New member.
6357 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6358 (Plugin_manager::cleanup_done_): Remove.
6359 (Plugin_manager::add_input_file): Edit error message.
6360 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6361 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6365 * fileread.cc: (File_read::View::~View): Use the new
6366 data_ownership_ filed.
6367 (File_read::~File_read): Dispose the new whole_file_view_.
6368 (File_read::open): Mmap the whole file if needed.
6369 (File_read::open): Use whole_file_view_ instead of contents_.
6370 (File_read::find_view): Use whole_file_view_ if applicable.
6371 (File_read::do_read): Use whole_file_view_ instead of contents_.
6372 (File_read::make_view): Use whole_file_view_ instead of contents_,
6373 update File_read::View::View call.
6374 (File_read::find_or_make_view): Update File_read::View::View
6376 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6378 (File_read::View::Data_ownership): New enum.
6379 (File_read::View::View): Replace bool mapped_ with Data_ownership
6381 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6382 (File_read::View::data_ownership_): New field.
6383 (File_read::contents_): Remove (replaced by whole_file_view_).
6384 (File_read::whole_file_view_): New field.
6385 * options.h (class General_options): Add --keep-files-mapped.
6389 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6390 * testsuite/Makefile.am (plugin_test_5): New test case.
6391 * testsuite/Makefile.in: Regenerate.
6395 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6396 from private to protected to allow access by child class.
6397 (Sized_relobj::do_relocate_sections): New method declaration.
6398 (Sized_relobj::relocate_sections): Virtualize.
6399 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6400 Sized_relobj::relocate_sections. Instantiate template explicitly
6401 for different target sizes and endianity.
6405 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6406 (Arm_input_section::as_arm_input_section): New method.
6407 (Arm_output_section): New class definition.
6408 (Arm_output_section::create_stub_group,
6409 Arm_output_section::group_sections): New method definitions.
6413 * arm.cc (Arm_input_section): New class definition.
6414 (Arm_input_section::init, Arm_input_section:do_write,
6415 Arm_input_section::set_final_data_size,
6416 Arm_input_section::do_reset_address_and_file_offset): New method
6421 * arm.cc (Stub_table, Arm_input_section): New forward class
6423 (Stub_table): New class defintion.
6424 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6425 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6426 New method definition.
6430 * arm.cc: Update copyright comments.
6431 (Target_arm): New forward class template declaration.
6432 (Arm_address): New type.
6433 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6434 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6435 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6437 (Insn_template): Same.
6438 (DEF_STUBS): New macro.
6439 (Stub_type): New enum type.
6440 (Stub_template): New class definition.
6443 (Stub_factory): Same.
6444 (Target_arm::Target_arm): Initialize may_use_blx_ and
6445 should_force_pic_veneer_.
6446 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6447 Target_arm::should_force_pic_veneer,
6448 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6449 Target_arm::using_thumb_only, Target_arm:;default_target): New
6451 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6452 New data member declarations.
6453 (Insn_template::size, Insn_template::alignment): New method defintions.
6454 (Stub_template::Stub_template): New method definition.
6455 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6456 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6457 (Stub_factory::Stub_factory): New method definition.
6458 * gold.h (string_hash): New template.
6459 * output.h (Input_section_specifier::hash_value): Use
6461 (Input_section_specifier::string_hash): Remove.
6462 * stringpool.cc (Stringpool_template::string_hash): Use
6467 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6468 symbols of relaxed input sections.
6469 * output.h (Output_section::find_relaxed_input_section): Make
6474 * dynobj.cc (Versions::Versions): Initialize version_script_.
6475 Only insert base version symbol definition for a shared object
6476 if version script defines any version versions.
6477 (Versions::define_base_version): New method definition.
6478 (Versions::add_def): Check that base version is not needed.
6479 (Versions::add_need): Define base version lazily.
6480 * dynobj.h (Versions::define_base_version): New method declaration.
6481 (Versions::needs_base_version_): New data member declaration.
6482 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6483 (check_DATA): Add no_version_test.stdout.
6484 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6486 * testsuite/Makefile.in: Regenerate.
6487 * testsuite/no_version_test.c: New file.
6488 * testsuite/no_version_test.sh: Ditto.
6492 * expression.cc (class Segment_start_expression): New class definition.
6493 (Segment_start_expression::value): New method definition.
6494 (script_exp_function_segment_start): Return a new
6495 Segment_start_expression.
6496 * gold/script-c.h (script_saw_segment_start_expression): New function
6498 * script-sections.cc (Script_sections::Script_sections): Initialize
6499 SAW_SEGMENT_START_EXPRESSION_ to false.
6500 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6501 and -Tbbs options to specify section addresses if given in
6502 command line and no SEGMENT_START expression is seen in a script.
6503 * script-sections.h (Script_sections::saw_segment_start_expression,
6504 Script_sections::set_saw_segment_start_expression): New method
6506 (Script_sections::saw_segment_start_expression_): New data member
6508 * script.cc (script_saw_segment_start_expression): New function.
6509 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6510 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6511 script_test_7.sh and script_test_8.sh.
6512 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6513 script_test_8.stdout.
6514 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6515 (script_test_6, script_test_6.stdout, script_test_7,
6516 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6517 * Makefile.in: Regenerate.
6518 * testsuite/script_test_6.sh: New file.
6519 * testsuite/script_test_6.t: Same.
6520 * testsuite/script_test_7.sh: Same.
6521 * testsuite/script_test_7.t: Same.
6522 * testsuite/script_test_8.sh: Same.
6526 * output.cc (Output_segment::set_section_list_address): Cast
6527 expressions to unsigned long long type to avoid format warnings.
6531 * script.cc (Script_options::add_symbol_assignment): Always add a
6532 dot assignment to script_sections_.
6533 * script-sections.cc (Script_sections::add_dot_assignment):
6534 Initialize if necessary.
6536 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6537 program headers with no load segment if there is a linker script.
6539 * layout.cc (Layout::set_segment_offsets): Align the file offset
6540 to the segment aligment for -N or -n with no load segment.
6541 * output.cc (Output_segment::add_output_section): Don't crash if
6542 the first section is a TLS section.
6543 (Output_segment::set_section_list_addresses): Print an error
6544 message if the address moves backward in a linker script.
6545 * script-sections.cc
6546 (Output_section_element_input::set_section_addresses): Don't
6547 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6548 (Orphan_output_section::set_section_addresses): Likewise.
6552 * layout.cc (Layout::finish_dynamic_section): Generate tags
6553 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6554 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6555 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6559 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6561 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6562 data_shdr fields of relinfo.
6563 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6564 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6565 R_386_TLS_LDO_32, adjust based on section flags.
6566 (Target_i386::Relocate::fix_up_ldo): Remove.
6570 Add support for -pie.
6571 * options.h (class General_options): Add -pie and
6573 (General_options::output_is_position_independent): Test -pie.
6574 (General_options::output_is_executable): Return true if not shared
6575 and not relocatable.
6576 (General_options::output_is_pie): Remove.
6577 * options.cc (General_options::finalize): Reject incompatible uses
6579 * gold.cc (queue_middle_tasks): A -pie link is not static.
6580 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6581 * symtab.cc (Symbol::final_value_is_known): Return false if
6582 output_is_position_independent.
6583 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6584 output_is_position_independent.
6585 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6586 output_is_position_independent.
6587 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6588 output_is_position_independent.
6589 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6591 (basic_pie_test.o, basic_pie_test): New targets.
6592 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6593 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6594 (two_file_pie_test): New target.
6595 * testsuite/Makefile.in: Rebuild.
6596 * README: Remove note saying that -pie is not supported.
6600 * options.h (class General_options): Add -init and -fini.
6601 * layout.cc (Layout::finish_dynamic_section): Emit
6602 given init and fini functions.
6606 * gc.h (gc_process_relocs): Check if icf is enabled using new
6608 * gold.cc (queue_initial_tasks): Likewise.
6609 (queue_middle_tasks): Likewise.
6610 * object.cc (do_layout): Likewise.
6611 * symtab.cc (is_section_folded): Likewise.
6612 * main.cc (main): Likewise.
6613 * reloc.cc (Read_relocs::run): Likewise.
6614 (Sized_relobj::do_scan_relocs): Likewise.
6615 * icf.cc (is_function_ctor_or_dtor): New function.
6616 (Icf::find_identical_sections): Check if function is ctor or dtor when
6618 * options.h (General_options::icf): Change option to be an enum.
6619 (Icf_status): New enum.
6620 (icf_enabled): New method.
6621 (icf_safe_folding): New method.
6622 (set_icf_status): New method.
6623 (icf_status_): New variable.
6624 * (options.cc) (General_options::finalize): Set icf_status_.
6625 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6626 icf_test and icf_keep_unique_test to use the --icf enum flag.
6627 * testsuite/icf_safe_test.sh: New file.
6628 * testsuite/icf_safe_test.cc: New file.
6632 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6633 includes to gc.h and icf.h.
6634 * arm.cc: Include gc.h.
6635 * gold.cc: Likewise.
6636 * i386.cc: Likewise.
6637 * powerpc.cc: Likewise.
6638 * sparc.cc: Likewise.
6639 * x86_64.cc: Likewise.
6640 * gc.h: Include icf.h.
6644 * plugin.cc: Include "gold.h" before other header files.
6648 * options.h (Input_file_argument::Input_file_type): New enum.
6649 (Input_file_argument::is_lib_): Replace with...
6650 (Input_file_argument::type_): New member.
6651 (Input_file_argument::Input_file_argument): Take Input_file_type
6652 'type' rather than boolean 'is_lib' as second argument.
6653 (Input_file_argument::is_lib): Use type_.
6654 (Input_file_argument::is_searched_file): New function.
6655 (Input_file_argument::may_need_search): Handle is_searched_file.
6656 * options.cc (General_options::parse_library): Support -l:filename.
6657 (General_options::parse_just_symbols): Update for Input_file_argument
6659 (Command_line::process): Likewise.
6660 * archive.cc (Archive::get_file_and_offset): Likewise.
6661 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6662 * script.cc (read_script_file, script_add_file): Likewise.
6663 * fileread.cc (Input_file::Input_file): Likewise.
6664 (Input_file::will_search_for): Handle is_searched_file.
6665 (Input_file::open): Likewise.
6666 * readsyms.cc (Read_symbols::get_name): Likewise.
6667 * testsuite/Makefile.am (searched_file_test): New test.
6668 * testsuite/Makefile.in: Regenerate.
6669 * testsuite/searched_file_test.cc: New file.
6670 * testsuite/searched_file_test_lib.cc: New file.
6675 * descriptor.cc: Include <cstdio> and "binary-io.h".
6676 (Descriptors::open): Open the files in binary mode always.
6677 * script.cc (Lex::get_token): Treat \r as whitespace.
6681 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6686 * configure.ac: Check for readv function also.
6687 * fileread.cc (readv): Define if not HAVE_READV.
6688 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6690 * config.in: Regenerate.
6691 * configure: Regenerate.
6695 * layout.cc (Layout::make_output_section): Call target hook to make
6696 ordinary output section.
6697 (Layout::finalize): Adjust parameter list of call the
6698 Target::may_relax().
6699 * layout.h (class Layout::section_list): New method.
6700 * merge.h (Output_merge_base::entsize): Change visibility to public.
6701 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6703 (Output_merge_string::do_is_string): New method.
6704 * object.cc (Sized_relobj::do_setup): renamed from
6705 Sized_relobj::set_up.
6706 * object.h (Sized_relobj::adjust_shndx,
6707 Sized_relobj::initializ_input_to_output_maps,
6708 Sized_relobj::free_input_to_output_maps): Change visibilities to
6710 (Sized_relobj::setup): Virtualize.
6711 (Sized_relobj::do_setup): New method declaration.
6712 (Sized_relobj::invalidate_section_offset,
6713 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6714 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6715 * options.cc (parse_int): New function.
6716 * options.h (parse_int): New declaration.
6717 (DEFINE_int): New macro.
6718 (stub_group_size): New option.
6719 * output.cc (Output_section::Output_section): Initialize memebers
6720 merge_section_map_, merge_section_by_properties_map_,
6721 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6722 (Output_section::add_input_section): Handled deferred code-fill
6723 generation and remove an old comment.
6724 (Output_section::add_relaxed_input_section): New method definition.
6725 (Output_section::add_merge_input_section): Use merge section by
6726 properties map to speed to search. Update merge section maps
6728 (Output_section::build_relaxation_map): New method definition.
6729 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6731 (Output_section::relax_input_section): Renamed to
6732 Output_section::convert_input_sections_to_relaxed_sections and change
6733 interface to take a vector of pointers to relaxed sections.
6734 (Output_section::find_merge_section,
6735 Output_section::find_relaxed_input_section): New method definitions.
6736 (Output_section::is_input_address_mapped,
6737 Output_section::output_offset, Output_section::output_address):
6738 Use output section data maps to speed up searching.
6739 (Output_section::find_starting_output_address): Add comments.
6740 (Output_section::do_write,
6741 Output_section::write_to_postprocessing_buffer): Do code-fill
6742 generation as appropriate.
6743 (Output_section::get_input_sections): Invalidate relaxed input section
6745 (Output_section::restore_states): Adjust type of checkpoint .
6746 Invalidate relaxed input section map.
6747 * output.h (Output_merge_base): New class declaration.
6748 (Input_section_specifier): New class defintion.
6749 (class Output_relaxed_input_section) Change base class to
6750 Output_section_data_build.
6751 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6752 base class initializer.
6753 (Output_section::add_relaxed_input_section): New method declaration.
6754 (Output_section::Input_section): Change visibility to protected.
6755 (Output_section::Input_section::relobj,
6756 Output_section::Input_section::shndx): Handle relaxed input sections.
6757 Output_section::input_sections) Change visibility to protected. Also
6758 define overload to return a non-const pointer.
6759 (Output_section::Merge_section_properties): New class defintion.
6760 (Output_section::Merge_section_by_properties_map,
6761 Output_section::Output_section_data_by_input_section_map,
6762 Output_section::Relaxation_map): New types.
6763 (Output_section::relax_input_section): Rename method to
6764 Output_section::convert_input_sections_to_relaxed_sections and change
6765 interface to take a vector of relaxed section pointers.
6766 (Output_section::find_merge_section,
6767 Output_section::find_relaxed_input_section,
6768 Output_section::build_relaxation_map,
6769 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6770 New method declarations.
6771 (Output_section::merge_section_map_
6772 Output_section::merge_section_by_properties_map_,
6773 Output_section::relaxed_input_section_map_,
6774 Output_section::is_relaxed_input_section_map_valid_,
6775 Output_section::generate_code_fills_at_write_): New data members.
6776 * script-sections.cc
6777 (Output_section_element_input::set_section_addresses): Call
6778 current_data_size and addralign methods of relaxed input sections.
6779 (Orphan_output_section::set_section_addresses): Call current_data_size
6780 and addralign methods of relaxed input sections.
6781 * symtab.cc (Symbol_table::compute_final_value): Extract template
6782 from the body of Symbol_table::sized_finalize_symbol.
6783 (Symbol_table::sized_finalized_symbol): Call
6784 Symbol_table::compute_final_value.
6785 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6786 (Symbol_table::compute_final_value): New templated method declaration.
6787 * target.cc (Target::do_make_output_section): New method defintion.
6788 * target.h (Target::make_output_section): New method declaration.
6789 (Target::relax): Add more parameters for input objects, symbol table
6790 and layout. Adjust call to do_relax.
6791 (Target::do_make_output_section): New method declaration.
6792 (Target::do_relax): Add parameters for input objects, symbol table
6797 * pread.c: Include stdio.h.
6801 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6806 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6807 Change read_shndx type to unsigned int.
6808 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6810 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6811 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6812 Change read_shndx type to unsigned int.
6813 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6815 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6816 * layout.cc (Layout::create_symtab_sections): Cast the result of
6817 local_symcount * symsize to off_t in the gold_assert.
6821 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6822 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6824 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6825 (Arm_relocate_functions::thm_abs5): New function.
6826 (Arm_relocate_functions::abs12): New function.
6827 (Arm_relocate_functions::abs16): New function.
6828 (Arm_relocate_functions::base_abs): New function.
6829 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6830 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6831 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6833 (Scan::global): Likewise.
6834 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6835 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6836 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6837 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6842 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6843 (Arm_relocate_functions::movt_prel): New function.
6844 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6845 (Arm_relocate_functions::thm_movt_prel): New function.
6846 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6847 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6848 (Scan::global, Relocate::relocate): Likewise.
6849 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6853 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6854 Incremental_checker.
6855 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6857 (class Incremental_inputs_header): New class.
6858 (Incremental_inputs_header_writer): Edit comment.
6859 (Incremental_inputs_entry): New class.
6860 (Incremental_inputs_entry_writer): Edit comment.
6861 (Sized_incremental_binary::do_find_incremental_inputs_section):
6862 Add *strtab_shndx parameter, fill it.
6863 (Sized_incremental_binary::do_check_inputs): New method.
6864 (Incremental_checker::can_incrementally_link_output_file): Use
6865 Sized_incremental_binary::check_inputs.
6866 (Incremental_inputs::report_command_line): Save command line in
6869 (Incremental_binary::find_incremental_inputs_section): New
6871 (Incremental_binary::do_find_incremental_inputs_section): Add
6872 strtab_shndx parameter.
6873 (Incremental_binary::do_check_inputs): New pure virtual method.
6874 (Sized_incremental_binary::do_check_inputs): Declare.
6875 (Incremental_checker::Incremental_checker): Add incremental_inputs
6876 parameter, use it to initialize incremental_inputs_.
6877 (Incremental_checker::incremental_inputs_): New field.
6878 (Incremental_checker::command_line): New method.
6879 (Incremental_checker::inputs): New method.
6880 (Incremental_checker::command_line_): New field.
6884 * incremental.cc: Include <cstdarg> and "target-select.h".
6885 (vexplain_no_incremental): New function.
6886 (explain_no_incremental): New function.
6887 (Incremental_binary::error): New method.
6888 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6890 (make_sized_incremental_binary): New function.
6891 (open_incremental_binary): New function.
6892 (can_incrementally_link_file): Add checks if output is ELF and has
6894 * incremental.h: Include "elfcpp_file.h" and "output.h".
6895 (Incremental_binary): New class.
6896 (Sized_incremental_binary): New class.
6897 (open_incremental_binary): Declare.
6898 * object.cc (is_elf_object): Use
6899 elfcpp::Elf_recognizer::is_elf_file.
6900 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6901 * output.h (Output_file::filesize): New method.
6905 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6907 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6908 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6910 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6912 (Arm_relocate_functions::movw_abs_nc): New function.
6913 (Arm_relocate_functions::movt_abs): New function.
6914 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6915 (Arm_relocate_functions::thm_movt_abs): New function.
6916 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6917 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6918 (Scan::global): Likewise.
6919 (Relocate::relocate): Likewise.
6920 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6924 * arm.cc (Arm_relocate_functions::got_prel) New function.
6925 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6926 (Relocate::relocate): Likewise.
6927 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6931 * options.h (class General_options): Define
6932 split_stack_adjust_size parameter.
6933 * object.h (class Object): Add uses_split_stack_ and
6934 has_no_split_stack_ fields. Add uses_split_stack and
6935 has_no_split_stack accessor functions. Declare
6936 handle_split_stack_section.
6937 (class Reloc_symbol_changes): Define.
6938 (class Sized_relobj): Define Function_offsets. Declare
6939 split_stack_adjust, split_stack_adjust_reltype, and
6941 * object.cc (Object::handle_split_stack_section): New function.
6942 (Sized_relobj::do_layout): Call handle_split_stack_section.
6943 * dynobj.cc (Sized_dynobj::do_layout): Call
6944 handle_split_stack_section.
6945 * reloc.cc (Sized_relobj::relocate_sections): Call
6946 split_stack_adjust for executable sections in split_stack
6947 objects. Pass reloc_map to relocate_section.
6948 (Sized_relobj::split_stack_adjust): New function.
6949 (Sized_relobj::split_stack_adjust_reltype): New function.
6950 (Sized_relobj::find_functions): New function.
6951 * target-reloc.h: Include "object.h".
6952 (relocate_section): Add reloc_symbol_changes parameter. Change
6954 * target.h (class Target): Add calls_non_split method. Declare
6955 do_calls_non_split virtual method. Declare match_view and
6957 * target.cc: Include "elfcpp.h".
6958 (Target::do_calls_non_split): New function.
6959 (Target::match_view): New function.
6960 (Target::set_view_to_nop): New function.
6961 * gold.cc (queue_middle_tasks): Give an error if mixing
6962 split-stack and non-split-stack objects with -r.
6963 * i386.cc (Target_i386::relocate_section): Add
6964 reloc_symbol_changes parameter.
6965 (Target_i386::do_calls_non_split): New function.
6966 * x86_64.cc (Target_x86_64::relocate_section): Add
6967 reloc_symbol_changes parameter.
6968 (Target_x86_64::do_calls_non_split): New function.
6969 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6971 * powerpc.cc (Target_powerpc::relocate_section): Add
6972 reloc_symbol_changes parameter.
6973 * sparc.cc (Target_sparc::relocate_section): Add
6974 reloc_symbol_changes parameter.
6975 * configure.ac: Call AM_CONDITIONAL for the default target.
6976 * configure: Rebuild.
6977 * testsuite/Makefile.am (TEST_AS): New variable.
6978 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6979 (check_DATA): Add split_i386 and split_x86_64 files.
6980 (SPLIT_DEFSYMS): Define.
6981 (split_i386_[1234n].o): New targets.
6982 (split_i386_[124]): New targets.
6983 (split_i386_[1234r].stdout): New targets.
6984 (split_x86_64_[1234n].o): New targets.
6985 (split_x86_64_[124]): New targets.
6986 (split_x86_64_[1234r].stdout): New targets.
6987 (MOSTLYCLEANFILES): Add new executables.
6988 * testsuite/split_i386.sh: New file.
6989 * testsuite/split_x86_64.sh: New file.
6990 * testsuite/split_i386_1.s: New file.
6991 * testsuite/split_i386_2.s: New file.
6992 * testsuite/split_i386_3.s: New file.
6993 * testsuite/split_i386_4.s: New file.
6994 * testsuite/split_i386_n.s: New file.
6995 * testsuite/split_x86_64_1.s: New file.
6996 * testsuite/split_x86_64_2.s: New file.
6997 * testsuite/split_x86_64_3.s: New file.
6998 * testsuite/split_x86_64_4.s: New file.
6999 * testsuite/split_x86_64_n.s: New file.
7000 * testsuite/testfile.cc (Target_test): Update relocation_section
7002 * testsuite/Makefile.in: Rebuild.
7006 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7007 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7008 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7009 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7010 the address on ldo_addrs_.
7011 (Target_i386::Relocate::fix_up_ldo): New function.
7015 * plugin.cc (add_input_library): New.
7016 (Plugin::load): Add add_input_library to tv.
7017 (Plugin_manager::add_input_file): Add the is_lib argument.
7018 (add_input_file): Update call to Plugin_manager::add_input_file.
7019 (add_input_library): New.
7020 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7024 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7025 symbol and call Symbol::may_need_copy_reloc to determine if
7026 a copy reloc is needed.
7027 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7028 nocopyreloc is given in command line.
7029 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7030 given in command line.
7031 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7032 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7033 of the removed Target_i386::may_need_copy_reloc.
7034 * options.h (copyreloc): New option with default value false.
7035 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7036 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7037 instead of the removed Target_powerpc::may_need_copy_reloc.
7038 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7039 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7040 instead of the removed Target_sparc::may_need_copy_reloc.
7041 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7042 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7043 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7044 instead of the removed Target_x86_64::may_need_copy_reloc.
7048 * object.h (class Object): Remove target_ field, and target,
7049 sized_target, and set_target methods.
7050 (Object::sized_target): Remove.
7051 (class Sized_relobj): Update declarations. Remove sized_target.
7052 * object.cc (Sized_relobj::setup): Remove target parameter.
7054 (Input_objects::add_object): Don't do anything with the target.
7055 (make_elf_sized_object): Add punconfigured parameter. Change all
7056 callers. Set or test parameter target.
7057 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7059 * parameters.cc (Parameters::set_target): Change parameter type to
7061 (Parameters::default_target): Remove.
7062 (set_parameters_target): Change parameter type to be non-const.
7063 (parameters_force_valid_target): New function.
7064 (parameters_clear_target): New function.
7065 * parameters.h (class Parameters): Update declarations. Remove
7066 default_target method. Add sized_target and clear_target
7067 methods. Change target_ to be non-const.
7068 (set_parameters_target): Update declaration.
7069 (parameters_force_valid_target): Declare.
7070 (parameters_clear_target): Declare.
7071 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7072 as NULL if we aren't searching.
7073 (Add_symbols::run): Don't check for compatible target.
7074 * fileread.cc (Input_file::open_binary): Call
7075 parameters_force_valid_target.
7076 * gold.cc (queue_middle_tasks): Likewise.
7077 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7078 set_target on object.
7079 * dynobj.h (class Sized_dynobj): Update declarations.
7080 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7081 make_elf_object returns NULL.
7082 (Archive::include_member): Don't check whether object target is
7084 * output.cc (Output_section::add_input_section): Get target from
7086 (Output_section::relax_input_section): Likewise.
7087 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7089 (Sized_relobj::do_scan_relocs): Likewise.
7090 (Sized_relobj::relocate_sections): Likewise.
7091 * resolve.cc (Symbol_table::resolve): Likewise.
7092 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7093 parameter. Change all callers.
7094 (Symbol_table::add_from_object): Get target from parameters.
7095 (Symbol_table::add_from_relobj): Don't check object target.
7096 (Symbol_table::add_from_dynobj): Likewise.
7097 (Symbol_table::define_special_symbol): Get target from
7099 * symtab.h (class Symbol_table): Update declaration.
7100 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7101 parameter. Change all callers. Clear parameter target.
7102 (Binary_test): Test target here.
7103 * testsuite/object_unittest.cc (gold_testsuite): Remove
7104 target_test_pointer parameter. Change all callers.
7105 (Object_test): Test target here.
7109 * testsuite/initpri1.c: Don't try to use constructor priorities if
7110 compiling with gcc before 4.3.
7114 * testsuite/retain_symbols_file_test.sh (check_present): Change
7115 output file name to retain_symbols_file_test.stdout.
7116 (check_absent): Likewise.
7120 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7121 * options.cc: Include <cerrno> and <fstream>.
7122 (General_options::finalize): Parse -retain-symbols-file tag.
7123 * options.h: New flag.
7124 (General_options): New method should_retain_symbol, new
7125 variable symbols_to_retain.
7126 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7127 should_retain_symbol map.
7128 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7129 * testsuite/Makefile.in: Regenerate.
7130 * testsuite/retain_symbols_file_test.sh: New file.
7134 * po/es.po: Updated Spanish translation.
7138 * debug.h (DEBUG_RELAXATION): New constant.
7139 (DEBUG_ALL): Add DEBUG_RELAXATION.
7140 (debug_string_to_enum): Add relaxation debug option.
7142 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7143 Layout::Relaxation_debug_check::read_sections,
7144 Layout::Relaxation_debug_check::read_sections): New method definitions.
7145 (Layout::Layout): Initialize data members
7146 record_output_section_data_from_scrips_,
7147 script_output_section_data_list_ and relaxation_debug_check_.
7148 (Layout::save_segments, Layout::restore_segments,
7149 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7150 Layout::relaxation_loop_body): New method definitions.
7151 (Layout::finalize): Support relaxation. Move section layout code to
7152 Layout::relaxation_loop_body.
7153 (Layout::set_asection_address_from_script): Move code for orphan
7154 section placement out.
7155 (Layout::place_orphan_sections_in_script): New method definition.
7156 * layout.h (Output_segment_headers, Output_file_header):
7157 New forward class declarations.
7158 (Layout::~Layout): Define.
7159 (Layout::new_output_section_data_from_script): New method definition.
7160 (Layout::place_orphan_sections_in_script): New method declaration.
7161 (Layout::Segment_states): New type declaration.
7162 (Layout::save_segments, Layout::restore_segments,
7163 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7164 Layout::relaxation_loop_body): New method declarations.
7165 (Layout::Output_section_data_list): New type declaration.
7166 (Layout::Relaxation_debug_check): New class definition.
7167 (Layout::record_output_section_data_from_script_,
7168 Layout::script_output_section_data_list_, Layout::segment_states_,
7169 Layout::relaxation_debug_check_): New data members.
7170 * output.cc: (Output_section_headers::do_size): New method definition.
7171 (Output_section_headers::Output_section_headers): Move size
7172 computation to Output_section_headers::do_size.
7173 (Output_segment_headers::do_size): New method definition.
7174 (Output_file_header::Output_file_header): Move size computation to
7175 Output_file_header::do_size and call it.
7176 (Output_file_header::do_size): New method definition.
7177 (Output_data_group::Output_data_group): Adjust call to
7178 Output_section_data.
7179 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7180 (Output_symtab_xindex::do_write): Add array bound check.
7181 (Output_section::Input_section::print_to_mapfile): Handle
7182 RELAXED_INPUT_SECTION_CODE.
7183 (Output_section::Output_section): Initialize data member checkpoint_.
7184 (Output_section::~Output_section): Delete checkpoint object pointed
7186 (Output_section::add_input_section): Always add an Input_section if
7188 (Output_section::add_merge_input_section): Add assert.
7189 (Output_section::relax_input_section): New method definition.
7190 (Output_section::set_final_data_size): Set load address to zero for
7191 an unallocated section.
7192 (Output_section::do_address_and_file_offset_have_reset_values):
7193 New method definition.
7194 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7195 Handle relaxed input section.
7196 (Output_section::sort_attached_input_sections): Checkpoint input
7197 section list lazily.
7198 (Output_section::get_input_sections): Change type of input_sections to
7199 list of Simple_input_section pointers. Checkpoint input section list
7200 lazily. Also handle relaxed input sections.
7201 (Output_section::add_input_section_for_script): Take a reference to
7202 a Simple_input_section object instead of Relobj pointer and section
7203 index as parameter. Handle relaxed input sections.
7204 (Output_section::save_states, Output_section::restore_states): New
7206 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7207 (Output_data::is_data_size_fixed): New method definition.
7208 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7210 (Output_data::address_and_file_offset_have_reset_values): New method
7212 (Output_data::do_address_and_file_offset_have_reset_values): New method
7214 (Output_data::set_data_size): Check that data size is not fixed.
7215 (Output_data::fix_data_size): New method definition.
7216 (Output_data::is_data_size_fixed_): New data member.
7217 (Output_section_headers::set_final_data_size): New method definition.
7218 (Output_section_headers::do_size): New method declaration.
7219 (Output_segment_headers::set_final_data_size): New method definition.
7220 (Output_segment_headers::do_size): New method declaration.
7221 (Output_file_header::set_final_data_size)::New method definition.
7222 (Output_file_header::do_size)::New method declaration.
7223 (Output_section_data::Output_section_data): Add new parameter
7224 is_data_size_fixed and use it to fix data size.
7225 (Output_data_const::Output_data_const): Adjust call to base class
7226 constructor and fix data size.
7227 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7228 base class constructor and fix data size.
7229 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7230 base class constructor and fix data size.
7231 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7232 class constructor and fix data size.
7233 (Output_data_group::set_final_data_size): New method definition.
7234 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7235 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7236 class constructor and fix data size.
7237 (Output_relaxed_input_section): New class definition.
7238 (Output_section::Simple_input_section): New class definition.
7239 (Output_section::get_input_sections): Adjust parameter list.
7240 (Output_section::add_input_section_for_script): Same.
7241 (Output_section::save_states, Output_section::restore_states,
7242 Output_section::do_address_and_file_offset_have_reset_values,
7243 (Output_section::Input_section::Input_section): Handle
7244 RELAXED_INPUT_SECTION_CODE. Add new overload for
7245 Output_relaxed_input_section.
7246 (Output_section::Input_section::is_input_section,
7247 Output_section::Input_section::set_output_section): Handle relaxed
7249 (Output_section::Input_section::is_relaxed_input_section,
7250 Output_section::Input_section::output_section_data,
7251 Output_section::Input_section::relaxed_input_section): New method
7253 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7255 (Output_section::Input_section::u1_): Update comments.
7256 (Output_section::Input_section::u2_): Add new union member poris.
7257 (Output_section::Checkpoint_output_section): New classs definition.
7258 (Output_section::relax_input_section): New method declaration.
7259 (Output_section::checkpoint_): New data member.
7260 (Output_segment): Update comments.
7261 (Output_segment::Output_segment): Un-privatize copy constructor.
7262 (Output_segment::operator=): Un-privatize.
7263 * script-sections.cc (Output_section_element::Input_section_list):
7264 Change element type to Output_section::Simple_input_section.
7265 (Output_section_element_dot_assignment::set_section_addresses):
7266 Register output section data for relaxation clean up.
7267 (Output_data_exression::Output_data_expression): Adjust call to base
7268 constructor to fix data size.
7269 (Output_section_element_data::set_section_addresses): Register
7270 Output_data_expression object for relaxation clean up.
7271 (struct Input_section_info): Replace Relobj pointer and section index
7272 pair with Output_section::Simple_input_section and Convert struct to a
7274 (Input_section_sorter::operator()): Adjust access to
7275 Input_section_info data member to use accessors.
7276 (Output_section_element_input::set_section_addresses): Use layout
7277 parameter. Adjust code to use Output_section::Simple_input_section
7278 and Input_secction_info classes. Register filler for relaxation
7280 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7281 and section index pair with Output_section::Simple_input_section
7282 class. Adjust code accordingly.
7283 (Phdrs_element::release_segment): New method definition.
7284 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7286 (Script_sections::release_segments): New method definition.
7287 * gold/script-sections.h (Script_sections::release_segments): New
7289 * gold/target.h (Target::may_relax, Target::relax,
7290 Target::do_may_relax, Target::do_relax): New method definitions.
7294 * arm.cc (has_signed_unsigned_overflow): New function.
7295 (Arm_relocate_functions::abs8): New function.
7296 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7297 (Target_arm::Scan::global): Likewise.
7298 (Target_arm::relocate::relocate): Likewise.
7299 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7304 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7305 * testsuite/Makefile.in: Regenerate.
7309 * po/gold.pot: Updated by the Translation project.
7313 * output.cc (Output_file::open): Add execute permission to empty file.
7314 * testsuite/Makefile.am (permission_test): New test.
7315 * testsuite/Makefile.in: Regenerate.
7319 * output.cc (Output_file::resize): Call map_no_anonymous rather
7324 * gold.cc: Include "incremental.h".
7325 (queue_initial_tasks): Call Incremental_checker methods.
7326 * incremental.cc: Include "output.h".
7327 (Incremental_checker::can_incrementally_link_output_file): New
7329 * incremental.h (Incremental_checker): New class.
7331 * output.cc (Output_file::open_for_modification): New method.
7332 (Output_file::map_anonymous): Changed return type to bool. Record
7334 (Output_file::map_no_anonymous): New method, broken out of map.
7335 (Output_file::map): Use map_no_anonymous and map_anonymous.
7336 * output.h (class Output_file): Update declarations.
7340 * options.h (Command_line::Pre_options): New class.
7341 (Command_line::pre_options): New member.
7342 * options.cc (gold::options::ready_to_register): New variable.
7343 (One_option::register_option): Do nothing if not registering options.
7344 Assert if same short option registered twice.
7345 (General_options::General_options): Turn off option registration when
7347 (Command_line::Pre_options::Pre_options): New constructor.
7351 * options.h (General_options::no_keep_memory): Remove incorrect
7356 * Makefile.am (am__skiplex, am__skipyacc): New.
7357 * Makefile.in: Regenerate.
7361 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7362 (INCLUDES): ... this.
7363 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7364 (AM_CPPFLAGS): Renamed from ...
7365 (INCLUDE): ... this.
7366 * Makefile.in, testsuite/Makefile.in: Regenerate.
7368 * Makefile.in: Regenerate.
7369 * aclocal.m4: Likewise.
7370 * config.in: Likewise.
7371 * configure: Likewise.
7372 * testsuite/Makefile.in: Likewise.
7374 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7375 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7376 * Makefile.in: Regenerate.
7377 * testsuite/Makefile.in: Regenerate.
7381 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7382 symbols in shared libraries overridden by hidden or internal symbols
7383 in the main program.
7387 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7388 checking source file names in error messages.
7392 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7393 an elcpp::Ehdr as parameter. Adjust call to set_target.
7394 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7395 an elfcpp::Ehdr as parameter.
7396 * object.cc (Object::set_target): Remove the version that looks up
7397 a target and sets it.
7398 (Sized_relobj::setup): Take a Target object instead of
7399 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7400 (make_elf_sized_object): Find target and ask target to
7402 * object.h: (Object::set_target): Remove the version that looks up
7403 a target and sets it.
7404 (Sized_relobj::setup): Take a Target object instead of
7405 an elfcpp:Ehdr as parameter.
7406 * target.cc: Include dynobj.h.
7407 (Target::do_make_elf_object_implementation): New.
7408 (Target::do_make_elf_object): New.
7409 * target.h (Target::make_elf_object): New template declaration.
7410 (Target::do_make_elf_object): New method declarations.
7411 (Target::do_make_elf_object_implementation): New template declaration.
7415 * gold.h (FUNCTION_NAME): Define.
7416 (gold_unreachable): Use FUNCTION_NAME.
7420 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7421 symbol in the --keep-unique list is not found.
7425 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7426 been maked as --keep-unique.
7427 (Icf::unfold_section): New function.
7428 * icf.h (Icf::unfold_section): New function.
7429 * options.h (General_options::keep_unique): New option.
7430 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7431 * testsuite/Makefile.in: Regenerate.
7432 * testsuite/icf_keep_unique_test.sh: New file.
7433 * testsuite/icf_keep_unique_test.cc: New file.
7438 * resolve.cc (Symbol_table::resolve): Check for references from
7439 dynamic objects to hidden and internal symbols.
7440 * testsuite/Makefile.am (hidden_test.sh): New test.
7441 * testsuite/Makefile.in: Regenerate.
7442 * testsuite/hidden_test.sh: New script.
7443 * testsuite/hidden_test_1.c: New test source.
7444 * testsuite/hidden_test_main.c: New test source.
7448 * arm.cc: Update comments.
7449 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7450 segment to locate the .ARM.exidx section if present.
7454 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7458 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7463 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7464 valid tls_segment only for non-debug-section relocations.
7465 * testsuite/Makefile.am: Add gc_tls_test.
7466 * testsuite/Makefile.in: Regenerate.
7467 * testsuite/gc_tls_test.cc: New file.
7468 * testsuite/gc_tls_test.sh: New file.
7474 * Makefile.am (CCFILES): Add icf.cc.
7476 * Makefile.in: Regenerate.
7477 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7478 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7479 section, symbol and addend information for the relocs.
7480 * gold.cc (queue_middle_tasks): Call identical code folding.
7481 * gold.h: Add defines for multimap.
7482 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7483 to the call of finalize_local_symbols.
7484 * main.cc (main): Create object of class Icf.
7485 * object.cc (Sized_relobj::do_layout): Allow this function to be
7486 called twice during icf.
7487 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7488 to sections marked as identical by icf.
7489 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7491 (Sized_relobj::do_section_entsize): New function.
7492 * object.h (Object::section_entsize): New function.
7493 (Object::do_section_entsize): New pure virtual function.
7494 (Relobj::finalize_local_symbols): Add new parameter.
7495 (Relobj::do_section_entsize): New function.
7496 * options.h (General_options::icf): New option.
7497 (General_options::icf_iterations): New option.
7498 (General_options::print_icf_sections): New option.
7499 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7500 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7501 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7503 * symtab.cc (Symbol_table::is_section_folded): New function.
7504 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7505 to sections marked as identical by icf.
7506 * symtab.h (Symbol_table::set_icf): New function.
7507 (Symbol_table::icf): New function.
7508 (Symbol_table::is_section_folded): New function.
7509 (Symbol_table::icf_): New data member.
7510 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7511 * testsuite/Makefile.am: Add commands to build icf_test.
7512 * testsuite/Makefile.in: Regenerate.
7513 * testsuite/icf_test.sh: New file.
7514 * testsuite/icf_test.cc: New file.
7518 * layout.cc (is_compressible_debug_section): Fix incorrect
7519 comment about compressed section names.
7524 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7529 * layout.h: #include <map>.
7530 (class Kept_section): Change from struct to class. Add accessors
7531 and setters. Add section size to Comdat_group mapping. Change
7532 Comdat_group to std::map. Add is_comdat_ field. Add
7533 linkonce_size field in union.
7534 (class Layout): Update declaration of find_or_add_kept_section.
7535 Don't declare find_kept_object.
7536 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7537 parameter. Add object, shndx, is_comdat, and is_group_name
7538 parameters. Change all callers. Adjust for new Kept_section.
7539 (Layout::find_kept_object): Remove.
7540 * object.cc (Sized_relobj::include_section_group): Update use of
7541 Kept_section. Rename secnum to shndx. Only record
7542 Kept_comdat_section if sections are the same size.
7543 (Sized_relobj::include_linkonce_section): Update use of
7544 Kept_section. Only record Kept_comdat_section if sections are the
7545 same size. Set size of linkonce section.
7546 (Sized_relobj::map_to_kept_section): Update call to
7547 get_kept_comdat_section.
7548 * object.h (class Sized_relobj): Rename fields in
7549 Kept_comdat_section to drop trailing underscores; change object
7550 field to Relobj*. Change Kept_comdat_section_table to store
7551 struct rather than pointer.
7552 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7553 Add kept_object and kept_shndx parameters. Change all callers.
7554 (Sized_relobj::get_kept_comdat_section): Change return type to
7555 bool. Add kept_object and kept_shndx parameters. Change all
7557 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7558 Layout::find_or_add_kept_section.
7562 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7563 Reserve space in the hash table.
7567 * fileread.cc (File_read::get_mtime): New method.
7568 * fileread.h (Timespec): New structure.
7569 (File_read::get_mtime): New method.
7570 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7571 Renamed from timestamp_nsec.
7572 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7574 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7576 (Incremental_inputs::report_archive): Save mtime; style fix.
7577 (Incremental_inputs::report_obejct): Save mtime; style fix.
7578 (Incremental_inputs::report_script): Save mtime; style fix.
7579 (Incremental_inputs::finalize_inputs): Style fix.
7580 (Incremental_inputs::finalize): Style fix.
7581 (Incremental_inputs::create_input_section_data): Store inputs
7583 * incremental.h (Incremental_inputs::report_script): Add mtime
7585 (Incremental_inputs::Input_info::Input_info): Intialize only one
7587 (Incremental_inputs::Input_info::archive): Move to nameless
7589 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7590 (Incremental_inputs::Input_info::script): Move to nameless union.
7591 (Incremental_inputs::mtime): New field.
7592 * script.cc (read_input_script): Pass file mtime to
7594 * script.h (Script_info::inputs): Style fix.
7598 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7604 * layout.cc (Layout::choose_output_section): If we find an
7605 existing section, update the flags.
7606 (Layout::create_notes): New function, broken out of
7608 (Layout::finalize): Don't create note sections.
7609 (Layout::create_note): Don't crash if linker script discards
7611 (Layout::create_gold_note): Likewise.
7612 (Layout::create_build_id): Likewise. Don't set
7613 after_input_sections on the section.
7614 (Layout::create_executable_stack_info): Remove target parameter.
7616 * layout.h (class Layout): Declare create_notes. Update
7617 declaration of create_executable_stack_info.
7618 * gold.cc (queue_middle_tasks): Call create_notes.
7619 * output.cc (Output_section::update_flags_for_input_section): Move
7620 here from output.h. If SHF_ALLOC flag is newly set, mark address
7622 * output.h (Output_data::mark_address_invalid): New function.
7623 (class Output_section): Only declare, not define,
7624 update_flags_for_input_section. Remove set_flags.
7628 * script-sections.cc (Output_section_definition::
7629 set_section_addresses): Rename shadowing local load_address to
7635 * reloc.cc (relocate_sections): Skip empty relocation sections.
7640 * layout.cc (Layout::create_note): Use choose_output_section
7641 rather than make_output_section.
7646 * options.cc (General_options::parse_V): Set printed_version_.
7647 (General_options::General_options): Initialize printed_version_.
7648 * options.h (class General_options): Add printed_version_ field.
7649 * gold.cc (queue_initial_tasks): If there are no input files,
7650 don't give a fatal error if we printed the version information.
7651 (queue_middle_tasks): If using -r with a shared object, give a
7652 fatal error rather than an ordinary error.
7657 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7658 (Layout::make_output_section): Set have_stabstr_section_ if we see
7659 a .stab*str section.
7660 (Layout::finalize): Call link_stabs_sections.
7661 (Layout::link_stabs_sections): New file.
7662 * layout.h (class Layout): Add have_stabstr_section_ field.
7663 Declare link_stabs_sections.
7667 * Makefile.am (libgold_a_LIBADD): New.
7668 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7669 * Makefile.in: Regenerate.
7670 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7671 * configure: Regenerate.
7672 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7673 * fileread.cc: Include sys/state.h
7674 * gold.h: Declare memmem and strndup if found missing.
7675 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7679 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7680 * configure: Rebuild.
7685 * object.cc (Object::section_contents): Don't try to get a view if
7686 the section has length zero.
7687 (Object::handle_gnu_warning_section): If the section is empty, use
7688 the name of the section as the warning.
7693 * stringpool.h (class Stringpool_template): Add optimize_ field.
7694 (Stringpool_template::set_optimize): New function.
7695 * stringpool.cc (Stringpool_template::Stringpool_template):
7696 Initialize optimize_ field.
7697 (Stringpool_template::set_string_offsets): Test local optimize
7698 fild rather than parameter.
7699 * layout.cc (Layout::Layout): Call set_optimize on the section
7705 * yyscript.y: Parse TARGET.
7706 * script.cc (script_set_target): New function.
7707 * script-c.h (script_set_target): Declare.
7708 * options.cc (General_options::string_to_object_format): Rename
7709 from string_to_object_format in anonymous namespace. Change
7711 * options.h (class General_options): Declare
7712 string_to_object_format.
7716 * script-sections.cc (Script_sections::create_segments): Don't put
7717 program headers in a PT_LOAD segment if -n or -N.
7722 * options.h (class General_options): Add -z lazy and -z now. Sort
7723 -z options into alphabetical order.
7724 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7728 * layout.cc (Layout::make_output_section): Call
7729 Target::new_output_section.
7730 (Layout::attach_allocated_section_to_segment): Put large section
7731 sections in a separate load segment with the large segment flag
7733 (Layout::segment_precedes): Sort large data segments after other
7735 (align_file_offset): New static function.
7736 (Layout::set_segment_offsets): Use align_file_offset.
7737 * output.h (class Output_section): Add is_small_section_ and
7738 is_large_section_ fields.
7739 (Output_section::is_small_section): New function.
7740 (Output_section::set_is_small_section): New function.
7741 (Output_section::is_large_section): New function.
7742 (Output_section::set_is_large_section): New function.
7743 (Output_section::is_large_data_section): New function.
7744 (class Output_segment): Add is_large_data_segment_ field.
7745 (Output_segment::is_large_data_segment): New function.
7746 (Output_segment::set_is_large_data_segment): New function.
7747 * output.cc (Output_section::Output_section): Initialize new
7749 (Output_segment::Output_segment): Likewise.
7750 (Output_segment::add_output_section): Add assertion that large
7751 data sections always go in large data segments. Force small data
7752 sections to the end of the list of data sections. Force small BSS
7753 sections to the start of the list of BSS sections. For large BSS
7754 sections to the end of the list of BSS sections.
7755 * symtab.h (class Symbol): Declare is_common_shndx.
7756 (Symbol::is_defined): Check Symbol::is_common_shndx.
7757 (Symbol::is_common): Likewise.
7758 (class Symbol_table): Define enum Commons_section_type. Update
7759 declarations. Add small_commons_ and large_commons_ fields.
7760 * symtab.cc (Symbol::is_common_shndx): New function.
7761 (Symbol_table::Symbol_table): Initialize new fields.
7762 (Symbol_table::add_from_object): Put small and large common
7763 symbols in the right list.
7764 (Symbol_table::sized_finalized_symbol): Check
7765 Symbol::is_common_shndx.
7766 (Symbol_table::sized_write_globals): Likewise.
7767 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7768 common symbol lists. Don't call do_allocate_commons_list if the
7770 (Symbol_table::do_allocate_commons_list): Remove is_tls
7771 parameter. Add comons_section_type parameter. Change all
7772 callers. Handle small and large common symbols.
7773 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7774 Symbol::is_common_shndx.
7775 * resolve.cc (symbol_to_bits): Likewise.
7776 * target.h (Target::small_common_shndx): New function.
7777 (Target::small_common_section_flags): New function.
7778 (Target::large_common_shndx): New function.
7779 (Target::large_common_section_flags): New function.
7780 (Target::new_output_section): New function.
7781 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7782 small_common_section_flags, and large_common_section_flags
7784 (Target::do_new_output_section): New virtual function.
7785 * arm.cc (Target_arm::arm_info): Initialize new fields.
7786 * i386.cc (Target_i386::i386_info): Likewise.
7787 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7789 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7790 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7791 (Target_x86_64::do_new_output_section): New function.
7792 * configure.ac: Define conditional MCMODEL_MEDIUM.
7793 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7794 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7795 (large_LDFLAGS): Define.
7796 * testsuite/large.c: New file.
7797 * testsuite/testfile.cc (Target_test::test_target_info):
7798 Initialize new fields.
7799 * configure, testsuite/Makefile.in: Rebuild.
7803 * Makefile.am (CCFILES): Add target.cc.
7804 * Makefile.in: Regenerate.
7805 * i386.cc (class Target_i386): Define new virtual method to
7806 override do_is_local_label_name in parent.
7807 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7808 local symbols if --discard-locals or -X is given.
7809 * options.h (class General_options): Declare new options
7810 '--discard-locals' and '-X' for discarding locals.
7811 * target.h (class Target): Define new methods is_local_label_name.
7812 Declare new virtual method do_is_local_label_name.
7813 * target.cc: New file.
7814 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7815 (check_SCRIPTS): Add discard_locals_test.sh.
7816 (check_DATA): Add discard_local_tests.syms.
7817 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7818 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7819 * testsuite/Makefile.in: Regenerate.
7820 * testsuite/discard_locals_test.c: New file.
7821 * testsuite/discard_locals_test.sh: Same.
7825 * object.cc (Sized_relobj::Sized_relobj): Initialize
7826 discarded_eh_frame_shndx_ to -1U.
7827 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7829 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7830 a discarded .eh_frame section.
7831 (Sized_relobj::do_finalize_local_symbols): Ditto.
7832 * object.h (class Sized_relobj): Declare new member
7833 discarded_eh_frame_shndx_.
7834 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7835 (local_labels_test.o, local_labels_test): New rules.
7836 * testsuite/Makefile.in: Regenerate.
7840 * layout.cc (Layout::section_name_mapping): Add mapping for
7841 special ARM sections.
7845 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7846 (utils::has_overflow): Same.
7850 * layout.cc (Layout::section_name_mapping): New array, replacing
7851 Layout::linkonce_mapping.
7852 (Layout::section_name_mapping_count): New variable, replacing
7853 Layout::linkonce_mapping_count.
7854 (Layout::linkonce_output_name): Remove.
7855 (Layout::output_section_name): Rewrite.
7856 * layout.h (class Layout): Rename Linkonce_mapping to
7857 Section_name_mapping, linkonce_mapping to section_name_mapping,
7858 linkonce_mapping_count to section_name_mapping_count. Don't
7859 declare linkonce_output_name.
7863 * gold/arm.cc (namespace utils): New.
7864 (Target_arm::reloc_is_non_pic): Define new method.
7865 (class Arm_relocate_functions): New.
7866 (Target_arm::Relocate::relocate): Handle relocation types used by
7871 * arm.cc (Target_arm::scan::global): Use || instead of |.
7875 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7876 issued_non_pic_error_.
7877 (class Target_arm::Scan): Declare new method check_non_pic.
7878 Define new method symbol_needs_plt_entry.
7879 Declare new data member issued_non_pic_error_.
7880 (class Target_arm::Relocate): Declare new method
7881 should_apply_static_reloc.
7882 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7883 (Target_arm::Scan::check_non_pic): Define new method.
7884 (Target_arm::Scan::local): Handle a small subset of reloc types used
7886 (Target_arm::Scan::local): Same.
7887 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7891 * incremental.cc (Incremental_inputs::report_command_line): Filter
7892 out --incremental-* options.
7896 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7898 (class Target_arm): Update comment.
7899 (Target_arm::Target_arm): Initialize new data members GOT_,
7900 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7901 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7902 and Target_arm::rel_dyn_section.
7903 Declare new_enum Target_arm::Got_type.
7904 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7906 Update commments for member do_dynsym_value.
7907 (Target_arm::got_size, Target_arm::plt_section,
7908 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7909 new methods inside class defintion.
7910 (Target_arm::got_section): Define new method.
7911 (Target_arm::rel_dyn_section): Same.
7912 (Output_data_plt_arm): New template class.
7913 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7914 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7915 (Output_data_plt_arm::add_entry): Same.
7916 (Output_data_plt_arm::first_plt_entry): Define new
7917 static data member for PLT instruction template.
7918 (Output_data_plt_arm::plt_entry): Same.
7919 (Output_data_plt_arm::do_write): Define new method.
7920 (Target_arm::make_plt_entry): Same.
7921 (Target_arm::do_finalize_sections): Same.
7922 (Target_arm::do_dynsym_value): Same.
7926 * Makefile.am (TARGETSOURCES): Add arm.cc.
7927 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7928 * Makefile.in: Regenerate.
7930 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7934 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7935 (General_options::check_excluded_libs): Strip off directories in
7936 archive name before matching like GNU ld does.
7937 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7938 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7939 (exclude_libs_test_LDFLAGS): Add linker option
7940 -Wl,--exclude-libs,libexclude_libs_test_3
7941 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7942 an explicit archive without using -l.
7943 (alt/libexclude_libs_test_3.a): New make rule.
7944 * testsuite/Makefile.in: Regenerate.
7945 * testsuite/exclude_libs_test.c : Declare lib3_default().
7947 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7948 * exclude_libs_test_3.c: New file.
7952 * po/id.po: New Indonesian translation.
7953 * po/gold.pot: Updated template file.
7957 * testsuite/Makefile.am: Add -ffunction-sections to compile
7958 gc_comdat_test files. Add -Wl,--gc-sections to build
7960 * testsuite/Makefile.in: Regenerate.
7961 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7965 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7966 kept comdat section was garbage collected.
7967 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7968 * testsuite/Makefile.in: Regenerate.
7969 * testsuite/gc_comdat_test.sh: New file.
7970 * testsuite/gc_comdat_test_1.cc: New file.
7971 * testsuite/gc_comdat_test_2.cc: New file.
7975 * archive.cc (Archive::Archive): Move constructor from archive.h
7976 to here. Initialize no_export_.
7977 (Archive::get_elf_object_for_member): Set no_export flag of object.
7978 * archive.h (Archive::Archive): Move constructor body to
7980 (Archive::no_export): New method.
7981 (Archive::no_export_): New field.
7982 * object.h (Object::Object): Initialize no_export_ to false.
7983 (Object::no_export, Object::set_no_export): New methods.
7984 (Object::no_export_): New field.
7985 * options.cc (General_options::parse_exclude_libs): New method.
7986 (General_options::check_excluded_libs) Same.
7987 * options.h (exclude_libs): New option.
7988 (General_options::check_excluded_libs): New method declaration.
7989 (General_options::excluded_libs_): New field.
7990 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7991 default or protected visibility if an object has no-export flag set.
7992 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7993 (check_SCRIPTS): Add exclude_libs_test.sh.
7994 (check_DATA): Add exclude_libs_test.syms.
7995 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7996 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7997 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7998 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7999 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8000 libexclude_libs_test_2.a): New rules.
8001 * testsuite/Makefile.in: Regenerate.
8002 * testsuite/exclude_libs_test.c: New file.
8003 * testsuite/exclude_libs_test.sh: Ditto.
8004 * testsuite/exclude_libs_test_1.c: Ditto.
8005 * testsuite/exclude_libs_test_2.c: Ditto.
8009 * configure.ac: Check for declarations for cases where libiberty.h
8010 checks HAVE_DECL_xxx.
8011 * configure, config.in: Rebuild.
8015 * gold.h (Incremental_argument_list): Remove (invalid) forward
8017 * incremental.cc (Incremental_inputs::report_achive): New method.
8018 (Incremental_inputs::report_object): New method.
8019 (Incremental_inputs::report_script): New method.
8020 (Incremental_inputs::finalize_inputs): New method.
8021 (Incremental_inputs::finalize): Call finalize_inputs().
8022 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8023 Create inputs entries.
8024 * incremental.h (Incremental_input_type): New enum.
8025 (Incremental_inputs::Incremental_input): Initialize new fields.
8026 (Incremental_inputs::report_inputs): New method.
8027 (Incremental_inputs::report_achive): New method.
8028 (Incremental_inputs::report_object): New method.
8029 (Incremental_inputs::report_script): New method.
8030 (Incremental_inputs::finalize_inputs): New method.
8031 (Incremental_inputs::Input_info): New struct.
8032 (Incremental_inputs::Input_info_map): New typedef.
8033 (Incremental_inputs::lock_): New field.
8034 (Incremental_inputs::Inputs_): New field.
8035 (Incremental_inputs::Inputs_map): New field.
8036 * main.cc (main): Call Incremental_input::report_inputs.
8037 * options.h (Input_argument_list): Typedef moved from
8039 (Input_file_group::Files): Remove, use ::Input_argument_list.
8040 (Input_file_group::Input_argument_list): Remove, use
8041 ::Input_argument_list.
8042 * plugin.cc (Plugin_manager::add_input_file): Add error in
8044 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8046 * script.cc (read_input_script): Call
8047 Incremental_input::report_script.
8048 * script.h (Script_info): New class.
8052 * x86_64.cc (do_adjust_output_section): Set entsize to
8057 * output.cc (Output_file::close): After short writes, continue
8058 writing from the correct offset in the buffer being written.
8062 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8063 * configure: Regenerate.
8064 * config.in: Regenerate.
8065 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8066 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8070 * incremental.cc (Incremental_inputs_header_data): Renamed from
8071 Incremental_input_header_data.
8072 (Incremental_inputs_header_data::data_size): New field.
8073 (Incremental_inputs_header_data::put_input_file_count): Renamed
8074 from input_file_count.
8075 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8076 from command_line_offset.
8077 (Incremental_inputs_header_data::put_reserved): Renamed from
8079 (Incremental_inputs_entry_data): Renamed from
8080 Incremental_input_entry_data.
8081 (Incremental_inputs_entry_data::data_size): New field.
8082 (Incremental_inputs::report_command_line): New method.
8083 (Incremental_inputs::finalize): New method.
8084 (Incremental_inputs::create_incremental_inputs_data): New method.
8085 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8086 * incremental.h: New file.
8087 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8088 (Layout::finalize): Create incremental inputs section in
8090 (Layout::create_incremental_info_sections): New method.
8091 * layout.h (Layout::incremental_inputs): New method.
8092 (Layout::create_incremental_info_sections): New method.
8093 (Layout::incremental_inputs_): New field.
8094 * main.cc (main): Notify Incremental_input of the command line.
8099 * gold.h (reserve_unordered_map): Define, three versions, one for
8100 each version of Unordered_map.
8101 * layout.cc (Layout::Layout): Remove options parameter. Add
8102 number_of_input_files parameter. Don't initialize options_.
8103 Initialize number_of_input_files_ and resized_signatures_. Move
8104 sections_are_attached_.
8105 (Layout::layout_group): Reserve space for group_signatures_.
8106 (Layout::find_or_add_kept_section): Change name parameter to be a
8107 reference. Resize signatures_ map when it gets large enough.
8108 (Layout::layout_eh_frame): Use parameters->options() instead of
8110 (Layout::make_output_section): Likewise.
8111 (Layout::attach_allocated_section_to_segment): Likewise.
8112 (Layout::finalize, Layout::create_executable_stack): Likewise.
8113 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8114 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8115 * layout.h (class Layout): Update declarations. Remove options_
8116 field. Add number_of_input_files_ and resized_signatures_
8117 fields. Move sections_are_attached_ field.
8118 * main.cc (main): Pass number of input files to Layout
8119 constructor. Don't pass options.
8123 * ffsll.c (ffsll): Correct implementation.
8127 * ffsll.c: New file.
8128 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8129 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8130 * ftruncate.c (ftruncate): Declare before definition.
8131 * mremap.c (mremap): Likewise.
8132 * pread.c (pread): Likewise.
8133 * configure, Makefile.in, config.in: Rebuild.
8135 * mremap.c: New file.
8136 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8137 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8138 (mremap): Declare if HAVE_MREMAP is not defined.
8139 * configure, Makefile.in, config.in: Rebuild.
8143 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8144 position independent.
8145 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8146 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8150 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8152 (needs_dynamic_reloc): Likewise.
8156 * yyscript.y (file_cmd): Recognize EXTERN.
8157 (extern_name_list, extern_name_list_body): New nonterminals.
8158 * script.cc (script_add_extern): Define.
8159 * script-c.h (script_add_extern): Declare.
8163 * object.cc (is_elf_object): Define.
8164 * object.h (is_elf_object): Declare.
8165 * archive.cc (Archive::get_elf_object_for_member): Call
8167 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8171 * output.cc (Output_file::map_anonymous): Define.
8172 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8173 try an anonymous one. Report the size if the mmap fails.
8174 * output.h (class Output_file): Declare map_anonymous.
8178 * target-select.cc (instantiate_target): Don't acquire the lock if
8179 the instantiated_target_ field has already been set.
8183 * gold-threads.h (class Initialize_lock): Define.
8184 * gold-threads.cc (class Initialize_lock_once): Define.
8185 (initialize_lock_control): New static variable.
8186 (initialize_lock_pointer): New static variable.
8187 (initialize_lock_once): New static function.
8188 (Initialize_lock::Initialize_lock): Define.
8189 (Initialize_lock::initialize): Define.
8190 * target-select.h: Include "gold-threads.h".
8191 (class Target_selector): Add lock_ and initialize_lock_ fields.
8192 Don't define instantiate_target, just declare it.
8193 * target-select.cc (Target_selector::Target_selector): Initialize
8195 (Target_selector::instantiate_target): Define.
8196 * descriptors.h: Include "gold-threads.h".
8197 (class Descriptors): Add initialize_lock_ field.
8198 * descriptors.cc (Descriptors::Descriptors): Initialize new
8200 (Descriptors::open): Use initialize_lock_ field
8201 * errors.h (class Errors): Add initialize_lock_ field.
8202 * errors.cc (Errors::Errors): Initialize new field.
8203 (Errors::initialize_lock): Use initialize_lock_ field.
8204 * powerpc.cc (class Target_selector_powerpc): Remove
8205 instantiated_target_ field. In do_recognize call
8206 instantiate_target rather than do_instantiate_target. In
8207 do_instantiate_target just allocate a new target.
8208 * sparc.cc (class Target_selector_sparc): Likewise.
8210 * freebsd.h: New file.
8211 * i386.cc: Include "freebsd.h".
8212 (Target_i386): Derive from Target_freebsd rather than
8214 (Target_selector_i386): Derive from Target_selector_freebsd rather
8215 than Target_selector.
8216 * x86_64.cc: Include "freebsd.h".
8217 (Target_x86_64): Derive from Target_freebsd rather than
8219 (Target_selector_x86_64): Derive from Target_selector_freebsd
8220 rather than Target_selector.
8221 * target.h (class Target): Add adjust_elf_header and
8222 do_adjust_elf_header.
8223 * output.cc (Output_file_header:: do_sized_write): Call target
8224 adjust_elf_header routine.
8225 * configure.tgt: Set targ_osabi.
8226 * configure.ac: Define GOLD_DEFAULT_OSABI.
8227 * parameters.cc (Parameters::default_target): Pass
8228 GOLD_DEFAULT_OSABI to select_target.
8229 * target-select.h (class Target_selector): Make instantiate_target
8230 protected rather than private.
8231 * Makefile.am (HFILES): Add freebsd.h.
8232 * configure, Makefile.in, config.in: Rebuild.
8234 * merge.cc (do_add_input_section): Correct pend value. Change
8235 message about last entry not being null terminated from error to
8240 * incremental.cc: New file.
8241 * Makefile.am (CCFILES): Add incremental.cc.
8242 * Makefile.in: Rebuild.
8246 * layout.cc (Layout::output_section_name): Preserve names
8247 of '.note.' sections.
8251 * descriptors.cc (Descriptors::open): Check that the options are
8252 valid before using them.
8256 * script-sections.h: Include <list>.
8257 (class Script_sections): Change Sections_elements from std::vector
8258 to std::list. Typedef public Elements_iterator. Add
8259 orphan_section_placement_, data_segment_align_start_, and
8260 saw_data_segment_align_ fields. Remove data_segment_align_index_
8262 * script-sections.cc (class Orphan_section_placement): New class.
8263 (class Sections_element): Add virtual functions is_relro and
8264 orphan_section_init. Remove virtual function place_orphan_here.
8265 (class Output_section_definition): Add is_relro and
8266 orphan_section_init. Remove place_orphan_here.
8267 (class Orphan_output_section): Likewise.
8268 (Script_sections::Script_sections): Update for field changes.
8269 (Script_sections::data_segment_align): Set saw_data_segment_align_
8270 and data_segment_align_start_, not data_segment_align_index.
8271 (Script_sections::data_segment_relro_end): Check
8272 saw_data_segment_align_. Use data_segment_align_start_ rather
8273 than data_segment_align_index_.
8274 (Script_sections::place_orphan): Rewrite to use
8275 Orphan_section_placement.
8279 * archive.cc (Archive::add_symbols): Check for a version attached
8280 to the symbol name in the archive map.
8281 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8282 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8283 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8284 (ver_test_11.a): New target.
8285 * testsuite/Makefile.in: Rebuild.
8287 * configure.ac: Check for chsize and posix_fallocate. Replace
8289 * ftruncate.c: New file, from gnulib.
8290 * output.cc (posix_fallocate): Define dummy version if not
8291 HAVE_POSIX_FALLOCATE.
8292 (Output_file::map): Call posix_fallocate rather than lseek and
8294 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8295 * configure, Makefile.in, config.in: Rebuild.
8299 * layout.h (Layout::create_note): Add section_name parameter.
8300 * layout.cc (Layout::create_note): Likewise.
8301 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8305 * descriptors.cc: Include "options.h".
8306 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8307 (Descriptors::open): Always use O_CLOEXEC when opening a new
8308 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8309 then set FD_CLOEXEC.
8311 * sparc.cc (class Target_sparc): Add has_got_section.
8312 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8313 make sure we have a GOT section.
8315 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8316 (Target_sparc::Scan::local): Likewise.
8317 (Target_sparc::Scan::global): Likewise.
8318 (Target_sparc::Relocate::relocate): Likewise.
8319 (Target_sparc::Relocate::relocate_tls): Likewise.
8321 * symtab.cc (Symbol_table::define_default_version): New function,
8322 broken out of add_from_object.
8323 (Symbol_table::add_from_object): Call define_default_version.
8324 (Symbol_table::define_special_symbol): Add resolve_oldsym
8325 parameter. Change all callers. If the version for a symbol comes
8326 from a version script, resolve it with the symbol with the same
8327 name with no version. Also add the symbol without a version if
8329 (do_define_in_output_data): If resolving with oldsym, don't delete
8331 (do_define_in_output_segment): Likewise.
8332 (do_define_as_constant): Likewise.
8333 * symtab.h (class Symbol_table): Update declarations.
8337 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8338 (Read_symbols::requeue): New function.
8339 (Read_symbols::do_read_symbols): If make_elf_object fails because
8340 the target type is not configured, and the file was searched for,
8341 issue a warning and retry with the next directory.
8342 (Add_symbols::run): If the file has an incompatible format, and
8343 it was searched for, requeue the Read_symbols task. On error,
8345 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8346 dirindex parameter to constructor. Change all callers. Declare
8347 incompatible_warning and requeue.
8348 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8349 input_argument_ and input_group_ fields. Add them to
8350 constructor. Change all callers.
8351 (class Read_script): Add dirindex_ field. Add it to constructor.
8353 * archive.cc (Archive::setup): Remove input_objects parameter.
8355 (Archive::get_file_and_offset): Likewise.
8356 (Archive::read_all_symbols): Likewise.
8357 (Archive::read_symbols): Likewise.
8358 (Archive::get_elf_object_for_member): Remove input_objects
8359 parameter. Add punconfigured parameter. Change all callers.
8360 (Archive::add_symbols): Change return type to bool. Check return
8361 value of include_member.
8362 (Archive::include_all_members): Likewise.
8363 (Archive::include_member): Change return type to bool. Return
8364 false if first included object has incompatible target. Set
8365 included_member_ field.
8366 (Add_archive_symbols::run): If add_symbols returns false, requeue
8368 * archive.h (class Archive): Add included_member_ field.
8369 Initialize it in constructor. Add input_file and searched_for
8370 methods. Update declarations.
8371 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8372 input_argument_ fields. Add them to constructor. Change all
8374 * script.cc: Include "target-select.h".
8375 (class Parser_closure): Add skip_on_incompatible_target_ and
8376 found_incompatible_target_ fields. Add
8377 skip_on_incompatible_target parameter to constructor. Change all
8378 callers. Add methods skip_on_incompatible_target,
8379 clear_skip_on_incompatible_target, found_incompatible_target, and
8380 set_found_incompatible_target.
8381 (read_input_script): Add dirindex parameter. Change all callers.
8382 If parser finds an incompatible target, requeue Read_symbols
8384 (script_set_symbol): Clear skip_on_incompatible_target in
8386 (script_add_assertion, script_parse_option): Likewise.
8387 (script_start_sections, script_add_phdr): Likewise.
8388 (script_check_output_format): New function.
8389 * script.h (read_input_script): Update declaration.
8390 * script-c.h (script_check_output_format): Declare.
8391 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8392 (ignore_cmd): Remove OUTPUT_FORMAT.
8393 * fileread.cc (Input_file::Input_file): Add explicit this.
8394 (Input_file::will_search_for): New function.
8395 (Input_file::open): Add pindex parameter. Change all callers.
8396 * fileread.h (class Input_file): Add input_file_argument method.
8397 Declare will_search_for. Update declarations.
8398 * object.cc (make_elf_object): Add punconfigured parameter.
8400 * object.h (class Object): Make input_file public. Add
8401 searched_for method.
8402 (make_elf_object): Update declaration.
8403 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8405 * dirsearch.h (class Dirsearch): Update declaration.
8406 * options.h (class General_options): Add --warn-search-mismatch.
8407 * parameters.cc (Parameters::is_compatible_target): New function.
8408 * parameters.h (class Parameters): Declare is_compatible_target.
8409 * workqueue.cc (Workqueue::add_blocker): New function.
8410 * workqueue.h (class Workqueue): Declare add_blocker.
8412 * fileread.cc (Input_file::open): Remove options parameter.
8414 (Input_file::open_binary): Likewise.
8415 * script.cc (read_input_script): Likewise.
8416 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8417 options parameter from constructor. Change all callers.
8418 (class Read_script): Likewise.
8419 * fileread.h (class Input_file): Update declarations.
8420 * script.h (read_input_script): Update declaration.
8424 * po/es.po: New Spanish translation.
8428 * options.cc (parse_short_option): Keep dash_z from registering itself.
8433 * target-reloc.h (relocate_section): Pass output_section to
8435 * i386.cc (Target_i386::should_apply_static_reloc): Add
8436 output_section parameter. Change all callers.
8437 (Target_i386::Relocate::relocate): Add output_section parameter.
8438 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8439 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8440 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8441 * testsuite/two_file_shared.sh: New script.
8442 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8443 (check_DATA): Add two_file_shared.dbg.
8444 (two_file_shared.dbg): New target.
8445 * testsuite/Makefile.in: Rebuild.
8449 * configure.ac: Check for byteswap.h.
8450 * configure: Rebuild.
8451 * config.in: Rebuild.
8455 * layout.cc (Layout::find_or_add_kept_section): New function.
8456 (Layout::add_comdat): Removed.
8457 * layout.h (struct Kept_section): Move out of class Layout.
8458 Remove trailing underscores from field names. Add group_sections
8459 field. Rename group_ field to is_group. Change all uses.
8460 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8461 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8462 comdat_groups_ field.
8463 (Sized_relobj::include_section_group): Use
8464 find_or_add_kept_section and Kept_section::group_sections.
8465 (Sized_relobj::include_linkonce_section): Likewise.
8466 * object.cc (class Sized_relobj): Don't define Comdat_group or
8467 Comdat_group_table. Remove find_comdat_group and
8468 add_comdat_group. Remove comdat_groups_ field.
8469 * plugin.cc (include_comdat_group): Use
8470 Layout::find_or_add_kept_section.
8474 * README: --gc-sections and map files are now supported. Document
8475 some build requirements.
8478 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8479 relocatable link set the value of the section symbol to zero.
8480 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8481 relocatable link don't include the section address in the local
8487 * options.h (class Search_directory): Add is_system_directory.
8488 (class General_options): Declare is_in_system_directory.
8489 * options.cc (get_relative_sysroot): Make static.
8490 (get_default_sysroot): Make static.
8491 (General_optoins::is_in_system_directory): New function.
8492 * fileread.cc (Input_file::is_in_system_directory): New function.
8493 * fileread.h (class Input_file): Declare is_in_system_directory.
8494 * object.h (class Object): Add is_in_system_directory.
8495 (class Input_objects): Remove system_library_directory_ field.
8496 * object.cc (Input_objects::add_object): Don't set
8497 system_library_directory_.
8498 (input_objects::found_in_system_library_directory): Remove.
8499 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8500 parameter. Change all callers.
8501 (Symbol_table::sized_write_globals): Likewise.
8502 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8503 Call Object::is_in_system_directory.
8504 * symtab.h (class Symbol_table): Update declarations.
8507 * descriptors.h (Open_descriptor): Add is_on_stack field.
8508 * descriptors.cc (Descriptors::open): If the descriptor is on the
8509 top of the stack, remove it. Initialize is_on_stack field.
8510 (Descriptors::release): Only add pod to stack if it is not on the
8512 (Descriptors::close_some_descriptor): Clear stack_next and
8516 * output.cc (Output_section::find_starting_output_address): Rename
8517 from starting_output_address; add PADDR parameter; change return
8519 * output.h (class Output_section): Declare
8520 find_starting_output_address instead of starting_output_address.
8521 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8522 section symbol for which we can't find a merge section.
8525 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8526 hidden or internal, force the symbol to be local.
8527 * resolve.cc (Symbol::override_visibility): Define.
8528 (Symbol::override_base): Use override_visibility.
8529 (Symbol_table::resolve): Likewise.
8530 (Symbol::override_base_with_special): Likewise.
8531 (Symbol_table::override_with_special): If the visibility is hidden
8532 or internal, force the symbol to be local.
8533 * symtab.h (class Symbol): Add set_visibility and
8534 override_visibility.
8535 * testsuite/ver_test_1.sh: New file.
8536 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8537 (check_DATA): Add ver_test_1.syms.
8538 (ver_test_1.syms): New target.
8539 * testsuite/Makefile.in: Rebuild.
8543 * layout.cc (Layout::choose_output_section): Don't rename sections
8544 when using a linker script that has a SECTIONS clause.
8545 * Makefile.in: Regenerate.
8547 * testsuite/Makefile.am (script_test_5.sh): New test case.
8548 * testsuite/Makefile.in: Regenerate.
8549 * testsuite/script_test_5.cc: New file.
8550 * testsuite/script_test_5.sh: New file.
8551 * testsuite/script_test_5.t: New file.
8555 * archive.cc (Archive::include_member): Update calls to add_symbols.
8556 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8557 the Layout argument.
8558 * dynobj.h (do_add_symbols): Add the Layout argument.
8559 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8561 * object.h (Object::add_symbols): Add the Layout argument.
8562 (Object::do_add_symbols): Add the Layout argument.
8563 (Sized_relobj::do_add_symbols): Add the Layout argument.
8564 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8565 Unify the two versions.
8566 (Add_plugin_symbols): Remove.
8567 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8568 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8569 (Add_plugin_symbols): Remove.
8570 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8571 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8572 (Add_symbols::run): Make it work with Pulginobj.
8576 * object.cc (Sized_relobj::do_layout): Make info message start
8577 with lower case letter.
8581 * binary.cc: Fix file comment.
8583 * options.h (enum Incremental_disposition): Define.
8584 (class General_options): Add new options: --incremental,
8585 --incremental_changed, --incremental_unchanged,
8586 --incremental_unknown. Add incremental_disposition_ and
8587 implicit_incremental_ fields.
8588 (General_options::incremental_disposition): New function.
8589 (class Position_dependent_options): Add incremental_disposition
8591 (Position_dependent_options::copy_from_options): Set incremental
8593 * options.cc (General_options::parse_incremental_changed): New
8595 (General_options::parse_incremental_unchanged): New function.
8596 (General_options::parse_incremental_unknown): New function.
8597 (General_options::General_options): Initialize new fields
8598 incremental_disposition_ and implicit_incremental_.
8599 (General_options::finalize): Check for uasge of --incremental-*
8600 without --incremental.
8604 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8605 pointer and to report location as the file name associated with
8607 (gold_undefined_symbol_at_location): New function to replace the
8608 old gold_undefined_symbol functionality.
8609 * target-reloc.h (relocate_section): Update to use
8610 gold_undefined_symbol_at_location.
8611 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8612 Call gold_undefined_symbol function rather than gold_error.
8613 * errors.h (Errors::undefined_symbol): Take location as a
8614 string, rather than calculating it from a relocation.
8615 * errors.cc (Errors::fatal): Print "fatal error:" before the
8617 (Errors::error, Errors::error_at_location): Print "error: "
8618 before the formatted message.
8619 (Errors::undefined_symbol): Take location as a string, rather
8620 than calculating it from a relocation.
8621 (gold_undefined_symbol_at_location): New function akin to
8622 old gold_undefined_symbol, calculates location from relocation.
8623 (gold_undefined_symbol): Change to take only a Symbol pointer
8624 and to report location as the file name associated with the symbol.
8625 * testsuite/debug_msg.sh: Update for changed error messages.
8626 * testsuite/undef_symbol.sh: Likewise.
8631 * reduced_debug_output.h
8632 (Output_reduced_debug_abbrev_section::failed): Use format for
8634 (Output_reduced_debug_info_section::faild): Likewise.
8638 * script.cc (Lazy_demangler): New class.
8639 (Version_script_info::get_symbol_version_helper): Demangle a
8644 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8646 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8650 * version.cc (version_string): Bump to 1.9.
8652 * gold.h: Include <cstring> and <stdint.h>.
8653 * version.cc: Include <cstdio>.
8654 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8656 * reduced_debug_output.cc (insert_into_vector): Rename from
8657 Insert_into_vector; change all callers. Use Swap_unaligned to
8658 avoid aliasing issue; remove union since it is unnecessary.
8662 * Makefile.am (CCFILES): Add gc.cc.
8664 * Makefile.in: Regenerate.
8665 * gold.cc (Gc_runner): New class.
8666 (queue_initial_tasks): Call garbage collection related tasks
8667 when corresponding options are invoked.
8668 (queue_middle_gc_tasks): New function.
8669 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8670 processed early before laying out sections during garbage collection.
8671 * gold.h (queue_middle_gc_tasks): New function.
8672 (is_prefix_of): Move from "layout.cc".
8673 * i386.cc (Target_i386::gc_process_relocs): New function.
8674 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8675 * main.cc (main): Create object of class "Garbage_collection".
8676 * object.cc (Relobj::copy_symbols_data): New function.
8677 (Relobj::is_section_name_included): New function.
8678 (Sized_relobj::do_layout): Allow this function to be called twice
8679 during garbage collection and defer layout of section during the
8681 * object.h (Relobj::get_symbols_data): New function.
8682 (Relobj::is_section_name_included): New function.
8683 (Relobj::copy_symbols_data): New function.
8684 (Relobj::set_symbols_data): New function.
8685 (Relobj::get_relocs_data): New function.
8686 (Relobj::set_relocs_data): New function.
8687 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8688 (Relobj::gc_process_relocs): New function.
8689 (Relobj::do_gc_process_relocs): New pure virtual function.
8690 (Relobj::sd_): New data member.
8691 (Sized_relobj::is_output_section_offset_invalid): New function.
8692 (Sized_relobj::do_gc_process_relocs): New function.
8693 * options.h (General_options::gc_sections): Modify to not be a no-op.
8694 (General_options::print_gc_sections): New option.
8695 * plugin.cc (Plugin_finish::run): Remove function call to
8696 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8697 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8698 * reloc.cc (Read_relocs::run): Add task to process relocs and
8699 determine unreferenced sections when doing garbage collection.
8700 (Gc_process_relocs): New class.
8701 (Sized_relobj::do_gc_process_relocs): New function.
8702 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8703 sections that are garbage collected.
8704 * reloc.h (Gc_process_relocs): New class.
8705 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8706 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8707 symbols whose corresponding sections are garbage collected.
8708 (Symbol_table::Symbol_table): Add new parameter for the garbage
8710 (Symbol_table::gc_mark_undef_symbols): New function.
8711 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8712 (Symbol_table::gc_mark_dyn_syms): New function.
8713 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8715 (Symbol_table::add_from_object): Likewise.
8716 (Symbol_table::add_from_relobj): When building shared objects, do not
8717 treat externally visible symbols as garbage.
8718 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8719 table information for static and relocatable links.
8720 * symtab.h (Symbol_table::set_gc): New function.
8721 (Symbol_table::gc): New function.
8722 (Symbol_table::gc_mark_undef_symbols): New function.
8723 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8724 (Symbol_table::gc_mark_dyn_syms): New function.
8725 (Symbol_table::gc_): New data member.
8726 * target.h (Sized_target::gc_process_relocs): New pure virtual
8728 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8729 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8733 * options.h (General_options::gc_sections): Define as a no-op for now.
8734 (General_options::no_keep_memory): Ditto.
8735 (General_options::Bshareable): Define.
8736 * options.cc (General_options::finalize): Honor -Bshareable.
8740 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8741 read the value in the contents, since we don't use it. Use the
8742 template endianness when writing.
8743 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8747 * configure.tgt (powerpc64-*): Fix targ_obj.
8751 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8752 local symbols when stripping all symbols.
8756 * output.cc (Output_reloc): Add explicit instantiations.
8760 * archive.cc (Archive::get_elf_object_for_member): Remove call
8761 to File_read::claim_for_plugin.
8762 * descriptors.cc (Descriptors::open): Remove reference to
8764 (Descriptors::claim_for_plugin): Remove.
8765 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8766 (Descriptors::is_claimed): Remove.
8767 (claim_descriptor_for_plugin): Remove.
8768 * fileread.cc (File_read::claim_for_plugin): Remove.
8769 * fileread.h (File_read::claim_for_plugin): Remove.
8770 (File_read::descriptor): Reopen descriptor if necessary.
8771 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8772 (Plugin_manager::all_symbols_read): Add task parameter. Change
8774 (Plugin_manager::get_input_file): New function.
8775 (Plugin_manager::release_input_file): New function.
8776 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8777 corresponding data member.
8778 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8779 and pass to base constructor. Change all callers.
8780 (get_input_file, release_input_file): New functions.
8781 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8782 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8783 (Plugin_manager::all_symbols_read): Add task parameter.
8784 (Plugin_manager::get_input_file): New function.
8785 (Plugin_manager::release_input_file): New function.
8786 (Plugin_manager::task_): New data member.
8787 (Pluginobj::Pluginobj): Add filesize parameter.
8788 (Pluginobj::filename): New function.
8789 (Pluginobj::descriptor): New function.
8790 (Pluginobj::filesize): New function.
8791 (Pluginobj::filesize_): New data member.
8792 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8793 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8794 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8796 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8797 with archive libraries.
8798 * testsuite/Makefile.in: Regenerate.
8799 * testsuite/plugin_test.c (struct sym_info): New type.
8800 (get_input_file, release_input_file): New static variables.
8801 (onload): Capture new transfer vector entries.
8802 (claim_file_hook): Stop reading at end of file according to filesize.
8803 Factor out parsing of readelf output into separate function.
8804 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8805 APIs and get the source file name from the symbol table. Convert
8806 source file name to corresponding object file name. Print info
8807 message when adding new input files.
8808 (parse_readelf_line): New function.
8809 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8810 * testsuite/plugin_test_2.sh: Likewise.
8811 * testsuite/plugin_test_3.sh: Likewise.
8812 * testsuite/plugin_test_4.sh: New test case.
8816 * version.cc (version_string): Bump to 1.8.
8820 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8821 * plugin.cc (Plugin_manager::finish): Rename as
8822 layout_deferred_objects. Move cleanup to separate function.
8823 (Plugin_manager::cleanup): New function.
8824 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8826 * plugin.h (Plugin_manager::finish): Rename as
8827 layout_deferred_objects.
8828 (Plugin_manager::cleanup): New function.
8829 (Plugin_manager::cleanup_done): New field.
8833 * plugin.cc (is_visible_from_outside): New function.
8834 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8835 so we don't return "IR only" status for exported symbols or -r links.
8837 * testsuite/Makefile.am (plugin_test_3): New test case.
8838 * testsuite/Makefile.in: Regenerate.
8839 * testsuite/plugin_test_3.sh: New file.
8843 * object.cc (Sized_relobj::layout_section): New function.
8844 (Sized_relobj::do_layout): Defer layout of input sections until after
8845 plugin has provided replacement files.
8846 (Sized_relobj::do_layout_deferred_sections): New function.
8847 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8848 (Relobj::layout_deferred_sections): New function.
8849 (Relobj::do_layout_deferred_sections): New function.
8850 (Sized_relobj::do_layout_deferred_sections): New function.
8851 (Sized_relobj::layout_section): New function.
8852 (Sized_relobj::Deferred_layout): New structure.
8853 (Sized_relobj::deferred_layout_): New field.
8854 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8855 Change all callers. Layout deferred sections.
8856 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8858 (Plugin_hook::run): Move code from do_plugin_hook inline.
8859 (Plugin_hook::do_plugin_hook): Remove.
8860 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8861 (Plugin_manager::finish): Renamed, was cleanup.
8862 (Plugin_manager::should_defer_layout): New function.
8863 (Plugin_manager::add_deferred_layout_object): New function.
8864 (Plugin_manager::Deferred_layout_list): New type.
8865 (Plugin_manager::deferred_layout_objects_): New field.
8866 (Plugin_hook::do_plugin_hook): Remove.
8870 * options.h (class General_options): Add --no case for
8875 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8877 (Plugin_manager::claim_file): Create plugin object even if
8878 plugin did not call the add_symbols callback.
8879 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8880 asking for more symbols than were added.
8881 * testsuite/Makefile.am (plugin_test_1): Add test case with
8883 (empty.syms): New target.
8884 * testsuite/Makefile.in: Regenerate.
8885 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8886 message. Don't call add_symbols if no globals.
8887 (all_symbols_read_hook): Don't provide replacement for empty
8892 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8893 r_type == 0 for a local symbol with r_sym == 0.
8894 (scan_relocatable_relocs): Pass r_sym to
8895 local_non_section_strategy.
8896 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8899 * configure.ac: Update test for TLS descriptors: they are
8900 supported as of glibc 2.9.
8901 * configure: Rebuild.
8906 * target-reloc.h (Default_scan_relocatable_relocs): For each
8907 function, map r_type == 0 to RELOC_DISCARD.
8911 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8912 object to override a kept COMDAT group from a plugin object.
8917 * yyscript.y (file_cmd): Handle INPUT.
8919 * testsuite/initpri1.c: Change all declarations to be full
8920 prototypes by adding void, to avoid compiler warnings.
8924 * options.cc (General_options::parse_plugin_opt): New.
8925 (General_options::add_plugin): The argument now is just the filename.
8926 (General_options::add_plugin_option): New.
8927 * options.h (plugin_opt): New.
8928 (add_plugin): Change argument name.
8929 (add_plugin_option): New.
8930 * plugin.cc (Plugin::load): Don't parse the plugin option.
8931 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8932 (Plugin::add_option): New.
8933 (Plugin::args_): Change type.
8934 (Plugin::filename_): New.
8935 (Plugin_manager::add_plugin_option): New.
8936 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8937 * testsuite/Makefile.in: Regenerate.
8941 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8942 Handle --strip-lto-sections option.
8943 * options.h (strip_lto_sections): New option.
8947 * plugin.cc (ld_plugin_message): Change format parameter to const.
8948 Fix mismatch between new[] and delete.
8952 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8957 * options.cc (General_options::parse_dynamic_list): New function.
8958 * options.h (General_options): New flags dynamic_list,
8959 dynamic_list_data, dynamic_list_cpp_new, and
8960 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8961 (General_options::in_dynamic_list): New function.
8962 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8963 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8964 (Lex::can_continue_name): Likewise.
8966 (read_script_file): New parameter script_options.
8967 (read_dynamic_list): New function.
8968 (Script_options::define_dynamic_list): New function.
8969 (dynamic_list_keyword_parsecodes): New variable.
8970 (dynamic_list_keywords): New variable.
8971 * script.h (Script_options::define_dynamic_list): New function
8973 (read_dynamic_list): New function prototype.
8974 * symtab.cc (strprefix): New macro.
8975 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8976 dynamic_list_data, dynamic_list_cpp_new, and
8977 dynamic_list_cpp_typeinfo.
8978 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8979 (dynamic_list_expr): New rule.
8980 (dynamic_list_nodes): Likewise.
8981 (dynamic_list_node): Likewise.
8982 * testsuite/Makefile.am (dynamic_list): New test.
8983 * testsuite/Makefile.in: Regenerated.
8984 * testsuite/dynamic_list.t: New file.
8985 * testsuite/dynamic_list.sh: New file.
8989 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8990 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8991 (t11_last): Likewise.
8992 * testsuite/ver_test_6.c (main): Likewise.
8996 * options.c (General_options::finalize): Add check for -static and
8998 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9003 * plugin.cc (make_sized_plugin_object): Fix conditional
9004 compilation to work when not all targets are enabled.
9008 * archive.cc (Archive::get_file_and_offset): Use filename instead
9009 of name to get library path.
9010 (Archive::include_member): Unlock external member of a thin archive.
9012 * testsuite/Makefile.am (TEST_AR): New variable.
9013 (thin_archive_test_1): New test.
9014 (thin_archive_test_2): New test.
9015 * testsuite/Makefile.in: Regenerate.
9016 * testsuite/thin_archive_main.cc: New file.
9017 * testsuite/thin_archive_test_1.cc: New file.
9018 * testsuite/thin_archive_test_2.cc: New file.
9019 * testsuite/thin_archive_test_3.cc: New file.
9020 * testsuite/thin_archive_test_4.cc: New file.
9024 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9025 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9027 (Sized_relobj::do_finalize_local_symbols): Likewise.
9028 (Sized_relobj::map_to_kept_section): Likewise.
9029 * object.h (Sized_relobj::invalid_address): New constant.
9030 (Sized_relobj::do_output_section_offset): Check for invalid_address
9032 * output.cc (Output_reloc::local_section_offset): Use constant
9033 invalid_address instead of -1U.
9034 (Output_reloc::get_address): Likewise.
9035 (Output_section::output_address): Change -1U to -1ULL.
9036 * output.h (Output_reloc::invalid_address): New constant.
9037 * reloc.cc (Sized_relobj::write_sections): Use constant
9038 invalid_address instead of -1U.
9039 (Sized_relobj::relocate_sections): Likewise.
9040 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9041 values for merge sections.
9042 * target-reloc.h (relocate_for_relocatable): Use constant
9043 invalid_address instead of -1U.
9047 Add plugin functionality for link-time optimization (LTO).
9048 * configure.ac (plugins): Add --enable-plugins option.
9049 * configure: Regenerate.
9050 * config.in: Regenerate.
9051 * Makefile.am (LIBDL): New variable.
9052 (CCFILES): Add plugin.cc.
9053 (HFILES): Add plugin.h.
9054 (ldadd_var): Add LIBDL.
9055 * Makefile.in: Regenerate.
9057 * archive.cc: Include "plugin.h".
9058 (Archive::setup): Don't preread archive symbols when using a plugin.
9059 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9060 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9062 (Archive::include_member): Add symbols from plugin objects.
9063 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9064 * descriptors.cc (Descriptors::open): Check for file descriptors
9065 abandoned by plugins.
9066 (Descriptors::claim_for_plugin): New function.
9067 * descriptors.h (Descriptors::claim_for_plugin): New function.
9068 (Open_descriptor::is_claimed): New field.
9069 (claim_descriptor_for_plugin): New function.
9070 * fileread.cc (File_read::claim_for_plugin): New function.
9071 * fileread.h (File_read::claim_for_plugin): New function.
9072 (File_read::descriptor): New function.
9073 * gold.cc: Include "plugin.h".
9074 (queue_initial_tasks): Add task to call plugin hooks for generating
9076 * main.cc: Include "plugin.h".
9077 (main): Load plugin libraries.
9078 * object.h (Pluginobj): Declare.
9079 (Object::pluginobj): New function.
9080 (Object::do_pluginobj): New function.
9081 (Object::set_target): New function.
9082 * options.cc: Include "plugin.h".
9083 (General_options::parse_plugin): New function.
9084 (General_options::General_options): Initialize plugins_ field.
9085 (General_options::add_plugin): New function.
9086 * options.h (Plugin_manager): Declare.
9087 (General_options): Add --plugin option.
9088 (General_options::has_plugins): New function.
9089 (General_options::plugins): New function.
9090 (General_options::add_plugin): New function.
9091 (General_options::plugins_): New field.
9092 * plugin.cc: New file.
9093 * plugin.h: New file.
9094 * readsyms.cc: Include "plugin.h".
9095 (Read_symbols::do_read_symbols): Check for archive before checking
9096 for ELF file. Call plugin hooks to claim files.
9097 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9098 from a real object file; force override when processing replacement
9100 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9101 (Symbol::init_base_object): Likewise.
9102 (Symbol::init_base_output_data): Likewise.
9103 (Symbol::init_base_output_segment): Likewise.
9104 (Symbol::init_base_constant): Likewise.
9105 (Symbol::init_base_undefined): Likewise.
9106 (Symbol::output_section): Assert that object is not a plugin.
9107 (Symbol_table::add_from_pluginobj): New function.
9108 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9110 (Symbol_table::sized_write_globals): Likewise.
9111 (Symbol_table::add_from_pluginobj): Instantiate template.
9112 * symtab.h (Sized_pluginobj): Declare.
9113 (Symbol::in_real_elf): New function.
9114 (Symbol::set_in_real_elf): New function.
9115 (Symbol::in_real_elf_): New field.
9116 (Symbol_table::add_from_pluginobj): New function.
9118 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9119 (LIBDL): New variable.
9121 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9122 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9123 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9124 (MOSTLYCLEANFILES): Likewise.
9125 * testsuite/Makefile.in: Regenerate.
9126 * testsuite/plugin_test.c: New file.
9127 * testsuite/plugin_test_1.sh: New file.
9128 * testsuite/plugin_test_2.sh: New file.
9132 * target-reloc.h (relocate_section): Check whether a symbol is
9133 defined by the ABI before reporting an undefined symbol error.
9134 * target.h (Target::is_defined_by_abi): Make parameter const.
9135 (Target::do_is_defined_by_abi): Likewise.
9136 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9137 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9138 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9139 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9140 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9141 * testsuite/Makefile.in: Rebuild.
9143 * fileread.cc (make_view): Add casts to avoid warning.
9147 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9148 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9152 * options.h (General_options::output_is_executable): New.
9153 (General_options::output_is_pie): New.
9154 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9155 for shared libraries.
9156 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9160 * options.h (origin): New -z option.
9161 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9162 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9167 * fileread.cc (File_read::make_view): Add check for attempt to map
9172 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9173 explicit instantiations.
9178 * options.cc (General_options::finalize): Allow undefined symbols
9179 in shlibs if linking -shared.
9182 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9183 symbols as not needing a dynsym entry.
9187 * fileread.cc (File_read::open): Do not lock the file unless it
9188 was successfully opened.
9192 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9193 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9194 * testsuite/tls_test.cc (struct int128): 128-bit struct
9195 for testing TLS relocs with non-zero addend.
9196 (v12): New TLS variable.
9198 (t_last): Add check for v12.
9199 * testsuite/tls_test.h (t12): New function.
9200 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9204 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9205 set tls_segment_ or relro_segment_.
9206 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9208 * output.h (Output_section::clear_is_relro): New function.
9209 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9210 sections specially even when output_data_ is empty.
9211 (Output_segment::maximum_alignment): When first section is relro,
9212 only force alignment for PT_LOAD segments.
9213 * script.cc (script_data_segment_align): New function.
9214 (script_data_segment_relro_end): New function.
9215 * script-c.h (script_data_segment_align): Declare.
9216 (script_data_segment_relro_end): Declare.
9217 * script-sections.h (class Script_sections): Declare
9218 data_segment_align and data_segment_relro_end. Add fields
9219 segment_align_index_ and saw_relro_end_.
9220 * script-sections.cc (class Sections_element): Add set_is_relro
9221 virtual function. Add new bool* parameter to place_orphan_here.
9222 Add get_output_section virtual function.
9223 (class Output_section_definition): Add set_is_relro. Add new
9224 bool* parameter to place_orphan_here. Add get_output_section.
9225 Add is_relro_ field.
9226 (Output_section_definition::Output_section_definition): Initialize
9227 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9228 and is_relro_ fields.
9229 (Output_section_definition::place_orphan_here): Add is_relro
9231 (Output_section_definition::set_section_addresses): Set relro for
9233 (Output_section_definition::alternate_constraint): Likewise.
9234 (class Orphan_output_section): Add new bool* parameter to
9235 place_orphan_here. Add get_output_section.
9236 (Orphan_output_section::place_orphan_here): Add is_relro
9238 (Script_sections::Script_sections): Initialize
9239 data_segment_align_index_ and saw_relro_end_.
9240 (Script_sections::data_segment_align): New function.
9241 (Script_sections::data_segment_relro_end): New function.
9242 (Script_sections::place_orphan): Set or clear is_relro.
9243 (Script_sections::set_section_addresses): Force alignment of first
9245 * yyscript.y (exp): Call script_data_segment_align and
9246 script_data_segment_relro_end.
9247 * testsuite/relro_script_test.t: New file.
9248 * testsuite/relro_test.cc (using_script): Declare.
9249 (t1, t2): Test using_script.
9250 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9251 (relro_script_test_SOURCES): Define.
9252 (relro_script_test_DEPENDENCIES): Define.
9253 (relro_script_test_LDFLAGS): Define.
9254 (relro_script_test_LDADD): Define.
9255 (relro_script_test.so): New target.
9256 * testsuite/Makefile.in: Rebuild.
9260 * archive.cc (Archive::total_archives, Archive::total_members)
9261 (Archive::total_members_loaded): New variables.
9262 (Archive::setup): Add parameter. Add option to preread
9264 (Archive::read_armap): Add counter.
9265 (Archive::get_file_and_offset): New function.
9266 (Archive::get_elf_object_for_member): New function.
9267 (Archive::read_all_symbols): New function.
9268 (Archive::read_symbols): New function.
9269 (Archive::add_symbols): Add counters.
9270 (Archive::include_all_members): Use armap to find members if it's
9272 (Archive::include_member): Skip reading symbols if already read.
9273 Factored code into Archive::get_file_and_offset and
9274 Archive::get_elf_object_for_member. Changed call to
9275 Mapfile::report_include_archive_member.
9276 (Archive::print_stats): New function.
9277 * archive.h: Declare Object and Read_symbols_data classes.
9278 (Archive::Archive): Add initializers for new members.
9279 (Archive::setup): Add parameter.
9280 (Archive::print_stats): New function.
9281 (Archive::total_archives, Archive::total_members)
9282 (Archive::total_members_loaded): New variables.
9283 (Archive::get_file_and_offset): New function.
9284 (Archive::get_elf_object_for_member): New function.
9285 (Archive::read_all_symbols): New function.
9286 (Archive::read_symbols): New function.
9287 (Archive::Archive_member): New class.
9288 (Archive::members_): New member.
9289 (Archive::num_members_): New member.
9290 * main.cc: Include archive.h.
9291 (main): Call Archive::print_stats.
9292 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9293 archive parameter; member_name is now the fully-decorated name.
9294 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9295 * options.h: (General_options): Add --preread-archive-symbols option.
9296 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9301 * symtab.h (Symbol::use_plt_offset): New function.
9302 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9303 * powerpc.cc (Relocate::relocate): Likewise.
9304 * sparc.cc (Relocate::relocate): Likewise.
9305 * x86_64.cc (Relocate::relocate): Likewise.
9306 * testsuite/weak_plt.sh: New test.
9307 * testsuite/weak_plt_main.cc: New test.
9308 * testsuite/weak_plt_shared.cc: New test.
9309 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9310 (check_PROGRAMS): Add weak_plt.
9311 (check_DATA): Add weak_plt_shared.so.
9312 (weak_plt_main_pic.o, weak_plt): New targets.
9313 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9314 * testsuite/Makefile.in: Rebuild.
9316 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9318 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9319 * testsuite/Makefile.in: Rebuild.
9323 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9324 * Makefile.in: Regenerate.
9325 * po/POTFILES.in: Regenerate.
9329 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9330 symbols before other symbols.
9331 * testsuite/script_test_2.cc (test_addr): Declare.
9332 (test_addr_alias): Declare.
9333 (main): Check that test_addr and test_addr_alias have the right
9335 * testsuite/script_test_2.t: Define test_addr_alias and
9341 * descriptors.cc: New file.
9342 * descriptors.h: New file.
9343 * gold-threads.h (class Hold_optional_lock): New class.
9344 * fileread.cc: Include "descriptors.h".
9345 (File_read::~File_read): Release descriptor rather than closing
9347 (File_read::open) [file]: Call open_descriptor rather than open.
9348 Set is_descriptor_opened_.
9349 (File_read::open) [memory]: Assert that descriptor is not open.
9350 (File_read::reopen_descriptor): New function.
9351 (File_read::release): Release descriptor.
9352 (File_read::do_read): Make non-const. Reopen descriptor.
9353 (File_read::read): Make non-const.
9354 (File_read::make_view): Reopen descriptor.
9355 (File_read::do_readv): Likewise.
9356 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9357 Update declarations.
9358 * layout.cc: Include "descriptors.h".
9359 (Layout::create_build_id): Use open_descriptor rather than open.
9360 * output.cc: Include "descriptors.h".
9361 (Output_file::open): Use open_descriptor rather than open.
9362 * archive.cc (Archive::const_iterator): Change Archive to be
9364 (Archive::begin, Archive::end): Make non-const.
9365 (Archive::count_members): Likewise.
9366 * archive.h (class Archive): Update declarations.
9367 * object.h (Object::read): Make non-const.
9368 * Makefile.am (CCFILES): Add descriptors.cc.
9369 (HFILES): Add descriptors.h.
9370 * Makefile.in: Rebuild.
9373 * gold.h: Always include <clocale>. Add Solaris workarounds
9374 following code in binutils/sysdep.h.
9377 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9378 this->eh_frame_hdr_ is NULL before using it.
9380 * dynobj.cc (Versions::Versions): Update comment.
9382 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9383 the base version name.
9385 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9386 array size plus one.
9387 (Stringpool_template::set_string_offsets): Subtract one from key
9388 before using it as an array index.
9389 (Stringpool_template::get_offset_with_length): Likewise.
9390 (Stringpool_template::write_to_buffer): Likewise.
9391 * stringpool.h (Stringpool_template::get_offset_from_key):
9397 * object.h (Merged_symbol_value::value): Do our best to handle a
9401 * script.cc (Version_script_info::get_versions): Don't add empty
9402 version tag to return value.
9403 (Version_script_info::get_symbol_version_helper): Change return
9404 type to bool. Add pversion parameter. Change all callers.
9405 (script_register_vers_node): Don't require a non-NULL tag.
9406 * script.h (class Version_script_info): Update declarations.
9407 (Version_script_info::get_symbol_version): Change return type to
9408 bool. Add version parameter. Change all callers.
9409 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9410 handling. Handle an empty version from a version script.
9411 (Symbol_table::define_special_symbol): Likewise.
9412 * testsuite/ver_test_10.script: New file.
9413 * testsuite/ver_test_10.sh: New file.
9414 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9415 (check_DATA): Add ver_test_10.syms.
9416 (ver_test_10.syms, ver_test_10.so): New target.
9417 * testsuite/Makefile.in: Rebuild.
9421 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9422 to zero for undefined symbols from dynamic libraries.
9426 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9428 * symtab.h (class Symbol_table): Update declaration.
9429 * testsuite/ver_test_9.cc: New file.
9430 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9431 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9432 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9433 (ver_test_9.so, ver_test_9.o): New targets.
9434 * testsuite/Makefile.in: Rebuild.
9438 * options.h (class General_options): Define --check-sections.
9439 * layout.cc (Layout::set_segment_offsets): Handle
9442 * options.h (class General_options): Define -n/--nmagic and
9444 * options.cc (General_options::finalize): For -n/--nmagic or
9445 -N/--omagic, set -static.
9446 * layout.cc (Layout::attach_allocated_section_to_segment): If
9447 -N/--omagic, don't put read-only and read-write sections in
9449 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9450 finding a read-only segment.
9451 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9452 don't set the minimum segment alignment to the common page size,
9453 and don't set the file offset to the address modulo the page size.
9454 * script-sections.cc (Script_sections::create_segments): If
9455 -n/--omagic, don't put read-only and read-write sections in
9458 * cref.cc: New file.
9460 * options.h (class General_options): Add --print-symbol-counts.
9461 * main.cc (main): Issue defined symbol report if requested.
9462 * archive.cc (Archive::interpret_header): Make into a const member
9464 (Archive::add_symbols): Call Input_objects::archive_start and
9466 (Archive::const_iterator): Define new class.
9467 (Archive::begin, Archive::end): New functions.
9468 (Archive::include_all_members): Rewrite to use iterator.
9469 (Archive::count_members): New function.
9470 * archive.h (class Archive): Update declarations.
9471 (Archive::filename): New function.
9472 * object.cc: Include "cref.h".
9473 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9474 (Sized_relobj::do_get_global_symbol_counts): New function.
9475 (Input_objects::add_object): Add object to cross-referencer.
9476 (Input_objects::archive_start): New function.
9477 (Input_objects::archive_stop): New function.
9478 (Input_objects::print_symbol_counts): New function.
9479 * object.h: Declare Cref and Archive.
9480 (Object::get_global_symbol_counts): New function.
9481 (Object::do_get_global_symbol_counts): New pure virtual function.
9482 (class Sized_relobj): Add defined_count_ field. Update
9484 (class Input_objects): Add cref_ field. Update constructor.
9485 Update declarations.
9486 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9488 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9490 (Sized_dynobj::do_get_global_symbol_counts): New function.
9491 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9492 defined_count_. Update declarations. Define Symbols typedef.
9493 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9494 parameter. Change all callers.
9495 (Symbol_table::add_from_dynobj): Add sympointers and defined
9496 parameters. Change all callers.
9497 * symtab.h (class Symbol_table): Update declarations.
9498 * Makefile.am (CCFILES): Add cref.cc.
9499 (HFILES): Add cref.h.
9500 * Makefile.in: Rebuild.
9504 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9505 to zero when writing undefined symbols.
9509 * output.cc (Output_section::add_input_section): Don't try to
9510 merge empty merge sections.
9514 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9515 Include symbol version in error message.
9519 * configure.ac (gold_cv_c_random_seed): New configured variable.
9520 (RANDOM_SEED_CFLAGS): New substituted variable.
9521 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9522 * configure: Rebuild.
9523 * Makefile.in: Likewise.
9524 * testsuite/Makefile.in: Likewise.
9528 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9529 where we see NAME/NULL and NAME/VERSION as separate symbols.
9530 * testsuite/ver_test_main.cc (main): Call t4.
9531 (t4, t4_2a): Define.
9532 * testsuite/ver_test_2.cc (t4_2): Define.
9533 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9534 * testsuite/ver_test_4.cc (t4_2a): Define.
9535 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9536 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9540 * dynobj.cc (Versions::add_def): If we give an error about a
9541 missing version, go ahead and create the version anyhow.
9545 Handle output sections with more than 0x7fffffff bytes.
9546 * object.h (class Relobj): Change map_to_output_ to
9547 output_sections_, and just keep a section pointer. Change all
9548 uses. Move comdat group support to Sized_relobj.
9549 (Relobj::is_section_specially_mapped): Remove.
9550 (Relobj::output_section): Remove poff parameter. Change all
9552 (Relobj::output_section_offset): New function.
9553 (Relobj::set_section_offset): Rewrite.
9554 (Relobj::map_to_output): Remove.
9555 (Relobj::output_sections): New function.
9556 (Relobj::do_output_section_offset): New pure virtual function.
9557 (Relobj::do_set_section_offset): Likewise.
9558 (class Sized_relobj): Add section_offsets_ field. Add comdat
9559 group support from Relobj. Update declarations.
9560 (Sized_relobj::get_output_section_offset): New function.
9561 (Sized_relobj::do_output_section_offset): New function.
9562 (Sized_relobj::do_set_section_offset): New function.
9563 * object.cc (Relobj::output_section_address): Remove.
9564 (Sized_relobj::Sized_relobj): Initialize new fields.
9565 (Sized_relobj::include_section_group): Cast find_kept_object to
9567 (Sized_relobj::include_linkonce_section): Likewise.
9568 (Sized_relobj::do_layout): Use separate arrays for output section
9570 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9572 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9573 output_sections and section_offsets.
9574 (Sized_relobj::write_local_symbols): Likewise.
9575 (map_to_kept_section): Compute output address directly.
9576 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9577 output_sections and section_offsets.
9578 (Sized_relobj::write_sections): Likewise.
9579 (Sized_relobj::relocate_sections): Likewise.
9580 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9581 * output.h (class Output_reloc): Update declarations. Change
9582 u2_.relobj to Sized_relobj*.
9583 (class Output_data_reloc): Change add functions to use
9585 * output.cc (Output_reloc::Output_reloc): Change relobj to
9587 (Output_reloc::local_section_offset): Change return type to
9588 Elf_Addr. Use get_output_section_offset.
9589 (Output_reloc::get_address): Likewise.
9590 (Output_section::is_input_address_mapped): Don't call
9591 is_section_specially_mapped.
9592 (Output_section::output_offset): Likewise.
9593 (Output_section::output_address): Likewise.
9594 (Output_section::starting_output_address): Likewise.
9595 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9596 parameter to Sized_relobj*.
9597 (Copy_relocs::need_copy_reloc): Likewise.
9598 (Copy_relocs::save): Likewise.
9599 * copy-relocs.h (class Copy_relocs): Update declarations.
9600 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9601 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9602 * target-reloc.h (relocate_for_relocatable): Change
9603 offset_in_output_section type to Elf_Addr. Change code that uses
9605 * layout.cc (Layout::layout): Always set *off.
9606 * mapfile.cc (Mapfile::print_input_section): Use
9607 output_section_offset.
9608 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9610 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9611 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9612 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9616 * layout.cc (Layout::include_section): Do not discard unrecognized
9617 SHT_STRTAB sections.
9621 * script.cc (Lex::can_continue_name): Make '?' allowable in
9622 version-script names.
9623 * testsuite/version_script.map: Change glob pattern to use '?'
9628 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9635 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9636 versions]: Don't try to read the value in the contents, since we
9637 don't use it. Use the template endianness when writing.
9641 * fileread.cc (File_read::make_view): Assert on zero-length view.
9642 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9643 symbol table when there are no symbols to read.
9647 * version.cc (version_string): Bump to 1.7
9651 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9652 constant 0xFFFF to type Valtype.
9653 (Powerpc_relocate_functions::rel16_ha): Likewise.
9657 * output.h (Output_section::Input_section): Initialize p2align_ to
9658 zero for Output_section_data constructors.
9659 (Output_section::Input_section::addralign): If not an input
9660 section, return the alignment of the Output_section_data.
9661 * testsuite/copy_test.cc: New file.
9662 * testsuite/copy_test_1.cc: New file.
9663 * testsuite/copy_test_2.cc: New file.
9664 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9665 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9666 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9667 (copy_test_1_pic.o, copy_test_1.so): New targets.
9668 (copy_test_2_pic.o, copy_test_2.so): New targets.
9669 * testsuite/Makefile.in: Rebuild.
9671 * script-sections.cc (Script_sections::place_orphan): Initialize
9672 local variable exact.
9676 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9681 * powerpc.cc: New file.
9682 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9683 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9684 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9685 * Makefile.in: Rebuild.
9689 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9691 (throwing, orig_terminate): New static variables.
9692 (terminate_handler): New static function.
9693 (t2): Set terminate handler.
9698 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9703 * archive.cc (Archive::include_all_members) Correct to step
9704 over symbol table and extended name table in thin archives.
9709 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9714 * reduced_debug_output.cc: New file.
9715 * reduced_debug_output.h: New file.
9716 * options.h (class General_options): Add --strip-debug-non-line.
9717 * options.cc (General_options::finalize): Add strip_debug_non_line
9718 to the strip heirarchy.
9719 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9721 * layout.cc: Include "reduced_debug_output.h".
9722 (Layout::Layout): Initialize new fields.
9723 (line_only_debug_sections): New static array.
9724 (is_lines_only_debug_sections): New static inline function.
9725 (Layout::include_section): Handle --strip-debug-non-line.
9726 (Layout::make_output_section): If --strip-debug-non-line, build
9727 new output sections for .debug_abbrev and .debug_info.
9728 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9729 gold. Warn about possible overflow.
9730 (read_signed_LEB_128): Likewise.
9731 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9732 (read_signed_LEB_128): Declare.
9733 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9734 (HFILES): Add reduced_debug_output.h.
9735 * Makefile.in: Rebuild.
9739 * mapfile.cc: New file.
9740 * mapfile.h: New file.
9741 * options.h (class General_options): Add -M/--print-map and -Map.
9742 * options.cc (General_options::finalize): Make -M equivalent to
9744 * main.cc: Include <cstdio> and "mapfile.h".
9745 (main): Open mapfile if requested.
9746 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9747 constructor. Change caller.
9748 (queue_initial_tasks): Add mapfile parameter. Change caller.
9749 (queue_middle_tasks): Likewise.
9750 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9752 * archive.cc: Include "mapfile.h".
9753 (Archive::add_symbols): Add mapfile parameter. Change all
9754 callers. Pass mapfile, symbol, and reason to include_member.
9755 (Archive::include_all_members): Add mapfile parameter. Change all
9757 (Archive::include_member): Add mapfile, sym, and why parameters.
9758 Change all callers. Report inclusion to map file.
9759 * archive.h: Include "fileread.h".
9760 (class Archive): Update declarations.
9761 (Archive::file): New const method.
9762 (class Add_archive_symbols): Add mapfile_ field. Update
9763 constructor. Change all callers.
9764 * readsyms.h (class Read_symbols): Likewise.
9765 (class Finish_group): Likewise.
9766 (class Read_script): Likewise.
9767 * common.cc: Include "mapfile.h".
9768 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9770 (Symbol_table::do_allocate_commons): Likewise.
9771 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9772 symbol allocation to mapfile.
9773 * common.h (class Allocate_commons_task): Add mapfile_ field.
9774 Update constructor. Change all callers.
9775 * symtab.h (class Symbol_table): Update declarations.
9776 * layout.cc: Include "mapfile.h".
9777 (Layout_task_runner::run): Print information to mapfile.
9778 (Layout::create_gold_note): Change Output_data_fixed_space to
9779 Output_data_zero_fill.
9780 (Layout::create_build_id): Likewise.
9781 (Layout::print_to_mapfile): New function.
9782 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9783 constructor. Change caller.
9784 (class Layout): Declare print_to_mapfile.
9785 * output.cc (Output_section::Input_section::print_to_mapfile): New
9787 (Output_section::add_input_section): If producing a map, always
9788 add to input_sections_ list.
9789 (Output_section::do_print_to_mapfile): New function.
9790 (Output_segment::print_sections_to_mapfile): New function.
9791 (Output_segment::print_section_list_to_mapfile): New function.
9792 * output.h: Include "mapfile.h".
9793 (Output_data::print_to_mapfile): New function.
9794 (Output_data::do_print_to_mapfile): New virtual function.
9795 (Output_segment_headers::do_print_to_mapfile): New function.
9796 (Output_file_header::do_print_to_mapfile): New function.
9797 (Output_data_const::do_print_to_mapfile): New function.
9798 (class Output_data_const_buffer): Add map_name_ field. Update
9799 constructor. Change all callers. Add do_print_to_mapfile
9801 (class Output_data_fixed_space): Likewise.
9802 (class Output_data_space): Likewise.
9803 (class Output_data_zero_fill): New class.
9804 (Output_data_strtab::do_print_to_mapfile): New function.
9805 (Output_data_reloc_base::do_print_to_mapfile): New function.
9806 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9807 (Output_data_group::do_print_to_mapfile): New function.
9808 (Output_data_got::do_print_to_mapfile): New function.
9809 (Output_data_dynamic::do_print_to_mapfile): New function.
9810 (Output_symtab_xindex::do_print_to_mapfile): New function.
9811 (class Output_section): Declare do_print_to_mapflie. Declare
9812 print_to_mapfile in Input_section.
9813 (class Output_segment): Declare new functions.
9814 * object.h (Sized_relobj::symbol_count): New function.
9815 * script-sections.cc
9816 (Output_section_element_dot_assignment::set_section_addresses):
9817 Change Output_data_fixed_space to Output_data_zero_fill.
9818 (Output_data_expression::do_print_to_mapfile): New function.
9819 * script.cc (read_input_script): Add mapfile parameter. Change
9821 * script.h (read_input_script): Update declaration.
9822 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9823 (Eh_frame::do_print_to_mapfile): New function.
9824 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9825 (Output_merge_string::do_print_to_mapfile): New function.
9826 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9828 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9830 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9832 * Makefile.am (CCFILES): Add mapfile.cc.
9833 (HFILES): Add mapfile.h.
9834 * Makefile.in: Rebuild.
9838 * options.h (class General_options): Add -z relro.
9839 * layout.cc (Layout::Layout): Initialize relro_segment_.
9840 (Layout::add_output_section_data): Return the output section.
9841 (Layout::make_output_section): Rcognize relro sections and mark
9843 (Layout::attach_allocated_section_to_segment): Put relro sections
9844 in a PT_GNU_RELRO segment.
9845 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9847 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9849 (Layout::linkonce_mapping): Map d.rel.ro.local to
9851 (Layout::output_section_name): Us .data.rel.ro.local for any
9852 section which begins with that.
9853 * layout.h (class Layout): Update add_output_section_data
9854 declaration. Add relro_segment_ field.
9855 * output.cc (Output_section::Output_section): Initialize is_relro_
9856 and is_relro_local_ fields.
9857 (Output_segment::add_output_section): Group relro sections.
9858 (Output_segment::is_first_section_relro): New function.
9859 (Output_segment::maximum_alignment): If there is a relro section,
9860 align the segment to the common page size.
9861 (Output_segment::set_section_addresses): Track whether we are
9862 looking at relro sections. If the last section is a relro
9863 section, align to the common page size.
9864 (Output_segment::set_section_list_addresses): Add in_relro
9865 parameter. Change all callers. Align to the page size when
9866 moving from relro to non-relro section.
9867 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9869 * output.h (class Output_section): Add is_relro_ and
9870 is_relro_local_ fields.
9871 (Output_section::is_relro): New function.
9872 (Output_section::set_is_relro): New function.
9873 (Output_section::is_relro_local): New function.
9874 (Output_section::set_is_relro_local): New function.
9875 (class Output_segment): Update declarations.
9876 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9877 * sparc.cc (Target_sparc::got_section): Likewise.
9878 * x86_64.cc (Target_x86_64::got_section): Likewise.
9879 * testsuite/relro_test_main.cc: New file.
9880 * testsuite/relro_test.cc: New file.
9881 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9882 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9883 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9884 (relro_test.so, relro_test_pic.o): New targets.
9885 * testsuite/Makefile.in: Rebuild.
9889 * output.cc (Output_segment::add_output_section): Remove front
9891 * output.h (class Output_segment): Remove
9892 add_initial_output_section and overloaded add_output_section.
9893 Update declaration of remaining add_output_section.
9894 * layout.cc (Layout::create_interp): Call add_output_section
9895 rather than add_initial_output_section.
9896 (Layout::finish_dynamic_section): Likewise.
9898 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9899 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9900 know the dynamic type.
9901 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9902 field. Initialize it in constructor.
9903 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9904 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9905 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9908 * output.cc (Output_reloc::get_address): Change return type to
9910 * output.h (class Output_reloc): Update get_address declaration.
9911 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9912 for section addresses.
9917 * gold.cc (gold_nomem): Use return value of write.
9921 * symtab.c (Symbol::init_base_output_data): Add version
9922 parameter. Change all callers.
9923 (Symbol::init_base_output_segment): Likewise.
9924 (Symbol::init_base_constant): Likewise.
9925 (Symbol::init_base_undefined): Likewise.
9926 (Sized_symbol::init_output_data): Likewise.
9927 (Sized_symbol::init_output_segment): Likewise.
9928 (Sized_symbol::init_constant): Likewise.
9929 (Sized_symbol::init_undefined): Likewise.
9930 (Symbol_table::do_define_in_output_data): If the new symbol has a
9931 version, mark it as the default.
9932 (Symbol_table::do_define_in_output_segment): Likewise.
9933 (Symbol_table::do_define_as_constant): Likewise.
9934 * symtab.h (class Symbol): Update declarations.
9935 (class Sized_symbol): Likewise.
9936 * resolve.cc (Symbol::override_version): New function.
9937 (Symbol::override_base): Call override_version.
9938 (Symbol::override_base_with_special): Likewise.
9939 * testsuite/ver_script_8.script: New file.
9940 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9941 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9942 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9943 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9948 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9950 (class General_options): Remove existing --undefined, and add
9951 --no-undefined instead. Add new --undefined as synonym for -u.
9952 * archive.cc (Archive::add_symbols): Check whether symbol was
9954 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9955 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9956 all uses. Add IS_UNDEFINED. Update declarations to split
9957 different versions of init_base. Declare init_base_undefined.
9958 (Symbol::is_defined): Handle IS_UNDEFINED.
9959 (Symbol::is_undefined): Likewise.
9960 (Symbol::is_weak_undefined): Call is_undefined.
9961 (Symbol::is_absolute): Handle IS_CONSTANT.
9962 (class Sized_symbol): Update declarations to split different
9963 versions of init. Declare init_undefined.
9964 (class Symbol_table): Declare new functions.
9965 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9967 (Symbol::init_base_output_data): Likewise.
9968 (Symbol::init_base_output_segment): Likewise.
9969 (Symbol::init_base_constant): Likewise.
9970 (Symbol::init_base_undefined): New function.
9971 (Sized_symbol::init_object): Rename from init. Change all
9973 (Sized_symbol::init_output_data): Likewise.
9974 (Sized_symbol::init_output_segment): Likewise.
9975 (Sized_symbol::init_constant): Likewise.
9976 (Sized_symbol::init_undefined): New function.
9977 (Symbol_table::add_undefined_symbols_from_command_line): New
9979 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9981 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9982 (Symbol::output_section): Likewise.
9983 (Symbol::set_output_section): Likewise.
9984 (Symbol_table::sized_finalize_symbol): Likewise.
9985 (Symbol_table::sized_write_globals): Likewise.
9986 * resolve.cc (Symbol_table::should_override): Likewise.
9987 (Symbol::override_base_with_special): Likewise.
9989 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9990 symbol, change it to have default visibility.
9991 * testsuite/protected_1.cc: New file.
9992 * testsuite/protected_2.cc: New file.
9993 * testsuite/protected_3.cc: New file.
9994 * testsuite/protected_main_1.cc: New file.
9995 * testsuite/protected_main_2.cc: New file.
9996 * testsuite/protected_main_3.cc: New file.
9997 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9998 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9999 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10000 (protected_1.so): New target.
10001 (protected_1_pic.o, protected_2_pic.o): New targets.
10002 (protected_3_pic.o): New target.
10003 (check_PROGRAMS): Add protected_2.
10004 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10005 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10006 * testsuite/Makefile.in: Rebuild.
10008 * options.h (DEFINE_var): Add set_user_set_##varname__.
10009 (DEFINE_bool_alias): New macro.
10010 (class General_options): Define -Bstatic using DEFINE_bool_alias
10011 rather than DEFINE_special. Add --undefined as an alias for -z
10013 * options.cc (General_options::parse_Bstatic): Remove.
10015 * options.h (class General_options): Add --fatal-warnings.
10016 * main.cc (main): Implement --fatal-warnings.
10017 * errors.h (Errors::warning_count): New function.
10019 * options.h (class General_options): Add -Bsymbolic-functions.
10020 * symtab.h (Symbol::is_preemptible): Check for
10021 -Bsymbolic-functions.
10025 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10026 as noVARNAME rather than no-VARNAME.
10027 (class General_options): Add option -z combreloc.
10028 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10030 (Output_reloc::sort_before) [SHT_REL]: New function.
10031 (Output_reloc::sort_before) [SHT_RELA]: New function.
10032 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10033 Sort_relocs_comparison.
10034 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10035 parameter. Change all callers.
10036 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10037 sort_relocs parameter. Change all callers.
10038 * output.cc (Output_reloc::get_address): New function, broken out
10040 (Output_reloc::write_rel): Call it.
10041 (Output_reloc::compare): New function.
10042 (Output_data_reloc_base::do_write): Optionally sort relocs.
10044 * configure.ac: If targ_extra_obj is set, link it in.
10045 * configure.tgt: Initialize all variables.
10046 (x86_64*): Set targ_extra_obj and targ_extra_size.
10047 * configure: Rebuild.
10049 * object.cc (Sized_relobj::include_section_group): Adjust section
10050 indexes read from group data. Build vector to pass to
10052 * layout.cc (Layout::layout_group): Add flags and shndxes
10053 parameters. Remove contents parameter. Change caller. Update
10054 explicit instantiations.
10055 * layout.h (class Layout): Update layout_group declaration.
10056 * output.cc (Output_data_group::Output_data_group): Add flags and
10057 input_shndxes parameters. Remove contents parameter. Change
10059 (Output_data_group::do_write): Change input_sections_ to
10061 * output.h (class Output_data_group): Update constructor
10062 declaration. Rename input_sections_ to input_shndxes_.
10063 * testsuite/many_sections_test.cc: Add template.
10067 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10069 * layout.cc (Layout::include_section): Refactored check for debug
10071 (Layout::add_comdat): Add new parameters. Change type
10072 of signature parameter. Add object and shndx to signatures table.
10073 (Layout::find_kept_object): New function.
10074 * layout.h: Include <cstring>.
10075 (Layout::is_debug_info_section): New function.
10076 (Layout::add_comdat): Add new parameters.
10077 (Layout::find_kept_object): New function.
10078 (Layout::Kept_section): New struct.
10079 (Layout::Signatures): Change type of map range.
10080 * object.cc (Relobj::output_section_address): New function.
10081 (Sized_relobj::include_section_group): Add new parameters. Change
10082 calls to Layout::add_comdat. Change to build table of kept comdat
10083 groups and table mapping discarded sections to kept sections.
10084 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10085 (Sized_relobj::do_layout): Change calls to include_section_group and
10086 include_linkonce_section.
10087 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10088 value to zero when section is discarded.
10089 (Sized_relobj::map_to_kept_section): New function.
10090 * object.h (Relobj::output_section_address): New function.
10091 (Relobj::Comdat_group): New type.
10092 (Relobj::find_comdat_group): New function.
10093 (Relobj::Comdat_group_table): New type.
10094 (Relobj::Kept_comdat_section): New type.
10095 (Relobj::Kept_comdat_section_table): New type.
10096 (Relobj::add_comdat_group): New function.
10097 (Relobj::set_kept_comdat_section): New function.
10098 (Relobj::get_kept_comdat_section): New function.
10099 (Relobj::comdat_groups_): New field.
10100 (Relobj::kept_comdat_sections_): New field.
10101 (Symbol_value::input_value): Update comment.
10102 (Sized_relobj::map_to_kept_section) New function.
10103 (Sized_relobj::include_linkonce_section): Add new parameter.
10104 * target-reloc.h (Comdat_behavior): New type.
10105 (get_comdat_behavior): New function.
10106 (relocate_section): Add code to map a discarded section to the
10107 corresponding kept section when applying a relocation.
10111 * dwarf_reader.cc (next_generation_count): New static var.
10112 (Addr2line_cache_entry): New struct.
10113 (addr2line_cache): New static var.
10114 (Dwarf_line_info::one_addr2line): Added caching.
10115 (Dwarf_line_info::clear_addr2line_cache): New function.
10116 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10117 cache-size parameter.
10118 (Dwarf_line_info::one_addr2line_cache): New function.
10119 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10120 new cache-size argument to one_addr2line(), and clear cache.
10124 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10125 R_386_PC8 relocations.
10129 * object.cc (Sized_relobj::include_section_group): Check for
10130 invalid section group.
10132 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10135 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10136 than read for file header.
10137 * archive.cc (Archive::include_member): Likewise.
10141 * aclocal.m4: Regenerate.
10142 * configure: Regenerate.
10146 * version.cc (version_string): Bump to 1.6.
10148 * testsuite/Makefile.am (many_sections_r_test): New target.
10149 (many_sections_r_test_SOURCES): Remove.
10150 (many_sections_r_test_DEPENDENCIES): Remove.
10151 (many_sections_r_test_LDFLAGS): Remove.
10152 (many_sections_r_test_LDADD): Remove.
10154 * object.cc (Sized_relobj::do_add_symbols): Always pass
10155 local_symbol_count_ to add_from_relobj.
10157 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10158 every thousand variables.
10159 * testsuite/Makefile.in: Rebuild.
10161 * object.cc (Xindex::initialize_symtab_xindex): New function.
10162 (Xindex::read_symtab_xindex): New function.
10163 (Xindex::sym_xindex_to_shndx): New function.
10164 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10166 (Sized_relobj::do_initialize_xindex): New function.
10167 (Sized_relobj::do_read_symbols): Adjust section links.
10168 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10169 parameter. Change all callers.
10170 (Sized_relobj::include_section_group): Adjust section links and
10171 symbol section indexes.
10172 (Sized_relobj::do_layout): Adjust section links.
10173 (Sized_relobj::do_count_local_symbols): Adjust section links and
10174 symbol section indexes.
10175 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10176 ordinary and special symbols.
10177 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10178 dynsym_xindex parameters. Change all callers. Adjust section
10179 links. Use SHN_XINDEX when needed.
10180 (Sized_relobj::get_symbol_location_info): Adjust section links.
10181 Don't get fooled by special symbols.
10182 * object.h (class Xindex): Define.
10183 (class Object): Add xindex_ parameter. Declare virtual functoin
10184 do_initialize_xindex.
10185 (Object::adjust_sym_shndx): New function.
10186 (Object::set_xindex): New protected function.
10187 (class Symbol_value): Add is_ordinary_shndx_ field.
10188 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10189 (Symbol_value::value): Assert ordinary section.
10190 (Symbol_value::initialize_input_to_output_map): Likewise.
10191 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10192 Change all callers.
10193 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10195 (class Sized_relobj): Update declarations.
10196 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10197 parameter. Change all callers.
10198 (Sized_relobj::adjust_shndx): New function.
10199 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10201 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10202 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10203 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10204 (Sized_dynobj::read_dynsym_section): Adjust section links.
10205 (Sized_dynobj::read_dynamic): Likewise.
10206 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10208 (Sized_dynobj::do_initialize_xindex): New function.
10209 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10210 do_initialize_xindex.
10211 (Sized_dynobj::adjust_shndx): New function.
10212 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10213 dynsym_xindex_ fields.
10214 (Layout::finalize): Add a call to set_section_indexes before
10215 creating the symtab sections.
10216 (Layout::set_section_indexes): Don't do anything if the section
10217 already has a section index.
10218 (Layout::create_symtab_sections): Add shnum parameter. Change
10219 caller. Create .symtab_shndx section if needed.
10220 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10222 (Layout::allocated_output_section_count): New function.
10223 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10225 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10226 fields. Update declarations.
10227 (Layout::symtab_xindex): New function.
10228 (Layout::dynsym_xindex): New function.
10229 (class Write_symbols_task): Add layout_ field.
10230 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10232 * output.cc (Output_section_headers::Output_section_headers): Add
10233 shstrtab_section parameter. Change all callers.
10234 (Output_section_headers::do_sized_write): Store overflow values
10235 for section count and section string table section index in
10236 section header zero.
10237 (Output_file_header::do_sized_write): Check for overflow of
10238 section count and section string table section index.
10239 (Output_symtab_xindex::do_write): New function.
10240 (Output_symtab_xindex::endian_do_write): New function.
10241 * output.h (class Output_section_headers): Add shstrtab_section_.
10242 Update declarations.
10243 (class Output_symtab_xindex): Define.
10244 (Output_section::has_out_shndx): New function.
10245 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10247 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10248 Change all callers.
10249 (Sized_symbol::init): Likewise.
10250 (Symbol::output_section): Check for ordinary symbol.
10251 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10252 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10254 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10255 Change all callers. Simplify handling of symbols from sections
10256 not included in the link.
10257 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10259 (Weak_alias_sorter::operator()): Assert that symbols are
10261 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10263 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10264 parameters. Change all callers.
10265 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10266 symbol distinction. Use SHN_XINDEX when needed.
10267 (Symbol_table::write_section_symbol): Add symtab_xindex
10268 parameter. Change all callers.
10269 (Symbol_table::sized_write_section_symbol): Likewise. Use
10270 SHN_XINDEX when needed.
10271 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10273 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10274 (Symbol::is_defined): Check is_ordinary.
10275 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10276 (Symbol::is_absolute, Symbol::is_common): Likewise.
10277 (class Sized_symbol): Update declarations.
10278 (class Symbol_table): Update declarations.
10279 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10280 parameters. Change all callers.
10281 (Sized_symbol::override): Likewise.
10282 (Symbol_table::override): Likewise.
10283 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10284 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10285 is_ordinary, and orig_st_shndx parameters. Change all callers.
10286 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10287 to be in an ordinary section.
10288 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10289 object and is_ordinary parameters. Change all callers.
10290 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10291 Change all callers. Don't add undefined or non-ordinary symbols
10293 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10294 Change all callers.
10295 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10297 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10298 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10299 (Sized_relobj::relocate_sections): Likewise.
10300 * target-reloc.h (scan_relocs): Adjust section symbol index.
10301 (scan_relocatable_relocs): Likewise.
10302 * i386.cc (Scan::local): Check for ordinary symbols.
10303 * sparc.cc (Scan::local): Likewise.
10304 * x86_64.cc (Scan::local): Likewise.
10305 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10306 to symbol_section_and_value.
10307 * testsuite/many_sections_test.cc: New file.
10308 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10309 (check_PROGRAMS): Add many_sections_test.
10310 (many_sections_test_SOURCES): Define.
10311 (many_sections_test_DEPENDENCIES): Define.
10312 (many_sections_test_LDFLAGS): Define.
10313 (BUILT_SOURCES): Add many_sections_define.h.
10314 (many_sections_define.h): New target.
10315 (BUILT_SOURCES): Add many_sections_check.h.
10316 (many_sections_check.h): New target.
10317 (check_PROGRAMS): Add many_sections_r_test.
10318 (many_sections_r_test_SOURCES): Define.
10319 (many_sections_r_test_DEPENDENCIES): Define.
10320 (many_sections_r_test_LDFLAGS): Define.
10321 (many_sections_r_test_LDADD): Define.
10322 (many_sections_r_test.o): New target.
10323 * testsuite/Makefile.in: Rebuild.
10327 * errors.cc (Errors::info): New function.
10328 (gold_info): New function.
10329 * errors.h (Errors::info): New function.
10330 * gold.h (gold_info): New function.
10331 * object.cc (Input_objects::add_object): Print trace output.
10332 * options.cc (options::parse_set): New function.
10333 (General_options::parse_wrap): Deleted.
10334 (General_options::General_options): Deleted initializer.
10335 * options.h (options::String_set): New typedef.
10336 (options::parse_set): New function.
10337 (DEFINE_set): New macro.
10338 (General_options::wrap): Changed to use DEFINE_set. Changed
10339 callers of any_wrap_symbols and is_wrap_symbol.
10340 (General_options::trace, General_options::trace_symbol):
10342 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10343 (General_options::wrap_symbols_): Deleted.
10344 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10348 * options.cc (General_options::parse_V): New function.
10349 * options.h: Add entries for -V and -Qy.
10353 * common.cc (Symbol_table::allocate_commons): Remove options
10354 parameter. Change caller.
10355 (Symbol_table::do_allocate_commons): Remove options parameter.
10356 Change caller. Just call do_allocate_commons_list twice.
10357 (Symbol_table::do_allocate_commons_list): New function, broken out
10358 of do_allocate_commons.
10359 * common.h (class Allocate_commons_task): Remove options_ field.
10360 Update constructor.
10361 * symtab.cc (Symbol_table::Symbol_table): Initialize
10363 (Symbol_table::add_from_object): Put TLS common symbols on
10365 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10366 which are IN_OUTPUT_DATA.
10367 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10368 allocate_commons and do_allocate_commons declarations. Declare
10369 do_allocate_commons_list.
10370 * gold.cc (queue_middle_tasks): Update creation of
10371 Allocate_commons_task to not pass options.
10372 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10373 (TLS_TEST_C_FLAGS): New variable.
10374 (tls_test_c_pic.o): New target.
10375 (tls_test_shared.so): Link in tls_test_c_pic.o.
10376 (tls_test_c_pic_ie.o): New target.
10377 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10378 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10379 (tls_test_c.o): New target.
10380 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10381 (tls_pic_test_LDADD): Likewise.
10382 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10383 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10384 (tls_test_c_gnu2.o): New target.
10385 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10387 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10388 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10389 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10390 * testsuite/tls_test.cc: Include "config.h".
10391 (t_last): Call t11_last.
10392 * testsuite/tls_test.h (t11, t11_last): Declare.
10393 * testsuite/tls_test_c.c: New file.
10394 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10395 * configure.ac: Check for OpenMP support.
10396 * configure, config.in, Makefile.in: Rebuild.
10397 * testsuite/Makefile.in: Rebuild.
10401 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10402 (Target_i386::tls_base_symbol_defined_): New field.
10403 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10404 (Target_i386::Scan::global): Likewise.
10405 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10406 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10407 (Target_x86_64::tls_base_symbol_defined_): New field.
10408 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10409 (Target_x86_64::Scan::global): Likewise.
10413 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10414 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10415 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10416 building shared libraries.
10417 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10418 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10419 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10420 * testsuite/Makefile.in: Rebuild.
10421 * testsuite/weak_undef.h: New file.
10422 * testsuite/weak_undef_file1.cc: Add extra test cases.
10423 * testsuite/weak_undef_file2.cc: Likewise.
10424 * testsuite/weak_undef_test.cc: Likewise.
10428 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10429 Add issued_non_pic_error_ field. Declare check_non_pic.
10430 (Target_sparc::Scan::check_non_pic): New function.
10431 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10432 (Target_sparc::Scan::global): Likewise.
10434 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10435 * configure: Rebuild.
10437 * options.h (DEFINE_enable): New macro.
10438 (new_dtags): New enable option.
10439 (initfirst, interpose, loadfltr, nodefaultlib,
10440 nodelete, nodlopen, nodump): New -z options.
10441 * layout.cc (Layout:finish_dynamic_section): If new
10442 dtags enabled, emit DT_RUNPATH. Also, emit a
10443 DT_FLAGS_1 containing any specified -z flags.
10447 * copy-relocs.cc: New file.
10448 * copy-relocs.h: New file.
10449 * reloc.cc: Remove Copy_relocs code.
10450 * reloc.h: Likewise.
10451 * reloc-types.h (struct Reloc_types) [both versions]: Add
10452 get_reloc_addend_noerror.
10453 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10454 variants of add_global which take an addend which must be zero.
10455 * i386.cc: Include "copy-relocs.h".
10456 (class Target_i386): Change type of copy_relocs_ to variable,
10457 update initializer.
10458 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10459 Change all callers.
10460 (Target_i386::do_finalize_sections): Change handling of
10462 * sparc.cc: Include "copy-relocs.h".
10463 (class Target_sparc): Change type of copy_relocs_ to variable,
10464 update initializer.
10465 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10466 Change all callers.
10467 (Target_sparc::do_finalize_sections): Change handling of
10469 * x86_64.cc: Include "copy-relocs.h".
10470 (class Target_x86_64): Change type of copy_relocs_ to variable,
10471 update initializer.
10472 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10473 class. Change all callers.
10474 (Target_x86_64::do_finalize_sections): Change handling of
10476 * Makefile.am (CCFILES): Add copy-relocs.cc.
10477 (HFILES): Add copy-relocs.h.
10479 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10481 * testsuite/script_test_4.sh: Permit leading zeroes.
10485 * script-sections.cc (Script_sections::create_segments): Use
10486 header_size_adjustment even when there is enough room for the
10488 * testsuite/script_test_4.sh: New file.
10489 * testsuite/script_test_4.t: New file.
10490 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10491 (check_DATA): Add script_test_4.stdout.
10492 (MOSTLYCLEANFILES): Likewise.
10493 (script_test_4): New target.
10494 (script_test_4.stdout): New target.
10495 * testsuite/Makefile.in: Rebuild.
10497 * sparc.cc: Add definitions for Output_data_plt_sparc class
10502 * sparc.cc: New file.
10503 * Makefile.am (TARGETSOURCES): Add sparc.cc
10504 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10505 * configure.tgt: Document targ_extra_size and
10506 targ_extra_big_endian. Add entries for sparc-* and
10508 * configure.ac: Handle targ_extra_size and
10509 targ_extra_big_endian.
10510 * Makefile.in: Rebuild.
10511 * configure: Likewise.
10512 * po/POTFILES.in: Likewise.
10513 * po/gold.pot: Likewise.
10517 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10518 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10519 in the name/type/flags to section mapping. Don't call
10520 allocate_output_section.
10521 (Layout::choose_output_section): Change parameter from adjust_name
10522 to is_input_section. Don't permit input sections after sections
10523 are attached to segments. Don't call allocate_output_section.
10524 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10525 not write_enable_output_section.
10526 (Layout::make_output_section): Don't push to
10527 unattached_section_list_ nor call attach_to_segment. Call
10528 attach_section_to_segment if sections are attached.
10529 (Layout::attach_sections_to_segments): New function.
10530 (Layout::attach_section_to_segment): New function.
10531 (Layout::attach_allocated_section_to_segment): Rename from
10532 attach_to_segment. Remove flags parameter.
10533 (Layout::allocate_output_section): Remove function.
10534 (Layout::write_enable_output_section): Remove function.
10535 * layout.h (class Layout): Update for above changes. Add new
10536 field sections_are_attached_.
10537 * output.h (Output_section::update_flags_for_input_section): New
10539 * output.cc (Output_section::add_input_section): Call
10540 update_flags_for_input_section.
10541 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10545 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10546 thought unnecessary.
10547 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10551 * output.h (class Output_section_data): Remove inline definition
10553 * output.cc (Output_section_data::set_addralign): New function.
10557 Add support for TLS descriptors for i386 and x86_64.
10558 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10559 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10560 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10562 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10563 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10564 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10566 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10567 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10568 Fix problem with initial-exec relocations.
10569 (Target_i386::Relocate::relocate_tls): Likewise.
10570 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10572 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10573 support for section-plus-offset dynamic table entries.
10574 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10575 (Output_data_dynamic::Dynamic_entry): Add support for
10576 section-plus-offset dynamic table entries.
10577 (Output_data_dynamic::Classification): Likewise.
10578 (Output_data_dynamic::classification_): Renamed offset_.
10579 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10580 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10581 (Target_x86_64::make_plt_section): New function.
10582 (Target_x86_64::reserve_tlsdesc_entries): New function.
10583 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10584 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10585 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10586 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10587 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10588 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10589 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10590 add extra PLT entry for TLS descriptors.
10591 (Output_data_plt_x86_64::got_): New field.
10592 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10593 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10595 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10597 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10598 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10599 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10600 R_386_TLS_DESC_CALL relocations.
10601 (Target_x86_64::Scan::global): Likewise.
10602 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10603 for TLS descriptors.
10604 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10605 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10606 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10607 GD-to-IE relaxation.
10608 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10609 and TLS_DESCRIPTORS.
10610 * Makefile.in: Rebuild.
10611 * configure: Rebuild.
10612 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10613 (tls_test_shared2.so): New target.
10614 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10615 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10616 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10617 (tls_shared_gd_to_ie_test_LDADD): New variable.
10618 (tls_shared_gnu2_gd_to_ie_test): New target.
10619 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10621 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10622 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10623 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10624 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10625 (tls_shared_gnu2_test): New target.
10626 (tls_test_gnu2_shared.so): New target.
10627 (tls_shared_gnu2_test_SOURCES): New variable.
10628 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10629 (tls_shared_gnu2_test_LDFLAGS): New variable.
10630 (tls_shared_gnu2_test_LDADD): New variable.
10631 * testsuite/Makefile.in: Rebuild.
10632 * testsuite/Makefile.
10636 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10638 * testsuite/Makefile.in: Rebuild.
10640 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10642 * testsuite/script_test_2.cc (main): Adjust test.
10647 * options.h (General_options): Add entries for '-Y' and
10649 * options.cc (General_options:finalize): If -Y was used, add those
10650 entries to the library path instead of the default "/lib" and
10655 * testsuite/justsyms.t: Start at 0x100.
10656 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10657 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10659 * testsuite/script_test_2.cc: Adjust string and section length
10665 * script-sections.cc (Sections_element::allocate_to_segment): Add
10667 (Output_section_definition::allocate_to_segment): Likewise.
10668 (Orphan_output_section::allocate_to_segment): Likewise.
10669 (Script_sections::attach_sections_using_phdrs_clause): Don't
10670 propagate non-PT_LOAD segments to orphan sections.
10671 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10672 readelf rather than objdump.
10673 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10674 .interp section and PT_INTERP segment are the same size.
10675 * testsuite/Makefile.in: Rebuild.
10677 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10678 aliases for symbols defined in the same object.
10679 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10680 (weak_alias_test_SOURCES): New variable.
10681 (weak_alias_test_DEPENDENCIES): New variable.
10682 (weak_alias_test_LDFLAGS): New variable.
10683 (weak_alias_test_LDADD): New variable.
10684 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10685 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10686 (weak_alias_test_3.o): New target.
10687 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10688 * testsuite/weak_alias_test_main.cc: New file.
10689 * testsuite/weak_alias_test_1.cc: New file.
10690 * testsuite/weak_alias_test_2.cc: New file.
10691 * testsuite/weak_alias_test_3.cc: New file.
10695 * options.h (class General_options): Add --noinhibit-exec option.
10696 * main.cc (main): Check --noinhibit-exec.
10698 * options.h (class General_options): Define --wrap as a special
10699 option. Add wrap_symbols_ field.
10700 (General_options::any_wrap_symbols): New function.
10701 (General_options::is_wrap_symbol): New function.
10702 * options.cc (General_options::parse_wrap): New function.
10703 (General_options::General_options): Initialize wrap_symbols_.
10704 * symtab.cc (Symbol_table::wrap_symbol): New function.
10705 (Symbol_table::add_from_object): Handle --wrap.
10706 * symtab.h (class Symbol_table): Declare wrap_symbol.
10707 * target.h (Target::wrap_char): New function.
10708 (Target::Target_info): Add wrap_char field.
10709 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10710 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10711 * testsuite/testfile.cc (Target_test::test_target_info):
10714 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10717 * layout.h (class Layout): Add added_eh_frame_data_ field.
10718 * layout.cc (Layout::Layout): Initialize new field.
10719 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10720 output section until we find a section we merged successfully.
10721 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10722 that the size be non-zero.
10724 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10729 * configure.ac: Export new conditional variable HAVE_ZLIB.
10730 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10732 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10733 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10737 * version.cc (version_string): Set to "1.5".
10739 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10740 Add issued_non_pic_error_ field. Declare check_non_pic.
10741 (Target_x86_64::Scan::check_non_pic): New function.
10742 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10743 (Target_x86_64::Scan::global): Likewise.
10745 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10746 addend parameter. Change caller. Handle merge sections.
10747 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10748 Address to Addend. Don't add in the result of
10749 local_section_offset, pass down the addend and use the returned
10751 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10752 Update declarations of local_section_offset and symbol_value.
10753 * testsuite/two_file_test_1.cc (t18): New function.
10754 * testsuite/two_file_test_2.cc (f18): New function.
10755 * testsuite/two_file_test_main.cc (main): Call t18.
10756 * testsuite/two_file_test.h (t18, f18): Declare.
10758 * configure.ac: Don't test for objdump, c++filt, or readelf.
10759 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10761 (TEST_READELF): New variable.
10762 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10763 (check_PROGRAMS): Add two_file_strip_test.
10764 (two_file_strip_test): New target.
10765 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10766 (two_file_same_shared_strip_test_SOURCES): New variable.
10767 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10768 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10769 (two_file_same_shared_strip_test_LDADD): New variable.
10770 (two_file_shared_strip.so): New target.
10771 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10772 (ver_test_5.syms, ver_test_7.syms): Likewise.
10773 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10774 (strip_test_3.stdout): Use TEST_OBJDUMP.
10775 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10779 * symtab.h (Symbol::is_weak_undefined): New function.
10780 (Symbol::is_strong_undefined): New function.
10781 (Symbol::is_absolute): New function.
10782 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10783 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10785 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10786 (weak_undef_test): New target.
10787 * testsuite/Makefile.in: Rebuild.
10788 * testsuite/weak_undef_file1.cc: New file.
10789 * testsuite/weak_undef_file2.cc: New file.
10790 * testsuite/weak_undef_test.cc: New file.
10794 * compressed_output.h (class Output_compressed_section): Use
10796 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10798 (zlib_compressed_suffix): Removed.
10799 (Output_compressed_section::set_final_data_size): Use unsigned
10801 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10802 Fix linker invocation.
10803 (flagstest_o_specialfile_and_compress_debug_sections):
10805 * testsuite/Makefile.in: Regenerated.
10809 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10810 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10818 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10819 parameters. Update for new key type to views_. Change all
10821 (File_read::read): Adjust for byteshift in returned view.
10822 (File_read::add_view): New function, broken out of
10823 find_and_make_view.
10824 (File_read::make_view): New function, broken out of
10825 find_and_make_view.
10826 (File_read::find_or_make_view): Add offset and aligned
10827 parameters. Rewrite accordingly. Change all callers.
10828 (File_read::get_view): Add offset and aligned parameters. Adjust
10829 for byteshift in return value.
10830 (File_read::get_lasting_view): Likewise.
10831 * fileread.h (class File_read): Update declarations.
10832 (class File_read::View): Add byteshift_ field. Add byteshift to
10833 constructor. Add byteshift method.
10834 * archive.h (Archive::clear_uncached_views): New function.
10835 (Archive::get_view): Add aligned parameter. Change all callers.
10836 * object.h (Object::get_view): Add aligned parameter. Change all
10838 (Object::get_lasting_view): Likewise.
10840 * fileread.cc (File_read::release): Don't call clear_views if
10841 there are multiple objects.
10842 * fileread.h (File_read::clear_uncached_views): New function.
10843 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10848 Add thin archive support.
10849 * archive.cc (Archive::armagt): New const.
10850 (Archive::setup): Remove task parameter and calls to unlock.
10851 (Archive::unlock_nested_archives): New function.
10852 (Archive::read_header): Add nested_off parameter. Change
10854 (Archive::interpret_header): Likewise.
10855 (Archive::include_all_members): Change to handle thin
10857 (Archive::include_member): Likewise.
10858 * archive.h (Archive::Archive): Add new parameters and
10860 (Archive::armagt): New const.
10861 (Archive::setup): Remove task parameter.
10862 (Archive::unlock_nested_archives): New function.
10863 (Archive::read_header): Add nested_off parameter.
10864 (Archive::interpret_header): Likewise.
10865 (Archive::Nested_archive_table): New typedef.
10866 (Archive::is_thin_archive_): New field.
10867 (Archive::nested_archives_): New field.
10868 (Archive::options_): New field.
10869 (Archive::dirpath_): New field.
10870 (Archive::task_): New field.
10871 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10872 for thin archives. Pass additional parameters to
10873 Archive::Archive. Unlock the archive file after calling
10878 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10879 version symbol to be local.
10880 * testsuite/ver_test_4.sh: New file.
10881 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10882 (check_DATA): Add ver_test_4.syms.
10883 (ver_test_4.syms): New target.
10884 * testsuite/Makefile.in: Rebuild.
10887 (Output_section::Input_section_sort_entry::has_priority): New
10889 (Output_section::Input_section_sort_entry::match_file_name): New
10891 (Output_section::Input_section_sort_entry::match_section_name):
10893 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10895 (Output_section::Input_section_sort_entry::match_section_file):
10897 (Output_section::Input_section_sort_compare::operator()): Rewrite
10898 using new Input_section_sort_entry functions. Sort crtbegin and
10899 crtend first. Sort sections with no priority before sections with
10901 * testsuite/initpri1.c (d3): Check j != 4.
10902 (cd5): New constructor/destructor function.
10903 (main): Check j != 2.
10905 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10906 new symbol when resolving, don't call set_is_default.
10907 * testsuite/ver_test_7.cc: New file.
10908 * testsuite/ver_test_7.sh: New file.
10909 * testsuite/Makefile.am (ver_test_7.so): New target.
10910 (ver_test_7.o): New target.
10911 (check_SCRIPTS): Add ver_test_7.sh.
10912 (check_DATA): Add ver_test_7.syms.
10913 (ver_test_7.syms): New target.
10917 * layout.cc (Layout::layout): If we see an input section with a
10918 name that needs sorting, set the must_sort flag for the output
10920 (Layout::make_output_section): If the name of the output section
10921 indicates that it might require sorting, set the may_sort flag.
10922 * output.h (Output_section::may_sort_attached_input_sections): New
10924 (Output_section::set_may_sort_attached_input_sections): New
10926 (Output_section::must_sort_attached_input_sections): New
10928 (Output_section::set_must_sort_attached_input_sections): New
10930 (class Output_section): Declare Input_section_sort_entry. Define
10931 Input_section_sort_compare. Declare
10932 sort_attached_input_sections. Add new fields:
10933 may_sort_attached_input_sections_,
10934 must_sort_attached_input_sections_,
10935 attached_input_sections_are_sorted_.
10936 * output.cc (Output_section::Output_section): Initialize new
10938 (Output_section::add_input_section): Add an entry to
10939 input_sections_ if may_sort or must_sort are true.
10940 (Output_section::set_final_data_size): Call
10941 sort_attached_input_sections if necessary.
10942 (Output_section::Input_section_sort_entry): Define new class.
10943 (Output_section::Input_section_sort_compare::operator()): New
10945 (Output_section::sort_attached_input_sections): New function.
10946 * configure.ac: Check whether the compiler supports constructor
10947 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10948 * testsuite/initpri1.c: New file.
10949 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10950 CONSTRUCTOR_PRIORITY.
10951 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10952 (initpri1_LDFLAGS): New variable.
10953 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10957 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10958 * testsuite/common_test_1.c: New file.
10959 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10960 (common_test_1_SOURCES): New variable.
10961 (common_test_1_DEPENDENCIES): New variable.
10962 (common_test_1_LDFLAGS): New variable.
10964 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10965 and commons_ correctly when NAME/VERSION does not override
10967 * testsuite/ver_test_6.c: New file.
10968 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10969 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10970 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10974 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10975 of an undefined symbol from a version script.
10976 * testsuite/Makefile.am (ver_test_5.so): New target.
10977 (ver_test_5.o): New target.
10978 (check_SCRIPTS): Add ver_test_5.sh.
10979 (check_DATA): Add ver_test_5.syms.
10980 (ver_test_5.syms): New target.
10981 * testsuite/ver_test_5.cc: New file.
10982 * testsuite/ver_test_5.script: New file.
10983 * testsuite/ver_test_5.sh: New file.
10984 * Makefile.in, testsuite/Makefile.in: Rebuild.
10987 Fix problems building gold with gcc 4.3.0.
10988 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10989 (gold_error_at_location, gold_warning_at_location): Use it.
10990 * configure.ac: Check whether we can compile and use a template
10991 function with a printf attribute.
10992 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10993 when jumping over bytes.
10994 * object.cc: Instantiate Object::read_section_data.
10995 * debug.h: Include <cstring>
10996 * dwarf_reader.cc: Include <algorithm>
10997 * main.cc: Include <cstring>.
10998 * options.cc: Include <cstring>.
10999 * output.cc: Include <cstring>.
11000 * script.cc: Include <cstring>.
11001 * script.h: Include <string>.
11002 * symtab.cc: Include <cstring> and <algorithm>.
11003 * target-select.cc: Include <cstring>.
11004 * version.cc: Include <string>.
11005 * testsuite/testmain.cc: Include <cstdlib>.
11006 * configure, config.in: Rebuild.
11010 * options.cc: Include "../bfd/bfdver.h".
11011 (options::help): Print bug reporting address.
11013 * version.cc (print_version): Adjust output for current value of
11014 BFD_VERSION_STRING.
11018 * options.cc (options::help): Print list of supported targets.
11019 * target-select.h: Include <vector>.
11020 (class Target_selector): Make machine_, size_, and is_big_endian_
11021 fields const. Add bfd_name_ and instantiated_target_ fields.
11022 (Target_selector::Target_selector): Add bfd_name parameter.
11023 (Target_selector::recognize): Make non-virtual, call
11025 (Target_selector::recognize_by_name): Make non-virtual, call
11026 do_recognize_by_name.
11027 (Target_selector::supported_names): New function.
11028 (Target_selector::bfd_name): New function.
11029 (Target_selector::do_instantiate_target): New pure virtual
11031 (Target_selector::do_recognize): New virtual function.
11032 (Target_selector::do_recognize_by_name): New virtual function.
11033 (Target_selector::instantiate_target): New private function.
11034 (supported_target_names): Declare.
11035 * target-select.cc (Target_selector::Target_selector): Update for
11036 new parameter and fields.
11037 (select_target_by_name): Check that the name matches before
11038 calling recognize_by_name.
11039 (supported_target_names): New function.
11040 * i386.cc (class Target_selector_i386): Update Target_selector
11041 constructor call. Remove recognize and recognize_by_name. Add
11042 do_instantiate_target.
11043 * x86_64.cc (class Target_selector_x86_64): Likewise.
11044 * testsuite/testfile.cc (class Target_selector_test): Update for
11045 changes to Target_selector.
11047 * README: Rewrite, with some notes on unsupported features.
11051 * i386.cc (Target_i386::Got_type): New enum declaration.
11052 (Target_i386::Scan::local): Updated callers of Output_data_got
11054 (Target_i386::Scan::global): Likewise.
11055 (Target_i386::Relocate::relocate): Likewise.
11056 (Target_i386::Relocate::relocate_tls): Likewise.
11057 * object.h (Got_offset_list): New class.
11058 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11059 (Sized_relobj::local_got_offset): Likewise.
11060 (Sized_relobj::set_local_got_offset): Likewise.
11061 (Sized_relobj::local_has_tls_got_offset): Removed.
11062 (Sized_relobj::local_tls_got_offset): Removed.
11063 (Sized_relobj::set_local_tls_got_offset): Removed.
11064 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11065 * output.cc (Output_data_got::add_global): Added got_type parameter.
11066 (Output_data_got::add_global_with_rel): Likewise.
11067 (Output_data_got::add_global_with_rela): Likewise.
11068 (Output_data_got::add_global_pair_with_rel): New function.
11069 (Output_data_got::add_global_pair_with_rela): New function.
11070 (Output_data_got::add_local): Added got_type parameter.
11071 (Output_data_got::add_local_with_rel): Likewise.
11072 (Output_data_got::add_local_with_rela): Likewise.
11073 (Output_data_got::add_local_pair_with_rel): New function.
11074 (Output_data_got::add_local_pair_with_rela): New function.
11075 (Output_data_got::add_global_tls): Removed.
11076 (Output_data_got::add_global_tls_with_rel): Removed.
11077 (Output_data_got::add_global_tls_with_rela): Removed.
11078 (Output_data_got::add_local_tls): Removed.
11079 (Output_data_got::add_local_tls_with_rel): Removed.
11080 (Output_data_got::add_local_tls_with_rela): Removed.
11081 * output.h (Output_data_got::add_global): Added got_type parameter.
11082 (Output_data_got::add_global_with_rel): Likewise.
11083 (Output_data_got::add_global_with_rela): Likewise.
11084 (Output_data_got::add_global_pair_with_rel): New function.
11085 (Output_data_got::add_global_pair_with_rela): New function.
11086 (Output_data_got::add_local): Added got_type parameter.
11087 (Output_data_got::add_local_with_rel): Likewise.
11088 (Output_data_got::add_local_with_rela): Likewise.
11089 (Output_data_got::add_local_pair_with_rel): New function.
11090 (Output_data_got::add_local_pair_with_rela): New function.
11091 (Output_data_got::add_global_tls): Removed.
11092 (Output_data_got::add_global_tls_with_rel): Removed.
11093 (Output_data_got::add_global_tls_with_rela): Removed.
11094 (Output_data_got::add_local_tls): Removed.
11095 (Output_data_got::add_local_tls_with_rel): Removed.
11096 (Output_data_got::add_local_tls_with_rela): Removed.
11097 * resolve.cc (Symbol::override_base_with_special): Removed
11098 reference to has_got_offset_ field.
11099 * symtab.cc (Symbol::init_fields): Replaced initialization
11100 of got_offset_ with got_offsets_. Removed initialization
11102 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11103 (Symbol::got_offset): Likewise.
11104 (Symbol::set_got_offset): Likewise.
11105 (Symbol::has_tls_got_offset): Removed.
11106 (Symbol::tls_got_offset): Removed.
11107 (Symbol::set_tls_got_offset): Removed.
11108 (Symbol::got_offset_): Removed.
11109 (Symbol::tls_mod_got_offset_): Removed.
11110 (Symbol::tls_pair_got_offset_): Removed.
11111 (Symbol::got_offsets_): New field.
11112 (Symbol::has_got_offset): Removed.
11113 (Symbol::has_tls_mod_got_offset): Removed.
11114 (Symbol::has_tls_pair_got_offset): Removed.
11115 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11116 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11118 (Target_x86_64::Scan::global): Likewise.
11119 (Target_x86_64::Relocate::relocate): Likewise.
11120 (Target_x86_64::Relocate::relocate_tls): Likewise.
11124 * yyscript.y: Fix spelling error in comment.
11128 * options.h (class General_options): Define build_id option.
11129 * layout.h (class Layout): Declare write_build_id, create_note,
11130 create_build_id. Add build_id_note_ member.
11131 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11132 "libiberty.h", "md5.h", "sha1.h".
11133 (Layout::Layout): Initialize eh_frame_data_,
11134 eh_frame_hdr_section_, and build_id_note_.
11135 (Layout::finalize): Call create_build_id.
11136 (Layout::create_note): New function, broken out of
11137 Layout::create_gold_note.
11138 (Layout::create_gold_note): Call create_note.
11139 (Layout::create_build_id): New function.
11140 (Layout::write_build_id): New function.
11141 (Close_task_runner::run): Call write_build_id.
11143 * x86_64.cc: Correct license to GPLv3.
11147 * options.cc: Include "demangle.h".
11148 (parse_optional_string): New function.
11149 (parse_long_option): Handle takes_optional_argument.
11150 (parse_short_option): Update dash_z initializer. Handle
11151 takes_optional_argument.
11152 (General_options::General_options): Initialize do_demangle_.
11153 (General_options::finalize): Set do_demangle_. Handle demangling
11155 * options.h (parse_optional_string): Declare.
11156 (struct One_option): Add optional_arg field. Update constructor.
11157 Update call constructor calls. Add takes_optional_argument
11159 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11160 (DEFINE_optional_string): Define.
11161 (General_options::demangle): Change from DEFINE_bool to
11162 DEFINE_optional_string.
11163 (General_options::no_demangle): New function.
11164 (General_options::do_demangle): New function.
11165 (General_options::set_do_demangle): New function.
11166 (General_options::execstack_status_): Move definition to end of
11168 (General_options::static_): Likewise.
11169 (General_options::do_demangle_): New field.
11170 * object.cc (big_endian>::get_symbol_location_info): Call
11171 Options::do_demangle, not Options::demangle.
11172 * symtab.cc (demangle): Likewise.
11176 * gold.h: Include <cstddef> and <sys/types.h>
11177 * options.h: Include <cstring>.
11181 * Added source code to GNU binutils.