3 * target.h (class Target): Add osabi_ field.
4 (Target::osabi): New function.
5 (Target::set_osabi): New function.
6 (Target::Target): Initialize osabi_.
7 (Target::do_adjust_elf_header): Make pure virtual.
8 (Sized_target::do_adjust_elf_header): Declare.
9 * target.cc (Sized_target::do_adjust_elf_header): New function.
10 (class Sized_target): Instantiate all versions.
11 * freebsd.h (class Target_freebsd): Remove.
12 (Target_selector_freebsd::do_recognize): Call set_osabi on
14 (Target_selector_freebsd::do_recognize_by_name): Likewise.
15 (Target_selector_freebsd::set_osabi): Remove.
16 * i386.cc (class Target_i386): Inherit from Sized_target rather
18 * x86_64.cc (class Target_x86_64): Likewise.
22 * target.h (Target::can_check_for_function_pointers): Rewrite.
24 (Target::can_icf_inline_merge_sections): Likewise.
25 (Target::section_may_have_icf_unsafe_poineters): Likewise.
26 (Target::Target_info): Add can_icf_inline_merge_sections field.
27 (Target::do_can_check_for_function_pointers): New virtual
29 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
30 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
31 from can_check_for_function_pointers, move in file.
32 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
33 section_may_have_icf_unsafe_poineters, move in file.
34 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
35 * i386.cc (Target_i386::do_can_check_for_function_pointers):
36 Rename from can_check_for_function_pointers, move in file.
37 (Target_i386::can_icf_inline_merge_sections): Remove.
38 (Target_i386::i386_info): Initialize
39 can_icf_inline_merge_sections.
40 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
41 Initialize can_icf_inline_merge_sections.
42 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
43 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
44 Rename from can_check_for_function_pointers, move in file.
45 (Target_x86_64::can_icf_inline_merge_sections): Remove.
46 (Target_x86_64::x86_64_info): Initialize
47 can_icf_inline_merge_sections.
48 * testsuite/testfile.cc (Target_test::test_target_info):
50 * icf.cc (get_section_contents): Correct formatting.
54 * symtab.cc (Symbol::versioned_name): New function.
55 (Symbol_table::add_to_final_symtab): Use versioned_name when
57 (Symbol_table::sized_write_symbol): Likewise.
58 * symtab.h (class Symbol): Declare versioned_name.
59 * stringpool.h (class Stringpool_template): Add variant of add
60 which takes a std::basic_string.
61 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
62 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
63 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
64 (ver_test_12.o): New target.
65 * testsuite/Makefile.in: Rebuild.
69 * arm.cc (Arm_relocate_functions::thm_jump8,
70 Arm_relocate_functions::thm_jump11): Use a wider signed
71 type to compute offset.
72 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
74 * testsuite/Makefile.in: Regenerate.
75 * testsuite/arm_branch_in_range.sh: Check test results of
76 arm_thm_jump11 and arm_thm_jump8.
77 * testsuite/arm_thm_jump11.s: New test source file.
78 * testsuite/arm_thm_jump11.t: New linker script.
79 * testsuite/arm_thm_jump8.s: New test source file.
80 * testsuite/arm_thm_jump8.t: New linker script.
84 * layout.cc: Include "object.h".
85 (ctors_sections_in_init_array): New static variable.
86 (Layout::is_ctors_in_init_array): New function.
87 (Layout::layout): Add entry to ctors_sections_in_init_array if
89 * layout.h (class Layout): Declare is_ctors_in_init_array.
90 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
91 is_ctors_reverse_view is set.
92 (Sized_relobj_file::write_sections): Add layout parameter. Change
93 all callers. Set is_ctors_reverse_view field of View_size.
94 (Sized_relobj_file::reverse_words): New function.
95 * object.h (Sized_relobj_file::View_size): Add
96 is_ctors_reverse_view field.
97 (class Sized_relobj_file): Update declarations.
98 * testsuite/initpri3.c: New test.
99 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
101 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
102 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
103 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
104 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
105 * testsuite/Makefile.in: Rebuild.
109 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
110 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
111 (debug_msg_cdebug.err): New targets.
112 * testsuite/Makefile.in: Regenerate.
113 * testsuite/debug_msg.sh: Check output of link with compressed debug.
114 Fix checks for link with shared library.
118 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
119 skip empty text sections.
120 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
125 * options.h (class General_options): Add --ctors-in-init-array.
126 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
127 friends as SHT_PROGBITS for merging sections.
128 (Layout::layout): Remove special handling of .init_array and
129 friends. Don't sort if doing relocatable link. Sort for .ctors
130 and .dtors if ctors_in_init_array.
131 (Layout::make_output_section): Force correct section types for
132 .init_array and friends. Don't sort if doing relocatable link,
133 Don't sort .ctors and .dtors if ctors_in_init_array.
134 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
135 (Layout::output_section_name): Add relobj parameter. Change all
136 callers. Handle .ctors. and .dtors. in code rather than table.
137 Handle .ctors and .dtors if ctors_in_init_array.
138 (Layout::match_file_name): New function, moved from output.cc.
139 * layout.h (class Layout): Update declarations.
140 * output.cc: Include "layout.h".
141 (Input_section_sort_entry::get_priority): New function.
142 (Input_section_sort_entry::match_file_name): Just call
143 Layout::match_file_name.
144 (Output_section::Input_section_sort_init_fini_compare::operator()):
145 Handle .ctors and .dtors. Sort by explicit priority rather than
147 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
148 * testsuite/initpri2.c: New test.
149 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
150 (check_PROGRAMS): Add initpri2.
151 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
152 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
153 * configure, testsuite/Makefile.in: Rebuild.
158 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
159 .interp section to a PT_INTERP segment even if we have seen a
160 --dynamic-linker option. Don't do it if we have seen a PHDRS
161 clause in a linker script.
162 (Layout::finalize): Don't create a .interp section if we've
163 already create a PT_INTERP segment.
164 (Layout::create_interp): Always call choose_output_section (revert
165 patch of 2011-06-17). Don't create PT_INTERP segment.
167 (Script_sections::create_note_and_tls_segments): Add a .interp
168 section to a PT_INTERP segment even if we have seen a
169 --dynamic-linker option.
173 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
174 merely because a non-PT_LOAD segment has a dynamic reloc.
178 * layout.cc (Layout::finish_dynamic_section): Don't create
179 DT_FLAGS entry if not needed.
184 * layout.cc (Layout::layout_eh_frame): Correct handling of
185 writable .eh_frame section.
190 * resolve.cc (Symbol_table::resolve): Don't give an error if a
191 symbol is redefined with the exact same object and value.
196 * layout.h (class Layout): Add interp_segment_ field.
197 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
198 (Layout::attach_allocated_section_to_segment): If making shared
199 library, put .interp section in PT_INTERP segment.
200 (Layout::finalize): Also call create_interp if -dynamic-linker
202 (Layout::create_interp): Assert that there is no PT_INTERP
203 segment. If not using a SECTIONS clause, use make_output_section.
204 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
206 (Script_sections::create_note_and_tls_segments): If making shared
207 library, put .interp section in PT_INTERP segment.
211 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
212 when making a shared library.
216 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
217 parameter. Change all callers. Don't issue warning about PC32
218 against locally defined symbol.
222 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
223 occurs in same object.
227 * po/POTFILES.in: Regenerate.
232 (Orphan_output_section::set_section_addresses): For a relocatable
233 link set address to 0.
238 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
239 used with --compress-debug-sections.
240 * gold/object.cc (Sized_relobj_file::do_layout): Report
241 uncompressed size of compressed input sections.
246 * testsuite/two_file_test_2_v1.cc: Change initialization of
247 v2 to keep it in .data.
251 * common.cc (Symbol_table::do_allocate_commons_list): Call
253 * errors.cc (Errors::fatal): Adjust call to gold_exit.
254 (Errors::fallback): New function.
255 (gold_fallback): New function.
256 * errors.h (Errors::fallback): New function.
257 * gold.cc (gold_exit): Change status parameter to enum; adjust
259 (queue_initial_tasks): Call gold_fallback.
260 * gold.h: Include cstdlib.
261 (Exit_status): New enum type.
262 (gold_exit): Change status parameter to enum.
263 (gold_fallback): New function.
264 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
265 (Layout::create_symtab_sections): Likewise.
266 (Layout::create_shdrs): Likewise.
267 * main.cc (main): Adjust call to gold_exit.
268 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
269 (Output_data_got::add_got_entry_pair): Likewise.
270 (Output_section::add_input_section): Likewise.
271 (Output_section::add_output_section_data): Likewise.
272 (Output_segment::set_section_list_addresses): Likewise.
273 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
277 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
278 for incremental links.
279 * output.cc (Output_segment::set_section_list_addresses): Remove
280 FIXME and test for TLS or BSS.
284 * testsuite/Makefile.am: Add incremental_copy_test,
285 incremental_common_test_1.
286 * testsuite/Makefile.in: Regenerate.
287 * testsuite/common_test_1_v1.c: New source file.
288 * testsuite/common_test_1_v2.c: New source file.
289 * testsuite/copy_test_v1.cc: New source file.
293 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
294 update, allocate common from bss section's free list.
295 * incremental-dump.cc (dump_incremental_inputs): Print flag for
296 linker-defined symbols.
297 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
298 Skip GOT and PLT entries that are no longer referenced.
299 (Output_section_incremental_inputs::write_info_blocks): Mark
300 linker-defined symbols.
301 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
302 * output.cc (Output_section::allocate): New function.
303 * output.h (Output_section::allocate): New function.
304 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
305 linker-defined symbols.
306 (Symbol::override_base_with_special): Copy is_predefined_ flag.
307 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
308 (Symbol::init_base_output_data): Likewise.
309 (Symbol::init_base_output_segment): Likewise.
310 (Symbol::init_base_constant): Likewise.
311 (Sized_symbol::init_output_data): Likewise.
312 (Sized_symbol::init_output_segment): Likewise.
313 (Sized_symbol::init_constant): Likewise.
314 (Symbol_table::do_define_in_output_data): Likewise.
315 (Symbol_table::do_define_in_output_segment): Likewise.
316 (Symbol_table::do_define_as_constant): Likewise.
317 * symtab.h (Symbol::is_predefined): New function.
318 (Symbol::init_base_output_data): Add is_predefined parameter.
319 (Symbol::init_base_output_segment): Likewise.
320 (Symbol::init_base_constant): Likewise.
321 (Symbol::is_predefined_): New data member.
322 (Sized_symbol::init_output_data): Add is_predefined parameter.
323 (Sized_symbol::init_output_segment): Likewise.
324 (Sized_symbol::init_constant): Likewise.
325 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
329 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
330 instead of emit_copy_reloc.
331 (Copy_relocs::emit_copy_reloc): Refactor.
332 (Copy_relocs::make_copy_reloc): New function.
333 (Copy_relocs::add_copy_reloc): Remove.
334 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
336 (Copy_relocs::make_copy_reloc): New function.
337 (Copy_relocs::add_copy_reloc): Remove.
338 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
339 unchanged input files.
340 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
341 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
342 Reserve BSS space for COPY relocations.
343 (Sized_incremental_binary::do_emit_copy_relocs): New function.
344 (Output_section_incremental_inputs::write_info_blocks): Record
345 whether a symbol is copied from a shared object.
346 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
347 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
348 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
349 (Incremental_input_entry_reader::get_output_symbol_index): Add
351 (Incremental_binary::emit_copy_relocs): New function.
352 (Incremental_binary::do_emit_copy_relocs): New function.
353 (Sized_incremental_binary::Sized_incremental_binary): Initialize
355 (Sized_incremental_binary::add_copy_reloc): New function.
356 (Sized_incremental_binary::do_emit_copy_relocs): New function.
357 (Sized_incremental_binary::Copy_reloc): New struct.
358 (Sized_incremental_binary::Copy_relocs): New typedef.
359 (Sized_incremental_binary::copy_relocs_): New data member.
360 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
361 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
362 * target.h (Sized_target::emit_copy_reloc): New function.
363 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
368 * gold/archive.cc (Archive::Archive): Initialize new data member.
369 (Archive::include_all_members): Return if archive has already been
371 * gold/archive.h (Archive::include_all_members_): New data member.
375 * dynobj.h: Fix spelling mistake in comment.
376 * output.cc: Likewise.
382 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
383 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
384 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
385 redundant arm_exidx_test.so.
386 * testsuite/Makefile.in: Regenerate.
387 (check_SCRIPTS): Add pr12826.sh
388 (check_DATA): Add pr12826.stdout
389 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
390 * testsuite/pr12826.sh: New file.
391 * testsuite/pr12826_1.s: Ditto.
392 * testsuite/pr12826_1.s: Ditto.
396 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
402 * testsuite/Makefile.am: Use different file name for two_file_test
403 temporary file for each incremental test.
404 * testsuite/Makefile.in: Rebuild.
408 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
409 binary input file is empty.
413 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
414 (ver_test_9.so): Likewise.
415 * testsuite/Makefile.in: Rebuild.
419 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
420 * incremental.cc (Incremental_inputs::report_input_section): Fix
421 comment, indentation.
422 (Incremental_inputs::report_comdat_group): New function.
423 (Output_section_incremental_inputs::set_final_data_size): Adjust size
424 of data for incremental input file entry.
425 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
426 group count, COMDAT group signatures.
427 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
428 an unchanged input file.
429 * incremental.h (Incremental_object_entry::Incremental_object_entry):
430 Initialize new data member.
431 (Incremental_object_entry::add_comdat_group): New function.
432 (Incremental_object_entry::get_comdat_group_count): New function.
433 (Incremental_object_entry::get_comdat_signature_key): New function.
434 (Incremental_object_entry::groups_): New data member.
435 (Incremental_inputs::report_comdat_group): New function.
436 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
437 data for incremental input file entry.
438 (Incremental_input_entry_reader::get_comdat_group_count): New function.
439 (Incremental_input_entry_reader::get_input_section): Adjust size of
440 data for incremental input file entry.
441 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
442 (Incremental_input_entry_reader::get_comdat_group_signature): New
444 * object.cc (Sized_relobj::include_section_group): Report kept
445 COMDAT groups for incremental links.
449 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
450 with name parameter. Add found_name parameter.
451 * fileread.cc (Input_file::find_file): Adjust code accordingly.
452 * dirsearch.h (class Dirsearch): Update declaration.
456 * archive.cc (Library_base::should_include_member): Pull in object
457 from archive if it defines the entry symbol.
458 * parameters.cc (Parameters::entry): New function.
459 * parameters.h (class Parameters): Declare entry.
460 * output.h (class Output_file_header): Remove entry_ field.
461 * output.cc (Output_file_header::Output_file_header): Remove entry
462 parameter. Change all callers.
463 (Output_file_header::entry): Use parameters->entry.
464 * gold.cc (queue_middle_tasks): Likewise.
465 * plugin.cc (Plugin_hook::run): Likewise.
469 * gold.cc (queue_initial_tasks): Pass incremental base filename
470 to Output_file::open_base_file; don't print error message.
471 * incremental-dump.cc (main): Adjust call to
472 Output_file::open_for_modification.
473 * incremental-dump.cc (main): Likewise.
474 * incremental.cc (Incremental_inputs::report_command_line):
475 Ignore --incremental-base option when comparing command lines.
476 Ignore parameter when given as separate argument.
477 * options.h (class General_options): Add --incremental-base.
478 * output.cc (Output_file::Output_file):
479 (Output_file::open_base_file): Add base_name and writable parameters;
480 read base file into new file; print error message here.
481 (Output_file::map_no_anonymous): Add writable parameter; adjust all
483 * output.h (Output_file::open_for_modification): Rename to...
484 (Output_file::open_base_file): ...this; add base_name and
485 writable parameters; adjust all callers.
486 (Output_file::map_no_anonymous): Add writable parameter; adjust all
488 * testsuite/Makefile.am (incremental_test_4): Test
490 * testsuite/Makefile.in: Regenerate.
494 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
496 * testsuite/Makefile.in: Regenerate.
497 * testsuite/two_file_test_1_v1.cc: New test source file.
498 * testsuite/two_file_test_1b_v1.cc: New test source file.
499 * testsuite/two_file_test_2_v1.cc: New test source file.
503 * dynobj.h (Dynobj::do_dynobj): New function.
504 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
505 flag and soname for shared objects.
506 * incremental.cc (Incremental_inputs::report_object): Make
507 either Incremental_object_entry or Incremental_dynobj_entry; add
508 soname to string table.
509 (Incremental_inputs::report_input_section): Add assertion.
510 (Output_section_incremental_inputs::set_final_data_size): Adjust
511 type of input file entry for shared libraries; adjust size of
512 shared library info entry.
513 (Output_section_incremental_inputs::write_input_files): Write
514 as_needed flag for shared libraries.
515 (Output_section_incremental_inputs::write_info_blocks): Adjust type
516 of input file entry for shared libraries; write soname.
517 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
518 soname from incremental info.
519 * incremental.h (enum Incremental_input_flags): Add
520 INCREMENTAL_INPUT_AS_NEEDED.
521 (Incremental_input_entry::Incremental_input_entry): Initialize new
523 (Incremental_input_entry::set_as_needed): New function.
524 (Incremental_input_entry::as_needed): New function.
525 (Incremental_input_entry::do_dynobj_entry): New function.
526 (Incremental_input_entry::as_needed_): New data member.
527 (Incremental_object_entry::Incremental_object_entry): Don't check
529 (Incremental_object_entry::do_type): Likewise.
530 (class Incremental_dynobj_entry): New class.
531 (Incremental_input_entry_reader::as_needed): New function.
532 (Incremental_input_entry_reader::get_soname): New function.
533 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
534 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
535 size of shared library info entry.
536 * layout.cc (Layout::finish_dynamic_section): Don't test for
537 incremental link when adding DT_NEEDED entries.
538 * object.h (Object::Object): Initialize new data member.
539 (Object::dynobj): New function.
540 (Object::set_as_needed): New function.
541 (Object::as_needed): New function.
542 (Object::do_dynobj): New function.
543 (Object::as_needed_): New data member.
547 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
548 info; adjust display of GOT entries.
549 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
550 vector of input objects; remove file_status_.
551 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
552 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
553 got_plt reader; call target hooks to reserve GOT entries.
554 (Output_section_incremental_inputs::set_final_data_size): Adjust size
555 of input file info header and GOT info entry.
556 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
558 (Got_plt_view_info::got_descriptor): Remove.
559 (Got_plt_view_info::sym_index): New data member.
560 (Got_plt_view_info::input_index): New data member.
561 (Local_got_offset_visitor::visit): Write input file index.
562 (Global_got_offset_visitor::visit): Write 0 for input file index.
563 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
564 with sym_index and input_index.
565 (Output_section_incremental_inputs::write_got_plt): Adjust size of
566 incremental info GOT entry; replace got_descriptor with input_index.
567 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
568 map from input file index to object.
569 (Sized_relobj_incr::do_layout): Replace direct data member reference
570 with accessor function.
571 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
572 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
573 Adjust size of input file info header.
574 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
575 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
576 (Incremental_input_entry_reader::get_input_section): Adjust size of
577 input file info header.
578 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
579 of incremental info GOT entry.
580 (Incremental_got_plt_reader::get_got_desc): Remove.
581 (Incremental_got_plt_reader::get_got_symndx): New function.
582 (Incremental_got_plt_reader::get_got_input_index): New function.
583 (Sized_incremental_binary::Sized_incremental_binary): Remove
584 file_status_; add input_objects_.
585 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
586 (Sized_incremental_binary::set_file_is_unchanged): Remove.
587 (Sized_incremental_binary::file_is_unchanged): Remove.
588 (Sized_incremental_binary::set_input_object): New function.
589 (Sized_incremental_binary::input_object): New function.
590 (Sized_incremental_binary::file_status_): Remove.
591 (Sized_incremental_binary::input_objects_): New data member.
592 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
594 (Sized_relobj_incr::invalid_address): Move to base class.
595 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
597 (Sized_relobj_incr::do_output_section_offset): Likewise.
598 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
599 (Sized_relobj_incr::section_offsets_): Likewise.
600 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
602 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
603 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
604 with accessor function.
605 (Sized_relobj_file::do_layout): Likewise.
606 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
607 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
608 (Sized_relobj_file::compute_final_local_value): Replace refs to
609 section_offsets_ with accessor function.
610 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
611 * object.h (Relobj::Relobj): Initialize new data members.
612 (Relobj::add_dyn_reloc): New function.
613 (Relobj::first_dyn_reloc): New function.
614 (Relobj::dyn_reloc_count): New function.
615 (Relobj::first_dyn_reloc_): New data member.
616 (Relobj::dyn_reloc_count_): New data member.
617 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
619 (Sized_relobj::Address): New typedef.
620 (Sized_relobj::invalid_address): Move here from child class.
621 (Sized_relobj::Sized_relobj): Initialize new data members.
622 (Sized_relobj::sized_relobj): New function.
623 (Sized_relobj::is_output_section_offset_invalid): Move here from
625 (Sized_relobj::get_output_section_offset): Likewise.
626 (Sized_relobj::local_has_got_offset): Likewise.
627 (Sized_relobj::local_got_offset): Likewise.
628 (Sized_relobj::set_local_got_offset): Likewise.
629 (Sized_relobj::do_for_all_local_got_entries): Likewise.
630 (Sized_relobj::clear_got_offsets): New function.
631 (Sized_relobj::section_offsets): Move here from child class.
632 (Sized_relobj::do_output_section_offset): Likewise.
633 (Sized_relobj::do_set_section_offset): Likewise.
634 (Sized_relobj::Local_got_offsets): Likewise.
635 (Sized_relobj::local_got_offsets_): Likewise.
636 (Sized_relobj::section_offsets_): Likewise.
637 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
639 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
641 (Sized_relobj_file::sized_relobj): New function
642 (Sized_relobj_file::local_has_got_offset): Move to base class.
643 (Sized_relobj_file::local_got_offset): Likewise.
644 (Sized_relobj_file::set_local_got_offset): Likewise.
645 (Sized_relobj_file::get_output_section_offset): Likewise.
646 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
647 (Sized_relobj_file::do_output_section_offset): Likewise.
648 (Sized_relobj_file::do_set_section_offset): Likewise.
649 (Sized_relobj_file::Local_got_offsets): Likewise.
650 (Sized_relobj_file::local_got_offsets_): Likewise.
651 (Sized_relobj_file::section_offsets_): Likewise.
652 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
654 (set_needs_dynsym_index): Convert relobj to derived class pointer.
655 (Output_reloc::get_symbol_index): Likewise.
656 (Output_reloc::local_section_offset): Likewise.
657 (Output_reloc::get_address): Likewise.
658 (Output_reloc::symbol_value): Likewise.
659 (Output_data_got::reserve_slot): Move to class definition.
660 (Output_data_got::reserve_local): New function.
661 (Output_data_got::reserve_slot_for_global): Remove.
662 (Output_data_got::reserve_global): New function.
663 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
664 (all constructors, two instantiations).
665 (Output_reloc::get_relobj): New function (two instantiations).
666 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
667 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
668 (Output_data_reloc::add_global): Adjust type of relobj.
669 (Output_data_reloc::add_global_relative): Likewise.
670 (Output_data_reloc::add_symbolless_global_addend): Likewise.
671 (Output_data_reloc::add_local): Likewise.
672 (Output_data_reloc::add_local_relative): Likewise.
673 (Output_data_reloc::add_symbolless_local_addend): Likewise.
674 (Output_data_reloc::add_local_section): Likewise.
675 (Output_data_reloc::add_output_section): Likewise.
676 (Output_data_reloc::add_absolute): Likewise.
677 (Output_data_reloc::add_target_specific): Likewise.
678 (Output_data_got::reserve_slot): Move definition here.
679 (Output_data_got::reserve_local): New function.
680 (Output_data_got::reserve_global): New function.
681 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
682 section_offsets_ with accessor function.
683 (Sized_relobj_file::write_sections): Likewise.
684 (Sized_relobj_file::do_relocate_sections): Likewise.
685 * target.h (Sized_target::reserve_local_got_entry): New function.
686 (Sized_target::reserve_global_got_entry): New function.
687 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
688 (Target_x86_64::reserve_global_got_entry): New function.
689 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
693 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
694 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
695 bit when checking got_type.
696 * incremental.cc (Sized_incremental_binary::setup_readers):
697 Store symbol table and string table locations; initialize bit vector
698 of file status flags.
699 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
701 (Sized_incremental_binary::do_process_got_plt): New function.
702 (Sized_incremental_binary::get_symtab_view): Use stored locations.
703 (Output_section_incremental_inputs::set_final_data_size): Record
704 file index for each input file.
705 (Output_section_incremental_inputs::write_got_plt): Store file index
706 instead of input entry offset for each GOT entry.
708 (Incremental_input_entry::Incremental_input_entry): Initialize new
710 (Incremental_input_entry::set_offset): Store file index.
711 (Incremental_input_entry::get_file_index): New function.
712 (Incremental_input_entry::file_index_): New data member.
713 (Incremental_binary::process_got_plt): New function.
714 (Incremental_binary::do_process_got_plt): New function.
715 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
717 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
718 (Sized_incremental_binary::set_file_is_unchanged): New function.
719 (Sized_incremental_binary::file_is_unchanged): New function.
720 (Sized_incremental_binary::do_process_got_plt): New function.
721 (Sized_incremental_binary::file_status_): New data member.
722 (Sized_incremental_binary::main_symtab_loc_): New data member.
723 (Sized_incremental_binary::main_strtab_loc_): New data member.
724 * output.cc (Output_data_got::Got_entry::write): Add case
726 (Output_data_got::add_global): Call add_got_entry.
727 (Output_data_got::add_global_plt): Likewise.
728 (Output_data_got::add_global_with_rel): Likewise.
729 (Output_data_got::add_global_with_rela): Likewise.
730 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
731 (Output_data_got::add_global_pair_with_rela): Likewise.
732 (Output_data_got::add_local): Call add_got_entry.
733 (Output_data_got::add_local_plt): Likewise.
734 (Output_data_got::add_local_with_rel): Likewise.
735 (Output_data_got::add_local_with_rela): Likewise.
736 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
737 (Output_data_got::add_local_pair_with_rela): Likewise.
738 (Output_data_got::reserve_slot): New function.
739 (Output_data_got::reserve_slot_for_global): New function.
740 (Output_data_got::add_got_entry): New function.
741 (Output_data_got::add_got_entry_pair): New function.
742 (Output_section::add_output_section_data): Edit FIXME.
744 (Output_section_data_build::Output_section_data_build): New
745 constructor with size parameter.
746 (Output_data_space::Output_data_space): Likewise.
747 (Output_data_got::Output_data_got): Initialize new data member; new
748 constructor with size parameter.
749 (Output_data_got::add_constant): Call add_got_entry.
750 (Output_data_got::reserve_slot): New function.
751 (Output_data_got::reserve_slot_for_global): New function.
752 (class Output_data_got::Got_entry): Add RESERVED_CODE.
753 (Output_data_got::add_got_entry): New function.
754 (Output_data_got::add_got_entry_pair): New function.
755 (Output_data_got::free_list_): New data member.
756 * target.h (Sized_target::init_got_plt_for_update): New function.
757 (Sized_target::register_global_plt_entry): New function.
758 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
759 Initialize new data member; call init; add constructor with PLT count.
760 (Output_data_plt_x86_64::init): New function.
761 (Output_data_plt_x86_64::add_relocation): New function.
762 (Output_data_plt_x86_64::reserve_slot): New function.
763 (Output_data_plt_x86_64::free_list_): New data member.
764 (Target_x86_64::init_got_plt_for_update): New function.
765 (Target_x86_64::register_global_plt_entry): New function.
766 (Output_data_plt_x86_64::add_entry): Allocate from free list for
768 (Output_data_plt_x86_64::add_relocation): New function.
769 * testsuite/object_unittest.cc (Object_test): Set default options.
773 * options.h (class General_options): Make -i a synonym for -r.
777 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
781 * object.cc (Sized_relobj::do_count_local_symbols): Check for
786 * layout.cc (Layout::layout): If the output section flags change,
791 * incremental-dump.cc (dump_incremental_inputs): Print local
792 symbol info for each input file.
794 (Output_section_incremental_inputs::set_final_data_size): Add local
795 symbol info to input file entries in incremental info.
796 (Output_section_incremental_inputs::write_info_blocks): Likewise.
797 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
798 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
799 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
801 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
802 (Sized_incr_relobj::do_relocate): Write the local symbols.
803 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
804 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
805 Adjust size of input file header.
806 (Incremental_inputs_reader::get_local_symbol_offset): New function.
807 (Incremental_inputs_reader::get_local_symbol_count): New function.
808 (Incremental_inputs_reader::get_input_section): Adjust size of input
810 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
811 (Sized_incr_relobj::This): New typedef.
812 (Sized_incr_relobj::sym_size): New const data member.
813 (Sized_incr_relobj::Local_symbol): New struct.
814 (Sized_incr_relobj::do_output_local_symbol_count): New function.
815 (Sized_incr_relobj::do_local_symbol_offset): New function.
816 (Sized_incr_relobj::local_symbol_count_): New data member.
817 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
818 (Sized_incr_relobj::local_symbol_index_): New data member.
819 (Sized_incr_relobj::local_symbol_offset_): New data member.
820 (Sized_incr_relobj::local_dynsym_offset_): New data member.
821 (Sized_incr_relobj::local_symbols_): New data member.
822 * object.h (Relobj::output_local_symbol_count): New function.
823 (Relobj::local_symbol_offset): New function.
824 (Relobj::do_output_local_symbol_count): New function.
825 (Relobj::do_local_symbol_offset): New function.
826 (Sized_relobj::do_output_local_symbol_count): New function.
827 (Sized_relobj::do_local_symbol_offset): New function.
831 * descriptors.cc (set_close_on_exec): New function.
832 (Descriptors::open): Use set_close_on_exec.
833 * output.cc (S_ISLNK): Define if not defined.
837 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
839 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
840 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
841 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
843 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
844 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
845 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
847 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
849 (Incremental_binary::apply_incremental_relocs): New function.
850 (Incremental_binary::do_apply_incremental_relocs): New function.
851 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
853 (Sized_incremental_binary::add_global_symbol): New function.
854 (Sized_incremental_binary::global_symbol): New function.
855 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
856 (Sized_incremental_binary::symbol_map_): New data member.
857 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
858 * target.h (Sized_target::apply_relocation): New function.
859 * target-reloc.h (apply_relocation): New function.
860 * x86_64.cc (Target_x86_64::apply_relocation): New function.
864 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
865 flag of a SHT_ARM_EXIDX section.
866 * testsuite/Makefile.am (arm_exidx_test): New test rules.
867 * testsuite/Makefile.in: Regenerate.
868 * testsuite/arm_exidx_test.s: New file.
869 * testsuite/arm_exidx_test.sh: Same.
874 * archive.h (Incremental_archive_entry::Archive_member):
875 Initialize arg_serial_ (second constructor).
879 * object.cc (Relocate_info::location): Simplify location string.
880 * errors.cc (Errors::error_at_location): Don't print program
882 (Errors::warning_at_location): Likewise.
883 (Errors::undefined_symbol): Likewise.
884 * testsuite/debug_msg.sh: Update accordingly.
888 * gold/layout.cc (Layout::symtab_section_offset): New function.
889 * gold/layout.h (Layout::symtab_section_offset): New function.
890 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
894 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
896 * output.h (class Output_file): Add map_is_allocated_ field.
897 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
898 not available, provide stubs. If mremap is not available, #define
900 (MREMAP_MAYMOVE): Define if not defined.
901 (Output_file::Output_file): Initialize map_is_allocated_.
902 (Output_file::resize): Check map_is_allocated_.
903 (Output_file::map_anonymous): If mmap fails, use malloc.
904 (Output_file::unmap): Don't do anything for an anonymous map.
905 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
906 is not available, provide stubs.
907 (File_read::View::~View): Use free rather than delete[].
908 (File_read::make_view): Use malloc rather than new[]. If mmap
910 (File_read::find_or_make_view): Use malloc rather than new[].
911 * gold.h: Remove HAVE_REMAP code.
912 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
913 exists. Rename mremap to gold_mremap. If mmap is not available
915 * configure, config.in: Rebuild.
919 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
920 initialize local variable v.
924 * archive.cc (Archive::include_member): Adjust call to
926 (Add_archive_symbols::run): Track argument serial numbers.
927 (Lib_group::include_member): Likewise.
928 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
929 * archive.h (Incremental_archive_entry::Archive_member):
930 Initialize arg_serial_.
931 (Archive_member::arg_serial_): New data member.
932 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
933 (Sized_dynobj::do_add_symbols): Track symbols when doing an
935 (Sized_dynobj::do_for_all_local_got_entries): New function.
936 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
938 * fileread.cc (get_mtime): New function.
939 * fileread.h (get_mtime): New function.
940 * gold.cc (queue_initial_tasks): Check for incremental update.
941 (process_incremental_input): New function.
942 (queue_middle_tasks): Don't force valid target for incremental
944 * incremental-dump.cc (find_input_containing_global): Adjust
945 size of symbol info entry.
946 (dump_incremental_inputs): Dump argument serial number and
947 in_system_directory flag; bias shndx by 1; print symbol names
948 when dumping per-file symbol lists; use new symbol info readers.
950 (Output_section_incremental_inputs:update_data_size): New function.
951 (Sized_incremental_binary::setup_readers): Setup input readers
952 for each input file; build maps for files added from libraries
954 (Sized_incremental_binary::check_input_args): New function.
955 (Sized_incremental_binary::do_check_inputs): Build map of argument
956 serial numbers to input arguments.
957 (Sized_incremental_binary::do_file_has_changed): Rename
958 do_file_is_unchanged to this; compare file modification times.
959 (Sized_incremental_binary::do_init_layout): New function.
960 (Sized_incremental_binary::do_reserve_layout): New function.
961 (Sized_incremental_binary::do_get_input_reader): Remove.
962 (Sized_incremental_binary::get_symtab_view): New function.
963 (Incremental_checker::can_incrementally_link_output_file): Remove.
964 (Incremental_inputs::report_command_line): Exclude --debug options.
965 (Incremental_inputs::report_archive_begin): Add parameter; track
966 argument serial numbers; don't put input file entry for archive
967 before archive members.
968 (Incremental_inputs::report_archive_end): Put input file entry
969 for archive after archive members.
970 (Incremental_inputs::report_object): Add parameter; track argument
971 serial numbers and in_system_directory flag.
972 (Incremental_inputs::report_script): Add parameter; track argument
974 (Output_section_incremental_inputs::set_final_data_size): Adjust
975 size of symbol info entry; check for forwarding symbols.
976 (Output_section_incremental_inputs::write_input_files): Write
977 in_system_directory flag and argument serial number.
978 (Output_section_incremental_inputs::write_info_blocks): Map section
979 indices between incremental info and original input file; store
980 input section index for each symbol.
981 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
982 change operator() to visit().
983 (class Global_got_offset_visitor): Likewise.
984 (class Global_symbol_visitor_got_plt):
985 (Output_section_incremental_inputs::write_got_plt): Use new visitor
987 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
988 (Sized_incr_relobj::do_read_symbols): New function.
989 (Sized_incr_relobj::do_layout): New function.
990 (Sized_incr_relobj::do_layout_deferred_sections): New function.
991 (Sized_incr_relobj::do_add_symbols): New function.
992 (Sized_incr_relobj::do_should_include_member): New function.
993 (Sized_incr_relobj::do_for_all_global_symbols): New function.
994 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
995 (Sized_incr_relobj::do_section_size): New function.
996 (Sized_incr_relobj::do_section_name): New function.
997 (Sized_incr_relobj::do_section_contents): New function.
998 (Sized_incr_relobj::do_section_flags): New function.
999 (Sized_incr_relobj::do_section_entsize): New function.
1000 (Sized_incr_relobj::do_section_address): New function.
1001 (Sized_incr_relobj::do_section_type): New function.
1002 (Sized_incr_relobj::do_section_link): New function.
1003 (Sized_incr_relobj::do_section_info): New function.
1004 (Sized_incr_relobj::do_section_addralign): New function.
1005 (Sized_incr_relobj::do_initialize_xindex): New function.
1006 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1007 (Sized_incr_relobj::do_read_relocs): New function.
1008 (Sized_incr_relobj::do_gc_process_relocs): New function.
1009 (Sized_incr_relobj::do_scan_relocs): New function.
1010 (Sized_incr_relobj::do_count_local_symbols): New function.
1011 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1012 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1013 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1014 (Sized_incr_relobj::do_relocate): New function.
1015 (Sized_incr_relobj::do_set_section_offset): New function.
1016 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1017 (Sized_incr_dynobj::do_read_symbols): New function.
1018 (Sized_incr_dynobj::do_layout): New function.
1019 (Sized_incr_dynobj::do_add_symbols): New function.
1020 (Sized_incr_dynobj::do_should_include_member): New function.
1021 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1022 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1023 (Sized_incr_dynobj::do_section_size): New function.
1024 (Sized_incr_dynobj::do_section_name): New function.
1025 (Sized_incr_dynobj::do_section_contents): New function.
1026 (Sized_incr_dynobj::do_section_flags): New function.
1027 (Sized_incr_dynobj::do_section_entsize): New function.
1028 (Sized_incr_dynobj::do_section_address): New function.
1029 (Sized_incr_dynobj::do_section_type): New function.
1030 (Sized_incr_dynobj::do_section_link): New function.
1031 (Sized_incr_dynobj::do_section_info): New function.
1032 (Sized_incr_dynobj::do_section_addralign): New function.
1033 (Sized_incr_dynobj::do_initialize_xindex): New function.
1034 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1035 (make_sized_incremental_object): New function.
1036 (Incremental_library::copy_unused_symbols): New function.
1037 (Incremental_library::do_for_all_unused_symbols): New function.
1038 * incremental.h (enum Incremental_input_flags): New type.
1039 (class Incremental_checker): Remove.
1040 (Incremental_input_entry::Incremental_input_entry): Add argument
1042 (Incremental_input_entry::arg_serial): New function.
1043 (Incremental_input_entry::set_is_in_system_directory): New function.
1044 (Incremental_input_entry::is_in_system_directory): New function.
1045 (Incremental_input_entry::arg_serial_): New data member.
1046 (Incremental_input_entry::is_in_system_directory_): New data member.
1047 (class Script_info): Move here from script.h.
1048 (Script_info::Script_info): Add filename parameter.
1049 (Script_info::filename): New function.
1050 (Script_info::filename_): New data member.
1051 (Incremental_script_entry::Incremental_script_entry): Add argument
1053 (Incremental_object_entry::Incremental_object_entry): Likewise.
1054 (Incremental_object_entry::add_input_section): Build list of input
1055 sections with map to original shndx.
1056 (Incremental_object_entry::get_input_section_index): New function.
1057 (Incremental_object_entry::shndx_): New data member.
1058 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1059 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1060 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1062 (Incremental_inputs::report_archive_begin): Likewise.
1063 (Incremental_inputs::report_object): Likewise.
1064 (Incremental_inputs::report_script): Likewise.
1065 (class Incremental_global_symbol_reader): New class.
1066 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1067 and store flags and input file type.
1068 (Incremental_input_entry_reader::arg_serial): New function.
1069 (Incremental_input_entry_reader::type): Extract type from flags.
1070 (Incremental_input_entry_reader::is_in_system_directory): New function.
1071 (Incremental_input_entry_reader::get_input_section_count): Call
1072 accessor function for type.
1073 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1074 function for type; adjust size of global symbol entry.
1075 (Incremental_input_entry_reader::get_global_symbol_count): Call
1076 accessor function for type.
1077 (Incremental_input_entry_reader::get_object_count): Likewise.
1078 (Incremental_input_entry_reader::get_object_offset): Likewise.
1079 (Incremental_input_entry_reader::get_member_count): Likewise.
1080 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1081 (Incremental_input_entry_reader::get_member_offset): Likewise.
1082 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1083 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1084 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1085 (Incremental_input_entry_reader::get_global_symbol_reader): New
1087 (Incremental_input_entry_reader::get_output_symbol_index): New
1089 (Incremental_input_entry_reader::type_): Remove.
1090 (Incremental_input_entry_reader::flags_): New data member.
1091 (Incremental_inputs_reader::input_file_offset): New function.
1092 (Incremental_inputs_reader::input_file_index): New function.
1093 (Incremental_inputs_reader::input_file): Call input_file_offset.
1094 (Incremental_inputs_reader::input_file_at_offset): New function.
1095 (Incremental_relocs_reader::get_r_type): Reformat.
1096 (Incremental_relocs_reader::get_r_shndx): Reformat.
1097 (Incremental_relocs_reader::get_r_offset): Reformat.
1098 (Incremental_relocs_reader::data): New function.
1099 (Incremental_binary::Incremental_binary): Initialize new data members.
1100 (Incremental_binary::check_inputs): Add cmdline parameter.
1101 (Incremental_binary::file_is_unchanged): Remove.
1102 (Input_reader::arg_serial): New function.
1103 (Input_reader::get_unused_symbol_count): New function.
1104 (Input_reader::get_unused_symbol): New function.
1105 (Input_reader::do_arg_serial): New function.
1106 (Input_reader::do_get_unused_symbol_count): New function.
1107 (Input_reader::do_get_unused_symbol): New function.
1108 (Incremental_binary::input_file_count): New function.
1109 (Incremental_binary::get_input_reader): Change signature to use
1110 index instead of filename.
1111 (Incremental_binary::file_has_changed): New function.
1112 (Incremental_binary::get_input_argument): New function.
1113 (Incremental_binary::get_library): New function.
1114 (Incremental_binary::get_script_info): New function.
1115 (Incremental_binary::init_layout): New function.
1116 (Incremental_binary::reserve_layout): New function.
1117 (Incremental_binary::output_file): New function.
1118 (Incremental_binary::do_check_inputs): New function.
1119 (Incremental_binary::do_file_is_unchanged): Remove.
1120 (Incremental_binary::do_file_has_changed): New function.
1121 (Incremental_binary::do_init_layout): New function.
1122 (Incremental_binary::do_reserve_layout): New function.
1123 (Incremental_binary::do_input_file_count): New function.
1124 (Incremental_binary::do_get_input_reader): Change signature.
1125 (Incremental_binary::input_args_map_): New data member.
1126 (Incremental_binary::library_map_): New data member.
1127 (Incremental_binary::script_map_): New data member.
1128 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1130 (Sized_incremental_binary::output_section): New function.
1131 (Sized_incremental_binary::inputs_reader): Add const.
1132 (Sized_incremental_binary::symtab_reader): Add const.
1133 (Sized_incremental_binary::relocs_reader): Add const.
1134 (Sized_incremental_binary::got_plt_reader): Add const.
1135 (Sized_incremental_binary::get_symtab_view): New function.
1136 (Sized_incremental_binary::Inputs_reader): New typedef.
1137 (Sized_incremental_binary::Input_entry_reader): New typedef.
1138 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1139 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1140 (Sized_incremental_binary::do_file_has_changed): New function.
1141 (Sized_incremental_binary::do_init_layout): New function.
1142 (Sized_incremental_binary::do_reserve_layout): New function.
1143 (Sized_input_reader::Inputs_reader): Remove.
1144 (Sized_input_reader::Input_entry_reader): Remove.
1145 (Sized_input_reader::do_arg_serial): New function.
1146 (Sized_input_reader::do_get_unused_symbol_count): New function.
1147 (Sized_input_reader::do_get_unused_symbol): New function.
1148 (Sized_incremental_binary::do_input_file_count): New function.
1149 (Sized_incremental_binary::do_get_input_reader): Change signature;
1150 use index instead of filename.
1151 (Sized_incremental_binary::section_map_): New data member.
1152 (Sized_incremental_binary::input_entry_readers_): New data member.
1153 (class Sized_incr_relobj): New class.
1154 (class Sized_incr_dynobj): New class.
1155 (make_sized_incremental_object): New function.
1156 (class Incremental_library): New class.
1157 * layout.cc (Free_list::num_lists): New static data member.
1158 (Free_list::num_nodes): New static data member.
1159 (Free_list::num_removes): New static data member.
1160 (Free_list::num_remove_visits): New static data member.
1161 (Free_list::num_allocates): New static data member.
1162 (Free_list::num_allocate_visits): New static data member.
1163 (Free_list::init): New function.
1164 (Free_list::remove): New function.
1165 (Free_list::allocate): New function.
1166 (Free_list::dump): New function.
1167 (Free_list::print_stats): New function.
1168 (Layout_task_runner::run): Resize output file for incremental updates.
1169 (Layout::Layout): Initialize new data members.
1170 (Layout::set_incremental_base): New function.
1171 (Layout::init_fixed_output_section): New function.
1172 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1173 incremental updates.
1174 (Layout::create_gold_note): Do not create gold note section for
1175 incremental updates.
1176 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1177 for incremental updates.
1178 (Layout::set_section_offsets): For incremental updates, allocate space
1180 (Layout::create_symtab_sections): Layout with offsets relative to
1181 start of section; for incremental updates, allocate space from free
1183 (Layout::create_shdrs): For incremental updates, allocate space from
1185 (Layout::finish_dynamic_section): For incremental updates, do not
1186 check --as-needed (fixed in subsequent patch).
1187 * layout.h (class Free_list): New class.
1188 (Layout::set_incremental_base): New function.
1189 (Layout::incremental_base): New function.
1190 (Layout::init_fixed_output_section): New function.
1191 (Layout::allocate): New function.
1192 (Layout::incremental_base_): New data member.
1193 (Layout::free_list_): New data member.
1194 * main.cc (main): Print Free_list statistics.
1195 * object.cc (Relobj::finalize_incremental_relocs): Add
1196 clear_counts parameter; clear counts only when clear_counts is set.
1197 (Sized_relobj::Sized_relobj): Initialize new base class.
1198 (Sized_relobj::do_layout): Don't report special sections.
1199 (Sized_relobj::do_for_all_local_got_entries): New function.
1200 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1201 symtab_off to all symbol table offsets.
1202 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1203 * object.h (class Got_offset_list): Move to top of file.
1204 (Object::Object): Allow case where input_file == NULL.
1205 (Object::~Object): Likewise.
1206 (Object::input_file): Assert that input_file != NULL.
1207 (Object::lock): Allow case where input_file == NULL.
1208 (Object::unlock): Likewise.
1209 (Object::is_locked): Likewise.
1210 (Object::token): Likewise.
1211 (Object::release): Likewise.
1212 (Object::is_incremental): New function.
1213 (Object::get_mtime): New function.
1214 (Object::for_all_local_got_entries): New function.
1215 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1216 (Object::set_is_in_system_directory): New function.
1217 (Object::is_in_system_directory): New function.
1218 (Object::do_is_incremental): New function.
1219 (Object::do_get_mtime): New function.
1220 (Object::do_for_all_local_got_entries): New function.
1221 (Object::is_in_system_directory_): New data member.
1222 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1223 (class Sized_relobj_base): New class.
1224 (class Sized_relobj): Derive from Sized_relobj_base.
1225 (class Sized_relobj::Symbols): Redeclare from base class.
1226 (class Sized_relobj::local_got_offset_list): Remove.
1227 (class Sized_relobj::Output_sections): Redeclare from base class.
1228 (class Sized_relobj::do_for_all_local_got_entries): New function.
1229 (class Sized_relobj::write_local_symbols): Add offset parameter.
1230 (class Sized_relobj::local_symbol_offset_): Update comment.
1231 (class Sized_relobj::local_dynsym_offset_): Update comment.
1232 * options.cc (Input_arguments::add_file): Remove const.
1233 * options.h (Input_file_argument::Input_file_argument):
1234 Initialize arg_serial_ (all constructors).
1235 (Input_file_argument::set_arg_serial): New function.
1236 (Input_file_argument::arg_serial): New function.
1237 (Input_file_argument::arg_serial_): New data member.
1238 (Input_arguments::Input_arguments): Initialize file_count_.
1239 (Input_arguments::add_file): Remove const.
1240 (Input_arguments::number_of_input_files): New function.
1241 (Input_arguments::file_count_): New data member.
1242 (Command_line::number_of_input_files): Call
1243 Input_arguments::number_of_input_files.
1244 * output.cc (Output_segment_headers::Output_segment_headers):
1246 (Output_section::Input_section::current_data_size): New function.
1247 (Output_section::Output_section): Initialize new data members.
1248 (Output_section::add_input_section): Don't do merge sections for
1249 an incremental link; allocate space from free list for an
1251 (Output_section::add_output_section_data): Allocate space from
1252 free list for an incremental update.
1253 (Output_section::update_data_size): New function.
1254 (Output_section::set_fixed_layout): New function.
1255 (Output_section::reserve): New function.
1256 (Output_segment::set_section_addresses): Remove const.
1257 (Output_segment::set_section_list_addresses): Remove const; allocate
1258 space from free list for an incremental update.
1259 (Output_segment::set_offset): Adjust size of RELRO segment for an
1261 * output.h (Output_data::current_data_size): Move here from
1263 (Output_data::pre_finalize_data_size): New function.
1264 (Output_data::update_data_size): New function.
1265 (Output_section_headers::update_data_size): new function.
1266 (Output_section_data_build::current_data_size): Move to Output_data.
1267 (Output_data_strtab::update_data_size): New function.
1268 (Output_section::current_data_size): Move to Output_data.
1269 (Output_section::set_fixed_layout): New function.
1270 (Output_section::has_fixed_layout): New function.
1271 (Output_section::reserve): New function.
1272 (Output_section::update_data_size): New function.
1273 (Output_section::has_fixed_layout_): New data member.
1274 (Output_section::free_list_): New data member.
1275 (Output_segment::set_section_addresses): Remove const.
1276 (Output_segment::set_section_list_addresses): Remove const.
1277 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1279 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1281 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1282 parameter when calling Add_symbols constructor; store argument
1283 serial number for members of a lib group.
1284 (Add_symbols::locks): Allow case where token == NULL.
1285 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1286 (Read_member::~Read_member): New function.
1287 (Read_member::is_runnable): New function.
1288 (Read_member::locks): New function.
1289 (Read_member::run): New function.
1290 (Check_script::~Check_script): New function.
1291 (Check_script::is_runnable): New function.
1292 (Check_script::locks): New function.
1293 (Check_script::run): New function.
1294 (Check_library::~Check_library): New function.
1295 (Check_library::is_runnable): New function.
1296 (Check_library::locks): New function.
1297 (Check_library::run): New function.
1298 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1299 (Add_symbols::library_): New data member.
1300 (class Read_member): New class.
1301 (class Check_script): New class.
1302 (class Check_library): New class.
1303 * reloc.cc (Read_relocs::is_runnable): Allow case where
1305 (Read_relocs::locks): Likewise.
1306 (Scan_relocs::locks): Likewise.
1307 (Relocate_task::locks): Likewise.
1308 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1310 (Sized_relobj::incremental_relocs_scan): Fix comment.
1311 (Sized_relobj::do_relocate): Pass output file offset to
1312 write_local_symbols.
1313 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1314 from class declaration.
1315 * script.cc (read_input_script): Allocate Script_info; pass
1316 argument serial number to report_script.
1317 * script.h (class Script_info): Move to incremental.h.
1318 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1319 * symtab.h (Symbol_table::add_from_incrobj): New function.
1320 (Symbol_table::set_file_offset): New function.
1324 * incremental-dump.cc (dump_incremental_inputs): Change signature
1325 to take a Sized_incremental_binary; change caller. Use readers
1326 in Sized_incremental_binary.
1328 (Sized_incremental_binary::find_incremental_inputs_sections):
1329 Rename do_find_incremental_inputs_sections to this.
1330 (Sized_incremental_binary::setup_readers): New function.
1331 (Sized_incremental_binary::do_check_inputs): Check
1332 has_incremental_info_ flag; move setup code to setup_readers;
1334 (Sized_incremental_binary::do_file_is_unchanged): New function.
1335 (Sized_incremental_binary::do_get_input_reader): New function.
1336 * incremental.h (class Incremental_binary): Move to end of file.
1337 (Incremental_binary::file_is_unchanged): New function.
1338 (Incremental_binary::do_file_is_unchanged): New function.
1339 (Incremental_binary::Input_reader): New class.
1340 (Incremental_binary::get_input_reader): New function.
1341 (class Sized_incremental_binary): Move to end of file.
1342 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1343 input section reader classes.
1344 (Sized_incremental_binary::has_incremental_info): New function.
1345 (Sized_incremental_binary::inputs_reader): New function.
1346 (Sized_incremental_binary::symtab_reader): New function.
1347 (Sized_incremental_binary::relocs_reader): New function.
1348 (Sized_incremental_binary::got_plt_reader): New function.
1349 (Sized_incremental_binary::do_file_is_unchanged): New function.
1350 (Sized_incremental_binary::Sized_input_reader): New class.
1351 (Sized_incremental_binary::get_input_reader): New function.
1352 (Sized_incremental_binary::find_incremental_inputs_sections):
1353 Rename do_find_incremental_inputs_sections to this.
1354 (Sized_incremental_binary::setup_readers): New function.
1355 (Sized_incremental_binary::has_incremental_info_): New data member.
1356 (Sized_incremental_binary::inputs_reader_): New data member.
1357 (Sized_incremental_binary::symtab_reader_): New data member.
1358 (Sized_incremental_binary::relocs_reader_): New data member.
1359 (Sized_incremental_binary::got_plt_reader_): New data member.
1360 (Sized_incremental_binary::current_input_file_): New data member.
1365 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1370 * archive.cc (Archive::include_member): Adjust call to report_object.
1371 (Add_archive_symbols::run): Add script_info to call to
1372 report_archive_begin.
1373 (Lib_group::include_member): Adjust call to report_object.
1374 (Add_lib_group_symbols::run): Adjust call to report_object.
1375 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1376 blocks. Add object count for script input files.
1377 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1378 script_info parameter; change all callers.
1379 (Incremental_inputs::report_object): Add script_info parameter;
1381 (Incremental_inputs::report_script): Store backpointer to
1382 incremental info entry.
1383 (Output_section_incremental_inputs::set_final_data_size): Record
1384 additional information for scripts.
1385 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1386 * incremental.h (Incremental_script_entry::add_object): New function.
1387 (Incremental_script_entry::get_object_count): New function.
1388 (Incremental_script_entry::get_object): New function.
1389 (Incremental_script_entry::objects_): New data member; adjust
1391 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1392 (Incremental_inputs::report_object): Add script_info parameter.
1393 (Incremental_inputs_reader::get_object_count): New function.
1394 (Incremental_inputs_reader::get_object_offset): New function.
1395 * options.cc (Input_arguments::add_file): Return reference to
1397 * options.h (Input_argument::set_script_info): New function.
1398 (Input_argument::script_info): New function.
1399 (Input_argument::script_info_): New data member; adjust all
1401 (Input_file_group::add_file): Return reference to new input argument.
1402 (Input_file_lib::add_file): Likewise.
1403 (Input_arguments::add_file): Likewise.
1404 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1405 * script.cc (Parser_closure::Parser_closure): Add script_info
1406 parameter; adjust all callers.
1407 (Parser_closure::script_info): New function.
1408 (Parser_closure::script_info_): New data member.
1409 (read_input_script): Report scripts earlier to incremental info.
1410 (script_add_file): Set script_info in Input_argument.
1411 (script_add_library): Likewise.
1412 * script.h (Script_options::Script_info): Rewrite class.
1416 * archive.cc (Library_base::should_include_member): Move
1417 method here from class Archive.
1418 (Archive::Archive): Initialize base class.
1419 (Archive::should_include_member): Move to base class.
1420 (Archive::do_for_all_unused_symbols): New function.
1421 (Add_archive_symbols::run): Remove redundant access to
1423 (Lib_group::Lib_group): Initialize base class.
1424 (Lib_group::do_filename): New function.
1425 (Lib_group::include_member): Pass pointer to Lib_group to
1427 (Lib_group::do_for_all_unused_symbols): New function.
1428 (Add_lib_group_symbols::run): Report archive information for
1430 * archive.h (class Library_base): New base class.
1431 (class Archive): Derive from Library_base.
1432 (Archive::filename): Move to base class.
1433 (Archive::set_incremental_info): Likewise.
1434 (Archive::incremental_info): Likewise.
1435 (Archive::Should_include): Likewise.
1436 (Archive::should_include_member): Likewise.
1437 (Archive::Armap_entry): Remove.
1438 (Archive::Unused_symbol_iterator): Remove.
1439 (Archive::unused_symbols_begin): Remove.
1440 (Archive::unused_symbols_end): Remove.
1441 (Archive::do_filename): New function.
1442 (Archive::do_get_mtime): New function.
1443 (Archive::do_for_all_unused_symbols): New function.
1444 (Archive::task_): Move to base class.
1445 (Archive::incremental_info_): Likewise.
1446 (class Lib_group): Derive from Library_base.
1447 (Lib_group::do_filename): New function.
1448 (Lib_group::do_get_mtime): New function.
1449 (Lib_group::do_for_all_unused_symbols): New function.
1450 (Lib_group::task_): Move to base class.
1451 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1453 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1455 * incremental.cc (Incremental_inputs::report_archive_begin):
1456 Use Library_base; call library's get_mtime; add incremental inputs
1457 entry before members.
1458 (class Unused_symbol_visitor): New class.
1459 (Incremental_inputs::report_archive_end): Use Library_base; use
1460 visitor class to record unused symbols; don't add incremental inputs
1461 entry after members.
1462 (Incremental_inputs::report_object): Use Library_base.
1464 (Incremental_archive_entry::Incremental_archive_entry): Remove
1465 unused Archive parameter.
1466 (Incremental_inputs::report_archive_begin): Use Library_base.
1467 (Incremental_inputs::report_archive_end): Likewise.
1468 (Incremental_inputs::report_object): Likewise.
1469 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1471 * object.h (Object::for_all_global_symbols): New function.
1472 (Object::do_for_all_global_symbols): New function.
1473 (Sized_relobj::do_for_all_global_symbols): New function.
1474 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1476 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1481 * archive.cc (Archive::interpret_header): Return -1 if something
1482 goes wrong. Change callers accordingly.
1486 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1487 * testsuite/Makefile.in: Regenerate.
1491 * plugin.cc (get_view): New.
1492 (Plugin::load): Pass get_view to the plugin.
1493 (Plugin_manager::get_view): New.
1497 * testsuite/final_layout.sh: Rewrite to not use dc.
1498 * testsuite/relro_test.sh: Fail if dc is not present.
1502 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1504 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1505 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1507 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1508 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1512 * script-sections.cc (Sort_output_sections::script_compare):
1513 Rename from is_before, change return type.
1514 (Sort_output_sections::operator()): Adjust accordingly.
1519 * testsuite/odr_violation2.cc: Add comment to make all error line
1520 numbers double digits.
1521 * testsuite/debug_msg.sh: Adjust expected errors.
1525 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1526 but mark earlier ones as non-canonical
1527 (offset_to_iterator): Update search target and example
1528 (do_addr2line): Return extra lines in a vector*
1529 (format_file_lineno): Extract from do_addr2line
1530 (one_addr2line): Add vector* out-param
1531 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1532 when a lineno entry appeared last for its instruction
1533 (Dwarf_line_info): Add vector* out-param
1534 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1535 * symtab.cc (Odr_violation_compare): Include the lineno in the
1537 (linenos_from_loc): New. Combine the canonical line for an
1538 address with its other lines.
1539 (True_if_intersect): New. Helper functor to make
1540 std::set_intersection a query.
1541 (detect_odr_violations): Compare sets of lines instead of just
1542 one line for each function. This became less deterministic, but
1543 has fewer false positives.
1544 * symtab.h: Declarations.
1545 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1546 mix an optimized and non-optimized object in the same binary
1547 (odr_violation2.so): Same.
1548 * testsuite/Makefile.in: Regenerate from Makefile.am.
1549 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1550 * testsuite/debug_msg.sh: Update line numbers and add
1552 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1553 non-optimized context.
1554 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1555 isn't inlined, and use OdrDerived in an optimized context.
1556 * testsuite/odr_header1.h: Defines OdrDerived, where
1557 optimization will change the
1558 first-instruction-in-the-destructor's file and line number.
1559 * testsuite/odr_header2.h: Defines OdrBase.
1563 * fileread.cc (File_read::clear_views): Don't delete the whole
1569 * fileread.cc: #include <climits>.
1570 (GOLD_IOV_MAX): Define.
1571 (File_read::read_multiple): Limit number of entries by iov_max.
1572 * fileread.h (class File_read): Always set max_readv_entries to
1578 * options.h (class General_options): Add -dy and -dn.
1582 * testsuite/script_test_9.t: Add TLS segment.
1586 * configure.ac: Add check for gnu_indirect_function support in
1587 the toolchain building binutils.
1588 * configure: Rebuild.
1592 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1593 plugin only symbols.
1594 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1595 in plugin files as not needed in the symbol table.
1599 * output.cc (Output_section::add_input_section): Delay fill
1600 generation for section ordering.
1605 * object.h (class Sized_relobj): Remove clear_local_symbols.
1606 * reloc.cc (Sized_relobj::do_relocate): Don't call
1607 clear_local_symbols.
1611 * plugin.cc (is_visible_from_outside): Return true for symbols
1616 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1621 * icf.h (is_section_foldable_candidate): Change type of parameter
1623 * icf.cc (Icf::find_identical_sections): Change type of local variable
1624 section_name to be std::string.
1625 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1629 * script.cc (script_add_extern): Rewrite to use
1630 add_symbol_reference.
1634 * icf.cc (get_section_contents): Always lock section's object.
1638 * options.h (class General_options): Accept
1639 --no-detect-odr-violations.
1643 * version.cc (version_string): Bump to 1.11.
1647 * plugin.cc (class Plugin_rescan): Define new class.
1648 (Plugin_manager::claim_file): Set any_claimed_.
1649 (Plugin_manager::save_archive): New function.
1650 (Plugin_manager::save_input_group): New function.
1651 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1653 (Plugin_manager::new_undefined_symbol): New function.
1654 (Plugin_manager::rescan): New function.
1655 (Plugin_manager::rescannable_defines): New function.
1656 (Plugin_manager::add_input_file): Set any_added_.
1657 * plugin.h (class Plugin_manager): define new fields rescannable_,
1658 undefined_symbols_, any_claimed_, and any_added_. Declare
1659 Plugin_rescan as friend. Declare new functions.
1660 (Plugin_manager::Rescannable): Define type.
1661 (Plugin_manager::Rescannable_list): Define type.
1662 (Plugin_manager::Undefined_symbol_list): Define type.
1663 (Plugin_manager::Plugin_manager): Initialize new fields.
1664 * archive.cc (Archive::defines_symbol): New function.
1665 (Add_archive_symbols::run): Pass archive to plugins if any.
1666 * archive.h (class Archive): Declare defines_symbol.
1667 * readsyms.cc (Input_group::~Input_group): New function.
1668 (Finish_group::run): Pass input_group to plugins if any.
1669 * readsyms.h (class Input_group): Declare destructor.
1670 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1675 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1677 (Layout::set_segment_offsets): Reset increase_relro before calling
1678 set_section_addresses a second time.
1682 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1683 sections before NOBITS sections.
1687 * version.cc (print_version): Update copyright to 2011.
1691 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1692 of OS to this->add. Add OD parameter to second form of the function.
1696 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1697 second of two consecutive entries with same offset.
1701 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1702 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1703 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1704 to avoid unneeded links against $(LDADD).
1705 * testsuite/Makefile.in: Regenerate.
1710 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1711 for R_X86_64_32 and R_X86_64_PC32.
1712 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1713 ver_matching_def_pic.o.
1714 (ver_matching_def_pic.o): New target.
1718 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1719 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1720 Move definition before File_read::View member definitions.
1721 (File_read::View::~View): Initialize and hold lock before
1722 updating current_mapped_bytes.
1726 * dwarf_reader.cc: Remove outdated comment.
1727 * gold-threads.cc: Fix typo in error message.
1728 * archive.cc: Fix typos in comments.
1729 * archive.h: Likewise.
1730 * arm-reloc-property.cc: Likewise.
1731 * arm-reloc-property.h: Likewise.
1732 * arm-reloc.def: Likewise.
1734 * attributes.h: Likewise.
1735 * cref.cc: Likewise.
1736 * ehframe.cc: Likewise.
1737 * fileread.h: Likewise.
1739 * i386.cc: Likewise.
1741 * incremental.h: Likewise.
1742 * int_encoding.cc: Likewise.
1743 * layout.h: Likewise.
1744 * main.cc: Likewise.
1745 * merge.h: Likewise.
1746 * object.cc: Likewise.
1747 * object.h: Likewise.
1748 * options.cc: Likewise.
1749 * readsyms.cc: Likewise.
1750 * reduced_debug_output.cc: Likewise.
1751 * reloc.cc: Likewise.
1752 * script-sections.cc: Likewise.
1753 * sparc.cc: Likewise.
1754 * symtab.h: Likewise.
1755 * target-reloc.h: Likewise.
1756 * target.cc: Likewise.
1757 * target.h: Likewise.
1758 * timer.cc: Likewise.
1759 * timer.h: Likewise.
1760 * x86_64.cc: Likewise.
1764 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1766 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1767 parameter; change all callers.
1768 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1769 * options.h (warn_execstack): New option.
1773 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1774 like function call relocations.
1778 * archive.cc (Archive::get_elf_object_for_member): Permit
1779 punconfigured to be NULL.
1780 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1781 (Archive::include_member): Pass NULL to get_elf_object_for_member
1782 if we searched for the archive and this is the first included
1787 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1788 track_relocs_type_ field.
1789 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1790 Set track_relocs_type_.
1791 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1792 contents when using RELA relocs.
1793 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1795 * reloc.cc (Track_relocs::next_addend): New function.
1796 * reloc.h (class Track_relocs): Declare next_addend.
1800 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1805 * README: Update compilers known to work and fail.
1809 * configure.in: For --enable-gold, handle value `default' instead of
1810 `both*'. Always install ld as ld.bfd, install as ld if gold is
1812 * configure: Regenerate.
1816 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1817 and right_alignment to be zero. Store result alignment only if it is
1818 greater than existing alignment.
1823 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1824 Check for ".zdebug_line".
1829 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1830 by reference; adjust all callers.
1831 * output.cc (Output_segment::set_section_addresses): Adjust references
1832 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1834 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1835 end at page boundary.
1840 * layout.cc (Layout::choose_output_section): Transform names of
1841 compressed sections even when using a script with a SECTIONS clause.
1842 (Layout::output_section_name): Remove code to transform
1843 compressed debug section names.
1844 * output.cc (Output_section::add_input_section): Use uncompressed
1845 section size when tracking input sections.
1849 * symtab.h (Symbol::NON_PIC_REF): Remove.
1850 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1851 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1852 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1853 (Symbol::use_plt_offset): Take a flags argument and pass it
1854 directly to needs_dynamic_reloc. Restrict check for undefined
1855 weak symbols to function calls.
1856 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1857 (Target_arm::Scan::global): Use it.
1858 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1859 (Target_arm::Relocate::relocate): Likewise.
1860 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1861 parameter with an r_type parameter. Use get_reference_flags
1863 (Target_arm::Relocate::relocate): Update accordingly.
1864 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1865 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1866 (Target_i386::Scan::global): Likewise.
1867 (Target_i386::Relocate::relocate): Likewise.
1868 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1869 parameter with an r_type parameter. Use get_reference_flags
1871 (Target_i386::Relocate::relocate): Update accordingly.
1872 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1873 (Target_powerpc::Scan::global): Use it.
1874 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1875 (Target_powerpc::Relocate::relocate): Likewise.
1876 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1877 (Target_sparc::Scan::global): Use it.
1878 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1879 (Target_sparc::Relocate::relocate): Likewise.
1880 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1881 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1882 (Target_x86_64::Scan::global): Likewise.
1883 (Target_x86_64::Relocate::relocate): Likewise.
1888 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1889 (Arm_exidx_merge_section::section_contents_): New data member.
1890 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1891 (Arm_input_section::~Arm_input_section): De-allocate memory.
1892 (Arm_input_section::original_contents_): New data member.
1893 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1894 in parameters instead of calling Object::section_contents without
1896 (Arm_output_section::group_section): New parameter TASK. Pass it
1897 to callees that need locking objects.
1898 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1899 to lock EXIDX input sections. Fix a formatting issue. Call
1900 Arm_exidx_merged_section::build_contents to create merged section
1902 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1903 to lock object of stub table owner.
1904 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1905 TEXT_SIZE to initialize data member TEXT_SIZE_.
1906 (Arm_exidx_input_section::addralign): Fix typo in comment.
1907 (Arm_exidx_input_section::text_size): New method.
1908 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1909 that require locking objects. Lock objects before scanning for stubs
1910 and updating local symbols.
1911 (Arm_input_section<big_endian>::init): Copy contents of original
1913 (Arm_input_section<big_endian>::do_write): Use saved contents of
1914 original input section instead of calling Object::section_contents
1916 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1917 size without calling Object::section_size().
1918 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1919 for size. Allocate a buffer for merged EXIDX entries.
1920 (Arm_exidx_merged_section::build_contents): New method.
1921 (Arm_exidx_merged_section::do_write): Move merge section contents
1922 building code to Arm_exidx_merged_section::build_contetns. Write
1923 out contetns in buffer instead of building it on the fly.
1924 (Arm_relobj::make_exidx_input_section): Also pass text section size
1925 to Arm_exidx_input_section constructor.
1926 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1927 (Arm_dynobj::do_read_symbols): Fix memory leak.
1928 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1929 * target.h: (class Task): Add forward declaration.
1930 (Target::relax): Add new parameter TASK and pass it to
1932 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1937 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1938 object when reading from the file.
1939 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1941 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1942 when reading section contents.
1943 (get_section_contents): Likewise.
1944 (icf::find_identical_sections): Likewise.
1945 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1946 object when reading from the file.
1947 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1948 the object when doing deferred section layout.
1953 * script.h (class Symbol_assignment: name): New member. Returns
1954 the name of the symbol.
1955 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1956 Returns true if the given symbol name is on the list of
1957 assignments wating to be processed.
1958 * archive.cc (should_incldue_member): If the symbol is undefined,
1959 check to see if it is on the list of symbols pending assignment.
1963 * script-sections.cc (Script_sections::find_memory_region): Check
1964 for a NULL output section pointer.
1968 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1969 Output_section::add_relaxed_input_section.
1970 * output.cc (Output_section::add_relaxed_input_section): Add new
1971 arguments LAYOUT and NAME. Set section order index.
1972 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1973 Copy section order index.
1974 * output.h (Output_section::add_relaxed_input_section): Add new
1975 arguments LAYOUT and NAME.
1979 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1980 NATIVE_OR_CROSS_LINKER.
1981 * testsuite/Makefile.in: Regenerate.
1985 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1986 without SHF_LINK_ORDER flags.
1987 * layout.cc (Layout::choose_output_section): Do not filter
1988 SHF_LINK_ORDER flag in a relocatable link.
1992 * output.h (Output_segment::set_section_addresses): Change function
1993 signature. Update all callers.
1994 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1996 (Output_segment::set_section_addresses): Align after last TLS
1997 section. Add padding before last relro section instead of after.
2001 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2002 GOT output section to be writable.
2006 * debug.h (DEBUG_INCREMENTAL): New flag.
2007 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2008 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2010 * incremental.cc (report_command_line): Ignore all forms of
2012 * layout.cc (Layout::Layout): Check parameters for incremental link
2014 * options.cc (General_options::parse_incremental): New function.
2015 (General_options::parse_no_incremental): New function.
2016 (General_options::parse_incremental_full): New function.
2017 (General_options::parse_incremental_update): New function.
2018 (General_options::incremental_mode_): New data member.
2019 (General_options::finalize): Check incremental_mode_.
2020 * options.h (General_options): Update help text for --incremental.
2021 Add --no-incremental, --incremental-full, --incremental-update.
2022 (General_options::Incremental_mode): New enum type.
2023 (General_options::incremental_mode): New function.
2024 (General_options::incremental_mode_): New data member.
2025 * parameters.cc (Parameters::incremental_mode_): New data member.
2026 (Parameters::set_options): Set incremental_mode_.
2027 (Parameters::set_incremental_full): New function.
2028 (Parameters::incremental): New function.
2029 (Parameters::incremental_update): New function.
2030 (set_parameters_incremental_full): New function.
2031 * parameters.h (Parameters::set_incremental_full): New function.
2032 (Parameters::incremental): New function.
2033 (Parameters::incremental_update): New function.
2034 (Parameters::incremental_mode_): New data member.
2035 (set_parameters_incremental_full): New function.
2036 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2037 incremental link mode.
2038 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2039 (Sized_relobj::do_relocate_sections): Likewise.
2040 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2042 * testsuite/Makefile.in: Regenerate.
2043 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2047 * script-sections.h (class Script_sections): Make
2048 Sections_elements typedef public.
2049 * script-sections.cc (class Sort_output_sections): Add elements_
2050 field. Add constructor which sets it; change all callers.
2051 (Sort_output_sections::is_before): New function.
2052 (Sort_output_sections::operator()): Call is_before.
2053 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2055 * testsuite/script_test_10.sh: New test. Test script section
2057 * testsuite/script_test_10.t: Likewise.
2058 * testsuite/script_test_10.s: Likewise.
2059 * testsuite/Makefile.am: Wrap the cross linker tests and the
2060 common tests into NATIVE_OR_CROSS_LINKER.
2061 (check_SCRIPTS): Add script_test_10.sh.
2062 (check_DATA): Add script_test_10.stdout.
2063 (script_test_10.o, script_test_10): New targets.
2064 (script_test_10.stdout): New target.
2065 * configure, testsuite/Makefile.in: Regenerate.
2069 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2070 error for the deprecated relocations.
2071 (Target_arm::Scan::global): Likewise.
2072 (Target_arm::Relocate::relocate): Likewise.
2076 * fileread.cc (Input_file::find_file): Initialize *found_name
2077 and *namep when using the fallback search for case 4.
2081 * options.h (class General_options): Redefine -z lazy as an alias for
2082 the negation of -z now.
2086 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2091 * script-sections.cc(class Memory_region): Remove
2092 current_lma_offset_ field. Rename current_vma_offset_ to
2093 current_offset_. Add last_section_ field.
2094 (Memory_region::get_current_vma_address): Rename to
2095 get_current_address.
2096 (Memory_region::get_current_lma_address): Delete.
2097 (Memory_region::increment_vma_offset): Rename to
2099 (Memory_region::increment_lma_offset): Delete.
2100 (Memory_region::attributes_compatible): New method. Returns
2101 true if the provided section is compatible with the region.
2102 (Memory_region::get_last_section): New method. Returns the last
2103 section to use the region.
2104 (Memory_region::set_last_section): New method. Stores the last
2105 section to use the region.
2106 (Script_sections::block_in_region): New method. Returns true if
2107 a block of memory is contained within a region.
2108 (Script_sections::find_memory_region): New method. Locates a
2109 memory region to be used to set a VMA or LMA address.
2110 (Output_section_definition::set_section_addresses): Add code to
2111 check for addresses set by memory regions.
2112 (Output_segment::set_section_addresses): Remove memory region
2114 (Script_sections::create_segment): Add a warning if a header
2115 segment is created outside of any region.
2116 * script-sections.h (class Script_sections): Add prototypes for
2117 find_memory_region and block_in_region methods.
2118 * testsuite/memory_test.s: Use .long instead of .word.
2119 * testsuite/memory_test.t: Add some more output sections.
2120 * testsuite/memory_test.sh: Update expected output.
2124 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2125 defintion to symtab.h
2126 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2127 declaration to defintion.
2131 * expression.cc (eval): Replace dummy argument with NULL.
2132 (eval_maybe_dot): Check for a NULL result section pointer.
2133 (Symbol_expression::value): Likewise.
2134 (Dot_expression::value): Likewise.
2135 (BINARY_EXPRESSION): Likewise.
2136 (Max_expression::value): Likewise.
2137 (Min_expression::value): Likewise.
2138 (Absolute_expression::value): Likewise.
2139 (Addr_expression::value_from_output_section): Likewise.
2140 (Loaddddr_expression::value_from_output_section): Likewise.
2141 (Segment_start_expression::value): Likewise.
2142 * script-sections.cc
2143 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2145 (Sections_elememt_dot_assignment::set_section_addresses):
2147 (Output_data_expression::do_write_to_buffer): Likewise.
2148 (Output_section_definition::finalize_symbols): Likewise.
2149 (Output_section_definition::set_section_addresses): Likewise.
2153 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2157 * target.h (Target::can_icf_inline_merge_sections): New virtual
2159 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2161 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2163 * icf.cc (get_section_contents): Inline merge sections only when
2168 * configure: Regenerate.
2172 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2173 * testsuite/Makefile.am (memory_test.o): New target.
2174 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2176 * testsuite/Makefile.in: Rebuild.
2180 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2181 defintion if relocation uses GOT entries of the symbol.
2182 * testsuite/icf_safe_test.sh: Fix test.
2183 * testsuite/icf_safe_so_test.sh: Fix test.
2187 * script_sections.cc (class Memory_region): Remove "NULL" from
2188 vector initializations.
2192 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2193 Resolve forwarding symbols.
2197 * gold/testsuite/script_test_3.t: Add ARM special sections.
2198 * gold/testsuite/script_test_4.t: Same.
2199 * gold/testsuite/script_test_5.t: Same.
2200 * gold/testsuite/script_test_6.t: Same.
2201 * gold/testsuite/script_test_7.t: Same.
2202 * gold/testsuite/script_test_7.t: Same.
2203 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2207 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2208 (Target_x86_64::Relocate::relocate_tls): Replace check for
2209 saw_tls_block_reloc_ with test for executable section.
2213 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2214 position-independent executables to shared libraries need dynamic
2216 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2217 position-independent executables.
2218 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2219 * testsuite/Makefile.in: Regenerate.
2224 * testsuite/memory_test.t: Discard any sections that are not
2230 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2231 "This::" to work around a bug in gcc 4.2.
2233 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2237 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2238 sections with different PF_X flags in the same segment.
2239 (Layout::find_first_load_seg): Search all segments to find the first
2241 * options.h (rosegment): New.
2245 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2249 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2250 (Arm_relobj::do_relocate_sections): Add new parameter for output
2251 file to match the parent.
2252 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2253 of local symbols instead of input values. Update code to track
2254 changes in gold::relocate_section.
2255 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2256 (Sized_relobj::compute_final_local_value_internal): New methods.
2257 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2258 body into private version of Sized_relobj::compute_final_local_value.
2259 Call the inline method.
2260 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2261 merged symbol value if there is one.
2262 (Symbol_value::has_output_value): New method defintiion.
2263 (Sized_relobj::Compute_final_local_value_status): New enum type.
2264 (Sized_relobj::compute_final_local_value): New methods.
2265 (Sized_relobj::compute_final_local_value_internal): New methods.
2266 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2267 and arm_cortex_a8.sh.
2268 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2269 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2271 * Makefile.in: Regenerate.
2272 * testsuite/arm_bl_out_of_range.s: Update test.
2273 * testsuite/thumb_bl_out_of_range.s: Ditto.
2274 * testsuite/thumb_blx_out_of_range.s: Ditto.
2275 * testsuite/arm_branch_out_of_range.sh: New file.
2276 * testsuite/arm_cortex_a8.sh: Ditto.
2277 * testsuite/arm_cortex_a8_b.s: Ditto.
2278 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2279 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2280 * testsuite/arm_cortex_a8_bl.s: Ditto.
2281 * testsuite/arm_cortex_a8_blx.s: Ditto.
2282 * testsuite/arm_cortex_a8_local.s: Ditto.
2283 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2284 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2288 * Makefile.am (memory_test.stdout): Run readelf with -W.
2289 * Makefile.in: Regenerate.
2290 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2295 * script-sections.cc (Script_sections::add_memory_region): Convert
2296 field precision to int.
2297 * script.cc (script_set_section_region, script_set_section_region):
2298 Convert field precision to int.
2302 * arm.cc (do_finalize_sections): Create the __exidx_start and
2303 __exdix_end symbols even when the section is missing.
2307 * README: Remove claim that MEMORY is not supported.
2308 * expression.cc (script_exp_function_origin)
2309 (script_exp_function_length): Move from here to ...
2310 * script.cc: ... here.
2311 (script_set_section_region, script_add_memory)
2312 (script_parse_memory_attr, script_include_directive): New
2314 * script-sections.cc
2315 (class Memory_region): New class.
2316 (class Output_section_definition): Add set_memory_region,
2317 set_section_vma, set_section_lma and get_section_name methods.
2318 (class Script_Sections): Add add_memory_region,
2319 find_memory_region, find_memory_region_origin,
2320 find_memory_region_length and set_memory_region methods.
2321 Have set_section_addresses method walk the list of set memory
2323 Extend the print methos to display memory regions.
2324 * script-sections.h: Add prototypes for new methods.
2325 Add enum for MEMORY region attributes.
2326 * yyscript.y: Add support for parsing MEMORY regions.
2327 * script-c.h: Add prototypes for new functions.
2328 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2329 * testsuite/Makefile.in: Regenerate.
2330 * testsuite/memory_test.sh: New script.
2331 * testsuite/memory_test.s: New assembler source file.
2332 * testsuite/memory_test.t: New linker script.
2336 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2337 reference override an existing dynamic weak reference.
2338 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2339 * testsuite/Makefile.in: Regenerate.
2340 * testsuite/dyn_weak_ref.sh: New file.
2341 * testsuite/dyn_weak_ref_1.c: Ditto.
2342 * testsuite/dyn_weak_ref_2.c: Ditto.
2346 * incremental.h (class Incremental_input_entry): Add virtual
2351 * testsuite/start_lib_test_3.c: Mark t3 as used.
2355 * options.cc (version_script): Fix small typo in previous
2360 * archive.cc: Formatting fixes: Remove whitespace between
2361 typename and following asterisk. Remove whitespace between
2362 function name and opening parenthesis.
2363 * archive.h: Likewise.
2365 * attributes.cc: Likewise.
2366 * attributes.h: Likewise.
2367 * common.cc: Likewise.
2368 * copy-relocs.cc: Likewise.
2369 * dirsearch.h: Likewise.
2370 * dynobj.cc: Likewise.
2371 * ehframe.cc: Likewise.
2372 * ehframe.h: Likewise.
2373 * expression.cc: Likewise.
2374 * fileread.cc: Likewise.
2375 * fileread.h: Likewise.
2377 * gold-threads.cc: Likewise.
2378 * gold.cc: Likewise.
2379 * i386.cc: Likewise.
2381 * incremental-dump.cc: Likewise.
2382 * incremental.cc: Likewise.
2383 * layout.cc: Likewise.
2384 * layout.h: Likewise.
2385 * main.cc: Likewise.
2386 * merge.cc: Likewise.
2387 * merge.h: Likewise.
2388 * object.cc: Likewise.
2389 * object.h: Likewise.
2390 * options.cc: Likewise.
2391 * options.h: Likewise.
2392 * output.cc: Likewise.
2393 * output.h: Likewise.
2394 * plugin.cc: Likewise.
2395 * plugin.h: Likewise.
2396 * powerpc.cc: Likewise.
2397 * reloc.cc: Likewise.
2398 * script-c.h: Likewise.
2399 * script-sections.cc: Likewise.
2400 * script.cc: Likewise.
2401 * stringpool.cc: Likewise.
2402 * symtab.cc: Likewise.
2403 * symtab.h: Likewise.
2404 * target.cc: Likewise.
2405 * timer.cc: Likewise.
2406 * timer.h: Likewise.
2407 * version.cc: Likewise.
2408 * x86_64.cc: Likewise.
2413 * layout.cc (segment_precedes): Sort segments by their physical
2414 addresses, if they have been set.
2418 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2420 (Lib_group::include_member): Unlock object after deleting its
2422 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2428 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2429 constructor, and set_blocker.
2430 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2432 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2433 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2434 * testsuite/Makefile.am (start_lib_test): New test case.
2435 * testsuite/Makefile.in: Regenerate.
2436 * testsuite/start_lib_test_main.c: New file.
2437 * testsuite/start_lib_test_1.c: New file.
2438 * testsuite/start_lib_test_2.c: New file.
2439 * testsuite/start_lib_test_3.c: New file.
2443 * Makefile.in: Rebuild with automake 1.11.1.
2444 * aclocal.m4: Likewise.
2445 * testsuite/Makefile.in: Likewise.
2450 * i386.cc (class Output_data_plt_i386): Update declarations.
2451 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2452 local_ifuncs_ fields.
2453 (Target_i386::do_plt_section_for_global): New function.
2454 (Target_i386::do_plt_section_for_local): New function.
2455 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2456 parameter; change all callers. Initialize global_ifuncs_ and
2457 local_ifuncs_. If doing a static link define __rel_iplt_start and
2459 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2460 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2461 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2463 (Target_i386::make_plt_section): New function, broken out of
2464 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2465 (Target_i386::make_plt_entry): Call make_plt_section.
2466 (Target_i386::make_local_ifunc_plt_entry): New function.
2467 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2468 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2469 R_386_IRELATIVE to switch.
2470 (Target_i386::Scan::global): Likewise.
2471 (Target_i386::Relocate::relocate): Likewise.
2472 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2474 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2475 (Target_x86_64::do_plt_section_for_global): New function.
2476 (Target_x86_64::do_plt_section_for_local): New function.
2477 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2478 parameter; change all callers. If doing a static link define
2479 __rela_iplt_start and __rela_iplt_end.
2480 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2481 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2482 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2484 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2485 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2487 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2488 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2489 R_X86_64_IRELATIVE to switch.
2490 (Target_x86_64::Scan::global): Likewise.
2491 (Target_x86_64::Relocate::relocate): Likewise.
2492 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2494 * target.h (class Target): Add plt_section_for_global and
2495 plt_section_for_local functions. Add do_plt_section_for_global
2496 and do_plt_section_for_local virtual functions.
2497 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2498 clarifying comments.
2499 (Symbol::use_plt_offset): Handle IFUNC symbol.
2500 * object.cc (Sized_relobj::Sized_relobj): Initialize
2502 (Sized_relobj::local_has_plt_offset): New function.
2503 (Sized_relobj::local_plt_offset): New function.
2504 (Sized_relobj::set_local_plt_offset): New function.
2505 (Sized_relobj::do_count): Handle IFUNC symbol.
2506 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2507 a bit away from input_shndx_ field. Add set_is_func_symbol and
2508 is_ifunc_symbol functions.
2509 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2510 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2511 local_plt_offsets_ field.
2512 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2513 * output.h (class Output_section_data): Add non-const
2514 output_section function.
2515 (class Output_data_got): Update declarations.
2516 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2517 Add use_plt_offset parameter to global and local constructors.
2518 Change all callers. Change local_sym_index_ field to 31 bits.
2519 Change GSYM_CODE and CONSTANT_CODE accordingly.
2520 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2521 doing a static link don't set sh_link field.
2522 (Output_data_got::Got_entry::write): Use PLT offset if
2524 (Output_data_got::add_global_plt): New function.
2525 (Output_data_got::add_local_plt): New function.
2526 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2527 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2528 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2529 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2530 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2532 * testsuite/ifunc-sel.h: New file.
2533 * testsuite/ifuncmain1.c: New file.
2534 * testsuite/ifuncmain1vis.c: New file.
2535 * testsuite/ifuncmod1.c: New file.
2536 * testsuite/ifuncdep2.c: New file.
2537 * testsuite/ifuncmain2.c: New file.
2538 * testsuite/ifuncmain3.c: New file.
2539 * testsuite/ifuncmod3.c: New file.
2540 * testsuite/ifuncmain4.c: New file.
2541 * testsuite/ifuncmain5.c: New file.
2542 * testsuite/ifuncmod5.c: New file.
2543 * testsuite/ifuncmain6pie.c: New file.
2544 * testsuite/ifuncmod6.c: New file.
2545 * testsuite/ifuncmain7.c: New file.
2546 * configure, testsuite/Makefile.in: Rebuild.
2551 (Output_section_incremental_inputs::write_input_files): Add cast
2552 to avoid signed/unsigned comparison warning.
2553 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2557 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2561 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2566 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2567 defintion overrides non-weak undef, remember that the original undef
2569 * symtab.cc (Symbol_table::sized_write_global): For undef without
2570 an original weak binding, set binding to global in output.
2571 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2572 * testsuite/Makefile.in: Regenerate.
2573 * testsuite/strong_ref_weak_def.sh: New file.
2574 * testsuite/strong_ref_weak_def_1.c: Ditto.
2575 * testsuite/strong_ref_weak_def_2.c: Ditto.
2579 * testsuite/incremental_test.sh: Rewrite.
2580 * testsuite/incremental_test_1.c: Rewrite.
2581 * testsuite/incremental_test_2.c: Rewrite.
2585 * arm.cc (Target_arm::got_size): Add const.
2586 (Target_arm::got_entry_count): New function.
2587 (Target_arm::plt_entry_count): New function.
2588 (Target_arm::first_plt_entry_offset): New function.
2589 (Target_arm::plt_entry_size): New function.
2590 (Output_data_plt_arm::entry_count): New function.
2591 (Output_data_plt_arm::first_plt_entry_offset): New function.
2592 (Output_data_plt_arm::get_plt_entry_size): New function.
2593 * i386.cc (Target_i386::got_size): Add const.
2594 (Target_i386::got_entry_count): New function.
2595 (Target_i386::plt_entry_count): New function.
2596 (Target_i386::first_plt_entry_offset): New function.
2597 (Target_i386::plt_entry_size): New function.
2598 (Output_data_plt_i386::entry_count): New function.
2599 (Output_data_plt_i386::first_plt_entry_offset): New function.
2600 (Output_data_plt_i386::get_plt_entry_size): New function.
2601 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2602 find_incremental_inputs_sections. Dump incremental_got_plt section.
2603 * incremental.cc: Include target.h.
2604 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2605 parameter. Adjust all callers. Find incremental_got_plt section.
2606 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2608 (Output_section_incremental_inputs::set_final_data_size): Calculate
2609 size of incremental_got_plt section.
2610 (Output_section_incremental_inputs::do_write): Write the
2611 incremental_got_plt section.
2612 (Got_plt_view_info): New struct.
2613 (Local_got_offset_visitor): New class.
2614 (Global_got_offset_visitor): New class.
2615 (Global_symbol_visitor_got_plt): New class.
2616 (Output_section_incremental_inputs::write_got_plt): New function.
2617 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2618 Add parameter. Adjust all callers.
2619 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2620 (Incremental_inputs::got_plt_section): New function.
2621 (Incremental_inputs::got_plt_section_): New data member.
2622 (Incremental_got_plt_reader): New class.
2623 * layout.cc (Layout::create_incremental_info_sections): Add the
2624 incremental_got_plt section.
2625 * object.h (Got_offset_list::get_list): New function.
2626 (Got offset_list::for_all_got_offsets): New function.
2627 (Sized_relobj::local_got_offset_list): New function.
2628 * powerpc.cc (Target_powerpc::got_size): Add const.
2629 (Target_powerpc::got_entry_count): New function.
2630 (Target_powerpc::plt_entry_count): New function.
2631 (Target_powerpc::first_plt_entry_offset): New function.
2632 (Target_powerpc::plt_entry_size): New function.
2633 (Output_data_plt_powerpc::entry_count): New function.
2634 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2635 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2636 * sparc.cc (Target_sparc::got_size): Add const.
2637 (Target_sparc::got_entry_count): New function.
2638 (Target_sparc::plt_entry_count): New function.
2639 (Target_sparc::first_plt_entry_offset): New function.
2640 (Target_sparc::plt_entry_size): New function.
2641 (Output_data_plt_sparc::entry_count): New function.
2642 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2643 (Output_data_plt_sparc::get_plt_entry_size): New function.
2644 * symtab.h (Symbol::got_offset_list): New function.
2645 (Symbol_table::for_all_symbols): New function.
2646 * target.h (Sized_target::got_entry_count): New function.
2647 (Sized_target::plt_entry_count): New function.
2648 (Sized_target::plt_entry_size): New function.
2649 * x86_64.cc (Target_x86_64::got_size): Add const.
2650 (Target_x86_64::got_entry_count): New function.
2651 (Target_x86_64::plt_entry_count): New function.
2652 (Target_x86_64::first_plt_entry_offset): New function.
2653 (Target_x86_64::plt_entry_size): New function.
2654 (Output_data_plt_x86_64::entry_count): New function.
2655 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2656 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2660 * archive.cc: Include incremental.h.
2661 (Archive::Archive): Initialize incremental_info_.
2662 (Archive::include_member): Record archive members in incremental info.
2663 (Add_archive_symbols::run): Record begin and end of an archive in
2665 (Lib_group::include_member): Record objects in incremental info.
2666 * archive.h (Incremental_archive_entry): Forward declaration.
2667 (Archive::set_incremental_info): New member function.
2668 (Archive::incremental_info): New member function.
2669 (Archive::Unused_symbol_iterator): New class.
2670 (Archive::unused_symbols_begin): New member function.
2671 (Archive::unused_symbols_end): New member function.
2672 (Archive::incremental_info_): New data member.
2673 * incremental-dump.cc (find_input_containing_global): New function.
2674 (dump_incremental_inputs): Dump new incremental info sections.
2675 * incremental.cc: Include symtab.h.
2676 (Output_section_incremental_inputs): New class.
2677 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2678 new incremental info sections.
2679 (Sized_incremental_binary::do_check_inputs): Likewise.
2680 (Incremental_inputs::report_archive): Remove.
2681 (Incremental_inputs::report_archive_begin): New function.
2682 (Incremental_inputs::report_archive_end): New function.
2683 (Incremental_inputs::report_object): New function.
2684 (Incremental_inputs::finalize_inputs): Remove.
2685 (Incremental_inputs::report_input_section): New function.
2686 (Incremental_inputs::report_script): Rewrite.
2687 (Incremental_inputs::finalize): Do nothing but finalize string table.
2688 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2689 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2690 (Incremental_inputs::create_data_sections): New function.
2691 (Incremental_inputs::relocs_entsize): New function.
2692 (Output_section_incremental_inputs::set_final_data_size): New function.
2693 (Output_section_incremental_inputs::do_write): New function.
2694 (Output_section_incremental_inputs::write_header): New function.
2695 (Output_section_incremental_inputs::write_input_files): New function.
2696 (Output_section_incremental_inputs::write_info_blocks): New function.
2697 (Output_section_incremental_inputs::write_symtab): New function.
2698 * incremental.h (Incremental_script_entry): Forward declaration.
2699 (Incremental_object_entry): Forward declaration.
2700 (Incremental_archive_entry): Forward declaration.
2701 (Incremental_inputs): Forward declaration.
2702 (Incremental_inputs_header_data): Remove.
2703 (Incremental_inputs_header): Remove.
2704 (Incremental_inputs_header_write): Remove.
2705 (Incremental_inputs_entry_data): Remove.
2706 (Incremental_inputs_entry): Remove.
2707 (Incremental_inputs_entry_write): Remove.
2708 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2709 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2710 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2711 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2713 (Incremental_input_entry): New class.
2714 (Incremental_script_entry): New class.
2715 (Incremental_object_entry): New class.
2716 (Incremental_archive_entry): New class.
2717 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2718 (Incremental_inputs::report_inputs): Remove.
2719 (Incremental_inputs::report_archive): Remove.
2720 (Incremental_inputs::report_archive_begin): New function.
2721 (Incremental_inputs::report_archive_end): New function.
2722 (Incremental_inputs::report_object): Change prototype.
2723 (Incremental_inputs::report_input_section): New function.
2724 (Incremental_inputs::report_script): Change prototype.
2725 (Incremental_inputs::get_reloc_count): New function.
2726 (Incremental_inputs::set_reloc_count): New function.
2727 (Incremental_inputs::create_data_sections): New function.
2728 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2729 (Incremental_inputs::inputs_section): New function.
2730 (Incremental_inputs::symtab_section): New function.
2731 (Incremental_inputs::relocs_section): New function.
2732 (Incremental_inputs::get_stringpool): Add const.
2733 (Incremental_inputs::command_line): Add const.
2734 (Incremental_inputs::inputs): Remove.
2735 (Incremental_inputs::command_line_key): New function.
2736 (Incremental_inputs::input_file_count): New function.
2737 (Incremental_inputs::input_files): New function.
2738 (Incremental_inputs::relocs_entsize): New function.
2739 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2740 (Incremental_inputs::finalize_inputs): Remove.
2741 (Incremental_inputs::Input_info): Remove.
2742 (Incremental_inputs::lock_): Remove.
2743 (Incremental_inputs::inputs_): Change type.
2744 (Incremental_inputs::inputs_map_): Remove.
2745 (Incremental_inputs::current_object_entry_): New data member.
2746 (Incremental_inputs::inputs_section_): New data member.
2747 (Incremental_inputs::symtab_section_): New data member.
2748 (Incremental_inputs::relocs_section_): New data member.
2749 (Incremental_inputs::reloc_count_): New data member.
2750 (Incremental_inputs_reader): New class.
2751 (Incremental_symtab_reader): New class.
2752 (Incremental_relocs_reader): New class.
2753 * layout.cc (Layout::finalize): Move finalization of incremental info
2754 and creation of incremental info sections to follow finalization of
2755 symbol table. Set offsets for postprocessing sections.
2756 (Layout::create_incremental_info_sections): Call
2757 Incremental_inputs::create_data_sections. Add incremental symtab
2758 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2759 sections to layout after input sections.
2760 * layout.h (struct Timespec): Forward declaration.
2761 (Layout::incremental_inputs): Add const.
2762 (Layout::create_incremental_info_sections): Add parameter.
2763 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2764 * object.cc: Include incremental.h.
2765 (Relobj::finalize_incremental_relocs): New function.
2766 (Sized_relobj::do_layout): Record input sections in incremental info.
2767 * object.h (Object::output_section): New function.
2768 (Object::output_section_offset): Moved from Relobj.
2769 (Object::get_incremental_reloc_base): New function.
2770 (Object::get_incremental_reloc_count): New function.
2771 (Object::do_output_section): New function.
2772 (Object::do_output_section_offset): Moved from Relobj.
2773 (Object::do_get_incremental_reloc_base): New function.
2774 (Object::do_get_incremental_reloc_count): New function.
2775 (Object::Object): Initialize new data members.
2776 (Relobj::output_section): Renamed do_output_section and moved to
2778 (Relobj::output_section_offset): Moved to Object.
2779 (Relobj::do_get_incremental_reloc_base): New function.
2780 (Relobj::do_get_incremental_reloc_count): New function.
2781 (Relobj::allocate_incremental_reloc_counts): New function.
2782 (Relobj::count_incremental_reloc): New function.
2783 (Relobj::finalize_incremental_relocs): New function.
2784 (Relobj::next_incremental_reloc_index): New function.
2785 (Relobj::reloc_counts_): New data member.
2786 (Relobj::reloc_bases_): New data member.
2787 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2788 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2789 (Sized_relobj::incremental_relocs_scan): New function.
2790 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2791 (Sized_relobj::incremental_relocs_write): New function.
2792 (Sized_relobj::incremental_relocs_write_reltype): New function.
2793 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2795 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2796 archives and object files elsewhere.
2797 (Add_symbols::run): Report object files here.
2798 (Finish_group::run): Report end of archive at end of group.
2799 * reloc.cc: Include layout.h, incremental.h.
2800 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2801 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2802 (Sized_relobj::incremental_relocs_scan): New function.
2803 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2804 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2805 (Sized_relobj::incremental_relocs_write): New function.
2806 (Sized_relobj::incremental_relocs_write_reltype): New function.
2807 * script.cc (read_input_script): Rewrite test for incremental link.
2808 Change call to Incremental_inputs::report_script.
2809 * symtab.h (Symbol_table::first_global_index): New function.
2810 (Symbol_table::output_count): New function.
2814 * arm.cc (Target_arm::merge_object_attributes): Check command line
2815 options --no-wchar-size-warning and --no-enum-size-warning.
2816 * options.h (General_options): Add ld-compatible options
2817 --no-enum-size-warning and --no-wchar-size-warning.
2821 * x86_64.cc (Target_x86_64::Scan::local): Use
2822 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2823 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2824 (Target_x86_64::Scan::global): Likewise.
2825 (Target_x86_64::Relocate::relocate): Likewise.
2826 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2831 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2832 to reserve space in merged_strings vector. Keep total input size
2834 (Output_merge_string::do_print_merge_stats): Print total input size.
2835 * merge.h (Output_merge_string): Add input_size_ field.
2836 * stringpool.cc (Stringpool_template::string_length): Move
2837 implementations out of Stringpool_template class and place in
2839 * stringpool.h (string_length): Move out of Stringpool_template.
2844 * layout.cc (relaxation_loop_body): If address of load segment is
2845 set, adjust address to include headers if possible.
2849 * version.cc (version_string): Bump to 1.10.
2854 * layout.h (enum Output_section_order): Define.
2855 (class Layout): Update declarations.
2856 * layout.cc (Layout::get_output_section): Add order parameter.
2857 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2858 is_first_non_relro parameters. Change all callers.
2859 (Layout::choose_output_section): Likewise.
2860 (Layout::add_output_section_data): Likewise.
2861 (Layout::make_output_section): Likewise. Set order.
2862 (Layout::default_section_order): New function.
2863 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2864 * output.cc (Output_section::Output_section): Initialize order_.
2865 Don't initialize deleted fields.
2866 (Output_segment::Output_segment): Don't initialize deleted
2868 (Output_segment::add_output_section_to_load): New function
2869 replacing add_output_section. Change all callers to call this or
2870 add_output_section_to_nonload.
2871 (Output_segment::add_output_section_to_nonload): New function.
2872 (Output_segment::remove_output_section): Rewrite.
2873 (Output_segment::add_initial_output_data): Likewise.
2874 (Output_segment::has_any_data_sections): Likewise.
2875 (Output_segment::is_first_section_relro): Likewise.
2876 (Output_segment::maximum_alignment): Likewise.
2877 (Output_segment::has_dynamic_reloc): New function replacing
2878 dynamic_reloc_count. Change all callers.
2879 (Output_segment::has_dynamic_reloc_list): New function replacing
2880 dynamic_reloc_count_list. Change all callers.
2881 (Output_segment::set_section_addresses): Rewrite.
2882 (Output_segment::set_offset): Rewrite.
2883 (Output_segment::find_first_and_last_list): Remove.
2884 (Output_segment::set_tls_offsets): Rewrite.
2885 (Output_segment::first_section_load_address): Likewise.
2886 (Output_segment::output_section_count): Likewise.
2887 (Output_segment::section_with_lowest_load_address): Likewise.
2888 (Output_segment::write_section_headers): Likewise.
2889 (Output_segment::print_sections_to_map): Likewise.
2890 * output.h (class Output_data): Remove dynamic_reloc_count_
2891 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2892 (Output_data::add_dynamic_reloc): Rewrite.
2893 (Output_data::has_dynamic_reloc): New function.
2894 (Output_data::dynamic_reloc_count): Remove.
2895 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2896 is_last_relro_, is_first_non_relro_, is_interp_,
2897 is_dynamic_linker_section_ fields. Add order and set_order
2898 functions. Remove is_relro_local, set_is_relro_local,
2899 is_last_relro, set_is_last_relro, is_first_non_relro,
2900 set_is_first_non_relro functions, is_interp, set_is_interp,
2901 is_dynamic_linker_section, and set_is_dynamic_linker_section
2903 (class Output_segment): Change Output_data_list from std::list to
2904 std:;vector. Add output_lists_ field. Remove output_data_ and
2905 output_bss_ fields. Update declarations.
2909 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2910 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2911 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2916 * script.cc (Script_options::Script_options): Initialize
2917 symbol_definitions_ and symbol_references_.
2918 (Script_options::add_symbol_assignment): Update
2919 symbol_definitions_ and symbol_references_.
2920 (Script_options::add_symbol_reference): New function.
2921 (script_symbol): New function.
2922 * script.h (class Script_options): Add symbol_definitions_ and
2923 symbol_references_ fields.
2924 (Script_options::referenced_const_iterator): New type.
2925 (Script_options::referenced_begin): New function.
2926 (Script_options::referenced_end): New function.
2927 (Script_options::is_referenced): New function.
2928 (Script_options::any_unreferenced): New function.
2929 * script-c.h (script_symbol): Declare.
2930 * yyscript.y (exp): Call script_symbol.
2931 * symtab.cc: Include "script.h".
2932 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2933 Change all callers. Check symbols referenced by scripts.
2934 (Symbol_table::add_undefined_symbols_from_command_line): Add
2935 layout parameter. Change all callers.
2936 (Symbol_table::do_add_undefined_symbols_from_command_line):
2937 Likewise. Break out loop body. Check symbols referenced by
2939 (Symbol_table::add_undefined_symbol_from_command_line): New
2940 function broken out of
2941 do_add_undefined_symbols_from_command_line.
2942 * symtab.h (class Symbol_table): Update declarations.
2943 * archive.cc: Include "layout.h".
2944 (Archive::should_include_member): Add layout parameter. Change
2945 all callers. Check for symbol mentioned in expression.
2946 * archive.h (class Archive): Update declaration.
2947 * object.cc (Sized_relobj::do_should_include_member): Add layout
2949 * object.h (Object::should_include_member): Add layout parameter.
2951 (Object::do_should_include_member): Add layout parameter.
2952 (class Sized_relobj): Update declaration.
2953 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2955 * dynobj.h (class Sized_dynobj): Update declaration.
2956 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2958 * plugin.h (class Sized_pluginobj): Update declaration.
2963 * output.cc (Output_segment::set_offset): Search for the first and
2964 last sections rather than assuming that the list is in order.
2965 (Output_segment::find_first_and_last_list): New function.
2966 * output.h (class Output_segment): Update declarations.
2967 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2968 (relro_strip_test_SOURCES): New variable.
2969 (relro_strip_test_DEPENDENCIES): New variable.
2970 (relro_strip_test_LDFLAGS): New variable.
2971 (relro_strip_test_LDADD): New variable.
2972 (relro_strip_test.so): New target.
2976 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2977 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2978 (Target_i386::got_tlsdesc_section): New function.
2979 (Target_i386::got_section): Create space for GOT entries for
2980 TLSDESC relocations.
2981 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2983 (Target_i386::Scan::global): Likewise.
2984 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2986 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2987 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2988 (Target_x86_64::got_tlsdesc_section): New function.
2989 (Target_x86_64::got_section): Create space for GOT entries for
2990 TLSDESC relocations.
2991 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2993 (Target_x86_64::Scan::global): Likewise.
2994 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2999 * testsuite/final_layout.sh: Use dc to convert from hex to
3004 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3005 paramter to the call to gold::gc_process_relocs.
3006 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3007 paramter to the call to gold::gc_process_relocs.
3008 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3009 parameter to the call to gold::gc_process_relocs.
3010 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3011 template parameter to the call to gold::gc_process_relocs.
3012 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3013 paramter to the call to gold::gc_process_relocs.
3014 * gc.h (get_embedded_addend_size): New function.
3015 (gc_process_relocs): Save the size of the reloc for use by ICF.
3016 * icf.cc (get_section_contents): Get the addend from the text section
3017 for SHT_REL relocation sections.
3018 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3019 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3020 * int_encoding.h (read_from_pointer): New overloaded function.
3021 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3022 * testsuite/icf_sht_rel_addend_test.sh: New file.
3023 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3024 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3028 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3029 * Makefile.in: Regenerate.
3030 * testsuite/Makefile.in: Regenerate.
3034 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3035 * gold/testsuite/debug_msg.cc: Likewise.
3036 * gold/testsuite/odr_violation1.cc
3037 * gold/testsuite/odr_violation2.cc
3041 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3042 string, and length fields.
3043 (Output_merge_string::Merged_strings_list): New type.
3044 (Output_merge_string::Merged_strings_lists): New typedef.
3045 (Output_merge_string): Replace merged_strings_ with
3046 merged_strings_lists_.
3047 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3048 Merged_strings_list per input object and section. Don't store pointer
3049 to the string. Don't store length with each merged string entry.
3050 (Output_merge_string::finalize_merged_data): Loop over list of merged
3051 strings lists. Recompute length of each merged string.
3055 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3060 * descriptors.cc (Descriptors::open): Report correct name in error
3065 * arm.cc (Arm_input_section::Arm_input_section): For a
3066 SHT_ARM_EXIDX section, always keeps the input sections.
3067 (Arm_input_section::set_exidx_section_link): New method.
3068 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3069 has_errors_ to false.
3070 (Arm_exidx_input_section::has_errors,
3071 Arm_exidx_input_section::set_has_errors): New methods.
3072 (Arm_exidx_input_section::has_errors_): New data member.
3073 (Arm_relobj::get_exidx_shndx_list): New method.
3074 (Arm_output_section::append_text_sections_to_list): Do not skip
3075 section without SHF_EXECINSTR.
3076 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3078 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3079 section header. Make error messages more verbose. Check for
3080 a non-executable section linked to an EXIDX section.
3081 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3082 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3083 check that there is no deferred EXIDX section if we exit early.
3084 Instead of not making an EXIDX section in case of an error, make one
3085 and set the has_errors flag of it.
3086 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3087 in a relocatable link.
3088 (Target_arm::do_relax): Look for the EXIDX output section instead of
3089 assuming that it is called .ARM.exidx.
3090 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3091 section list. Do not check for SHF_EXECINSTR section flags but
3092 skip any input section with errors.
3093 * output.cc (Output_section::Output_section): Initialize
3094 always_keeps_input_sections_ to false.
3095 (Output_section::add_input_section): Check for
3096 always_keeps_input_sections_.
3097 * output.h (Output_section::always_keeps_input_sections,
3098 Output_section::set_always_keeps_input_sections): New methods.
3099 (Output_section::always_keeps_input_sections): New data member.
3103 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3104 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3109 * output.h (Output_section_lookup_maps::add_merge_section):
3110 Correct check of whether value was inserted.
3111 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3112 (Output_section_lookup_maps::add_relaxed_input_section):
3114 * arm.cc (Target_arm::got_section): Remove used local os.
3115 * i386.cc (Target_i386::got_section): Likewise.
3116 * x86_64.cc (Target_x86_64::got_section): Likewise.
3117 * sparc.cc (Target_sparc::got_section): Likewise.
3118 (Target_sparc::relocate): Remove unused local have_got_offset.
3119 * powerpc.cc (Target_powerpc::relocate): Likewise.
3123 * compressed_output.cc (zlib_decompress): Fix signature in
3126 * archive.cc (Archive::include_member): Unlock an external member
3127 of a thin archive. Don't bother to delete an object we know is
3132 * compressed_output.cc (zlib_decompress): New function.
3133 (get_uncompressed_size): New function.
3134 (decompress_input_section): New function.
3135 * compressed_output.h (get_uncompressed_size): New function.
3136 (decompress_input_section): New function.
3137 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3138 Handle compressed debug sections.
3139 * layout.cc (is_compressed_debug_section): New function.
3140 (Layout::output_section_name): Map compressed section names to
3142 * layout.h (is_compressed_debug_section): New function.
3143 (is_debug_info_section): Recognize compressed debug sections.
3144 * merge.cc: Include compressed_output.h.
3145 (Output_merge_data::do_add_input_section): Handle compressed
3147 (Output_merge_string::do_add_input_section): Handle compressed
3149 * object.cc: Include compressed_output.h.
3150 (Sized_relobj::Sized_relobj): Initialize new data members.
3151 (build_compressed_section_map): New function.
3152 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3153 * object.h (Object::section_is_compressed): New method.
3154 (Object::do_section_is_compressed): New method.
3155 (Sized_relobj::Compressed_section_map): New type.
3156 (Sized_relobj::do_section_is_compressed): New method.
3157 (Sized_relobj::compressed_sections_): New data member.
3158 * output.cc (Output_section::add_input_section): Handle compressed
3160 * reloc.cc: Include compressed_output.h.
3161 (Sized_relobj::write_sections): Handle compressed debug sections.
3165 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3166 weak when resolving to a dynamic def.
3167 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3168 for weak undef/dynamic def cases. Adjust callers.
3169 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3170 undef_binding_weak_.
3171 (Symbol_table::sized_write_globals): Adjust symbol binding.
3172 (Symbol_table::sized_write_symbol): Add binding parameter.
3173 * symtab.h (Symbol::set_undef_binding): New method.
3174 (Symbol::is_undef_binding_weak): New method.
3175 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3176 (Symbol_table::should_override): Add new parameter.
3177 (Symbol_table::sized_write_symbol): Add new parameter.
3179 * testsuite/weak_undef_file1.cc: Add new test case.
3180 * testsuite/weak_undef_file2.cc: Fix header comment.
3181 * testsuite/weak_undef_test.cc: Add new test case.
3185 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3186 Initialize USE_SYMBOL_.
3187 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3189 (Arm_reloc_property::uses_symbol_): New data member declaration.
3190 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3191 uses symbol value and symbol is undefined but not weakly undefined.
3195 * plugin.cc (Plugin::load): Use dlerror.
3199 * symtab.cc (detect_odr_violations): When reporting an ODR
3200 violation, report an object where the symbol is defined.
3204 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3205 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3207 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3208 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3209 target hook to detect function points.
3210 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3211 * icf.h (Icf::check_section_for_function_pointers): Change type of
3212 parameter SECTION_NAME to const reference to std::string. Use
3213 target hook to determine if section may have unsafe pointers.
3214 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3219 * fileread.cc (Input_file::find_fie): New
3220 (Input_file::open): Use Input_file::find_fie.
3221 * fileread.h (Input_file::find_fie): New
3222 * plugin.cc (set_extra_library_path): New.
3223 (Plugin::load): Add set_extra_library_path to the transfer vector.
3224 (Plugin_manager::set_extra_library_path): New.
3225 (Plugin_manager::add_input_file): Use the extra search path if set.
3226 (set_extra_library_path(): New.
3227 * plugin.h (Plugin_manager): Add set_extra_library_path and
3232 * layout.cc (gdb_sections): Add .debug_types.
3233 (lines_only_debug_sections): Likewise.
3237 * plugin.cc (add_input_file,add_input_library)
3238 (Plugin_manager::add_input_file): Make filename arguments const.
3239 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3244 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3245 .ARM.attributes section if we have not merged any input
3246 attributes sections.
3250 * arm.cc: Allow combining objects with no EABI version
3255 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3259 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3260 (struct iovec): Correct !HAVE_READV definition.
3264 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3265 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3267 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3270 * symtab.h (Symbol::is_placeholder): New member function.
3271 * target-reloc.h (relocate_section): Check for placeholder symbols.
3273 * testsuite/Makefile.am (plugin_test_8): New test.
3274 (plugin_test_9): New test.
3275 * testsuite/Makefile.in: Regenerate.
3279 * yyscript.y (input_list_element): Allow strings prefixed with
3280 the '-' character. Treat these as libraries.
3281 * script.cc (script_add_library): New function. Adds a library
3282 specified by "-l<name>" found in an input script.
3283 * script-c.h: Add prototype for script_add_library.
3287 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3288 Restrict stub-group size to be within long conditional branch
3289 range when working around cortex-A8 erratum.
3293 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3300 (Output_section::Input_section_sort_entry::compare_section_ordering):
3301 Change to return non-zero correctly.
3302 (Output_section::Input_section_sort_section_order_index_compare
3303 ::operator()): Change to fix ambiguity in comparisons.
3307 * gold.h (is_wildcard_string): New function.
3308 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3309 (Layout::layout_eh_frame): Ditto.
3310 (Layout::find_section_order_index): New method.
3311 (Layout::read_layout_from_file): New method.
3312 * layout.h (Layout::find_section_order_index): New method.
3313 (Layout::read_layout_from_file): New method.
3314 (Layout::input_section_position_): New private member.
3315 (Layout::input_section_glob_): New private member.
3316 * main.cc (main): Call read_layout_from_file here.
3317 * options.h (--section-ordering-file): New option.
3318 * output.cc (Output_section::input_section_order_specified_): New
3320 (Output_section::Output_section): Initialize new member.
3321 (Output_section::add_input_section): Add new parameter.
3322 Keep input sections when --section-ordering-file is used.
3323 (Output_section::set_final_data_size): Sort input sections when
3324 section ordering file is specified.
3325 (Output_section::Input_section_sort_entry): Add new parameter.
3327 (Output_section::Input_section_sort_entry::compare_section_ordering):
3329 (Output_section::Input_section_sort_compare::operator()): Change to
3330 consider section_order_index.
3331 (Output_section::Input_section_sort_init_fini_compare::operator()):
3332 Change to consider section_order_index.
3333 (Output_section::Input_section_sort_section_order_index_compare
3334 ::operator()): New method.
3335 (Output_section::sort_attached_input_sections): Change to sort
3336 according to section order when specified.
3337 (Output_section::add_input_section<32, true>): Add new parameter.
3338 (Output_section::add_input_section<64, true>): Add new parameter.
3339 (Output_section::add_input_section<32, false>): Add new parameter.
3340 (Output_section::add_input_section<64, false>): Add new parameter.
3341 * output.h (Output_section::add_input_section): Add new parameter.
3342 (Output_section::input_section_order_specified): New
3344 (Output_section::set_input_section_order_specified): New method.
3345 (Input_section::Input_section): Initialize section_order_index_.
3346 (Input_section::section_order_index): New method.
3347 (Input_section::set_section_order_index): New method.
3348 (Input_section::section_order_index_): New member.
3349 (Input_section::Input_section_sort_section_order_index_compare): New
3351 (Output_section::input_section_order_specified_): New member.
3352 * script-sections.cc (is_wildcard_string): Delete and move modified
3354 (Output_section_element_input::Output_section_element_input): Modify
3355 call to is_wildcard_string.
3356 (Output_section_element_input::Input_section_pattern
3357 ::Input_section_pattern): Ditto.
3358 (Output_section_element_input::Output_section_element_input): Ditto.
3359 * testsuite/Makefile.am (final_layout): New test case.
3360 * testsuite/Makefile.in: Regenerate.
3361 * testsuite/final_layout.cc: New file.
3362 * testsuite/final_layout.sh: New file.
3366 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3370 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3371 visibility of symbols.
3375 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3376 from start of output section instead of address for a local symbol
3377 in a merged or relaxed section when doing a relocatable link.
3382 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3383 adding sections the garbage collector removed.
3384 * gold/testsuite/Makefile.am: Add test.
3385 * gold/testsuite/Makefile.in: Regenerate.
3386 * gold/testsuite/plugin_test_7.sh: New.
3387 * gold/testsuite/plugin_test_7_1.c: New.
3388 * gold/testsuite/plugin_test_7_2.c: New.
3392 * script-sections.cc (Output_section_definition::set_section_addresses):
3393 Check for --section-start.
3397 * arm.cc (Arm_scan_relocatable_relocs): New class.
3398 (Target_arm::relocate_special_relocatable): New method.
3399 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3400 (Arm_relocate_functions::thumb_branch_common): Same.
3401 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3402 instead of Default_scan_relocatable_relocs.
3403 * target-reloc.h (relocate_for_relocatable): Let target handle
3404 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3405 * target.h (Sized_target::relocate_special_relocatable): New method.
3409 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3413 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3415 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3416 with a direct branch, not a conditional branch, to a stub.
3417 * merge.cc (Output_merge_base::record_input_section): New method
3419 (Output_merge_data::do_add_input_section): Record input section if
3420 keeps-input-sections flag is set.
3421 (Output_merge_string::do_add_input_section): Ditto.
3422 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3423 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3425 (Output_merge_base::keeps_input_sections,
3426 Output_merge_base::set_keeps_input_sections,
3427 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3429 (Output_merge_base::Input_sections): New type declaration.
3430 (Output_merge_base::input_sections_begin,
3431 Output_merge_base::input_sections_end,
3432 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3433 (Output_merge_base::bool keeps_input_sections_,
3434 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3435 Output_merge_base::input_sections_): New data members.
3436 (Output_merge_data::do_set_keeps_input_sections): New method
3438 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3439 * output.cc (Output_section::Input_section::relobj): Move method
3440 defintion from class declaration to here and handle merge sections.
3441 (Output_section::Input_section::shndx): Ditto.
3442 (Output_section::Output_section): Remove initializations of removed
3443 data members and initialize new data member LOOKUP_MAPS_.
3444 (Output_section::add_input_section): Set keeps-input-sections flag
3445 for a newly created merge output section as appropriate. Adjust code
3446 to use Output_section_lookup_maps class.
3447 (Output_section::add_relaxed_input_section): Adjst code for lookup
3448 maps code refactoring.
3449 (Output_section::add_merge_input_section): Add a new parameter
3450 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3451 class. If adding input section to a newly created merge output
3452 section fails, remove the new merge section.
3453 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3454 Adjust code for use of the Output_section_lookup_maps class.
3455 (Output_section::find_merge_section): Ditto.
3456 (Output_section::build_lookup_maps): New method defintion.
3457 (Output_section::find_relaxed_input_section): Adjust code to use
3458 Output_section_lookup_maps class.
3459 (Output_section::get_input_sections): Export merge sections. Adjust
3460 code to use Output_section_lookup_maps class.
3461 (Output_section:::add_script_input_section): Adjust code to use
3462 Output_section_lookup_maps class. Update lookup maps for merge
3464 (Output_section::discard_states): Use Output_section_lookup_maps.
3465 (Output_section::restore_states): Same.
3466 * output.h (Merge_section_properties): Move class defintion out of
3468 (Output_section_lookup_maps): New class.
3469 (Output_section::Input_section::is_merge_section): New method
3471 (Output_section::Input_section::relobj): Move defintion out of class
3472 defintion. Declare method only.
3473 (Output_section::Input_section::shndx): Ditto.
3474 (Output_section::Input_section::output_merge_base): New method defintion.
3475 (Output_section::Input_section::u2_.pomb): New union field.
3476 (Output_section::Merge_section_by_properties_map,
3477 Output_section::Output_section_data_by_input_section_map,
3478 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3480 (Output_section::add_merge_input_section): Add new parameter
3481 KEEPS_INPUT_SECTIONS.
3482 (Output_section::build_lookup_maps): New method declaration.
3483 (Output_section::merge_section_map_,
3484 Output_section::merge_section_by_properties_map_,
3485 Output_section::relaxed_input_section_map_,
3486 Output_section::is_relaxed_input_section_map_valid_): Remove data
3488 (Output_section::lookup_maps_): New data member.
3493 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3494 avoid a compilation error.
3498 * script-sections.cc (Output_section_definition::allocate_to_segment):
3499 Update the phdrs_list even when the output section is NULL.
3500 * testsuite/Makefile.am: Add test.
3501 * testsuite/Makefile.in: Regenerate.
3502 * testsuite/script_test_9.cc: New.
3503 * testsuite/script_test_9.sh: New.
3504 * testsuite/script_test_9.t: New.
3508 * arm.cc (Arm_input_section::original_size): New method.
3509 (Arm_input_section::do_addralign): Add a cast.
3510 (Arm_input_section::do_output_offset): Remove static cast.
3511 (Arm_input_section::original_addralign,
3512 Arm_input_section::original_size_): Change type to uint32_t.
3513 (Arm_input_section::init): Add safe casts for section alignment
3515 (Arm_input_section::set_final_data_size): Do not set address and
3516 offset of stub table.
3517 (Arm_output_section::fix_exidx_coverage): Change use of of
3518 Output_section::Simple_input_section to that of
3519 Output_section::Input_section.
3520 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3521 except for the first pass.
3522 * output.cc (Output_section::get_input_sections): Change type of
3523 input_sections to std::list<Input_section>.
3524 (Output_section::add_script_input_section): Rename from
3525 Output_section::add_simple_input_section. Change type of SIS
3526 parameter from Simple_input_section to Input_section.
3527 * output.h (Output_section::Simple_input_section): Remove class.
3528 (Output_section::Input_section): Change class visibility to public.
3529 (Output_section::Input_section::addralign): Use stored alignments
3530 for special input sections if set.
3531 (Output_section::Input_section::set_addralign): New method.
3532 (Output_section::get_input_sections): Change parameter type from
3533 list of Simple_input_section to list of Input_section.
3534 (Output_section::add_script_input_section): Rename from
3535 Output_section::add_simple_input_section. Change first parameter's
3536 type from Simple_input_section to Input_section and remove the
3537 second and third parameters.
3538 * script-sections.cc (Input_section::Input_section_list): Change
3539 type to list of Output_section::Input_section/
3540 (Input_section_info::Input_section_info): Change parameter type of
3541 INPUT_SECTION to Output_section::Input_section.
3542 (Input_section_info::input_section): Change return type.
3543 (Input_section_info::input_section_): Change type to
3544 Output_section::Input_section.
3545 (Output_section_element_input::set_section_addresses): Adjust code
3546 to use Output_section::Input_section instead of
3547 Output_section::Simple_input_section. Adjust code for renaming
3548 of Output_section::add_simple_input_section.
3549 (Orphan_output_section::set_section_addresses): Ditto.
3553 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3554 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3558 * options.cc (General_options::finalize): Handle -nostdlib.
3559 * options.h (nostdlib): New option.
3560 * script.cc (script_add_search_dir): Handle -nostdlib.
3564 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3565 attributes section only if there no attributes section after merging.
3566 (Target_arm::merge_object_attributes): Move value of
3567 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3568 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3569 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3570 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3571 and arm_attr_merge_7.stdout.
3572 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3573 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3574 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3575 arm_attr_merge_7b.o): New rules.
3576 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3578 * testsuite/Makefile.in: Regenerate.
3579 * testsuite/arm_attr_merge.sh: New file.
3580 * testsuite/arm_attr_merge_[67][ab].s: Same.
3584 * po/es.po: Updated Spanish translation.
3588 * Makefile.am (install-exec-local): Properly install gold as
3589 default cross linker.
3590 * Makefile.in: Regenerated.
3595 * configure.ac (install_as_default): Define and set to false
3596 unless --enable-gold or --enable-gold=both/gold has been
3598 * configure: Regenerate.
3600 * Makefile.am (install-exec-local): Install the executable as
3601 'ld.gold'. If install_as_default is true then also install it as
3603 * Makefile.in: Regenerated.
3607 * layout.cc (Layout::layout_reloc): In relocatable link don't
3608 combine reloc sections for grouped sections.
3612 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3613 sections that are not ordinary to icf.
3614 * icf.cc (get_section_contents): Handle relocation pointing to section
3615 with no object or shndx information.
3616 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3617 * testsuite/Makefile.in: Regenerate.
3618 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3619 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3623 * expression.cc (Expression::Expression_eval_info): Add
3624 result_alignment_pointer field.
3625 (Expression::eval_with_dot): Add result_alignment_pointer
3626 parameter. Change all callers.
3627 (Expression::eval_maybe_dot): Likewise.
3628 (class Binary_expression): Add alignment_pointer parameter to
3629 left_value and right_value. Change all callers.
3630 (BINARY_EXPRESSION): Set result alignment.
3631 (class Trinary_expression): Add alignment_pointer parameter to
3632 arg2_value and arg3_value. Change all callers.
3633 (Trinary_cond::value): Set result alignment.
3634 (Max_expression::value, Min_expression::value): Likewise.
3635 (Align_expression::value): Likewise.
3636 * script-sections.cc (class Sections_element): Add dot_alignment
3637 parameter to set_section_addresses virtual function. Update
3639 (class Output_section_element): Likewise.
3640 (Script_sections::create_segments): Add dot_alignment parameter.
3642 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3643 (Script_sections::set_phdrs_clause_addresses): Likewise.
3644 * script-sections.h: Update declarations.
3645 * script.h: Update declarations.
3646 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3648 * testsuite/script_test_3.t: Set large alignment.
3649 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3650 segment has expected alignment.
3654 * po/gold.pot: Updated by the Translation project.
3655 * po/vi.po: Updated Vietnamese translation.
3659 * testsuite/Makefile.am (check_PROGRAMS): Add
3660 icf_virtual_function_folding_test.
3661 * testsuite/Makefile.in: Regenerated.
3665 * options.h (merge_exidx_entries): New option.
3666 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3667 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3668 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3669 (Target_arm::merge_exidx_entries): New function.
3670 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3671 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3672 to Arm_exidx_fixup constructor.
3673 Add new arg, merge_exidx_entries.
3674 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3675 Arm_output_section::fix_exidx_coverage.
3679 * icf.cc (get_section_contents): Check for preemptible functions.
3680 Ignore addend when appropriate.
3681 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3683 (add_from_relobj): Check for section folded.
3684 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3685 * symtab.h (should_add_dynsym_entry): Add new parameter.
3686 * target-reloc.h (scan_relocs): Check for section folded.
3687 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3688 Check reloc types for function pointers in shared objects.
3689 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3691 (icf_preemptible_functions_test): New test case.
3692 (icf_string_merge_test): New test case.
3693 * testsuite.Makefile.in: Regenerate.
3694 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3695 bar_glob. Refactor code.
3696 * testsuite/icf_preemptible_functions_test.cc: New file.
3697 * testsuite/icf_preemptible_functions_test.sh: New file.
3698 * testsuite/icf_string_merge_test.cc: New file.
3699 * testsuite/icf_string_merge_test.sh: New file.
3700 * testsuite/icf_virtual_function_folding_test.cc: New file.
3701 * testsuite/icf_virtual_function_folding_test.sh: New file.
3705 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3706 for local symbol recounting if we remove a section due to ICF.
3707 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3708 there are no regular objects in input.
3712 * arm.cc (Arm_input_section::set_final_data_size): Compute
3713 accurate final data size instead of using current data size.
3717 * layout.cc (Layout::choose_output_section): Handle script section
3719 (Layout::make_output_section_for_script): Add section type parameter.
3720 Handle script section types.
3721 * layout.h (Layout::make_output_section_for_script): Add section
3723 * output.cc (Output_section::Output_section): Initialize data member
3725 (Output_section::do_reset_address_and_file_offset): Do not set address
3726 to 0 if section is a NOLOAD section.
3727 * output.h (Output_section::is_noload): New method.
3728 (Output_section::set_is_noload): Ditto.
3729 (Output_section::is_noload_): New data member.
3730 * script-c.h (Script_section_type): New enum type.
3731 (struct Parser_output_section_header): Add new file section_type.
3732 * script-sections.cc (Sections_element::output_section_name): Add
3733 parameter for returning script section type.
3734 (Output_section_definition::output_section_name): Ditto.
3735 (Output_section_definition::section_type)P; New method.
3736 (Output_section_definiton::script_section_type_name): Ditto.
3737 (Output_section_definition::script_section_type_): New data member.
3738 (Output_section_definition::Output_section_definition): Initialize
3739 data member Output_section_definition::script_section_type_.
3740 (Output_section_definition::create_sections): Pass script section type
3741 to Layout::make_output_section_for_script.
3742 (Output_section_definition::output_section_name): Return script
3743 section type to caller.
3744 (Output_section_definition::set_section_address): Do not advance
3745 dot value and load address if section type is NOLOAD. Set address
3746 of NOLOAD sections regardless of section flags.
3747 (Output_section_definition::print): Print section type if it is
3748 not SCRIPT_SECTION_TYPE_NONE.
3749 (Output_section_definition::section_type): New method.
3750 (Output_section_definition::script_section_type_name): Ditto.
3751 (Script_sections::output_section_name): Add new parameter
3752 PSECTION_TYPE for returning script section type. Pass it to
3753 section elements. Handle discard sections.
3754 (Sort_output_sections::operator()): Handle NOLOAD sections.
3755 * script-sections.h (Script_sections::Section_type): New enum type.
3756 (Script_sections::output_section_name): Add a new parameter for
3757 returning script section type.
3758 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3760 * yyscript.y (union): Add new field SECTION_TYPE.
3761 (COPY, DSECT, INFO, NOLOAD): New tokens.
3762 (opt_address_and_section_type): Change type to output_section_header.
3763 (section_type): New non-terminal
3764 (section_header): Handle section type.
3765 (opt_address_and_section_type): Return section type value.
3769 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3770 * testsuite/plugin_common_test_2.c (foo): Likewise.
3774 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3776 * output.cc (Output_section::add_merge_input_section): Simplify
3777 code and return status of Output_merge_base::add_input_section.
3778 Update merge section map only if Output_merge_base::add_input_section
3783 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3784 if section is marked as containing instructions but has no mapping
3786 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3787 correct section index.
3788 (Arm_relobj::find_linked_text_section): Ditto.
3792 * archive.cc (include_member): Destroy Read_symbols_data object before
3794 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3795 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3796 (Read_symbols_data::~Read_symbols_data) New destructor.
3797 (Section_relocs::Section_relocs) New constructor.
3798 (Section_relocs::~Section_relocs) New destructor.
3799 (Read_relocs_data::Read_relocs_data) New constructor.
3800 (Read_relocs_data::~Read_relocs_data) New destructor.
3801 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3802 pointers to NULL after deleting.
3806 * arm.cc: Replace "endianity" with "endianness" in comments.
3807 (Arm_exidx_cantunwind): Ditto.
3808 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3809 (Arm_relobj::merge_flags_and_attributes): New method.
3810 (Arm_relobj::merge_flags_and_attributes_): New data member.
3811 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3812 (Arm_relobj::scan_sections_for_stubs): Ditto.
3813 (Arm_relobj::do_read_symbols): Check to see if we really want to
3814 merge processor-specific flags and attributes. Exit early if
3815 an object is empty except for section names and the undefined symbol.
3816 (Target_arm::do_finalize_sections): Move check for ELF format to
3817 Arm_relobj::do_read_symbols. Merge processor specific flags and
3818 attributes from a regular object only when we have determined that
3819 it is aapropriate. Do not create an .ARM.attributes section in
3820 output if there is no regular input object.
3821 (Target_arm::merge_processor_specific_flags): Check
3822 --warn-mismatch before printing any error.
3823 (Target_arm::merge_object_attributes): Ditto.
3824 * gold.cc (queue_middle_tasks): Handle the case in which there is
3825 no regular object in input.
3826 * options.cc (General_options::parse_EB): New method.
3827 (General_options::parse_EL): Same.
3828 (General_options::General_options): Initialize endianness_.
3829 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3831 (General_options::Endianness): New enum.
3832 (General_options::endianness): New method.
3833 (General_options::endianness_): New data member.
3834 * parameters.cc (Parameters::set_options): Check target endianness.
3835 (Parameters::set_target_once): Ditto.
3836 (Parameters::check_target_endianness): New method.
3837 (parameters_force_valid_target): If either -EL or -EB is specified,
3838 use it to define endianness of default target.
3839 * parameters.h (Parameters::check_target_endianness): New method
3841 * target.h (class Target): Change "endianity" to "endianness"
3846 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3847 * configure: Regenerate.
3848 * Makefile.in: Regenerate.
3849 * testsuite/Makefile.in: Regenerate.
3854 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3855 prevailing definitions of common symbols.
3856 * testsuite/plugin_test_6.sh: New test case.
3857 * testsuite/plugin_common_test_1.c: New test case.
3858 * testsuite/plugin_common_test_2.c: New test case.
3859 * testsuite/Makefile.am (plugin_test_6): New test case.
3860 * testsuite/Makefile.in: Regenerate.
3864 * po/vi.po: New Vietnamese translation.
3868 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3872 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3873 to avoid a conversion warning on a 32-bit host.
3877 * testsuite/script_test_3.t: Add a TLS segment.
3878 * testsuite/Makefile.am (check_PROGRAMS): Add
3879 tls_phdrs_script_test.
3880 (tls_phdrs_script_test_SOURCES): Define.
3881 (tls_phdrs_script_test_DEPENDENCIES): Define.
3882 (tls_phdrs_script_test_LDFLAGS): Define.
3883 (tls_phdrs_script_test_LDADD): Define.
3884 * testsuite/Makefile.in: Rebuild.
3888 * fileread.cc (find_or_make_view): Fix comment.
3892 * script-sections.cc (class Orphan_section_placement): Define
3893 PLACE_TLS and PLACE_TLS_BSS.
3894 (Orphan_section_placement::Orphan_section_placement): Initialize
3896 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3897 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3898 (tls_script_test_SOURCES): Define.
3899 (tls_script_test_DEPENDENCIES): Define.
3900 (tls_script_test_LDFLAGS): Define.
3901 (tls_script_test_LDADD): Define.
3902 * testsuite/Makefile.in: Rebuild.
3906 * arm.cc (Arm_relocate_functions::abs8,
3907 Arm_relocate_functions::abs16): Use correct check for overflow
3908 specified in the ARM ELF specs.
3909 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3910 target of a BLX instruction specially.
3911 (Reloc_stub::stub_type_for_reloc): Ditto.
3912 (Relocate::relocate): Use symbolic names instead of numeric relocation
3913 codes to report error.
3914 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3916 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3917 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3918 thumb2_blx_out_of_range.stdout
3919 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3920 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3921 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3922 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3923 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3924 thumb2_blx_in_range, thumb2_blx_in_range.o,
3925 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3926 thumb2_blx_out_of_range.o): New rules.
3927 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3928 thumb2_blx_in_range and thumb2_blx_out_of_range.
3929 * testsuite/Makefile.in: Regenerate.
3930 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3931 * testsuite/thumb_blx_in_range.s: New file.
3932 * testsuite/thumb_blx_out_of_range.s: New file.
3936 * archive.cc (Should_include): Move to archive.h.
3937 (should_include_member): Make it a member of Archive.
3939 (Add_lib_group_symbols): New.
3940 * archive.h: Include options.h.
3941 (Archive_member): Moved from Archive.
3942 (Should_include): Moved from archive.cc.
3944 (Add_lib_group_symbols): New.
3945 * dynobj.cc (do_should_include_member): New.
3946 * dynobj.h (do_should_include_member): New.
3947 * gold.cc (queue_initial_tasks): Update call to queue.
3948 * main.cc (main): Print lib group stats.
3949 * object.cc (do_should_include_member): New.
3950 * object.h: Include archive.h.
3951 (Object::should_include_member): New.
3952 (Object::do_should_include_member): New.
3953 (Sized_relobj::do_should_include_member): New.
3954 * options.cc (General_options::parse_start_lib): New.
3955 (General_options::parse_end_lib): New.
3956 (Input_arguments::add_file): Handle lib groups.
3957 (Input_arguments::start_group): Check we are not in a lib.
3958 (Input_arguments::start_lib): New.
3959 (Input_arguments::end_lib): New.
3960 * options.h (General_options): Add start_lib and end_lib.
3961 (Input_argument::lib_): New.
3962 (Input_argument::lib): New.
3963 (Input_argument::is_lib): New.
3964 (Input_file_lib): New.
3965 (Input_arguments::in_lib_): New.
3966 (Input_arguments::in_lib): New.
3967 (Input_arguments::start_lib): New.
3968 (Input_arguments::end_lib_): New.
3969 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3970 in unused members as preempted.
3971 (Sized_pluginobj::do_should_include_member): New.
3972 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3973 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3975 (Read_symbols::do_whole_lib_group): New.
3976 (Read_symbols::do_lib_group): New.
3977 (Read_symbols::do_read_symbols): Handle lib groups.
3978 (Read_symbols::get_name): Handle lib groups.
3979 * readsyms.h (Read_symbols): Add an archive member pointer.
3980 (Read_symbols::do_whole_lib_group): New.
3981 (Read_symbols::do_lib_group): New.
3982 (Read_symbols::member_): New.
3983 * script.cc (read_input_script): Update call to queue_soon.
3987 * arm.cc (Stub_table::Stub_table): Initialize new data members
3988 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3989 (Stub_table::add_reloc_stub): Assign stub offset and update
3990 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3991 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3993 (Stub_table::update_data_size_and_addralign): Use
3994 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3995 instead of going over all reloc stubs.
3996 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3997 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3998 Stringpool_template::offset_ to size of Stringpool_char.
3999 (Stringpool_template::new_key_offset): Remove code to initialize
4000 Stringpool_template::offset_.
4001 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4002 Stringpool_template::offset_ to zero.
4006 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4008 (Stringpool_template::new_key_offset): New method.
4009 (Stringpool_template::add_string): Assign offsets when adding new
4011 (Stringpool_template::set_string_offsets): Do not set string offsets
4012 when not optimizing.
4013 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4015 (Chunked_vector::clear): Clear size_.
4016 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4017 (Chunked_vector::size): Return size_.
4018 (Chunked_vector::push_back): Use size_ to find insert position.
4019 (Chunked_vector::size_): New data member.
4020 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4021 (Stringpool_template::new_key_offset): New method declaration.
4022 (Stringpool_template::offset_): New data member.
4026 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4027 Add_symbols' constructor.
4028 * readsyms.h (Add_symbols): Remove the input_group member.
4032 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4033 target to ask whether a reference to a symbol requires a stack
4035 * target.h (Target::is_call_to_non_split): New function.
4036 (Target::do_is_call_to_non_split): Declare virtual function.
4037 * target.cc: Include "symtab.h".
4038 (Target::do_is_call_to_non_split): New function.
4039 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4043 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4044 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4045 (File_read::open[2]): Add whole_file_view_ to list of views.
4046 (File_read::make_view): Remove test of whole_file_view_.
4047 (File_read::find_or_make_view): Create whole_file_view_ if
4049 (File_read::clear_views): Replace bool parameter with enum;
4050 adjust all callers. Don't delete views with permanent data;
4051 do delete cached views and views from archives if
4052 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4053 if clearing the corresponding view.
4054 * fileread.h (File_read::Clear_views_mode): New enum.
4055 (File_read::View::is_permanent_view): New method.
4056 (File_read::clear_views): Replace bool parameter
4057 with enum; adjust all callers.
4058 * options.h (General_options): Change keep_files_mapped option;
4059 add map_whole_files.
4060 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4062 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4067 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4071 * icf.cc (get_section_contents): Add '@' marker after processing the
4076 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4077 due to a conversion warning.
4078 (Arm_relobj::update_output_local_symbol_count): Check for local
4079 symbol with unset output index.
4083 * options.h (class General_options): Add --spare-dynamic-tags.
4084 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4085 --spare-dynamic-tags.
4089 * incremental.cc: Include "libiberty.h".
4093 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4094 function, is_info_ member.
4095 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4096 (Versions::Versions): Update caller.
4097 (Versions::define_base_version): Likewise.
4098 (Versions::add_def): Likewise.
4102 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4103 (Scan::possible_function_pointer_reloc): New function.
4104 (Scan::local_reloc_may_be_function_pointer): Change to call
4105 possible_function_pointer_reloc.
4106 (Scan::global_reloc_may_be_function_pointer): Ditto.
4107 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4108 relocations in ".data.rel.ro._ZTV" section.
4109 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4110 * testsuite/icf_safe_so_test.cc: Ditto.
4111 * testsuite/icf_safe_test.cc: Ditto.
4112 * testsuite/icf_safe_test.sh: Ditto.
4117 * target-reloc.h (relocate_section): Check the symbol table index
4118 for -1U before setting the local symbol index.
4119 (scan_relocatable_relocs): If copying the relocation, record that
4120 the local symbol is required.
4121 * object.h (Symbol_value::is_output_symtab_index_set): New
4123 (Symbol_value::may_be_discarded_from_output_symtab): New
4125 (Symbol_value::has_output_symtab_entry): New function.
4126 (Symbol_value::needs_output_symtab_entry): Remove.
4127 (Symbol_value::output_symtab_index): Make sure the symbol index is
4129 (Symbol_value::set_output_symtab_index): Make sure the symbol
4130 index is not set. Make sure the new index is valid.
4131 (Symbol_value::set_must_have_output_symtab_entry): New function.
4132 (Symbol_value::has_output_dynsym_entry): New function.
4133 (Symbol_value::set_output_dynsym_index): Make sure the new index
4135 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4136 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4137 local symbol if permitted.
4138 (Sized_relobj::do_finalize_local_symbols): Call
4139 is_output_symtab_index_set rather than needs_output_symtab_entry.
4140 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4141 rather than needs_output_symtab_entry. Call
4142 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4143 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4144 is_output_symtab_index_set rather than needs_output_symtab_entry.
4145 * testsuite/discard_locals_relocatable_test.c: New file.
4146 * testsuite/discard_locals_test.sh: Test -r.
4147 * testsuite/Makefile.am (check_DATA): Add
4148 discard_locals_relocatable_test1.syms,
4149 discard_local_relocatable_test2.syms.
4150 (MOSTLYCLEANFILES): Likewise. Also add
4151 discard_locals_relocatable_test1.lout and
4152 discard_locals_relocatable_test2.out.
4153 (discard_locals_relocatable_test1.syms): New target.
4154 (discard_locals_relocatable_test.o): New target.
4155 (discard_locals_relocatable_test1.out): New target.
4156 (discard_locals_relocatable_test2.syms): New target.
4157 (discard_locals_relocatable_test2.out): New target.
4158 (various): Add missing ../ld-new dependencies.
4159 * testsuite/Makefile.in: Rebuild.
4163 * po/fi.po: New Finnish translation.
4167 * layout.cc (Layout::Layout): Force section types of .init_array*,
4168 .preinit_array* and .fini_array* sections.
4169 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4170 Fix check of return value of std::string::find.().
4171 (Output_section::Input_section_sort_compare::operator()): Remove
4172 comment about .init_array.
4173 (Output_section::Input_section_sort_init_fini_compare::operator()):
4175 (Output_section::sort_attached_input_sections): Handle .init_array
4176 and .fini_array specially.
4177 * output.h (Output_section::Inut_section_sort_compare): Update
4179 (Output_section::Input_section_sort_init_fini_compare): New struct.
4183 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4184 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4185 * testsuite/debug_msg.sh: Avoid matching source line number for
4186 use of global variable undef_int.
4190 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4191 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4192 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4193 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4194 * options.cc (General_options::General_options): Initialize member
4196 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4197 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4198 and rm_no_fix_v4bx.stdout
4199 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4200 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4201 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4202 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4203 and arm_no_fix_v4bx.
4204 * Makefile.in: Regenerate.
4205 * testsuite/arm_fix_v4bx.s: New file.
4206 * testsuite/arm_fix_v4bx.sh: Ditto.
4210 * arm.cc (Target_arm::got_section): Make the .got section the first
4211 non RELRO section in the data segment.
4212 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4213 suffixes of section names.
4217 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4218 flags and attributes merging if an input file is a binary file.
4219 * fileread.cc (Input_file::open): Record format of original file.
4220 * fileread.h (Input_file::Format): New enum type.
4221 (Input_file::Input_file): Initialize data member format_.
4222 (Input_file::format): New method definition.
4223 (Input_file::format_):: New data member.
4227 * arm.cc (Arm_output_data_got): New class.
4228 (ARM_TCB_SIZE): New constant
4229 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4230 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4231 If user uses a script with a SECTIONS clause, issue only a warning
4232 for a misplaced EXIDX input section. Otherwise, issue an error.
4233 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4235 (Target_arm::got_mode_index_entry): Handle static linking.
4236 (Target_arm::Scan::local): Ditto.
4237 (Target_arm::Scan::global): Ditto.
4238 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4239 all incorrectly implemented relocations.
4240 (Target_arm::fix_exidx_coverage): Pass layout to
4241 Arm_output_section::fix_exidx_coverage.
4242 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4243 from ".ARM.exidx." and ".ARM.extab.".
4247 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4248 section if it does not already exist.
4249 * attributes.cc (Attributes_section_data::Attributes_section_data):
4250 Don't crash if size is zero.
4255 * gold.cc (queue_middle_tasks): If no input files were opened,
4257 * workqueue.h (Task_function::Task_function): Assert that there is
4262 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4263 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4264 types to avoid warnings due to different uint64_t implementations
4269 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4270 handling of the maximum backward branch offset.
4271 (Arm_relocate_functions::thumb_branch_common): Ditto.
4272 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4273 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4274 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4275 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4276 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4277 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4278 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4279 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4280 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4281 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4282 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4283 thumb2_bl_out_of_range.o): New rules.
4284 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4285 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4286 thumb2_bl_out_of_range
4287 * testsuite/Makefile.in: Regenerate.
4288 * testsuite/arm_bl_in_range.s: New file.
4289 * testsuite/arm_bl_out_of_range.s: Ditto.
4290 * testsuite/arm_branch_in_range.sh: Ditto.
4291 * testsuite/arm_branch_range.t: Ditto.
4292 * testsuite/thumb2_branch_range.t: Ditto.
4293 * testsuite/thumb_bl_in_range.s: Ditto.
4294 * testsuite/thumb_bl_out_of_range.s: Ditto.
4295 * testsuite/thumb_branch_range.t: Ditto.
4299 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4300 Add reloc offset information.
4301 * icf.cc (get_section_contents): Change iterators to point to the new
4302 vectors. Add reloc offset information to the contents.
4303 * icf.h (Icf::Sections_reachable_info): New typedef.
4304 (Icf::Sections_reachable_list): New typedef.
4305 (Icf::Offset_info): New typedef.
4306 (Icf::Reloc_info): New struct typedef.
4307 (Icf::Reloc_info_list): New typedef.
4308 (Icf::symbol_reloc_list): Delete method.
4309 (Icf::addend_reloc_list): Delete method.
4310 (Icf::section_reloc_list): Delete method.
4311 (Icf::reloc_info_list): New method.
4312 (Icf::reloc_info_list_): New member.
4316 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4317 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4318 * arm.cc (Arm_relocation_functions): New forward declaration.
4319 (Target_arm::Target_arm): Initialize new data members
4320 got_mod_index_offset_ and tls_base_symbol_defined_.
4321 (Target_arm::Relocate::relocate_tls): New method.
4322 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4323 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4325 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4326 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4327 (Target_arm::got_mod_index_offset_,
4328 Target_arm::tls_base_symbol_defined_): New data members.
4329 (Target_arm::Scan::local, Target::Scan::global,
4330 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4335 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4336 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4337 text section as a parameter becuase some broken tools may not set
4338 the link in section header.
4339 (Target_arm::has_got_section): New method.
4340 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4341 without any mapping symbol as data only. Remove warning.
4342 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4343 link in its section header, try to discover the link by inspecting the
4344 REL31 relocation at the beginning of the section.
4345 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4347 (Target_arm::Scan::global): Treat any reference to the symbol
4348 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4352 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4353 (Scan::global_reloc_may_be_function_pointer): New function.
4354 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4355 (Scan::global_reloc_may_be_function_pointer): New function.
4356 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4357 (Scan::global_reloc_may_be_function_pointer): New function.
4358 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4359 (Scan::global_reloc_may_be_function_pointer): New function.
4360 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4361 (Scan::global_reloc_may_be_function_pointer): New function.
4362 (Scan::possible_function_pointer_reloc): New function.
4363 (Target_x86_64::can_check_for_function_pointers): New function.
4364 * gc.h (gc_process_relocs): Scan relocation types to determine if
4365 function pointers were taken for targets that support it.
4366 * icf.cc (Icf::find_identical_sections): Include functions for
4367 folding in safe ICF whose pointer is not taken.
4368 * icf.h (Secn_fptr_taken_set): New typedef.
4369 (fptr_section_id_): New member.
4370 (section_has_function_pointers): New function.
4371 (set_section_has_function_pointers): New function.
4372 (check_section_for_function_pointers): New function.
4373 * options.h: Fix comment for safe ICF option.
4374 * target.h (can_check_for_function_pointers): New function.
4375 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4376 Modify icf_safe_test for X86-64.
4377 * testsuite/Makefile.in: Regenerate.
4378 * testsuite/icf_safe_so_test.cc: New file.
4379 * testsuite/icf_safe_so_test.sh: New file.
4380 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4381 (main): Change to take pointer to function kept_func_3.
4382 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4383 folding is done correctly for X86-64.
4387 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4388 is_symbolless parameter.
4389 (Output_reloc<SHT_REL>::is_symbolless): New.
4390 (Output_reloc<SHT_REL>::is_symbolless_): New.
4391 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4392 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4393 (Output_reloc<SHT_RELA>::is_symbolless): New.
4394 (Output_data_reloc::add_global): Handle is_symbolless.
4395 (Output_data_reloc::add_global_relative): Likewise.
4396 (Output_data_reloc::add_local): Likewise.
4397 (Output_data_reloc::add_local_relative): Likewise.
4398 (Output_data_reloc::add_symbolless_global_addend): New.
4399 (Output_data_reloc::add_symbolless_local_addend): New.
4400 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4402 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4403 instead of ->is_relative_
4404 (Output_reloc::write): Likewise.
4405 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4406 (Output_reloc::write_rel): Simplify.
4408 * sparc.cc (Target_sparc::Scan::local): Use
4409 ->add_symbolless_local_addend as needed.
4410 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4411 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4412 based upon relocation offset.
4416 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4417 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4418 beginning of function.
4419 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4420 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4421 parameter is_32bit in calls to should_apply_static_reloc.
4422 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4423 (check_DATA): Add arm_abs_global.stdout.
4424 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4425 arm_abs_global.stdout): New rules.
4426 (MOSTLLYCLEANFILES): Add arm_abs_global
4427 * Makefile.in: Regenerate.
4428 * testsuite/arm_abs_global.s: New file.
4429 * testsuite/arm_abs_global.sh: Ditto.
4430 * testsuite/arm_abs_lib.s: Ditto.
4434 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4436 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4437 Allocate_commons_task first.
4438 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4439 task, rather than symtab_lock_.
4440 (Gc_process_relocs::~Gc_process_relocs): New function.
4441 (Gc_process_relocs::is_runnable): Check this_blocker_.
4442 (Gc_process_relocs::locks): Use next_blocker_ rather than
4444 (Scan_relocs::~Scan_relocs): New function.
4445 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4447 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4449 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4450 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4451 constructor accordingly.
4452 (class Gc_process_relocs): Likewise.
4453 (class Scan_relocs): Likewise.
4454 * common.h (class Allocate_commons_task): Remove symtab_lock_
4455 field, and corresponding constructor parameter.
4456 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4458 (Allocate_commons_task::locks): Likewise.
4462 * gold-threads.h (class Once): Define.
4463 (class Initialize_lock): Rewrite as child of Once.
4464 * gold-threads.cc (class Once_initialize): Define.
4465 (once_pointer_control): New static variable.
4466 (once_pointer, once_arg): New static variables.
4467 (c_run_once): New static function.
4468 (Once::Once, Once::run_once, Once::internal_run): New functions.
4469 (class Initialize_lock_once): Remove.
4470 (initialize_lock_control): Remove.
4471 (initialize_lock_pointer): Remove.
4472 (initialize_lock_once): Remove.
4473 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4474 (Initialize_lock::initialize): Rewrite.
4475 (Initialize_lock::do_run_once): New function.
4476 * archive.cc (Archive::interpret_header): Only clear name if it is
4478 * fileread.cc: Include "gold-threads.h"
4479 (file_counts_lock): New static variable.
4480 (file_counts_initialize_lock): Likewise.
4481 (File_read::release): Only increment counts when using --stats.
4482 Use a lock around the increment.
4483 * parameters.cc (class Set_parameters_target_once): Define.
4484 (set_parameters_target_once): New static variable.
4485 (Parameters::Parameters): Move here from parameters.h.
4486 (Parameters::set_target): Rewrite.
4487 (Parameters::set_target_once): New function.
4488 (Parameters::clear_target): Move here and rewrite.
4489 * parameters.h (class Parameters): Update declarations. Add
4490 set_parameters_target_once_ field.
4491 (Parameters::Parameters): Move to parameters.cc.
4492 (Parameters::clear_target): Likewise.
4493 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4495 (Start_group::~Start_group): New function.
4496 (Start_group::is_runnable): New function.
4497 (Start_group::locks, Start_group::run): New functions.
4498 (Finish_group::run): Change saw_undefined to size_t.
4499 * readsyms.h (class Start_group): Define.
4500 (class Finish_group): Change saw_undefined_ field to size_t.
4501 (Finish_group::Finish_group): Remove saw_undefined and
4502 this_blocker parameters. Change all callers.
4503 (Finish_group::set_saw_undefined): New function.
4504 (Finish_group::set_blocker): New function.
4505 * symtab.h (class Symbol_table): Change saw_undefined to return
4506 size_t. Change saw_undefined_ field to size_t.
4507 * target-select.cc (Set_target_once::do_run_once): New function.
4508 (Target_selector::Target_selector): Initialize set_target_once_
4509 field. Don't initialize lock_ and initialize_lock_ fields.
4510 (Target_selector::instantiate_target): Rewrite.
4511 (Target_selector::set_target): New function.
4512 * target-select.h (class Set_target_once): Define.
4513 (class Target_selector): Update declarations. Make
4514 Set_target_once a friend. Remove lock_ and initialize_lock_
4515 fields. Add set_target_once_ field.
4519 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4521 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4522 (queue_middle_tasks): Add all blockers before queueing any tasks.
4523 (queue_final_tasks): Likewise.
4524 * token.h (Task_token::add_blockers): New function.
4525 * object.h (Input_objects::number_of_relobjs): New function.
4529 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4530 shared, not if not position independent.
4531 * x86_64.cc (Relocate::relocate_tls): Likewise.
4532 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4533 (tls_pie_pic_test): New target.
4534 * testsuite/Makefile.in: Rebuild.
4536 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4537 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4538 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4539 * testsuite/Makefile.in: Rebuild.
4543 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4544 R_SPARC_RELATIVE using ->add_local_relative().
4545 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4547 * output.h (Output_data_dynamic::add_section_size): New method
4548 that takes two Output_data objects.
4549 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4550 entry param. Handle it in initializers.
4551 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4552 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4553 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4555 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4556 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4557 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4558 for dynrel_includes_plt.
4559 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4560 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4561 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4563 (Target_sparc::do_finalize_sections): Update to pass true for
4564 dynrel_includes_plt.
4565 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4566 output before .rela.plt
4567 (Target_powerpc::do_finalize_sections): Update to pass true for
4568 dynrel_includes_plt when 32-bit.
4572 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4574 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4575 Arm_relobj::scan_section_for_cortex_a8_stubs,
4576 Arm_relobj::do_relocation_section): Instead of calling
4577 Output_section::output_address, use faster
4578 Arm_relobj::simple_input_section_output_address.
4582 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4583 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4584 relocation helper function.
4586 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4587 just like R_SPARC_GOT{10,13,22}.
4588 (Target_sparc::Scan::local): Likewise.
4589 (Target_sparc::Relocate:relocate): Likewise.
4593 * configure.ac: Rewrite targetobjs duplicate removal code to use
4594 only shell constructs.
4595 * configure: Rebuild.
4600 * arm.cc (Arm_relobj::section_is_scannable): New method.
4601 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4602 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4607 * arm-reloc-property.cc (cstdio): Include.
4608 * configure.ac (targetobjs): Remove duplicates.
4609 * configure: Regenerate.
4610 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4611 big and little endian version for a given address size.
4615 * arm-reloc-property.cc
4616 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4618 * arm-reloc-property.h
4619 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4620 New method definition.
4621 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4623 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4625 (GOT_PREL): Change implemented to Y.
4626 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4627 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4628 (Arm_relocate_functions::movw_abs_nc): Remove method.
4629 (Arm_relocate_functions::movt_abs): Ditto.
4630 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4631 (Arm_relocate_functions::thm_movt_abs): Ditto.
4632 (Arm_relocate_functions::movw_rel_nc): Ditto.
4633 (Arm_relocate_functions::movw_rel): Ditto.
4634 (Arm_relocate_functions::movt_rel): Ditto.
4635 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4636 (Arm_relocate_functions:thm_movw_rel): Ditto.
4637 (Arm_relocate_functions:thm_movt_rel): Ditto.
4638 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4639 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4640 New method definitions.
4641 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4642 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4643 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4644 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4645 (Target_arm::Relocate::relocate): Check for non-static or
4646 unimplemented relocation code and exit early. Change calls to
4647 Target_arm::reloc_uses_thumb_bit and
4648 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4649 instead. Refactor code to handle similar relocations to increase
4650 code sharing. Remove check for unsupported relocation code in switch
4652 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4653 relocation property table to find out size. Change error message to
4654 print out the name of a relocation code instead of the numeric value.
4655 (Target_arm::scan_reloc_for_stub): Use relocation property table
4656 instead of calling Target_arm::reloc_uses_thumb_bit().
4660 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4661 types of relaxed input section.
4665 * Makefile.am (HFILES): Add arm-reloc-property.h.
4667 (TARGETSOURCES): Add arm-reloc-property.cc
4668 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4669 (libgold_a_SOURCES): $(DEFFILES)
4670 * Makefile.in: Regenerate.
4671 * arm-reloc-property.cc: New file.
4672 * arm-reloc-property.h: New file.
4673 * arm-reloc.def: New file.
4674 * arm.cc: Update comments.
4675 (arm-reloc-property.h): New included header.
4676 (arm_reloc_property_table): New global variable.
4677 (Target_arm::do_select_as_default_target): New method definition.
4678 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4679 arm-reloc-property to targ_extra_obj.
4680 * parameters.cc (set_parameters_target): Call
4681 Target::select_as_default_target().
4682 * target.h (Target::select_as_default_target): New method definition.
4683 (Target::do_select_as_default_target): Same.
4687 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4688 first_output_text_section_.
4689 (Arm_exidx_fixup::first_output_text_section): New method definition.
4690 (Arm_exidx_fixup::first_output_text_section_): New data member.
4691 (Arm_exidx_fixup::process_exidx_section): Record the first text
4692 output section seen.
4693 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4694 and entsize in output section header.
4698 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4699 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4700 (Arm_relocate_functions::thm_alu11): New Method.
4701 (Arm_relocate_functions::thm_pc8): New Method.
4702 (Arm_relocate_functions::thm_pc12): New Method.
4703 (Target_arm::Scan::local): Handle the relocations.
4704 (Target_arm::Scan::global): Likewise.
4705 (Target_arm::Relocate::relocate): Likewise.
4706 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4710 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4711 of relocation types as ld.
4715 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4717 (Arm_relocate_functions::thumb_branch_common): Ditto.
4718 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4719 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4720 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4721 Arm_relocate_functions::jump24): Remove.
4722 (Target_arm::Relocate::relocate): Adjust code to call
4723 Arm_relocation_functions::arm_branch_common and
4724 Arm_relocation_functions::thumb_branch_common instead of their removed
4725 wrappers. Merge switch-cases together to reduce source code size.
4729 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4730 output_local_symbol_count_needs_update_.
4731 (Arm_relobj::output_local_symbol_count_needs_update,
4732 Arm_relobj::set_output_local_symbol_count_needs_update,
4733 Arm_relobj::update_output_local_symbol_count): New methods.
4734 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4736 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4737 of pointed function as in a R_ARM_PREL31 relocation.
4738 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4739 for output local symbol count updating.
4740 (Target_arm::do_relax): Update output local symbol counts in objects
4742 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4746 * arm.cc: Added support for the ARM relocations:
4747 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4748 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4749 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4751 (Arm_relocate_functions::movw_rel): New method.
4752 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4753 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4755 (Arm_relocate_functions::thm_movw_rel): New method.
4756 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4758 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4760 (Target_arm::Scan::global): Likewise.
4761 (Target_arm::Relocate::relocate): Likewise.
4762 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4767 * arm.cc: Added support for ARM group relocations.
4768 (Target_arm::reloc_needs_sym_origin): New method.
4769 (Arm_relocate_functions::calc_grp_kn): New method.
4770 (Arm_relocate_functions::calc_grp_residual): New method.
4771 (Arm_relocate_functions::calc_grp_gn): New method.
4772 (Arm_relocate_functions::arm_grp_alu): New Method.
4773 (Arm_relocate_functions::arm_grp_ldr): New Method.
4774 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4775 (Arm_relocate_functions::arm_grp_ldc): New Method.
4776 (Target_arm::Scan::local): Handle the ARM group relocations.
4777 (Target_arm::Scan::global): Likewise.
4778 (Target_arm::Relocate::relocate): Likewise.
4779 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4784 * arm.cc (set): Include.
4785 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4787 (Arm_output_section::Text_section_list): New type.
4788 (Arm_output_section::append_text_sections_to_list): New method.
4789 (Arm_output_section::fix_exidx_coverage): Ditto.
4790 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4791 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4792 Relobj::set_section_offset() instead of
4793 Sized_relobj::invalidate_section_offset().
4794 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4795 parameter for section headers. Ignore relocation sections for
4796 unallocated sections and EXIDX sections.
4797 (Target_arm::fix_exidx_coverage): New method.
4798 (Target_arm::output_section_address_less_than): New type.
4799 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4800 linked text section instead of the EXIDX section.
4801 (Arm_output_section::create_stub_group): Add an assertion to check
4802 that this is not an EXIDX output section.
4803 (Arm_output_section::append_text_sections_to_list): New method.
4804 (Arm_output_section::fix_exidx_coverage): Ditto.
4805 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4806 Arm_relobj::section_needs_reloc_stub_scanning.
4807 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4809 (Target_arm::fix_exidx_coverage): New method.
4810 * object.h (Relobj::set_output_section): New method.
4811 (Sized_relobj::invalidate_section_offset): Remove method.
4812 (Sized_relobj::do_invalidate_section_offset): Remove method.
4813 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4817 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4818 Fix warning due to signed and unsigned comparison on a 32-bit host.
4822 * arm.cc (Target_arm::do_relax): Record an output section for section
4823 offset adjustment it contains any stub table that has changed.
4824 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4825 offsets in an output section if necessary.
4826 * output.cc (Output_section::Output_section): Initialize
4827 section_offsets_need_adjustments_.
4828 (Output_section::add_input_section_for_script): Renamed to
4829 Output_section::add_simple_input_section.
4830 (Output_section::save_states): Add a comment.
4831 (Output_section::discard_states): New method defintion.
4832 (Output_section::adjust_section_offsets): Same.
4833 * output.h (Output_section::add_input_section_for_script): Renamed to
4834 Output_section::add_simple_input_section.
4835 (Output_section::discard_states): New method declaration.
4836 (Output_section::adjust_section_offsets): Same.
4837 (Output_section::section_offsets_need_adjustment,
4838 Output_section::set_section_offsets_need_adjustment): New method
4840 (Output_section::section_offsets_need_adjustment_): New data member.
4841 * script-sections.cc
4842 (Output_section_element_input::set_section_address): Adjust code for
4843 renaming of Output_section::add_input_section_for_script.
4844 (Orphan_output_section::set_section_address): Same.
4848 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4849 Fix_v4bx enum values .
4850 * gold/options.h (General_options): New option definitions.
4851 (General_options::fix_v4bx): New method.
4852 (General_options::Fix_v4bx): New enum.
4853 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4854 (General_options::parse_fix_v4bx_interworking): New method.
4858 * arm.cc (Arm_exidx_fixup): New class.
4862 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4864 (Arm_exidx_section_offset_map): New type.
4868 * arm.cc (Arm_exidx_input_section): New class.
4869 (Arm_relobj::exidx_input_section_by_link,
4870 Arm_relobj::exidx_input_section_by_shndx,
4871 Arm_relobj::make_exidx_input_section): New methods.
4872 (read_arm_attributes_section): Remove.
4873 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4874 information about them.
4875 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4880 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4881 Input_section_specifier to Section_id.
4882 (Target_arm::new_arm_input_section: Adjust code for change of key
4884 (Target_arm::find_arm_input_section): Ditto.
4885 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4886 (Section_id): Remove.
4887 (Garbage_collection::Section_id_hash): Remove.
4888 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4889 (Section_id): Remove.
4890 (Icf::Section_id_hash): Remove.
4891 * object.h (Section_id, Const_section_id, Section_id_hash,
4892 Const_section_id_hash): New type definitions.
4893 * output.cc (Output_section::add_relaxed_input_section): Change to
4894 use Const_section_id instead of Input_section_specifier as key type.
4895 (Output_section::add_merge_input_section): Ditto.
4896 (Output_section::build_relaxation_map): Change to use Section_id
4897 instead of Input_section_specifier as key type.
4898 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4900 (Output_section::convert_input_sections_to_relaxed_sections): Change
4901 to use Const_section_id instead of Input_section_specifier as key type.
4902 (Output_section::find_merge_section): Ditto.
4903 (Output_section::find_relaxed_input_section): Ditto.
4904 * output.h (Input_section_specifier): Remove class.
4905 (Output_section::Output_section_data_by_input_section_map): Change
4906 key type to Const_section_id.
4907 (Output_section::Output_relaxed_input_section_by_input_section_map):
4909 (Output_section::Relaxation_map): Change key type to Section_id.
4913 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4914 (class Arm_v4bx_stub): New class.
4915 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4916 (Stub_factory::make_arm_v4bx_stub): New method.
4917 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4918 (Stub_table::empty): Handle v4bx stubs.
4919 (Stub_table::add_arm_v4bx_stub): New method.
4920 (Stub_table::find_arm_v4bx_stub): New method.
4921 (Arm_relocate_functions::v4bx): New method.
4922 (Target_arm::fix_v4bx): New method.
4923 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4924 (Stub_table::relocate_stubs): Likewise.
4925 (Stub_table::do_write): Likewise.
4926 (Stub_table::update_data_size_and_addralign): Likewise.
4927 (Stub_table::finalize_stubs): Likewise.
4928 (Target_arm::Scan::local): Likewise.
4929 (Target_arm::Scan::global): Likewise.
4930 (Target_arm::do_finalize_sections): Likewise.
4931 (Target_arm::Relocate::relocate): Likewise.
4932 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4934 (Target_arm::scan_reloc_for_stub): Likewise.
4935 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4939 * output.cc (Output_section_headers::do_sized_write): Write large
4940 segment count to sh_info field.
4941 (Output_file_header::do_sized_write): For large segment count,
4942 write PN_XNUM to e_phnum field.
4946 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4947 (Arm_relocate_functions::thm_jump8): New function.
4948 (Arm_relocate_functions::thm_jump11): New function.
4949 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4951 (Target_arm::Scan::global): Likewise.
4952 (Target_arm::Relocate::relocate): Likewise.
4953 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4958 * arm.cc (map, utility): Include headers.
4959 (Target_arm::apply_cortex_a8_workaround): New method.
4960 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4961 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4962 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4963 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4964 the --[no-]fix-cortex-a8 command line options.
4965 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4966 (Target_arm::relocate_stub): Use addend in instruction template.
4967 * options.h (DEFINE_bool): Set the user-set flag.
4968 (General_options): Add --[no-]-fix-cortex options.
4969 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4970 : Update fast look-up map after conversion.
4974 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4975 in the first pass of do_layout.
4979 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4980 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4981 apparent compiler problem of not folding static constant integral
4982 data members of elfcpp::Elf_sizes<32>.
4986 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4987 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4988 Arm_relobj::scan_section_for_cortex_a8_erratum,
4989 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4990 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4991 sections to scan for relocation stubs into a new method
4992 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4993 relocation and Cortex-A8 stub scanning.
4994 (Target_arm::do_relax): Force stubs to be after stubbed sections
4995 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4996 the beginning of a new relaxation pass. Update a comment.
4997 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5001 * target-reloc.h (visibility_error): New inline function.
5002 (relocate_section): Call visibility_error.
5003 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5004 (MOSTLYCLEANFILES): Likewise.
5005 (protected_4_pic.o, protected_3.err): New targets.
5006 * testsuite/protected_4.cc: New file.
5010 * arm.cc (Cortex_a8_reloc): New class.
5011 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5012 and cortex_a8_relocs_info_.
5013 (Target_arm::fix_cortex_a8): New method definition.
5014 (Target_arm::Cortex_a8_relocs_info): New type.
5015 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5016 New data member declarations.
5017 (Target_arm::scan_reloc_for_stub): Record information about
5018 relocations for THUMB branches that might be exempted from the
5019 Cortex-A8 workaround.
5020 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5021 at the beginning of a relaxation pass.
5025 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5026 (Arm_relobj::Mapping_symbol_position,
5027 Arm_reloj::Mapping_symbol_position_less,
5028 Arm_relobj::Mapping_symbols_info): New types.
5029 (Target_arm::is_mapping_symbol_name): New method definition.
5030 (Arm_relobj::do_count_local_symbols): Save information about mapping
5035 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5036 Arm_relocate_functions::thumb32_branch_upper,
5037 Arm_relocate_functions::thumb32_branch_lower,
5038 Arm_relocate_functions::thumb32_cond_branch_offset,
5039 Arm_relocate_functions::thumb32_cond_branch_upper,
5040 Arm_relocate_functions::thumb32_cond_branch_lower,
5041 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5042 branch offset encoding.
5043 (Arm_relocate_functions::thumb_branch_common): Use new branch
5044 offset encoding methods to avoid code duplication.
5045 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5046 (Stub_addend_reader::operator()): Use new branch encoding method
5047 to avoid code duplication.
5051 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5052 (Target_arm::do_finalize_sections): Define special EXIDX section
5053 symbols only if referenced.
5054 * gc.h (Garbage_collection::add_reference): New method.
5055 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5060 * script.cc (Version_script_info::build_expression_list_lookup):
5061 Change complaing about duplicate wildcard match from error to
5064 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5066 (Version_script_info::Version_script_info): Initialize globs_,
5067 default_version_, default_is_global_, and exact_. Don't
5068 initialize globals_ or locals_.
5069 (Version_script_info::build_lookup_tables): Build local symbols
5071 (Version_script_info::unquote): New function.
5072 (Version_script_info::add_exact_match): New function.
5073 (Version_script_info::build_expression_list_lookup): Remove lookup
5074 parameter. Add is_global parameter. Change all callers. Handle
5075 wildcard pattern specially. Unquote pattern. Call
5077 (Version_script_info::get_name_to_match): New function.
5078 (Version_script_info::get_symbol_version): New function.
5079 (Version_script_info::get_symbol_version_helper): Remove.
5080 (Version_script_info::check_unmatched_names): Call unquote.
5081 * script.h (class Version_script_info): Change get_symbol_version
5082 to be non-inline and add is_global parameter; change all callers.
5083 Rewrite symbol_is_local. Update declarations. Define struct
5084 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5085 Remove globals_ and locals_ members. Add exact_, globs_,
5086 default_version_, is_global_.
5087 (Version_script_info::Glob): Remove pattern, add expression and
5088 is_global. Update constructor. Change all callers.
5089 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5091 (Versions::symbol_section_contents): If a symbol is undefined, or
5092 defined in a dynamic object, set the version index to
5094 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5096 (Symbol_table::add_from_pluginobj): Likewise.
5097 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5101 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5102 (incremental_dump_LDADD): Add linking option for libintl.
5103 * Makefile.in: Regenerate.
5108 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5110 * testsuite/Makefile.in: Regenerated.
5114 * options.h (DEFINE_var): Use parentheses around argument varname__
5115 in macro body to avoid any unintended subsequent substitutions.
5119 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5120 candidates before doing symbol resolution.
5122 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5123 ODR candidates if only one is weak.
5127 * script.cc (Version_script_info::build_expression_list_lookup):
5128 Don't warn about ambiguous version, just record the ambiguity.
5129 (Version_script_info::get_symbol_version_helper): Give error if
5130 version is ambiguous.
5134 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5135 prev_data_size_ and prev_addralign_. Remove initializer for
5136 deleted data member has_been_changed_.
5137 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5138 to determine if the table is empty.
5139 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5141 (Stub_table::add_reloc_stub): Define method in class definition
5142 instead of just declaring it there.
5143 (Stub_table::add_cortex_a8_stub): New method definition.
5144 (Stub_table::update_data_size_and_addralign): Ditto.
5145 (Stub_table::finalize_stubs): Ditto.
5146 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5147 (Stub_table::do_addralign_): Return address alignment in the
5148 (Stub_table::do_reset_address_and_file_offset): Define method in
5149 class definition instead of declaring it there. Set current data
5150 size to be the data size of the previous pass.
5151 (Stub_table::set_final_data_size): Use current data size as the
5153 (Stub_table::relocate_stub): Change parameter type of stub from
5154 Reloc_stub pointer to Stub pointer.
5155 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5156 (Stub_table::Cortex_a8_stub_list): New typedef.
5157 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5158 Stub_table::prev_addralign_): New data member.
5159 (Arm_relobj::Arm_relobj): Initialize data member
5160 section_has_cortex_a8_workaround_.
5161 (Arm_relobj::section_has_cortex_a8_workaround,
5162 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5164 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5166 (Target_arm::relocate_stub): Change parameter type of stub from
5167 Reloc_stub pointer to Stub pointer.
5168 (Insn_template::size, Insn_template::alignment): Handle
5169 THUMB16_SPECIAL_TYPE.
5170 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5171 Stub_table::update_data_size_and_addralign,
5172 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5174 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5175 (Stub_table::do_write): Ditto.
5176 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5181 * symtab.h (class Symbol): Remove fields is_target_special_ and
5182 has_plt_offset_. Add field is_defined_in_discarded_section_.
5183 (Symbol::is_defined_in_discarded_section): New function.
5184 (Symbol::set_is_defined_in_discarded_section): New function.
5185 (Symbol::has_plt_offset): Rewrite.
5186 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5187 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5188 Don't initialize is_target_special_ or has_plt_offset_.
5189 Initialize is_defined_in_discarded_section_.
5190 (Symbol_table::add_from_relobj): If appropriate, set
5191 is_defined_in_discarded_section.
5192 * resolve.cc (Symbol::override_base_with_special): Don't test
5193 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5194 * target-reloc.h (relocate_section): Do special handling for
5195 symbols defined in discarded sections for global symbols as well
5200 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5201 the SHT_SYMTAB case.
5205 * object.cc (Sized_relobj::do_layout): Don't get confused if
5206 layout_eh_frame returns NULL.
5211 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5212 dynamic symbol table, use the normal symbol table.
5213 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5219 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5224 * version.cc (print_version): Change to "Copyright 2010".
5230 * i386.cc (class Target_i386): Change return type of plt_section
5232 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5233 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5234 tls_desc_rel_ field.
5235 (Output_data_plt_i386::rel_tls_desc): New function.
5236 (Target_i386::rel_tls_desc_section): New function.
5237 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5238 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5239 R_386_TLS_DESC reloc in rel_tls_desc_section.
5240 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5241 Define struct Tlsdesc_info.
5242 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5243 (Target_x86_64::do_reloc_symbol_index): New function.
5244 (Target_x86_64::add_tlsdesc_info): New function.
5245 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5246 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5248 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5250 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5251 (Target_x86_64::rela_tlsdesc_section): New function.
5252 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5254 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5255 (Target_x86_64::do_reloc_addend): New function.
5256 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5257 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5258 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5259 (Output_reloc::type): New function.
5260 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5261 (Output_reloc::is_target_specific): New function.
5262 (Output_reloc::target_arg): New function.
5263 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5264 absolute relocs and target specific relocs.
5265 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5266 add_target_specific.
5267 (class Output_data_reloc) [SHT_RELA]: Likewise.
5268 * output.cc (Output_reloc::Output_reloc): Add four new versions
5269 for absolute relocs and target specific relocs.
5270 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5271 (Output_reloc::get_symbol_index): Likewise.
5272 (Output_reloc::local_section_offset): Check that local_sym_index_
5273 is not TARGET_CODE or 0.
5274 (Output_reloc::symbol_value): Likewise.
5275 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5277 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5278 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5280 * layout.cc (add_target_dynamic_tags): Use output section for
5281 DT_PLTRELSZ and DT_JMPREL.
5286 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5288 (class Output_data_reloc_generic): Define.
5289 (class Output_data_reloc_base): Change base class to
5290 Output_data_reloc_generic. Change add() method to call
5291 bump_relative_reloc_count for a relative reloc. Remove
5293 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5295 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5296 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5298 * layout.h (class Layout): Update declaration.
5302 * output.h (class Output_data): Add const version of
5303 output_section and do_output_section.
5304 (class Output_section_data): Add const version of
5306 (class Output_section): Likewise.
5307 * layout.cc (Layout::add_target_dynamic_tags): New function.
5308 * layout.h (class Layout): Update declarations.
5309 * arm.cc (Target_arm::do_finalize_sections): Use
5310 add_target_dynamic_tags.
5311 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5312 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5313 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5314 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5319 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5326 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5327 Xindex::read_symtab_xindex.
5331 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5332 (Insn_template::thumb16_bcond_insn): New method declaration.
5333 (Insn_template): Fix spelling.
5334 (Stub::thumb16_special): New method declaration.
5335 (Stub::do_write): Define virtual method which was previously pure
5337 (Stub::do_thumb16_special): New method declaration.
5338 (Stub::do_fixed_endian_write): New template member.
5339 (Reloc_stub::do_write): Remove.
5340 (Reloc_stub::do_fixed_endian_write): Remove.
5341 (Cortex_a8_stub): New class definition.
5342 (Stub_factory::make_cortex_a8_stub): New method definition.
5343 (Stub_factory::Stub_factory): Add missing static storage class
5344 qualifier for elf32_arm_stub_a8_veneer_blx.
5349 * options.h (class General_options): Add --warn-unresolved-symbols
5350 and --error-unresolved-symbols.
5351 * errors.cc (Errors::undefined_symbol): Implement
5352 --warn-unresolved-symbols.
5354 * options.h (class General_options): Add -z text and -z textoff.
5355 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5359 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5360 (Garbage_collection::cident_sections): New function.
5361 (Garbage_collection::add_cident_section): New function.
5362 (Garbage_collection::cident_sections_): New member.
5363 (gc_process_relocs): Add references to sections whose names are C
5365 * gold.h (cident_section_start_prefix): New constant.
5366 (cident_section_stop_prefix): New constant.
5367 (is_cident): New function.
5368 * layout.cc (Layout::define_section_symbols): Replace string constants
5369 with the newly defined constants.
5370 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5372 * testsuite/Makefile.am: Add gc_orphan_section_test.
5373 * testsuite/Makefile.in: Regenerate.
5374 * testsuite/gc_orphan_section_test.cc: New file.
5375 * testsuite/gc_orphan_section_test.sh: New file.
5380 * options.h (class General_options): Add --warn-shared-textrel.
5381 * layout.cc (Layout::finish_dynamic_section): Implement
5382 --warn-shared-textrel.
5385 * options.h (class General_options): Add --warn-multiple-gp.
5389 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5390 $(THREADSLIB) and $(LIBDL).
5391 * Makefile.in: Rebuild.
5396 * options.cc (General_options::parse_section_start): New function.
5397 (General_options::section_start): New function.
5398 (General_options::General_options): Initialize all members.
5399 * options.h: Include <map>
5400 (class General_options): Add --section-start. Add section_starts_
5402 * layout.cc (Layout::attach_allocated_section_to_segment): If
5403 --section-start was used, set the address of the segment. Remove
5404 local sort_sections.
5405 (Layout::relaxation_loop_body): If the address of the load segment
5406 has been set by --section-start, don't use it.
5407 * output.h (Output_segment::update_flags_for_output_section): New
5409 * output.cc (Output_segment::add_output_section): Call
5410 update_flags_for_output_section.
5415 * options.h (class General_options): Add --undefined-version.
5416 * script.cc (struct Version_expression): Add was_matched_by_symbol
5418 (Version_script_info::matched_symbol): New function.
5419 (Version_script_info::get_symbol_version_helper): Call
5421 (Version_script_info::check_unmatched_names): New function.
5422 * script.h (class Version_script_info): Update declarations.
5423 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5425 * options.h (class General_options): Use DEFINE_bool_alias for
5426 allow_multiple_definition.
5427 * resolve.cc (Symbol_table::should_override): Don't test
5428 allow_multiple_definition.
5431 * options.h (class General_options): Add --cref.
5432 * main.cc (main): Print cref table if --cref. Don't close mapfile
5433 until after printing cref table.
5434 * cref.cc: Include "symtab.h".
5435 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5436 (Cref_table_compare::operator()): New function.
5437 (Cref_inputs::gather_cref): New function.
5438 (filecol): New static const.
5439 (Cref_inputs::print_cref): New function.
5440 (Cref::print_cref): New function.
5441 * cref.h: Include <cstdio>.
5442 (class Cref): Update declarations.
5443 * mapfile.h (Mapfile::file): New function.
5444 * object.h (class Object): Define Symbols. Declare virtual
5445 do_get_global_symbols.
5446 (Object::get_global_symbols): New function.
5447 * object.cc (Input_objects::add_object): Pass object to cref_ if
5449 (Input_objects::archive_start): Likewise.
5450 (Input_objects::archive_stop): Likewise.
5451 (Input_objects::print_cref): New function.
5452 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5453 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5455 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5457 * plugin.h (class Sized_pluginobj): Update declarations.
5461 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5462 to is_default_version. Rename insdef to insdefault.
5463 (Symbol_table::add_from_relobj): Rename def to is_default_version
5464 and local to is_forced_local.
5465 (Symbol_table::add_from_pluginobj): Likewise.
5466 (Symbol_table::add_from_dynobj): Likewise.
5467 (Symbol_table::define_special_symbol): Rename insdef to
5473 * options.h (class General_options): Add
5474 --allow-multiple-definition and -z muldefs.
5475 * resolve.cc (Symbol_table::should_override): Don't warn about a
5476 multiple symbol definition if --allow-multiple-definition or -z
5480 * options.h (class General_options): Add --add-needed and
5481 --copy-dt-needed-entries. Tweak --as-needed help entry.
5482 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5483 error if --copy-dt-needed-entries aka --add-needed is used and
5484 would cause a change in behaviour.
5487 * options.h (class General_options): Add -G as a short version of
5488 --shared. Add no-op options -assert, -g, and -i.
5492 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5493 check for .text or .gnu.linkonce.t sections.
5494 * icf.cc (Icf::find_identical_sections): Ditto.
5495 Change the detection for mangled function name within the section
5497 * icf.h (is_section_foldable_candidate): New function.
5502 * options.h (class General_options): Permit two dashes with
5503 --retain-symbols-file.
5508 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5509 don't put the file header and segment headers in the text
5513 * common.cc (Sort_commons::operator()): Stabilize sort when both
5515 (Symbol_table::do_allocate_commons_list): When allocating common
5516 symbols, skip a symbol which is no longer common.
5517 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5518 an object before checking its type.
5519 * testsuite/common_test_2.c: New file.
5520 * testsuite/common_test_3.c: New file.
5521 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5522 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5523 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5524 (common_test_2_pic.o, common_test_2.so): New targets.
5525 (common_test_3_pic.o, common_test_3.so): New targets.
5526 * testsuite/Makefile.in: Rebuild.
5529 * script.cc (read_input_script): If we see a new SECTIONS clause,
5530 and we have added an input section, give an error.
5531 * layout.h (class Layout): Add have_added_input_section function.
5532 Add have_added_input_section_ field.
5533 * layout.cc (Layout::Layout): Initialize
5534 have_added_input_section_.
5535 (Layout::layout): Set have_added_input_section_.
5536 (Layout::layout_eh_frame): Likewise.
5541 * options.h (class General_options): Add --sort-common option.
5542 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5543 * common.cc (Sort_common): Add sort_order parameter to
5544 constructor. Add sort_order_ field.
5545 (Sort_commons::operator): Check sort_order_.
5546 (Symbol_table::allocate_commons): Determine the sort order.
5547 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5549 (Symbol_table::do_allocate_commons_list): Likewise.
5554 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5555 symbols from this object, don't change the visibility of an
5557 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5562 * script.h (class Version_script_info): Define Language enum.
5563 Update declarations. Define Glob, Exact, and Lookup types. Add
5564 new fields globals_, locals_, and is_finalized_.
5565 * script.cc: Various formatting fixes.
5566 (class Parser_closure): Change language_stack_ from a vector of
5567 std::string to one of Version_script_info::Language. Adjust all
5569 (class Lazy_demangler): Remove.
5570 (struct Version_expression): Change language from std::string to
5571 Version_script_info::Language.
5572 (Version_script_info::Version_script_info): New function.
5573 (Version_script_info::~Version_script_info): Don't call clear.
5574 (Version_script_info::finalize): New function.
5575 (Version_script_info::build_lookup_tables): New function.
5576 (Version_script_info::build_expression_list_lookup): New
5578 (Version_script_info::get_symbol_version_helper): Rewrite to use
5580 (Version_script_info::print_expression_list): Adjust to use
5581 Version_script_info::Language.
5582 (script_push_lex_into_version_mode): Check that the version script
5583 has not been finalized.
5584 (version_script_push_lang): Change language string to
5585 Version_script_info::Language.
5586 * options.cc (Command_line::version_script): New function.
5587 * options.h (class General_options): Add finalize_dynamic_list
5588 function. Change version_script from declaration to definition.
5589 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5590 * testsuite/version_script.map: Remove duplicate def of foo.
5591 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5593 * testsuite/Makefile.in: Rebuild.
5598 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5599 if the input symbol index is 0, make the output symbol index 0.
5604 * options.h (class General_options): Add -x/--discard-all.
5605 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5606 --discard-all. If the local symbol needs a dynamic entry, check
5607 that before handling --discard-locals.
5612 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5614 (Output_segment::add_output_section): Don't change the flags if
5618 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5619 GNU hash table if they need a dynamic value. Otherwise, don't add
5620 them if they are defined in a dynamic object or are forced local.
5625 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5626 .gnu.hash table for a 32-bit target.
5629 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5630 regular and a dynamic object only needs a dynamic symbol table
5631 entry if it is externally visible.
5634 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5635 constructor. Add global_offset_table_ field.
5636 (Target_i386::got_section): Set global_offset_table_.
5637 (Target_i386::do_finalize_sections): Set global_offset_table_
5639 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5640 in constructor. Add global_offset_table_ field.
5641 (Target_x86_64::got_section): Set global_offset_table_.
5642 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5645 * layout.cc (Layout::Layout): Initialize increase_relro_.
5646 (Layout::get_output_section): Add is_relro, is_last_relro, and
5647 is_first_non_relro parameters. Change all callers.
5648 (Layout::choose_output_section): Likewise.
5649 (Layout::add_output_section_data): Likewise.
5650 (Layout::make_output_section): Likewise.
5651 (Layout::set_segment_offsets): Clear increase_relro when using a
5653 * layout.h (class Layout): Add increase_relro method. Add
5654 increase_relro_ field. Update declarations.
5655 * output.cc (Output_section::Output_section): Initialize
5656 is_last_relro_ and is_first_non_relro_.
5657 (Output_segment::add_output_section): Group relro sections is
5658 do_sort is true. Handle is_last_relro and is_first_non_relro.
5659 (Output_segment::maximum_alignment): Remove relro handling.
5660 (Output_segment::set_section_addresses): Add increase_relro
5661 parameter. Change all callers. Add initial alignment to align
5662 relro sections on separate page. Remove old relro handling.
5663 (Output_segment::set_section_list_addresses): Remove in_relro
5664 parameter. Change all callers.
5665 (Output_segment::set_offset): Add increase parameter. Change all
5666 callers. Remove old relro handling.
5667 * output.h (class Output_section): Add new methods: is_last_relro,
5668 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5669 Add is_last_relro_ and is_first_non_relro_ fields.
5670 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5671 Create separate .got.plt section. Call increase_relro.
5672 * x86_64.cc (Target_x86_64::got_section): Likewise.
5673 * testsuite/relro_script_test.t: Add .got.plt.
5676 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5677 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5678 (Layout::finalize): Call set_dynamic_symbol_size.
5679 (Layout::set_dynamic_symbol_size): New function.
5680 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5681 set_dynamic_symbol_size.
5684 * output.h (class Output_section): Add is_entsize_zero_ field.
5685 * output.cc (Output_section::Output_section): Initialize
5687 (Output_section::set_entsize): If two different entsizes are
5688 requested, force it to zero.
5689 (Output_section::add_input_section): Set flags for .debug_str
5690 before updating section flags. Set entsize.
5691 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5692 and SHF_STRING if all input sections have those flags.
5696 * main.cc (main): Fix the sys time reporting.
5697 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5702 * options.cc (General_options::parse_version): Allow -v to exit
5703 without an error if there is nothing to link.
5707 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5708 using a version of gcc before 4.1.
5709 * configure: Rebuild.
5713 * attributes.cc (Output_attributes_section_data::do_write): Use
5714 std::vector::front rather than std::vector::data.
5718 * symtab.h (class Symbol_table): Add enum Defined.
5719 * resolve.cc (Symbol_table::should_override): Add defined
5720 parameter. Change all callers. Test whether object is NULL
5721 before calling a method on it.
5722 (Symbol_table::report_resolve_problem): Add defined parameter.
5724 (Symbol_table::should_override_with_special): Likewise.
5725 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5726 parameter. Change all callers.
5727 (Symbol_table::do_define_in_output_data): Likewise.
5728 (Symbol_table::define_in_output_segment): Likewise.
5729 (Symbol_table::do_define_in_output_segment): Likewise.
5730 (Symbol_table::define_as_constant): Likewise.
5731 (Symbol_table::do_define_as_constant): Likewise.
5732 * script.h (class Symbol_assignment): Add is_defsym parameter to
5733 constructor; change all callers.
5734 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5735 parameter. Change all callers. Add is_defsym_ field.
5736 (class Parser_closure): Add parsing_defsym parameter to
5737 constructor; change all callers. Add parsing_defsym accessor
5738 function. Add parsing_defsym_ field.
5742 * gold.cc (queue_middle_tasks): Fix formatting.
5743 * object.cc (Relobj::is_section_name_included): Likewise.
5747 * i386.cc (Target_i386::do_calls_non_split): Recognize
5748 -fsplit-stack prologue for a function with a static chain.
5749 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5750 -fsplit-stack prologue when using %r11.
5754 * options.cc (General_options::parse_version): Make -v continue and do
5755 the link like GNU ld does.
5759 * Makefile.am (CCFILES): Add timer.cc.
5760 (HFILES): Add timer.h.
5761 * configure.ac: Check for sysconf and times.
5762 * main.cc: include timer.h.
5763 (main): Use Timer instead of get_run_time.
5766 * workqueue.cc: include timer.h.
5767 (Workqueue::find_and_run_task):
5768 Report user, sys and wall time.
5769 * Makefile.in: Regenerate.
5770 * config.in: Regenerate.
5771 * configure: Regenerate.
5775 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5777 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5778 relaxed input sections.
5779 * output.cc (Output_section::find_relaxed_input_section): Change
5780 return type to Output_relaxed_input_section pointer. Adjust code
5781 for new type of relaxed_input_section_map_.
5782 * output.h (Output_section::find_relaxed_input_section): Change
5783 return type to Output_relaxed_input_section pointer.
5784 (Output_section::Output_relaxed_input_section_by_input_section_map):
5786 (Output_section::relaxed_input_section_map_): Change type to
5787 Output_section::Output_relaxed_input_section_by_input_section_map.
5788 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5793 * layout.cc (Layout::create_shstrtab): Only write out after input
5794 sections if we are compressing debug sections.
5798 * archive.cc (Archive::add_symbols): Only look up a symbol without
5799 a version if there is, in fact, a version.
5803 Revert -Wshadow changes, all changes from:
5806 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5810 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5812 * attributes.cc (Object_attribute::size): Ditto.
5813 (Attributes_section_data::size): Ditto.
5814 (Attributes_section_data::Attributes_section_data): Ditto.
5815 (Output_attributes_section_data::do_write): Ditto.
5816 * attributes.h (Object_attribute::set_type): Ditto.
5817 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5821 * archive.cc: Fix shadowed variable warnings.
5823 * compressed_output.cc: Likewise.
5824 * compressed_output.h: Likewise.
5825 * configure: Likewise.
5826 * dwarf_reader.cc: Likewise.
5827 * dynobj.cc: Likewise.
5828 * dynobj.h: Likewise.
5829 * ehframe.cc: Likewise.
5830 * ehframe.h: Likewise.
5831 * errors.cc: Likewise.
5832 * expression.cc: Likewise.
5833 * fileread.cc: Likewise.
5834 * fileread.h: Likewise.
5835 * freebsd.h: Likewise.
5836 * i386.cc: Likewise.
5838 * incremental.h: Likewise.
5839 * layout.cc: Likewise.
5840 * layout.h: Likewise.
5841 * mapfile.cc: Likewise.
5842 * merge.cc: Likewise.
5843 * merge.h: Likewise.
5844 * object.cc: Likewise.
5845 * object.h: Likewise.
5846 * options.h: Likewise.
5847 * output.cc: Likewise.
5848 * output.h: Likewise.
5849 * parameters.cc: Likewise.
5850 * plugin.cc: Likewise.
5851 * powerpc.cc: Likewise.
5852 * reduced_debug_output.cc: Likewise.
5853 * reduced_debug_output.h: Likewise.
5854 * reloc.cc: Likewise.
5855 * reloc.h: Likewise.
5856 * resolve.cc: Likewise.
5857 * script-sections.cc: Likewise.
5858 * script.cc: Likewise.
5859 * script.h: Likewise.
5860 * sparc.cc: Likewise.
5861 * symtab.cc: Likewise.
5862 * symtab.h: Likewise.
5863 * target-select.cc: Likewise.
5864 * target-select.h: Likewise.
5865 * token.h: Likewise.
5866 * workqueue.cc: Likewise.
5867 * workqueue.h: Likewise.
5868 * x86_64.cc: Likewise.
5872 * arm.cc (attributes.h): New include.
5873 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5874 (Arm_relobj::~Arm_relobj): Delete object pointed by
5875 attributes_section_data_.
5876 (Arm_relobj::attributes_section_data): New method definition.
5877 (Arm_relobj::attributes_section_data_): New data member declaration.
5878 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5879 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5880 attributes_section_data_.
5881 (Arm_dynobj::attributes_section_data): New method definition.
5882 (Arm_dynobj::attributes_section_data_): New data member declaration.
5883 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5884 initialization value of may_use_blx_ to false.
5885 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5886 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5887 object attributes to compute results instead of hard-coding.
5888 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5889 Target_arm::get_secondary_compatible_arch,
5890 Target_arm::set_secondary_compatible_arch
5891 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5892 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5893 New method declarations.
5894 (Target_arm::get_aeabi_object_attribute): New method definition.
5895 (Target_arm::attributes_section_data_): New data member declaration.
5896 (read_arm_attributes_section): New template definition.
5897 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5898 (Arm_dynobj::do_read_symbols): Ditto.
5899 (Target_arm::do_finalize_sections): Merge attributes sections from
5900 input. Check for BLX use after attributes section merging.
5901 Fix __exidx_start and __exidx_end visibility. Create an
5902 .ARM.attributes section if necessary.
5903 (Target_arm::get_secondary_compatible_arch,
5904 Target_arm::set_secondary_compatible_arch,
5905 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5906 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5907 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5908 New method definitions.
5912 * plugin.cc (Plugin::load): Don't cast from void* to a function
5917 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5922 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5923 Replace two_file_shared_1.so with two_file_shared_2.so.
5924 * testsuite/Makefile.in: Regenerated.
5928 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5929 (HFILES): Add attributes.h and int_encoding.h.
5930 * Makefile.in: Regenerate.
5931 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5932 function definitions to int_encoding.cc
5933 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5934 prototypes to int_encoding.h
5935 * reduced_debug_output.cc (int_encoding.h): New include.
5936 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5937 function definitions to int_encoding.cc
5938 (insert_into_vector, read_from_pointer): Move template definitions to
5940 * attributes.cc: New file.
5941 * attributes.h: New file.
5942 * int_encoding.cc: New file.
5943 * int_encoding.h: New file.
5948 * incremental-dump.cc (dump_incremental_inputs): New.
5949 (main): Use dump_incremental_inputs.
5954 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5955 checking elfcpp::STT_FUNC.
5956 (Target_i386::Relocate::relocate): Likewise.
5957 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5959 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5960 symbols from shared libraries into normal FUNC symbols.
5962 * symtab.h (Symbol): Add is_func and use it.
5966 * arm.cc (Target_arm::arm_info): Initialize new fields
5967 attributes_section and attributes_vendor.
5968 * i386.cc (Target_i386::i386_info): Same.
5969 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5970 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5971 fields attributes_section and attributes_vendor.
5972 * sparc.cc (Target_sparc::sparc_info): Same.
5973 * target.h (Target::attributes_section, Target::attributes_vendor,
5974 Target::is_attributes_section, Target::attribute_arg_type,
5975 Target::attributes_order): New method definitions.
5976 (Target::Target_info::attributes_section,
5977 Target::Target_info::attributes_vendor): New fields.
5978 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5979 virtual method definitions.
5980 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5981 attributes_section and attributes_vendor.
5982 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5986 * arm.cc: Update comments about interworking and stub generation.
5987 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5988 considered as non-PIC.
5989 (Arm_relocate_functions::base_abs): Fix formatting.
5990 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5991 of function to use GOT entry address instead of offset.
5992 (Target_arm::Scan::global): Issue an error if a symbol would need a
5993 PLT does not get one because it is untyped. Remove code to create
5994 dynamic symbols for relative branches.
5995 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5996 takes unsigned integer instead of boolean.
6000 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6001 (two_file_test_LDADD): Likewise.
6002 (common_test_1_LDADD): Likewise.
6003 (exception_test_LDADD) Likewise.
6004 (weak_test_LDADD): Likewise.
6005 (many_sections_test_LDADD): Likewise.
6006 (initpri1_LDADD): Likewise.
6007 (script_test_1_LDADD): Likewise.
6008 (script_test_2_LDADD): Likewise.
6009 (justsyms_LDADD): Likewise.
6010 (binary_test_LDADD): Likewise.
6011 (large_LDADD): Likewise.
6012 * testsuite/Makefile.in: Regenerated.
6016 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6017 (Symbol_table::override_with_special): Likewise.
6018 (Symbol_table::add_from_object): Likewise.
6022 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6023 Don't set the data_offset twice.
6027 * testsuite/Makefile.in: Regenerate.
6031 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6032 (Target_arm::do_finalize_sections): Add parameter for symbol table
6033 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6034 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6035 parameter for symbol table pointer.
6036 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6037 an additional parameter for a pointer to symbol table.
6038 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6039 parameter for a symbol table pointer.
6040 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6041 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6043 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6044 parameter for a symbol table pointer.
6048 * incremental.cc (Incremental_inputs_header)
6049 (Incremental_inputs_header_write, Incremental_inputs_entry)
6050 (Incremental_inputs_entry_write): Move ...
6051 * incremental.h (Incremental_inputs_header)
6052 (Incremental_inputs_header_write, Incremental_inputs_entry)
6053 (Incremental_inputs_entry_write): here.
6057 * incremental.cc (make_sized_incremental_binary): Set the target.
6058 Error if it is incompatible.
6059 * output.h (Output_file): Add filename method.
6063 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6064 from the get_* methods.
6068 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6069 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6070 Write 0 for the data_offset of scripts.
6074 * testsuite/Makefile.am: Add the incremental_test.sh test.
6075 * testsuite/incremental_test.sh: New.
6076 * testsuite/incremental_test_1.c: New.
6077 * testsuite/incremental_test_2.c: New.
6081 * incremental-dump.cc (main): Fix typos.
6086 * incremental-dump.cc (main): Use llu to print 64 bit values.
6091 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6093 (incremental_dump_LDADD): Likewise.
6094 * Makefile.in: Regenerated.
6102 * arm.cc (Target_arm::Target_arm): Move method definition
6103 outside of class definition. Add code to handle
6104 --target1-rel, --target1-abs and --target2= options.
6105 (Target_arm::get_reloc_reloc_type): Change method to be
6106 non-static and const.
6107 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6108 New data member declaration.
6109 (Target_arm::Scan::local, Target_arm::Scan::global,
6110 Target_arm::Relocate::relocate,
6111 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6112 Adjust call to Target_arm::get_real_reloc_type.
6113 (Target_arm::get_real_reloc_type): Use command line options
6114 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6115 * options.h (--target1-rel, --target1-abs, --target2): New
6120 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6121 class definition. Add code to handle --target1-rel, --target1-abs
6122 and --target2= options.
6123 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6125 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6127 (Target_arm::Scan::local, Target_arm::Scan::global,
6128 Target_arm::Relocate::relocate,
6129 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6130 call to Target_arm::get_real_reloc_type.
6131 (Target_arm::get_real_reloc_type): Use command line options to
6132 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6133 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6138 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6139 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6140 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6142 (Arm_relocate_functions::thm_call): Replace body with a call to
6143 Arm_relocate_functions::thumb_branch_common.
6144 (Arm_relocate_functions::thm_jump24,
6145 Arm_relocate_functions::thm_xpc22): New method definitions.
6146 (Arm_relocate_functions::thumb_branch_common): New method definition.
6147 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6149 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6150 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6154 * Makefile.am: Build incremental-dump
6155 * Makefile.in: Regenerate.
6156 * incremental-dump.cc: New.
6157 * incremental.cc (Incremental_inputs_header_data,
6158 Incremental_inputs_entry_data): Move to incremental.h
6159 * incremental.h: (Incremental_inputs_header_data,
6160 Incremental_inputs_entry_data): Move from incremental.cc
6164 * incremental.cc (Incremental_inputs_header,
6165 Incremental_inputs_header_write, Incremental_inputs_entry,
6166 Incremental_inputs_entry_write): Add a typedef with the data type.
6170 * incremental.cc (Incremental_inputs_header,
6171 Incremental_inputs_header_write, Incremental_inputs_entry,
6172 Incremental_inputs_entry_write): Update comment about which
6173 type has the filed descriptions.
6177 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6178 (Arm_relocate_functions::arm_branch_common): Change method defintion
6179 in class definition to a method declaration and update list of formal
6181 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6182 Arm_relocation_functions::jump24): Adjust call to
6183 Arm_relocate_functions::arm_branch_common. Update list of formal
6185 (Arm_relocate_functions::xpc25): New method definition.
6186 (Arm_relocate_functions::arm_branch_common): Move method defintion
6187 out from class definition. Use stubs for mode-switching and extending
6189 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6190 specially. Change code to enable use of stubs in ARM branches.
6194 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6195 in method declaration.
6196 (Target_arm::relocate_stub): New method declaration.
6197 (Target_arm::default_target): Change to return a pointer instead of
6199 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6200 Target_arm::default_target.
6201 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6203 (Target_arm::relocate_section): Adjust view.
6204 (Target_arm::relocate_stub): New method definition.
6208 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6210 * incremental.cc (open_incremental_binary): Initialized local
6211 variables to avoid warnings.
6212 * object.cc (make_elf_object): Ditto.
6213 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6219 * testsuite/plugin_test.c: Include "config.h".
6223 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6224 (arm_symbol_value): Remove.
6225 (Arm_relocate_functions::arm_branch_common,
6226 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6227 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6228 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6229 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6230 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6231 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6232 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6233 Arm_relocate_functions::thm_mobw_abs_nc,
6234 Arm_relocate_functions::thm_mov_abs,
6235 Arm_relocate_functions::movw_prel_nc,
6236 Arm_relocate_functions::thm_movt_abs,
6237 Arm_relocate_functions::movt_prel,
6238 Arm_relocate_functions::thm_movw_prel_nc,
6239 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6240 (Target_arm::Relocate::relocate): Only decompose address into two
6241 parts if relocation type uses the thumb-bit and pass the actual
6242 bit instead of a flag indicating that the thumb-bit is used. Adjust
6243 calls to methods in Arm_relocate_functions for this change.
6248 * reloc.cc: Instantiate
6249 Sized_relobj::initialize_input_to_output_maps and
6250 Sized_relobj:free_input_to_output_maps.
6255 * defstd.cc (in_segment): Set only_if_ref true for "end".
6259 * arm.cc (class Reloc_stub): Correct a comment.
6260 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6261 (Target_arm::scan_section_for_stubs): New method declaration.
6262 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6263 Change methods from private to protected.
6264 (Target_arm::do_may_relax): New method definition.
6265 (Target_arm::do_relax, Target_arm::group_sections,
6266 Target_arm::scan_reloc_for_stub,
6267 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6268 (Target_arm::arm_input_section_map_): New data member declaration.
6269 (Target_arm::scan_reloc_for_stub,
6270 Target_arm::scan_reloc_section_for_stubs,
6271 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6272 Target_arm::do_relax): New method definitions.
6276 * configure.ac: Check for (struct stat)::st_mtim
6277 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6278 * config.in: Regenerate.
6279 * configure: Regenerate.
6284 * output.cc (Output_segment::add_output_section): Add missing
6290 * object.h (class Object): Add is_needed and set_is_needed
6291 methods. Add is_needed_ field. Make bool fields into bitfields.
6292 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6293 defined in a dynamic object and referenced by a regular object,
6294 set is_needed for the dynamic object.
6295 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6296 if the file is marked with as_needed and it is not needed.
6301 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6302 tags if data is discarded by linker script.
6303 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6304 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6305 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6306 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6310 * layout.cc (Layout::get_output_section): Add is_interp and
6311 is_dynamic_linker_section parameters. Change all callers.
6312 (Layout::choose_output_section): Likewise.
6313 (Layout::make_output_section): Likewise.
6314 (Layout::add_output_section_data): Add is_dynamic_linker_section
6315 parameter. Change all callers.
6316 * layout.h (class Layout): Update declarations.
6317 * output.h (class Output_section): Add is_interp, set_is_interp,
6318 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6319 Add is_interp_, is_dynamic_linker_section_ fields. Change
6320 generate_code_fills_at_write_ to a bitfield.
6321 * output.cc (Output_section::Output_sections): Initialize new
6323 (Output_segment::add_output_section): Add do_sort parameter.
6329 * options.h (class General_options): Add --warn-common.
6330 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6331 merging two common symbols.
6332 (Symbol_table::should_override): Handle --warn-common when merging
6333 a common symbol with a defined symbol. Use report_resolve_problem
6334 for multiple definitions.
6335 (Symbol_table::report_resolve_problem): New function.
6336 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6340 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6342 (Target_arm::stub_factory): New method definition.
6343 (Target_arm::new_arm_input_section,
6344 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6345 Target_arm::reloc_uses_thumb_bit): New method declarations.
6346 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6347 New type definitions.
6348 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6349 member declarations.
6350 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6351 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6352 New method definitions.
6356 * options.h (class General_options): Add --warn_constructors.
6361 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6362 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6367 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6368 --msgid-bugs-address.
6369 (install-pdf): New target.
6370 (install-data_yes): Look up one directory to find mkinstalldirs.
6374 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6379 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6383 * arm.cc (Stub_addend_reader): New struct template definition
6384 and partial specializations.
6385 (Stub_addend_reader::operator()): New method definition for a
6386 partially specialized template.
6390 * arm.cc (Arm_relobj::processor_specific_flags): New method
6392 (Arm_relobj::do_read_symbols): New method declaration.
6393 (Arm_relobj::processor_specific_flags_): New data member declaration.
6394 (Arm_dynobj): New class definition.
6395 (Target_arm::do_finalize_sections): Add input_objects parameter.
6396 (Target_arm::do_adjust_elf_header): New method declaration.
6397 (Target_arm::are_eabi_versions_compatible,
6398 (Target_arm::merge_processor_specific_flags): New method declaration.
6399 (Target_arm::do_make_elf_object): New overloaded method definitions
6401 (Arm_relobj::do_read_symbols): New method definition.
6402 (Arm_dynobj::do_read_symbols): Ditto.
6403 (Target_arm::do_finalize_sections): Add input_objects parameters.
6404 Merge processor-specific flags from all input objects.
6405 (Target_arm::are_eabi_versions_compatible,
6406 Target_arm::merge_processor_specific_flags,
6407 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6408 New method definitions.
6409 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6410 Input_objects pointer type parameter.
6411 * layout.cc (Layout::finalize): Pass input objects to target's.
6412 finalize_sections function.
6413 * output.cc (Output_file_header::do_sized_write): Set ELF file
6414 header's processor-specific flags.
6415 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6416 Input_objects pointer type parameter.
6417 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6418 * target.h (Input_objects): New forward class declaration.
6419 (Target::processor_specific_flags,
6420 Target::are_processor_specific_flags_sect): New method definitions.
6421 (Target::finalize_sections): Add input_objects parameter.
6422 (Target::Target): Initialize processor_specific_flags_ and
6423 are_processor_specific_flags_set_.
6424 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6426 (Target::set_processor_specific_flags): New method definition.
6427 (Target::processor_specific_flags_,
6428 Target::are_processor_specific_flags_set_): New data member
6430 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6431 Input_objects pointer type parameter.
6435 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6439 * object.h (class Relobj): Drop options parameter from
6440 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6441 do_scan_relocs, do_relocate. Change all callers.
6442 (class Sized_relobj): Drop options parameters from
6443 do_gc_process_relocs, do_scan_relocs, do_relocate,
6444 do_relocate_sections, relocate_sections, emit_relocs_scan,
6445 emit_relocs_scan_reltype. Change all callers.
6446 (struct Relocate_info): Remove options field and all references to
6448 * reloc.h (class Read_relocs): Remove options constructor
6449 parameter and options_ field. Change all callers.
6450 (class Gc_process_relocs, class Scan_relocs): Likewise.
6451 (class Relocate_task): Likewise.
6452 * target-reloc.h (scan_relocs): Remove options parameter. Change
6454 (scan_relocatable_relocs): Likewise.
6455 * target.h (class Sized_target): Remove options parameter from
6456 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6458 * gc.h (gc_process_relocs): Remove options parameter. Change all
6460 * arm.cc: Update functions to remove options parameters.
6461 * i386.cc: Likewise.
6462 * powerpc.cc: Likewise.
6463 * sparc.cc: Likewise.
6464 * x86_64.cc: Likewise.
6465 * testsuite/testfile.cc: Likewise.
6469 * arm.cc (Arm_relobj): New class definition.
6470 (Arm_relobj::scan_sections_for_stubs,
6471 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6472 New method definitions.
6476 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6477 (Plugin::cleanup_done_): New member.
6478 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6479 (Plugin_manager::cleanup_done_): Remove.
6480 (Plugin_manager::add_input_file): Edit error message.
6481 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6482 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6486 * fileread.cc: (File_read::View::~View): Use the new
6487 data_ownership_ filed.
6488 (File_read::~File_read): Dispose the new whole_file_view_.
6489 (File_read::open): Mmap the whole file if needed.
6490 (File_read::open): Use whole_file_view_ instead of contents_.
6491 (File_read::find_view): Use whole_file_view_ if applicable.
6492 (File_read::do_read): Use whole_file_view_ instead of contents_.
6493 (File_read::make_view): Use whole_file_view_ instead of contents_,
6494 update File_read::View::View call.
6495 (File_read::find_or_make_view): Update File_read::View::View
6497 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6499 (File_read::View::Data_ownership): New enum.
6500 (File_read::View::View): Replace bool mapped_ with Data_ownership
6502 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6503 (File_read::View::data_ownership_): New field.
6504 (File_read::contents_): Remove (replaced by whole_file_view_).
6505 (File_read::whole_file_view_): New field.
6506 * options.h (class General_options): Add --keep-files-mapped.
6510 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6511 * testsuite/Makefile.am (plugin_test_5): New test case.
6512 * testsuite/Makefile.in: Regenerate.
6516 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6517 from private to protected to allow access by child class.
6518 (Sized_relobj::do_relocate_sections): New method declaration.
6519 (Sized_relobj::relocate_sections): Virtualize.
6520 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6521 Sized_relobj::relocate_sections. Instantiate template explicitly
6522 for different target sizes and endianity.
6526 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6527 (Arm_input_section::as_arm_input_section): New method.
6528 (Arm_output_section): New class definition.
6529 (Arm_output_section::create_stub_group,
6530 Arm_output_section::group_sections): New method definitions.
6534 * arm.cc (Arm_input_section): New class definition.
6535 (Arm_input_section::init, Arm_input_section:do_write,
6536 Arm_input_section::set_final_data_size,
6537 Arm_input_section::do_reset_address_and_file_offset): New method
6542 * arm.cc (Stub_table, Arm_input_section): New forward class
6544 (Stub_table): New class defintion.
6545 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6546 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6547 New method definition.
6551 * arm.cc: Update copyright comments.
6552 (Target_arm): New forward class template declaration.
6553 (Arm_address): New type.
6554 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6555 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6556 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6558 (Insn_template): Same.
6559 (DEF_STUBS): New macro.
6560 (Stub_type): New enum type.
6561 (Stub_template): New class definition.
6564 (Stub_factory): Same.
6565 (Target_arm::Target_arm): Initialize may_use_blx_ and
6566 should_force_pic_veneer_.
6567 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6568 Target_arm::should_force_pic_veneer,
6569 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6570 Target_arm::using_thumb_only, Target_arm:;default_target): New
6572 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6573 New data member declarations.
6574 (Insn_template::size, Insn_template::alignment): New method defintions.
6575 (Stub_template::Stub_template): New method definition.
6576 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6577 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6578 (Stub_factory::Stub_factory): New method definition.
6579 * gold.h (string_hash): New template.
6580 * output.h (Input_section_specifier::hash_value): Use
6582 (Input_section_specifier::string_hash): Remove.
6583 * stringpool.cc (Stringpool_template::string_hash): Use
6588 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6589 symbols of relaxed input sections.
6590 * output.h (Output_section::find_relaxed_input_section): Make
6595 * dynobj.cc (Versions::Versions): Initialize version_script_.
6596 Only insert base version symbol definition for a shared object
6597 if version script defines any version versions.
6598 (Versions::define_base_version): New method definition.
6599 (Versions::add_def): Check that base version is not needed.
6600 (Versions::add_need): Define base version lazily.
6601 * dynobj.h (Versions::define_base_version): New method declaration.
6602 (Versions::needs_base_version_): New data member declaration.
6603 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6604 (check_DATA): Add no_version_test.stdout.
6605 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6607 * testsuite/Makefile.in: Regenerate.
6608 * testsuite/no_version_test.c: New file.
6609 * testsuite/no_version_test.sh: Ditto.
6613 * expression.cc (class Segment_start_expression): New class definition.
6614 (Segment_start_expression::value): New method definition.
6615 (script_exp_function_segment_start): Return a new
6616 Segment_start_expression.
6617 * gold/script-c.h (script_saw_segment_start_expression): New function
6619 * script-sections.cc (Script_sections::Script_sections): Initialize
6620 SAW_SEGMENT_START_EXPRESSION_ to false.
6621 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6622 and -Tbbs options to specify section addresses if given in
6623 command line and no SEGMENT_START expression is seen in a script.
6624 * script-sections.h (Script_sections::saw_segment_start_expression,
6625 Script_sections::set_saw_segment_start_expression): New method
6627 (Script_sections::saw_segment_start_expression_): New data member
6629 * script.cc (script_saw_segment_start_expression): New function.
6630 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6631 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6632 script_test_7.sh and script_test_8.sh.
6633 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6634 script_test_8.stdout.
6635 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6636 (script_test_6, script_test_6.stdout, script_test_7,
6637 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6638 * Makefile.in: Regenerate.
6639 * testsuite/script_test_6.sh: New file.
6640 * testsuite/script_test_6.t: Same.
6641 * testsuite/script_test_7.sh: Same.
6642 * testsuite/script_test_7.t: Same.
6643 * testsuite/script_test_8.sh: Same.
6647 * output.cc (Output_segment::set_section_list_address): Cast
6648 expressions to unsigned long long type to avoid format warnings.
6652 * script.cc (Script_options::add_symbol_assignment): Always add a
6653 dot assignment to script_sections_.
6654 * script-sections.cc (Script_sections::add_dot_assignment):
6655 Initialize if necessary.
6657 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6658 program headers with no load segment if there is a linker script.
6660 * layout.cc (Layout::set_segment_offsets): Align the file offset
6661 to the segment aligment for -N or -n with no load segment.
6662 * output.cc (Output_segment::add_output_section): Don't crash if
6663 the first section is a TLS section.
6664 (Output_segment::set_section_list_addresses): Print an error
6665 message if the address moves backward in a linker script.
6666 * script-sections.cc
6667 (Output_section_element_input::set_section_addresses): Don't
6668 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6669 (Orphan_output_section::set_section_addresses): Likewise.
6673 * layout.cc (Layout::finish_dynamic_section): Generate tags
6674 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6675 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6676 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6680 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6682 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6683 data_shdr fields of relinfo.
6684 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6685 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6686 R_386_TLS_LDO_32, adjust based on section flags.
6687 (Target_i386::Relocate::fix_up_ldo): Remove.
6691 Add support for -pie.
6692 * options.h (class General_options): Add -pie and
6694 (General_options::output_is_position_independent): Test -pie.
6695 (General_options::output_is_executable): Return true if not shared
6696 and not relocatable.
6697 (General_options::output_is_pie): Remove.
6698 * options.cc (General_options::finalize): Reject incompatible uses
6700 * gold.cc (queue_middle_tasks): A -pie link is not static.
6701 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6702 * symtab.cc (Symbol::final_value_is_known): Return false if
6703 output_is_position_independent.
6704 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6705 output_is_position_independent.
6706 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6707 output_is_position_independent.
6708 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6709 output_is_position_independent.
6710 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6712 (basic_pie_test.o, basic_pie_test): New targets.
6713 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6714 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6715 (two_file_pie_test): New target.
6716 * testsuite/Makefile.in: Rebuild.
6717 * README: Remove note saying that -pie is not supported.
6721 * options.h (class General_options): Add -init and -fini.
6722 * layout.cc (Layout::finish_dynamic_section): Emit
6723 given init and fini functions.
6727 * gc.h (gc_process_relocs): Check if icf is enabled using new
6729 * gold.cc (queue_initial_tasks): Likewise.
6730 (queue_middle_tasks): Likewise.
6731 * object.cc (do_layout): Likewise.
6732 * symtab.cc (is_section_folded): Likewise.
6733 * main.cc (main): Likewise.
6734 * reloc.cc (Read_relocs::run): Likewise.
6735 (Sized_relobj::do_scan_relocs): Likewise.
6736 * icf.cc (is_function_ctor_or_dtor): New function.
6737 (Icf::find_identical_sections): Check if function is ctor or dtor when
6739 * options.h (General_options::icf): Change option to be an enum.
6740 (Icf_status): New enum.
6741 (icf_enabled): New method.
6742 (icf_safe_folding): New method.
6743 (set_icf_status): New method.
6744 (icf_status_): New variable.
6745 * (options.cc) (General_options::finalize): Set icf_status_.
6746 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6747 icf_test and icf_keep_unique_test to use the --icf enum flag.
6748 * testsuite/icf_safe_test.sh: New file.
6749 * testsuite/icf_safe_test.cc: New file.
6753 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6754 includes to gc.h and icf.h.
6755 * arm.cc: Include gc.h.
6756 * gold.cc: Likewise.
6757 * i386.cc: Likewise.
6758 * powerpc.cc: Likewise.
6759 * sparc.cc: Likewise.
6760 * x86_64.cc: Likewise.
6761 * gc.h: Include icf.h.
6765 * plugin.cc: Include "gold.h" before other header files.
6769 * options.h (Input_file_argument::Input_file_type): New enum.
6770 (Input_file_argument::is_lib_): Replace with...
6771 (Input_file_argument::type_): New member.
6772 (Input_file_argument::Input_file_argument): Take Input_file_type
6773 'type' rather than boolean 'is_lib' as second argument.
6774 (Input_file_argument::is_lib): Use type_.
6775 (Input_file_argument::is_searched_file): New function.
6776 (Input_file_argument::may_need_search): Handle is_searched_file.
6777 * options.cc (General_options::parse_library): Support -l:filename.
6778 (General_options::parse_just_symbols): Update for Input_file_argument
6780 (Command_line::process): Likewise.
6781 * archive.cc (Archive::get_file_and_offset): Likewise.
6782 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6783 * script.cc (read_script_file, script_add_file): Likewise.
6784 * fileread.cc (Input_file::Input_file): Likewise.
6785 (Input_file::will_search_for): Handle is_searched_file.
6786 (Input_file::open): Likewise.
6787 * readsyms.cc (Read_symbols::get_name): Likewise.
6788 * testsuite/Makefile.am (searched_file_test): New test.
6789 * testsuite/Makefile.in: Regenerate.
6790 * testsuite/searched_file_test.cc: New file.
6791 * testsuite/searched_file_test_lib.cc: New file.
6796 * descriptor.cc: Include <cstdio> and "binary-io.h".
6797 (Descriptors::open): Open the files in binary mode always.
6798 * script.cc (Lex::get_token): Treat \r as whitespace.
6802 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6807 * configure.ac: Check for readv function also.
6808 * fileread.cc (readv): Define if not HAVE_READV.
6809 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6811 * config.in: Regenerate.
6812 * configure: Regenerate.
6816 * layout.cc (Layout::make_output_section): Call target hook to make
6817 ordinary output section.
6818 (Layout::finalize): Adjust parameter list of call the
6819 Target::may_relax().
6820 * layout.h (class Layout::section_list): New method.
6821 * merge.h (Output_merge_base::entsize): Change visibility to public.
6822 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6824 (Output_merge_string::do_is_string): New method.
6825 * object.cc (Sized_relobj::do_setup): renamed from
6826 Sized_relobj::set_up.
6827 * object.h (Sized_relobj::adjust_shndx,
6828 Sized_relobj::initializ_input_to_output_maps,
6829 Sized_relobj::free_input_to_output_maps): Change visibilities to
6831 (Sized_relobj::setup): Virtualize.
6832 (Sized_relobj::do_setup): New method declaration.
6833 (Sized_relobj::invalidate_section_offset,
6834 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6835 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6836 * options.cc (parse_int): New function.
6837 * options.h (parse_int): New declaration.
6838 (DEFINE_int): New macro.
6839 (stub_group_size): New option.
6840 * output.cc (Output_section::Output_section): Initialize memebers
6841 merge_section_map_, merge_section_by_properties_map_,
6842 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6843 (Output_section::add_input_section): Handled deferred code-fill
6844 generation and remove an old comment.
6845 (Output_section::add_relaxed_input_section): New method definition.
6846 (Output_section::add_merge_input_section): Use merge section by
6847 properties map to speed to search. Update merge section maps
6849 (Output_section::build_relaxation_map): New method definition.
6850 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6852 (Output_section::relax_input_section): Renamed to
6853 Output_section::convert_input_sections_to_relaxed_sections and change
6854 interface to take a vector of pointers to relaxed sections.
6855 (Output_section::find_merge_section,
6856 Output_section::find_relaxed_input_section): New method definitions.
6857 (Output_section::is_input_address_mapped,
6858 Output_section::output_offset, Output_section::output_address):
6859 Use output section data maps to speed up searching.
6860 (Output_section::find_starting_output_address): Add comments.
6861 (Output_section::do_write,
6862 Output_section::write_to_postprocessing_buffer): Do code-fill
6863 generation as appropriate.
6864 (Output_section::get_input_sections): Invalidate relaxed input section
6866 (Output_section::restore_states): Adjust type of checkpoint .
6867 Invalidate relaxed input section map.
6868 * output.h (Output_merge_base): New class declaration.
6869 (Input_section_specifier): New class defintion.
6870 (class Output_relaxed_input_section) Change base class to
6871 Output_section_data_build.
6872 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6873 base class initializer.
6874 (Output_section::add_relaxed_input_section): New method declaration.
6875 (Output_section::Input_section): Change visibility to protected.
6876 (Output_section::Input_section::relobj,
6877 Output_section::Input_section::shndx): Handle relaxed input sections.
6878 Output_section::input_sections) Change visibility to protected. Also
6879 define overload to return a non-const pointer.
6880 (Output_section::Merge_section_properties): New class defintion.
6881 (Output_section::Merge_section_by_properties_map,
6882 Output_section::Output_section_data_by_input_section_map,
6883 Output_section::Relaxation_map): New types.
6884 (Output_section::relax_input_section): Rename method to
6885 Output_section::convert_input_sections_to_relaxed_sections and change
6886 interface to take a vector of relaxed section pointers.
6887 (Output_section::find_merge_section,
6888 Output_section::find_relaxed_input_section,
6889 Output_section::build_relaxation_map,
6890 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6891 New method declarations.
6892 (Output_section::merge_section_map_
6893 Output_section::merge_section_by_properties_map_,
6894 Output_section::relaxed_input_section_map_,
6895 Output_section::is_relaxed_input_section_map_valid_,
6896 Output_section::generate_code_fills_at_write_): New data members.
6897 * script-sections.cc
6898 (Output_section_element_input::set_section_addresses): Call
6899 current_data_size and addralign methods of relaxed input sections.
6900 (Orphan_output_section::set_section_addresses): Call current_data_size
6901 and addralign methods of relaxed input sections.
6902 * symtab.cc (Symbol_table::compute_final_value): Extract template
6903 from the body of Symbol_table::sized_finalize_symbol.
6904 (Symbol_table::sized_finalized_symbol): Call
6905 Symbol_table::compute_final_value.
6906 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6907 (Symbol_table::compute_final_value): New templated method declaration.
6908 * target.cc (Target::do_make_output_section): New method defintion.
6909 * target.h (Target::make_output_section): New method declaration.
6910 (Target::relax): Add more parameters for input objects, symbol table
6911 and layout. Adjust call to do_relax.
6912 (Target::do_make_output_section): New method declaration.
6913 (Target::do_relax): Add parameters for input objects, symbol table
6918 * pread.c: Include stdio.h.
6922 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6927 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6928 Change read_shndx type to unsigned int.
6929 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6931 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6932 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6933 Change read_shndx type to unsigned int.
6934 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6936 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6937 * layout.cc (Layout::create_symtab_sections): Cast the result of
6938 local_symcount * symsize to off_t in the gold_assert.
6942 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6943 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6945 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6946 (Arm_relocate_functions::thm_abs5): New function.
6947 (Arm_relocate_functions::abs12): New function.
6948 (Arm_relocate_functions::abs16): New function.
6949 (Arm_relocate_functions::base_abs): New function.
6950 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6951 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6952 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6954 (Scan::global): Likewise.
6955 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6956 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6957 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6958 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6963 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6964 (Arm_relocate_functions::movt_prel): New function.
6965 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6966 (Arm_relocate_functions::thm_movt_prel): New function.
6967 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6968 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6969 (Scan::global, Relocate::relocate): Likewise.
6970 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6974 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6975 Incremental_checker.
6976 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6978 (class Incremental_inputs_header): New class.
6979 (Incremental_inputs_header_writer): Edit comment.
6980 (Incremental_inputs_entry): New class.
6981 (Incremental_inputs_entry_writer): Edit comment.
6982 (Sized_incremental_binary::do_find_incremental_inputs_section):
6983 Add *strtab_shndx parameter, fill it.
6984 (Sized_incremental_binary::do_check_inputs): New method.
6985 (Incremental_checker::can_incrementally_link_output_file): Use
6986 Sized_incremental_binary::check_inputs.
6987 (Incremental_inputs::report_command_line): Save command line in
6990 (Incremental_binary::find_incremental_inputs_section): New
6992 (Incremental_binary::do_find_incremental_inputs_section): Add
6993 strtab_shndx parameter.
6994 (Incremental_binary::do_check_inputs): New pure virtual method.
6995 (Sized_incremental_binary::do_check_inputs): Declare.
6996 (Incremental_checker::Incremental_checker): Add incremental_inputs
6997 parameter, use it to initialize incremental_inputs_.
6998 (Incremental_checker::incremental_inputs_): New field.
6999 (Incremental_checker::command_line): New method.
7000 (Incremental_checker::inputs): New method.
7001 (Incremental_checker::command_line_): New field.
7005 * incremental.cc: Include <cstdarg> and "target-select.h".
7006 (vexplain_no_incremental): New function.
7007 (explain_no_incremental): New function.
7008 (Incremental_binary::error): New method.
7009 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7011 (make_sized_incremental_binary): New function.
7012 (open_incremental_binary): New function.
7013 (can_incrementally_link_file): Add checks if output is ELF and has
7015 * incremental.h: Include "elfcpp_file.h" and "output.h".
7016 (Incremental_binary): New class.
7017 (Sized_incremental_binary): New class.
7018 (open_incremental_binary): Declare.
7019 * object.cc (is_elf_object): Use
7020 elfcpp::Elf_recognizer::is_elf_file.
7021 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7022 * output.h (Output_file::filesize): New method.
7026 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7028 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7029 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7031 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7033 (Arm_relocate_functions::movw_abs_nc): New function.
7034 (Arm_relocate_functions::movt_abs): New function.
7035 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7036 (Arm_relocate_functions::thm_movt_abs): New function.
7037 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7038 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7039 (Scan::global): Likewise.
7040 (Relocate::relocate): Likewise.
7041 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7045 * arm.cc (Arm_relocate_functions::got_prel) New function.
7046 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7047 (Relocate::relocate): Likewise.
7048 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7052 * options.h (class General_options): Define
7053 split_stack_adjust_size parameter.
7054 * object.h (class Object): Add uses_split_stack_ and
7055 has_no_split_stack_ fields. Add uses_split_stack and
7056 has_no_split_stack accessor functions. Declare
7057 handle_split_stack_section.
7058 (class Reloc_symbol_changes): Define.
7059 (class Sized_relobj): Define Function_offsets. Declare
7060 split_stack_adjust, split_stack_adjust_reltype, and
7062 * object.cc (Object::handle_split_stack_section): New function.
7063 (Sized_relobj::do_layout): Call handle_split_stack_section.
7064 * dynobj.cc (Sized_dynobj::do_layout): Call
7065 handle_split_stack_section.
7066 * reloc.cc (Sized_relobj::relocate_sections): Call
7067 split_stack_adjust for executable sections in split_stack
7068 objects. Pass reloc_map to relocate_section.
7069 (Sized_relobj::split_stack_adjust): New function.
7070 (Sized_relobj::split_stack_adjust_reltype): New function.
7071 (Sized_relobj::find_functions): New function.
7072 * target-reloc.h: Include "object.h".
7073 (relocate_section): Add reloc_symbol_changes parameter. Change
7075 * target.h (class Target): Add calls_non_split method. Declare
7076 do_calls_non_split virtual method. Declare match_view and
7078 * target.cc: Include "elfcpp.h".
7079 (Target::do_calls_non_split): New function.
7080 (Target::match_view): New function.
7081 (Target::set_view_to_nop): New function.
7082 * gold.cc (queue_middle_tasks): Give an error if mixing
7083 split-stack and non-split-stack objects with -r.
7084 * i386.cc (Target_i386::relocate_section): Add
7085 reloc_symbol_changes parameter.
7086 (Target_i386::do_calls_non_split): New function.
7087 * x86_64.cc (Target_x86_64::relocate_section): Add
7088 reloc_symbol_changes parameter.
7089 (Target_x86_64::do_calls_non_split): New function.
7090 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7092 * powerpc.cc (Target_powerpc::relocate_section): Add
7093 reloc_symbol_changes parameter.
7094 * sparc.cc (Target_sparc::relocate_section): Add
7095 reloc_symbol_changes parameter.
7096 * configure.ac: Call AM_CONDITIONAL for the default target.
7097 * configure: Rebuild.
7098 * testsuite/Makefile.am (TEST_AS): New variable.
7099 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7100 (check_DATA): Add split_i386 and split_x86_64 files.
7101 (SPLIT_DEFSYMS): Define.
7102 (split_i386_[1234n].o): New targets.
7103 (split_i386_[124]): New targets.
7104 (split_i386_[1234r].stdout): New targets.
7105 (split_x86_64_[1234n].o): New targets.
7106 (split_x86_64_[124]): New targets.
7107 (split_x86_64_[1234r].stdout): New targets.
7108 (MOSTLYCLEANFILES): Add new executables.
7109 * testsuite/split_i386.sh: New file.
7110 * testsuite/split_x86_64.sh: New file.
7111 * testsuite/split_i386_1.s: New file.
7112 * testsuite/split_i386_2.s: New file.
7113 * testsuite/split_i386_3.s: New file.
7114 * testsuite/split_i386_4.s: New file.
7115 * testsuite/split_i386_n.s: New file.
7116 * testsuite/split_x86_64_1.s: New file.
7117 * testsuite/split_x86_64_2.s: New file.
7118 * testsuite/split_x86_64_3.s: New file.
7119 * testsuite/split_x86_64_4.s: New file.
7120 * testsuite/split_x86_64_n.s: New file.
7121 * testsuite/testfile.cc (Target_test): Update relocation_section
7123 * testsuite/Makefile.in: Rebuild.
7127 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7128 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7129 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7130 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7131 the address on ldo_addrs_.
7132 (Target_i386::Relocate::fix_up_ldo): New function.
7136 * plugin.cc (add_input_library): New.
7137 (Plugin::load): Add add_input_library to tv.
7138 (Plugin_manager::add_input_file): Add the is_lib argument.
7139 (add_input_file): Update call to Plugin_manager::add_input_file.
7140 (add_input_library): New.
7141 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7145 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7146 symbol and call Symbol::may_need_copy_reloc to determine if
7147 a copy reloc is needed.
7148 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7149 nocopyreloc is given in command line.
7150 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7151 given in command line.
7152 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7153 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7154 of the removed Target_i386::may_need_copy_reloc.
7155 * options.h (copyreloc): New option with default value false.
7156 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7157 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7158 instead of the removed Target_powerpc::may_need_copy_reloc.
7159 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7160 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7161 instead of the removed Target_sparc::may_need_copy_reloc.
7162 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7163 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7164 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7165 instead of the removed Target_x86_64::may_need_copy_reloc.
7169 * object.h (class Object): Remove target_ field, and target,
7170 sized_target, and set_target methods.
7171 (Object::sized_target): Remove.
7172 (class Sized_relobj): Update declarations. Remove sized_target.
7173 * object.cc (Sized_relobj::setup): Remove target parameter.
7175 (Input_objects::add_object): Don't do anything with the target.
7176 (make_elf_sized_object): Add punconfigured parameter. Change all
7177 callers. Set or test parameter target.
7178 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7180 * parameters.cc (Parameters::set_target): Change parameter type to
7182 (Parameters::default_target): Remove.
7183 (set_parameters_target): Change parameter type to be non-const.
7184 (parameters_force_valid_target): New function.
7185 (parameters_clear_target): New function.
7186 * parameters.h (class Parameters): Update declarations. Remove
7187 default_target method. Add sized_target and clear_target
7188 methods. Change target_ to be non-const.
7189 (set_parameters_target): Update declaration.
7190 (parameters_force_valid_target): Declare.
7191 (parameters_clear_target): Declare.
7192 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7193 as NULL if we aren't searching.
7194 (Add_symbols::run): Don't check for compatible target.
7195 * fileread.cc (Input_file::open_binary): Call
7196 parameters_force_valid_target.
7197 * gold.cc (queue_middle_tasks): Likewise.
7198 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7199 set_target on object.
7200 * dynobj.h (class Sized_dynobj): Update declarations.
7201 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7202 make_elf_object returns NULL.
7203 (Archive::include_member): Don't check whether object target is
7205 * output.cc (Output_section::add_input_section): Get target from
7207 (Output_section::relax_input_section): Likewise.
7208 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7210 (Sized_relobj::do_scan_relocs): Likewise.
7211 (Sized_relobj::relocate_sections): Likewise.
7212 * resolve.cc (Symbol_table::resolve): Likewise.
7213 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7214 parameter. Change all callers.
7215 (Symbol_table::add_from_object): Get target from parameters.
7216 (Symbol_table::add_from_relobj): Don't check object target.
7217 (Symbol_table::add_from_dynobj): Likewise.
7218 (Symbol_table::define_special_symbol): Get target from
7220 * symtab.h (class Symbol_table): Update declaration.
7221 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7222 parameter. Change all callers. Clear parameter target.
7223 (Binary_test): Test target here.
7224 * testsuite/object_unittest.cc (gold_testsuite): Remove
7225 target_test_pointer parameter. Change all callers.
7226 (Object_test): Test target here.
7230 * testsuite/initpri1.c: Don't try to use constructor priorities if
7231 compiling with gcc before 4.3.
7235 * testsuite/retain_symbols_file_test.sh (check_present): Change
7236 output file name to retain_symbols_file_test.stdout.
7237 (check_absent): Likewise.
7241 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7242 * options.cc: Include <cerrno> and <fstream>.
7243 (General_options::finalize): Parse -retain-symbols-file tag.
7244 * options.h: New flag.
7245 (General_options): New method should_retain_symbol, new
7246 variable symbols_to_retain.
7247 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7248 should_retain_symbol map.
7249 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7250 * testsuite/Makefile.in: Regenerate.
7251 * testsuite/retain_symbols_file_test.sh: New file.
7255 * po/es.po: Updated Spanish translation.
7259 * debug.h (DEBUG_RELAXATION): New constant.
7260 (DEBUG_ALL): Add DEBUG_RELAXATION.
7261 (debug_string_to_enum): Add relaxation debug option.
7263 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7264 Layout::Relaxation_debug_check::read_sections,
7265 Layout::Relaxation_debug_check::read_sections): New method definitions.
7266 (Layout::Layout): Initialize data members
7267 record_output_section_data_from_scrips_,
7268 script_output_section_data_list_ and relaxation_debug_check_.
7269 (Layout::save_segments, Layout::restore_segments,
7270 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7271 Layout::relaxation_loop_body): New method definitions.
7272 (Layout::finalize): Support relaxation. Move section layout code to
7273 Layout::relaxation_loop_body.
7274 (Layout::set_asection_address_from_script): Move code for orphan
7275 section placement out.
7276 (Layout::place_orphan_sections_in_script): New method definition.
7277 * layout.h (Output_segment_headers, Output_file_header):
7278 New forward class declarations.
7279 (Layout::~Layout): Define.
7280 (Layout::new_output_section_data_from_script): New method definition.
7281 (Layout::place_orphan_sections_in_script): New method declaration.
7282 (Layout::Segment_states): New type declaration.
7283 (Layout::save_segments, Layout::restore_segments,
7284 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7285 Layout::relaxation_loop_body): New method declarations.
7286 (Layout::Output_section_data_list): New type declaration.
7287 (Layout::Relaxation_debug_check): New class definition.
7288 (Layout::record_output_section_data_from_script_,
7289 Layout::script_output_section_data_list_, Layout::segment_states_,
7290 Layout::relaxation_debug_check_): New data members.
7291 * output.cc: (Output_section_headers::do_size): New method definition.
7292 (Output_section_headers::Output_section_headers): Move size
7293 computation to Output_section_headers::do_size.
7294 (Output_segment_headers::do_size): New method definition.
7295 (Output_file_header::Output_file_header): Move size computation to
7296 Output_file_header::do_size and call it.
7297 (Output_file_header::do_size): New method definition.
7298 (Output_data_group::Output_data_group): Adjust call to
7299 Output_section_data.
7300 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7301 (Output_symtab_xindex::do_write): Add array bound check.
7302 (Output_section::Input_section::print_to_mapfile): Handle
7303 RELAXED_INPUT_SECTION_CODE.
7304 (Output_section::Output_section): Initialize data member checkpoint_.
7305 (Output_section::~Output_section): Delete checkpoint object pointed
7307 (Output_section::add_input_section): Always add an Input_section if
7309 (Output_section::add_merge_input_section): Add assert.
7310 (Output_section::relax_input_section): New method definition.
7311 (Output_section::set_final_data_size): Set load address to zero for
7312 an unallocated section.
7313 (Output_section::do_address_and_file_offset_have_reset_values):
7314 New method definition.
7315 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7316 Handle relaxed input section.
7317 (Output_section::sort_attached_input_sections): Checkpoint input
7318 section list lazily.
7319 (Output_section::get_input_sections): Change type of input_sections to
7320 list of Simple_input_section pointers. Checkpoint input section list
7321 lazily. Also handle relaxed input sections.
7322 (Output_section::add_input_section_for_script): Take a reference to
7323 a Simple_input_section object instead of Relobj pointer and section
7324 index as parameter. Handle relaxed input sections.
7325 (Output_section::save_states, Output_section::restore_states): New
7327 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7328 (Output_data::is_data_size_fixed): New method definition.
7329 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7331 (Output_data::address_and_file_offset_have_reset_values): New method
7333 (Output_data::do_address_and_file_offset_have_reset_values): New method
7335 (Output_data::set_data_size): Check that data size is not fixed.
7336 (Output_data::fix_data_size): New method definition.
7337 (Output_data::is_data_size_fixed_): New data member.
7338 (Output_section_headers::set_final_data_size): New method definition.
7339 (Output_section_headers::do_size): New method declaration.
7340 (Output_segment_headers::set_final_data_size): New method definition.
7341 (Output_segment_headers::do_size): New method declaration.
7342 (Output_file_header::set_final_data_size)::New method definition.
7343 (Output_file_header::do_size)::New method declaration.
7344 (Output_section_data::Output_section_data): Add new parameter
7345 is_data_size_fixed and use it to fix data size.
7346 (Output_data_const::Output_data_const): Adjust call to base class
7347 constructor and fix data size.
7348 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7349 base class constructor and fix data size.
7350 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7351 base class constructor and fix data size.
7352 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7353 class constructor and fix data size.
7354 (Output_data_group::set_final_data_size): New method definition.
7355 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7356 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7357 class constructor and fix data size.
7358 (Output_relaxed_input_section): New class definition.
7359 (Output_section::Simple_input_section): New class definition.
7360 (Output_section::get_input_sections): Adjust parameter list.
7361 (Output_section::add_input_section_for_script): Same.
7362 (Output_section::save_states, Output_section::restore_states,
7363 Output_section::do_address_and_file_offset_have_reset_values,
7364 (Output_section::Input_section::Input_section): Handle
7365 RELAXED_INPUT_SECTION_CODE. Add new overload for
7366 Output_relaxed_input_section.
7367 (Output_section::Input_section::is_input_section,
7368 Output_section::Input_section::set_output_section): Handle relaxed
7370 (Output_section::Input_section::is_relaxed_input_section,
7371 Output_section::Input_section::output_section_data,
7372 Output_section::Input_section::relaxed_input_section): New method
7374 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7376 (Output_section::Input_section::u1_): Update comments.
7377 (Output_section::Input_section::u2_): Add new union member poris.
7378 (Output_section::Checkpoint_output_section): New classs definition.
7379 (Output_section::relax_input_section): New method declaration.
7380 (Output_section::checkpoint_): New data member.
7381 (Output_segment): Update comments.
7382 (Output_segment::Output_segment): Un-privatize copy constructor.
7383 (Output_segment::operator=): Un-privatize.
7384 * script-sections.cc (Output_section_element::Input_section_list):
7385 Change element type to Output_section::Simple_input_section.
7386 (Output_section_element_dot_assignment::set_section_addresses):
7387 Register output section data for relaxation clean up.
7388 (Output_data_exression::Output_data_expression): Adjust call to base
7389 constructor to fix data size.
7390 (Output_section_element_data::set_section_addresses): Register
7391 Output_data_expression object for relaxation clean up.
7392 (struct Input_section_info): Replace Relobj pointer and section index
7393 pair with Output_section::Simple_input_section and Convert struct to a
7395 (Input_section_sorter::operator()): Adjust access to
7396 Input_section_info data member to use accessors.
7397 (Output_section_element_input::set_section_addresses): Use layout
7398 parameter. Adjust code to use Output_section::Simple_input_section
7399 and Input_secction_info classes. Register filler for relaxation
7401 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7402 and section index pair with Output_section::Simple_input_section
7403 class. Adjust code accordingly.
7404 (Phdrs_element::release_segment): New method definition.
7405 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7407 (Script_sections::release_segments): New method definition.
7408 * gold/script-sections.h (Script_sections::release_segments): New
7410 * gold/target.h (Target::may_relax, Target::relax,
7411 Target::do_may_relax, Target::do_relax): New method definitions.
7415 * arm.cc (has_signed_unsigned_overflow): New function.
7416 (Arm_relocate_functions::abs8): New function.
7417 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7418 (Target_arm::Scan::global): Likewise.
7419 (Target_arm::relocate::relocate): Likewise.
7420 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7425 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7426 * testsuite/Makefile.in: Regenerate.
7430 * po/gold.pot: Updated by the Translation project.
7434 * output.cc (Output_file::open): Add execute permission to empty file.
7435 * testsuite/Makefile.am (permission_test): New test.
7436 * testsuite/Makefile.in: Regenerate.
7440 * output.cc (Output_file::resize): Call map_no_anonymous rather
7445 * gold.cc: Include "incremental.h".
7446 (queue_initial_tasks): Call Incremental_checker methods.
7447 * incremental.cc: Include "output.h".
7448 (Incremental_checker::can_incrementally_link_output_file): New
7450 * incremental.h (Incremental_checker): New class.
7452 * output.cc (Output_file::open_for_modification): New method.
7453 (Output_file::map_anonymous): Changed return type to bool. Record
7455 (Output_file::map_no_anonymous): New method, broken out of map.
7456 (Output_file::map): Use map_no_anonymous and map_anonymous.
7457 * output.h (class Output_file): Update declarations.
7461 * options.h (Command_line::Pre_options): New class.
7462 (Command_line::pre_options): New member.
7463 * options.cc (gold::options::ready_to_register): New variable.
7464 (One_option::register_option): Do nothing if not registering options.
7465 Assert if same short option registered twice.
7466 (General_options::General_options): Turn off option registration when
7468 (Command_line::Pre_options::Pre_options): New constructor.
7472 * options.h (General_options::no_keep_memory): Remove incorrect
7477 * Makefile.am (am__skiplex, am__skipyacc): New.
7478 * Makefile.in: Regenerate.
7482 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7483 (INCLUDES): ... this.
7484 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7485 (AM_CPPFLAGS): Renamed from ...
7486 (INCLUDE): ... this.
7487 * Makefile.in, testsuite/Makefile.in: Regenerate.
7489 * Makefile.in: Regenerate.
7490 * aclocal.m4: Likewise.
7491 * config.in: Likewise.
7492 * configure: Likewise.
7493 * testsuite/Makefile.in: Likewise.
7495 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7496 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7497 * Makefile.in: Regenerate.
7498 * testsuite/Makefile.in: Regenerate.
7502 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7503 symbols in shared libraries overridden by hidden or internal symbols
7504 in the main program.
7508 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7509 checking source file names in error messages.
7513 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7514 an elcpp::Ehdr as parameter. Adjust call to set_target.
7515 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7516 an elfcpp::Ehdr as parameter.
7517 * object.cc (Object::set_target): Remove the version that looks up
7518 a target and sets it.
7519 (Sized_relobj::setup): Take a Target object instead of
7520 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7521 (make_elf_sized_object): Find target and ask target to
7523 * object.h: (Object::set_target): Remove the version that looks up
7524 a target and sets it.
7525 (Sized_relobj::setup): Take a Target object instead of
7526 an elfcpp:Ehdr as parameter.
7527 * target.cc: Include dynobj.h.
7528 (Target::do_make_elf_object_implementation): New.
7529 (Target::do_make_elf_object): New.
7530 * target.h (Target::make_elf_object): New template declaration.
7531 (Target::do_make_elf_object): New method declarations.
7532 (Target::do_make_elf_object_implementation): New template declaration.
7536 * gold.h (FUNCTION_NAME): Define.
7537 (gold_unreachable): Use FUNCTION_NAME.
7541 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7542 symbol in the --keep-unique list is not found.
7546 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7547 been maked as --keep-unique.
7548 (Icf::unfold_section): New function.
7549 * icf.h (Icf::unfold_section): New function.
7550 * options.h (General_options::keep_unique): New option.
7551 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7552 * testsuite/Makefile.in: Regenerate.
7553 * testsuite/icf_keep_unique_test.sh: New file.
7554 * testsuite/icf_keep_unique_test.cc: New file.
7559 * resolve.cc (Symbol_table::resolve): Check for references from
7560 dynamic objects to hidden and internal symbols.
7561 * testsuite/Makefile.am (hidden_test.sh): New test.
7562 * testsuite/Makefile.in: Regenerate.
7563 * testsuite/hidden_test.sh: New script.
7564 * testsuite/hidden_test_1.c: New test source.
7565 * testsuite/hidden_test_main.c: New test source.
7569 * arm.cc: Update comments.
7570 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7571 segment to locate the .ARM.exidx section if present.
7575 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7579 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7584 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7585 valid tls_segment only for non-debug-section relocations.
7586 * testsuite/Makefile.am: Add gc_tls_test.
7587 * testsuite/Makefile.in: Regenerate.
7588 * testsuite/gc_tls_test.cc: New file.
7589 * testsuite/gc_tls_test.sh: New file.
7595 * Makefile.am (CCFILES): Add icf.cc.
7597 * Makefile.in: Regenerate.
7598 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7599 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7600 section, symbol and addend information for the relocs.
7601 * gold.cc (queue_middle_tasks): Call identical code folding.
7602 * gold.h: Add defines for multimap.
7603 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7604 to the call of finalize_local_symbols.
7605 * main.cc (main): Create object of class Icf.
7606 * object.cc (Sized_relobj::do_layout): Allow this function to be
7607 called twice during icf.
7608 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7609 to sections marked as identical by icf.
7610 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7612 (Sized_relobj::do_section_entsize): New function.
7613 * object.h (Object::section_entsize): New function.
7614 (Object::do_section_entsize): New pure virtual function.
7615 (Relobj::finalize_local_symbols): Add new parameter.
7616 (Relobj::do_section_entsize): New function.
7617 * options.h (General_options::icf): New option.
7618 (General_options::icf_iterations): New option.
7619 (General_options::print_icf_sections): New option.
7620 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7621 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7622 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7624 * symtab.cc (Symbol_table::is_section_folded): New function.
7625 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7626 to sections marked as identical by icf.
7627 * symtab.h (Symbol_table::set_icf): New function.
7628 (Symbol_table::icf): New function.
7629 (Symbol_table::is_section_folded): New function.
7630 (Symbol_table::icf_): New data member.
7631 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7632 * testsuite/Makefile.am: Add commands to build icf_test.
7633 * testsuite/Makefile.in: Regenerate.
7634 * testsuite/icf_test.sh: New file.
7635 * testsuite/icf_test.cc: New file.
7639 * layout.cc (is_compressible_debug_section): Fix incorrect
7640 comment about compressed section names.
7645 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7650 * layout.h: #include <map>.
7651 (class Kept_section): Change from struct to class. Add accessors
7652 and setters. Add section size to Comdat_group mapping. Change
7653 Comdat_group to std::map. Add is_comdat_ field. Add
7654 linkonce_size field in union.
7655 (class Layout): Update declaration of find_or_add_kept_section.
7656 Don't declare find_kept_object.
7657 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7658 parameter. Add object, shndx, is_comdat, and is_group_name
7659 parameters. Change all callers. Adjust for new Kept_section.
7660 (Layout::find_kept_object): Remove.
7661 * object.cc (Sized_relobj::include_section_group): Update use of
7662 Kept_section. Rename secnum to shndx. Only record
7663 Kept_comdat_section if sections are the same size.
7664 (Sized_relobj::include_linkonce_section): Update use of
7665 Kept_section. Only record Kept_comdat_section if sections are the
7666 same size. Set size of linkonce section.
7667 (Sized_relobj::map_to_kept_section): Update call to
7668 get_kept_comdat_section.
7669 * object.h (class Sized_relobj): Rename fields in
7670 Kept_comdat_section to drop trailing underscores; change object
7671 field to Relobj*. Change Kept_comdat_section_table to store
7672 struct rather than pointer.
7673 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7674 Add kept_object and kept_shndx parameters. Change all callers.
7675 (Sized_relobj::get_kept_comdat_section): Change return type to
7676 bool. Add kept_object and kept_shndx parameters. Change all
7678 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7679 Layout::find_or_add_kept_section.
7683 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7684 Reserve space in the hash table.
7688 * fileread.cc (File_read::get_mtime): New method.
7689 * fileread.h (Timespec): New structure.
7690 (File_read::get_mtime): New method.
7691 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7692 Renamed from timestamp_nsec.
7693 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7695 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7697 (Incremental_inputs::report_archive): Save mtime; style fix.
7698 (Incremental_inputs::report_obejct): Save mtime; style fix.
7699 (Incremental_inputs::report_script): Save mtime; style fix.
7700 (Incremental_inputs::finalize_inputs): Style fix.
7701 (Incremental_inputs::finalize): Style fix.
7702 (Incremental_inputs::create_input_section_data): Store inputs
7704 * incremental.h (Incremental_inputs::report_script): Add mtime
7706 (Incremental_inputs::Input_info::Input_info): Intialize only one
7708 (Incremental_inputs::Input_info::archive): Move to nameless
7710 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7711 (Incremental_inputs::Input_info::script): Move to nameless union.
7712 (Incremental_inputs::mtime): New field.
7713 * script.cc (read_input_script): Pass file mtime to
7715 * script.h (Script_info::inputs): Style fix.
7719 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7725 * layout.cc (Layout::choose_output_section): If we find an
7726 existing section, update the flags.
7727 (Layout::create_notes): New function, broken out of
7729 (Layout::finalize): Don't create note sections.
7730 (Layout::create_note): Don't crash if linker script discards
7732 (Layout::create_gold_note): Likewise.
7733 (Layout::create_build_id): Likewise. Don't set
7734 after_input_sections on the section.
7735 (Layout::create_executable_stack_info): Remove target parameter.
7737 * layout.h (class Layout): Declare create_notes. Update
7738 declaration of create_executable_stack_info.
7739 * gold.cc (queue_middle_tasks): Call create_notes.
7740 * output.cc (Output_section::update_flags_for_input_section): Move
7741 here from output.h. If SHF_ALLOC flag is newly set, mark address
7743 * output.h (Output_data::mark_address_invalid): New function.
7744 (class Output_section): Only declare, not define,
7745 update_flags_for_input_section. Remove set_flags.
7749 * script-sections.cc (Output_section_definition::
7750 set_section_addresses): Rename shadowing local load_address to
7756 * reloc.cc (relocate_sections): Skip empty relocation sections.
7761 * layout.cc (Layout::create_note): Use choose_output_section
7762 rather than make_output_section.
7767 * options.cc (General_options::parse_V): Set printed_version_.
7768 (General_options::General_options): Initialize printed_version_.
7769 * options.h (class General_options): Add printed_version_ field.
7770 * gold.cc (queue_initial_tasks): If there are no input files,
7771 don't give a fatal error if we printed the version information.
7772 (queue_middle_tasks): If using -r with a shared object, give a
7773 fatal error rather than an ordinary error.
7778 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7779 (Layout::make_output_section): Set have_stabstr_section_ if we see
7780 a .stab*str section.
7781 (Layout::finalize): Call link_stabs_sections.
7782 (Layout::link_stabs_sections): New file.
7783 * layout.h (class Layout): Add have_stabstr_section_ field.
7784 Declare link_stabs_sections.
7788 * Makefile.am (libgold_a_LIBADD): New.
7789 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7790 * Makefile.in: Regenerate.
7791 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7792 * configure: Regenerate.
7793 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7794 * fileread.cc: Include sys/state.h
7795 * gold.h: Declare memmem and strndup if found missing.
7796 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7800 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7801 * configure: Rebuild.
7806 * object.cc (Object::section_contents): Don't try to get a view if
7807 the section has length zero.
7808 (Object::handle_gnu_warning_section): If the section is empty, use
7809 the name of the section as the warning.
7814 * stringpool.h (class Stringpool_template): Add optimize_ field.
7815 (Stringpool_template::set_optimize): New function.
7816 * stringpool.cc (Stringpool_template::Stringpool_template):
7817 Initialize optimize_ field.
7818 (Stringpool_template::set_string_offsets): Test local optimize
7819 fild rather than parameter.
7820 * layout.cc (Layout::Layout): Call set_optimize on the section
7826 * yyscript.y: Parse TARGET.
7827 * script.cc (script_set_target): New function.
7828 * script-c.h (script_set_target): Declare.
7829 * options.cc (General_options::string_to_object_format): Rename
7830 from string_to_object_format in anonymous namespace. Change
7832 * options.h (class General_options): Declare
7833 string_to_object_format.
7837 * script-sections.cc (Script_sections::create_segments): Don't put
7838 program headers in a PT_LOAD segment if -n or -N.
7843 * options.h (class General_options): Add -z lazy and -z now. Sort
7844 -z options into alphabetical order.
7845 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7849 * layout.cc (Layout::make_output_section): Call
7850 Target::new_output_section.
7851 (Layout::attach_allocated_section_to_segment): Put large section
7852 sections in a separate load segment with the large segment flag
7854 (Layout::segment_precedes): Sort large data segments after other
7856 (align_file_offset): New static function.
7857 (Layout::set_segment_offsets): Use align_file_offset.
7858 * output.h (class Output_section): Add is_small_section_ and
7859 is_large_section_ fields.
7860 (Output_section::is_small_section): New function.
7861 (Output_section::set_is_small_section): New function.
7862 (Output_section::is_large_section): New function.
7863 (Output_section::set_is_large_section): New function.
7864 (Output_section::is_large_data_section): New function.
7865 (class Output_segment): Add is_large_data_segment_ field.
7866 (Output_segment::is_large_data_segment): New function.
7867 (Output_segment::set_is_large_data_segment): New function.
7868 * output.cc (Output_section::Output_section): Initialize new
7870 (Output_segment::Output_segment): Likewise.
7871 (Output_segment::add_output_section): Add assertion that large
7872 data sections always go in large data segments. Force small data
7873 sections to the end of the list of data sections. Force small BSS
7874 sections to the start of the list of BSS sections. For large BSS
7875 sections to the end of the list of BSS sections.
7876 * symtab.h (class Symbol): Declare is_common_shndx.
7877 (Symbol::is_defined): Check Symbol::is_common_shndx.
7878 (Symbol::is_common): Likewise.
7879 (class Symbol_table): Define enum Commons_section_type. Update
7880 declarations. Add small_commons_ and large_commons_ fields.
7881 * symtab.cc (Symbol::is_common_shndx): New function.
7882 (Symbol_table::Symbol_table): Initialize new fields.
7883 (Symbol_table::add_from_object): Put small and large common
7884 symbols in the right list.
7885 (Symbol_table::sized_finalized_symbol): Check
7886 Symbol::is_common_shndx.
7887 (Symbol_table::sized_write_globals): Likewise.
7888 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7889 common symbol lists. Don't call do_allocate_commons_list if the
7891 (Symbol_table::do_allocate_commons_list): Remove is_tls
7892 parameter. Add comons_section_type parameter. Change all
7893 callers. Handle small and large common symbols.
7894 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7895 Symbol::is_common_shndx.
7896 * resolve.cc (symbol_to_bits): Likewise.
7897 * target.h (Target::small_common_shndx): New function.
7898 (Target::small_common_section_flags): New function.
7899 (Target::large_common_shndx): New function.
7900 (Target::large_common_section_flags): New function.
7901 (Target::new_output_section): New function.
7902 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7903 small_common_section_flags, and large_common_section_flags
7905 (Target::do_new_output_section): New virtual function.
7906 * arm.cc (Target_arm::arm_info): Initialize new fields.
7907 * i386.cc (Target_i386::i386_info): Likewise.
7908 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7910 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7911 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7912 (Target_x86_64::do_new_output_section): New function.
7913 * configure.ac: Define conditional MCMODEL_MEDIUM.
7914 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7915 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7916 (large_LDFLAGS): Define.
7917 * testsuite/large.c: New file.
7918 * testsuite/testfile.cc (Target_test::test_target_info):
7919 Initialize new fields.
7920 * configure, testsuite/Makefile.in: Rebuild.
7924 * Makefile.am (CCFILES): Add target.cc.
7925 * Makefile.in: Regenerate.
7926 * i386.cc (class Target_i386): Define new virtual method to
7927 override do_is_local_label_name in parent.
7928 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7929 local symbols if --discard-locals or -X is given.
7930 * options.h (class General_options): Declare new options
7931 '--discard-locals' and '-X' for discarding locals.
7932 * target.h (class Target): Define new methods is_local_label_name.
7933 Declare new virtual method do_is_local_label_name.
7934 * target.cc: New file.
7935 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7936 (check_SCRIPTS): Add discard_locals_test.sh.
7937 (check_DATA): Add discard_local_tests.syms.
7938 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7939 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7940 * testsuite/Makefile.in: Regenerate.
7941 * testsuite/discard_locals_test.c: New file.
7942 * testsuite/discard_locals_test.sh: Same.
7946 * object.cc (Sized_relobj::Sized_relobj): Initialize
7947 discarded_eh_frame_shndx_ to -1U.
7948 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7950 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7951 a discarded .eh_frame section.
7952 (Sized_relobj::do_finalize_local_symbols): Ditto.
7953 * object.h (class Sized_relobj): Declare new member
7954 discarded_eh_frame_shndx_.
7955 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7956 (local_labels_test.o, local_labels_test): New rules.
7957 * testsuite/Makefile.in: Regenerate.
7961 * layout.cc (Layout::section_name_mapping): Add mapping for
7962 special ARM sections.
7966 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7967 (utils::has_overflow): Same.
7971 * layout.cc (Layout::section_name_mapping): New array, replacing
7972 Layout::linkonce_mapping.
7973 (Layout::section_name_mapping_count): New variable, replacing
7974 Layout::linkonce_mapping_count.
7975 (Layout::linkonce_output_name): Remove.
7976 (Layout::output_section_name): Rewrite.
7977 * layout.h (class Layout): Rename Linkonce_mapping to
7978 Section_name_mapping, linkonce_mapping to section_name_mapping,
7979 linkonce_mapping_count to section_name_mapping_count. Don't
7980 declare linkonce_output_name.
7984 * gold/arm.cc (namespace utils): New.
7985 (Target_arm::reloc_is_non_pic): Define new method.
7986 (class Arm_relocate_functions): New.
7987 (Target_arm::Relocate::relocate): Handle relocation types used by
7992 * arm.cc (Target_arm::scan::global): Use || instead of |.
7996 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7997 issued_non_pic_error_.
7998 (class Target_arm::Scan): Declare new method check_non_pic.
7999 Define new method symbol_needs_plt_entry.
8000 Declare new data member issued_non_pic_error_.
8001 (class Target_arm::Relocate): Declare new method
8002 should_apply_static_reloc.
8003 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8004 (Target_arm::Scan::check_non_pic): Define new method.
8005 (Target_arm::Scan::local): Handle a small subset of reloc types used
8007 (Target_arm::Scan::local): Same.
8008 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8012 * incremental.cc (Incremental_inputs::report_command_line): Filter
8013 out --incremental-* options.
8017 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8019 (class Target_arm): Update comment.
8020 (Target_arm::Target_arm): Initialize new data members GOT_,
8021 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8022 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8023 and Target_arm::rel_dyn_section.
8024 Declare new_enum Target_arm::Got_type.
8025 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8027 Update commments for member do_dynsym_value.
8028 (Target_arm::got_size, Target_arm::plt_section,
8029 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8030 new methods inside class defintion.
8031 (Target_arm::got_section): Define new method.
8032 (Target_arm::rel_dyn_section): Same.
8033 (Output_data_plt_arm): New template class.
8034 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8035 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8036 (Output_data_plt_arm::add_entry): Same.
8037 (Output_data_plt_arm::first_plt_entry): Define new
8038 static data member for PLT instruction template.
8039 (Output_data_plt_arm::plt_entry): Same.
8040 (Output_data_plt_arm::do_write): Define new method.
8041 (Target_arm::make_plt_entry): Same.
8042 (Target_arm::do_finalize_sections): Same.
8043 (Target_arm::do_dynsym_value): Same.
8047 * Makefile.am (TARGETSOURCES): Add arm.cc.
8048 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8049 * Makefile.in: Regenerate.
8051 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8055 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8056 (General_options::check_excluded_libs): Strip off directories in
8057 archive name before matching like GNU ld does.
8058 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8059 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8060 (exclude_libs_test_LDFLAGS): Add linker option
8061 -Wl,--exclude-libs,libexclude_libs_test_3
8062 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8063 an explicit archive without using -l.
8064 (alt/libexclude_libs_test_3.a): New make rule.
8065 * testsuite/Makefile.in: Regenerate.
8066 * testsuite/exclude_libs_test.c : Declare lib3_default().
8068 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8069 * exclude_libs_test_3.c: New file.
8073 * po/id.po: New Indonesian translation.
8074 * po/gold.pot: Updated template file.
8078 * testsuite/Makefile.am: Add -ffunction-sections to compile
8079 gc_comdat_test files. Add -Wl,--gc-sections to build
8081 * testsuite/Makefile.in: Regenerate.
8082 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8086 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8087 kept comdat section was garbage collected.
8088 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8089 * testsuite/Makefile.in: Regenerate.
8090 * testsuite/gc_comdat_test.sh: New file.
8091 * testsuite/gc_comdat_test_1.cc: New file.
8092 * testsuite/gc_comdat_test_2.cc: New file.
8096 * archive.cc (Archive::Archive): Move constructor from archive.h
8097 to here. Initialize no_export_.
8098 (Archive::get_elf_object_for_member): Set no_export flag of object.
8099 * archive.h (Archive::Archive): Move constructor body to
8101 (Archive::no_export): New method.
8102 (Archive::no_export_): New field.
8103 * object.h (Object::Object): Initialize no_export_ to false.
8104 (Object::no_export, Object::set_no_export): New methods.
8105 (Object::no_export_): New field.
8106 * options.cc (General_options::parse_exclude_libs): New method.
8107 (General_options::check_excluded_libs) Same.
8108 * options.h (exclude_libs): New option.
8109 (General_options::check_excluded_libs): New method declaration.
8110 (General_options::excluded_libs_): New field.
8111 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8112 default or protected visibility if an object has no-export flag set.
8113 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8114 (check_SCRIPTS): Add exclude_libs_test.sh.
8115 (check_DATA): Add exclude_libs_test.syms.
8116 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8117 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8118 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8119 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8120 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8121 libexclude_libs_test_2.a): New rules.
8122 * testsuite/Makefile.in: Regenerate.
8123 * testsuite/exclude_libs_test.c: New file.
8124 * testsuite/exclude_libs_test.sh: Ditto.
8125 * testsuite/exclude_libs_test_1.c: Ditto.
8126 * testsuite/exclude_libs_test_2.c: Ditto.
8130 * configure.ac: Check for declarations for cases where libiberty.h
8131 checks HAVE_DECL_xxx.
8132 * configure, config.in: Rebuild.
8136 * gold.h (Incremental_argument_list): Remove (invalid) forward
8138 * incremental.cc (Incremental_inputs::report_achive): New method.
8139 (Incremental_inputs::report_object): New method.
8140 (Incremental_inputs::report_script): New method.
8141 (Incremental_inputs::finalize_inputs): New method.
8142 (Incremental_inputs::finalize): Call finalize_inputs().
8143 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8144 Create inputs entries.
8145 * incremental.h (Incremental_input_type): New enum.
8146 (Incremental_inputs::Incremental_input): Initialize new fields.
8147 (Incremental_inputs::report_inputs): New method.
8148 (Incremental_inputs::report_achive): New method.
8149 (Incremental_inputs::report_object): New method.
8150 (Incremental_inputs::report_script): New method.
8151 (Incremental_inputs::finalize_inputs): New method.
8152 (Incremental_inputs::Input_info): New struct.
8153 (Incremental_inputs::Input_info_map): New typedef.
8154 (Incremental_inputs::lock_): New field.
8155 (Incremental_inputs::Inputs_): New field.
8156 (Incremental_inputs::Inputs_map): New field.
8157 * main.cc (main): Call Incremental_input::report_inputs.
8158 * options.h (Input_argument_list): Typedef moved from
8160 (Input_file_group::Files): Remove, use ::Input_argument_list.
8161 (Input_file_group::Input_argument_list): Remove, use
8162 ::Input_argument_list.
8163 * plugin.cc (Plugin_manager::add_input_file): Add error in
8165 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8167 * script.cc (read_input_script): Call
8168 Incremental_input::report_script.
8169 * script.h (Script_info): New class.
8173 * x86_64.cc (do_adjust_output_section): Set entsize to
8178 * output.cc (Output_file::close): After short writes, continue
8179 writing from the correct offset in the buffer being written.
8183 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8184 * configure: Regenerate.
8185 * config.in: Regenerate.
8186 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8187 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8191 * incremental.cc (Incremental_inputs_header_data): Renamed from
8192 Incremental_input_header_data.
8193 (Incremental_inputs_header_data::data_size): New field.
8194 (Incremental_inputs_header_data::put_input_file_count): Renamed
8195 from input_file_count.
8196 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8197 from command_line_offset.
8198 (Incremental_inputs_header_data::put_reserved): Renamed from
8200 (Incremental_inputs_entry_data): Renamed from
8201 Incremental_input_entry_data.
8202 (Incremental_inputs_entry_data::data_size): New field.
8203 (Incremental_inputs::report_command_line): New method.
8204 (Incremental_inputs::finalize): New method.
8205 (Incremental_inputs::create_incremental_inputs_data): New method.
8206 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8207 * incremental.h: New file.
8208 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8209 (Layout::finalize): Create incremental inputs section in
8211 (Layout::create_incremental_info_sections): New method.
8212 * layout.h (Layout::incremental_inputs): New method.
8213 (Layout::create_incremental_info_sections): New method.
8214 (Layout::incremental_inputs_): New field.
8215 * main.cc (main): Notify Incremental_input of the command line.
8220 * gold.h (reserve_unordered_map): Define, three versions, one for
8221 each version of Unordered_map.
8222 * layout.cc (Layout::Layout): Remove options parameter. Add
8223 number_of_input_files parameter. Don't initialize options_.
8224 Initialize number_of_input_files_ and resized_signatures_. Move
8225 sections_are_attached_.
8226 (Layout::layout_group): Reserve space for group_signatures_.
8227 (Layout::find_or_add_kept_section): Change name parameter to be a
8228 reference. Resize signatures_ map when it gets large enough.
8229 (Layout::layout_eh_frame): Use parameters->options() instead of
8231 (Layout::make_output_section): Likewise.
8232 (Layout::attach_allocated_section_to_segment): Likewise.
8233 (Layout::finalize, Layout::create_executable_stack): Likewise.
8234 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8235 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8236 * layout.h (class Layout): Update declarations. Remove options_
8237 field. Add number_of_input_files_ and resized_signatures_
8238 fields. Move sections_are_attached_ field.
8239 * main.cc (main): Pass number of input files to Layout
8240 constructor. Don't pass options.
8244 * ffsll.c (ffsll): Correct implementation.
8248 * ffsll.c: New file.
8249 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8250 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8251 * ftruncate.c (ftruncate): Declare before definition.
8252 * mremap.c (mremap): Likewise.
8253 * pread.c (pread): Likewise.
8254 * configure, Makefile.in, config.in: Rebuild.
8256 * mremap.c: New file.
8257 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8258 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8259 (mremap): Declare if HAVE_MREMAP is not defined.
8260 * configure, Makefile.in, config.in: Rebuild.
8264 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8265 position independent.
8266 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8267 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8271 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8273 (needs_dynamic_reloc): Likewise.
8277 * yyscript.y (file_cmd): Recognize EXTERN.
8278 (extern_name_list, extern_name_list_body): New nonterminals.
8279 * script.cc (script_add_extern): Define.
8280 * script-c.h (script_add_extern): Declare.
8284 * object.cc (is_elf_object): Define.
8285 * object.h (is_elf_object): Declare.
8286 * archive.cc (Archive::get_elf_object_for_member): Call
8288 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8292 * output.cc (Output_file::map_anonymous): Define.
8293 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8294 try an anonymous one. Report the size if the mmap fails.
8295 * output.h (class Output_file): Declare map_anonymous.
8299 * target-select.cc (instantiate_target): Don't acquire the lock if
8300 the instantiated_target_ field has already been set.
8304 * gold-threads.h (class Initialize_lock): Define.
8305 * gold-threads.cc (class Initialize_lock_once): Define.
8306 (initialize_lock_control): New static variable.
8307 (initialize_lock_pointer): New static variable.
8308 (initialize_lock_once): New static function.
8309 (Initialize_lock::Initialize_lock): Define.
8310 (Initialize_lock::initialize): Define.
8311 * target-select.h: Include "gold-threads.h".
8312 (class Target_selector): Add lock_ and initialize_lock_ fields.
8313 Don't define instantiate_target, just declare it.
8314 * target-select.cc (Target_selector::Target_selector): Initialize
8316 (Target_selector::instantiate_target): Define.
8317 * descriptors.h: Include "gold-threads.h".
8318 (class Descriptors): Add initialize_lock_ field.
8319 * descriptors.cc (Descriptors::Descriptors): Initialize new
8321 (Descriptors::open): Use initialize_lock_ field
8322 * errors.h (class Errors): Add initialize_lock_ field.
8323 * errors.cc (Errors::Errors): Initialize new field.
8324 (Errors::initialize_lock): Use initialize_lock_ field.
8325 * powerpc.cc (class Target_selector_powerpc): Remove
8326 instantiated_target_ field. In do_recognize call
8327 instantiate_target rather than do_instantiate_target. In
8328 do_instantiate_target just allocate a new target.
8329 * sparc.cc (class Target_selector_sparc): Likewise.
8331 * freebsd.h: New file.
8332 * i386.cc: Include "freebsd.h".
8333 (Target_i386): Derive from Target_freebsd rather than
8335 (Target_selector_i386): Derive from Target_selector_freebsd rather
8336 than Target_selector.
8337 * x86_64.cc: Include "freebsd.h".
8338 (Target_x86_64): Derive from Target_freebsd rather than
8340 (Target_selector_x86_64): Derive from Target_selector_freebsd
8341 rather than Target_selector.
8342 * target.h (class Target): Add adjust_elf_header and
8343 do_adjust_elf_header.
8344 * output.cc (Output_file_header:: do_sized_write): Call target
8345 adjust_elf_header routine.
8346 * configure.tgt: Set targ_osabi.
8347 * configure.ac: Define GOLD_DEFAULT_OSABI.
8348 * parameters.cc (Parameters::default_target): Pass
8349 GOLD_DEFAULT_OSABI to select_target.
8350 * target-select.h (class Target_selector): Make instantiate_target
8351 protected rather than private.
8352 * Makefile.am (HFILES): Add freebsd.h.
8353 * configure, Makefile.in, config.in: Rebuild.
8355 * merge.cc (do_add_input_section): Correct pend value. Change
8356 message about last entry not being null terminated from error to
8361 * incremental.cc: New file.
8362 * Makefile.am (CCFILES): Add incremental.cc.
8363 * Makefile.in: Rebuild.
8367 * layout.cc (Layout::output_section_name): Preserve names
8368 of '.note.' sections.
8372 * descriptors.cc (Descriptors::open): Check that the options are
8373 valid before using them.
8377 * script-sections.h: Include <list>.
8378 (class Script_sections): Change Sections_elements from std::vector
8379 to std::list. Typedef public Elements_iterator. Add
8380 orphan_section_placement_, data_segment_align_start_, and
8381 saw_data_segment_align_ fields. Remove data_segment_align_index_
8383 * script-sections.cc (class Orphan_section_placement): New class.
8384 (class Sections_element): Add virtual functions is_relro and
8385 orphan_section_init. Remove virtual function place_orphan_here.
8386 (class Output_section_definition): Add is_relro and
8387 orphan_section_init. Remove place_orphan_here.
8388 (class Orphan_output_section): Likewise.
8389 (Script_sections::Script_sections): Update for field changes.
8390 (Script_sections::data_segment_align): Set saw_data_segment_align_
8391 and data_segment_align_start_, not data_segment_align_index.
8392 (Script_sections::data_segment_relro_end): Check
8393 saw_data_segment_align_. Use data_segment_align_start_ rather
8394 than data_segment_align_index_.
8395 (Script_sections::place_orphan): Rewrite to use
8396 Orphan_section_placement.
8400 * archive.cc (Archive::add_symbols): Check for a version attached
8401 to the symbol name in the archive map.
8402 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8403 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8404 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8405 (ver_test_11.a): New target.
8406 * testsuite/Makefile.in: Rebuild.
8408 * configure.ac: Check for chsize and posix_fallocate. Replace
8410 * ftruncate.c: New file, from gnulib.
8411 * output.cc (posix_fallocate): Define dummy version if not
8412 HAVE_POSIX_FALLOCATE.
8413 (Output_file::map): Call posix_fallocate rather than lseek and
8415 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8416 * configure, Makefile.in, config.in: Rebuild.
8420 * layout.h (Layout::create_note): Add section_name parameter.
8421 * layout.cc (Layout::create_note): Likewise.
8422 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8426 * descriptors.cc: Include "options.h".
8427 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8428 (Descriptors::open): Always use O_CLOEXEC when opening a new
8429 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8430 then set FD_CLOEXEC.
8432 * sparc.cc (class Target_sparc): Add has_got_section.
8433 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8434 make sure we have a GOT section.
8436 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8437 (Target_sparc::Scan::local): Likewise.
8438 (Target_sparc::Scan::global): Likewise.
8439 (Target_sparc::Relocate::relocate): Likewise.
8440 (Target_sparc::Relocate::relocate_tls): Likewise.
8442 * symtab.cc (Symbol_table::define_default_version): New function,
8443 broken out of add_from_object.
8444 (Symbol_table::add_from_object): Call define_default_version.
8445 (Symbol_table::define_special_symbol): Add resolve_oldsym
8446 parameter. Change all callers. If the version for a symbol comes
8447 from a version script, resolve it with the symbol with the same
8448 name with no version. Also add the symbol without a version if
8450 (do_define_in_output_data): If resolving with oldsym, don't delete
8452 (do_define_in_output_segment): Likewise.
8453 (do_define_as_constant): Likewise.
8454 * symtab.h (class Symbol_table): Update declarations.
8458 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8459 (Read_symbols::requeue): New function.
8460 (Read_symbols::do_read_symbols): If make_elf_object fails because
8461 the target type is not configured, and the file was searched for,
8462 issue a warning and retry with the next directory.
8463 (Add_symbols::run): If the file has an incompatible format, and
8464 it was searched for, requeue the Read_symbols task. On error,
8466 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8467 dirindex parameter to constructor. Change all callers. Declare
8468 incompatible_warning and requeue.
8469 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8470 input_argument_ and input_group_ fields. Add them to
8471 constructor. Change all callers.
8472 (class Read_script): Add dirindex_ field. Add it to constructor.
8474 * archive.cc (Archive::setup): Remove input_objects parameter.
8476 (Archive::get_file_and_offset): Likewise.
8477 (Archive::read_all_symbols): Likewise.
8478 (Archive::read_symbols): Likewise.
8479 (Archive::get_elf_object_for_member): Remove input_objects
8480 parameter. Add punconfigured parameter. Change all callers.
8481 (Archive::add_symbols): Change return type to bool. Check return
8482 value of include_member.
8483 (Archive::include_all_members): Likewise.
8484 (Archive::include_member): Change return type to bool. Return
8485 false if first included object has incompatible target. Set
8486 included_member_ field.
8487 (Add_archive_symbols::run): If add_symbols returns false, requeue
8489 * archive.h (class Archive): Add included_member_ field.
8490 Initialize it in constructor. Add input_file and searched_for
8491 methods. Update declarations.
8492 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8493 input_argument_ fields. Add them to constructor. Change all
8495 * script.cc: Include "target-select.h".
8496 (class Parser_closure): Add skip_on_incompatible_target_ and
8497 found_incompatible_target_ fields. Add
8498 skip_on_incompatible_target parameter to constructor. Change all
8499 callers. Add methods skip_on_incompatible_target,
8500 clear_skip_on_incompatible_target, found_incompatible_target, and
8501 set_found_incompatible_target.
8502 (read_input_script): Add dirindex parameter. Change all callers.
8503 If parser finds an incompatible target, requeue Read_symbols
8505 (script_set_symbol): Clear skip_on_incompatible_target in
8507 (script_add_assertion, script_parse_option): Likewise.
8508 (script_start_sections, script_add_phdr): Likewise.
8509 (script_check_output_format): New function.
8510 * script.h (read_input_script): Update declaration.
8511 * script-c.h (script_check_output_format): Declare.
8512 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8513 (ignore_cmd): Remove OUTPUT_FORMAT.
8514 * fileread.cc (Input_file::Input_file): Add explicit this.
8515 (Input_file::will_search_for): New function.
8516 (Input_file::open): Add pindex parameter. Change all callers.
8517 * fileread.h (class Input_file): Add input_file_argument method.
8518 Declare will_search_for. Update declarations.
8519 * object.cc (make_elf_object): Add punconfigured parameter.
8521 * object.h (class Object): Make input_file public. Add
8522 searched_for method.
8523 (make_elf_object): Update declaration.
8524 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8526 * dirsearch.h (class Dirsearch): Update declaration.
8527 * options.h (class General_options): Add --warn-search-mismatch.
8528 * parameters.cc (Parameters::is_compatible_target): New function.
8529 * parameters.h (class Parameters): Declare is_compatible_target.
8530 * workqueue.cc (Workqueue::add_blocker): New function.
8531 * workqueue.h (class Workqueue): Declare add_blocker.
8533 * fileread.cc (Input_file::open): Remove options parameter.
8535 (Input_file::open_binary): Likewise.
8536 * script.cc (read_input_script): Likewise.
8537 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8538 options parameter from constructor. Change all callers.
8539 (class Read_script): Likewise.
8540 * fileread.h (class Input_file): Update declarations.
8541 * script.h (read_input_script): Update declaration.
8545 * po/es.po: New Spanish translation.
8549 * options.cc (parse_short_option): Keep dash_z from registering itself.
8554 * target-reloc.h (relocate_section): Pass output_section to
8556 * i386.cc (Target_i386::should_apply_static_reloc): Add
8557 output_section parameter. Change all callers.
8558 (Target_i386::Relocate::relocate): Add output_section parameter.
8559 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8560 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8561 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8562 * testsuite/two_file_shared.sh: New script.
8563 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8564 (check_DATA): Add two_file_shared.dbg.
8565 (two_file_shared.dbg): New target.
8566 * testsuite/Makefile.in: Rebuild.
8570 * configure.ac: Check for byteswap.h.
8571 * configure: Rebuild.
8572 * config.in: Rebuild.
8576 * layout.cc (Layout::find_or_add_kept_section): New function.
8577 (Layout::add_comdat): Removed.
8578 * layout.h (struct Kept_section): Move out of class Layout.
8579 Remove trailing underscores from field names. Add group_sections
8580 field. Rename group_ field to is_group. Change all uses.
8581 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8582 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8583 comdat_groups_ field.
8584 (Sized_relobj::include_section_group): Use
8585 find_or_add_kept_section and Kept_section::group_sections.
8586 (Sized_relobj::include_linkonce_section): Likewise.
8587 * object.cc (class Sized_relobj): Don't define Comdat_group or
8588 Comdat_group_table. Remove find_comdat_group and
8589 add_comdat_group. Remove comdat_groups_ field.
8590 * plugin.cc (include_comdat_group): Use
8591 Layout::find_or_add_kept_section.
8595 * README: --gc-sections and map files are now supported. Document
8596 some build requirements.
8599 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8600 relocatable link set the value of the section symbol to zero.
8601 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8602 relocatable link don't include the section address in the local
8608 * options.h (class Search_directory): Add is_system_directory.
8609 (class General_options): Declare is_in_system_directory.
8610 * options.cc (get_relative_sysroot): Make static.
8611 (get_default_sysroot): Make static.
8612 (General_optoins::is_in_system_directory): New function.
8613 * fileread.cc (Input_file::is_in_system_directory): New function.
8614 * fileread.h (class Input_file): Declare is_in_system_directory.
8615 * object.h (class Object): Add is_in_system_directory.
8616 (class Input_objects): Remove system_library_directory_ field.
8617 * object.cc (Input_objects::add_object): Don't set
8618 system_library_directory_.
8619 (input_objects::found_in_system_library_directory): Remove.
8620 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8621 parameter. Change all callers.
8622 (Symbol_table::sized_write_globals): Likewise.
8623 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8624 Call Object::is_in_system_directory.
8625 * symtab.h (class Symbol_table): Update declarations.
8628 * descriptors.h (Open_descriptor): Add is_on_stack field.
8629 * descriptors.cc (Descriptors::open): If the descriptor is on the
8630 top of the stack, remove it. Initialize is_on_stack field.
8631 (Descriptors::release): Only add pod to stack if it is not on the
8633 (Descriptors::close_some_descriptor): Clear stack_next and
8637 * output.cc (Output_section::find_starting_output_address): Rename
8638 from starting_output_address; add PADDR parameter; change return
8640 * output.h (class Output_section): Declare
8641 find_starting_output_address instead of starting_output_address.
8642 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8643 section symbol for which we can't find a merge section.
8646 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8647 hidden or internal, force the symbol to be local.
8648 * resolve.cc (Symbol::override_visibility): Define.
8649 (Symbol::override_base): Use override_visibility.
8650 (Symbol_table::resolve): Likewise.
8651 (Symbol::override_base_with_special): Likewise.
8652 (Symbol_table::override_with_special): If the visibility is hidden
8653 or internal, force the symbol to be local.
8654 * symtab.h (class Symbol): Add set_visibility and
8655 override_visibility.
8656 * testsuite/ver_test_1.sh: New file.
8657 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8658 (check_DATA): Add ver_test_1.syms.
8659 (ver_test_1.syms): New target.
8660 * testsuite/Makefile.in: Rebuild.
8664 * layout.cc (Layout::choose_output_section): Don't rename sections
8665 when using a linker script that has a SECTIONS clause.
8666 * Makefile.in: Regenerate.
8668 * testsuite/Makefile.am (script_test_5.sh): New test case.
8669 * testsuite/Makefile.in: Regenerate.
8670 * testsuite/script_test_5.cc: New file.
8671 * testsuite/script_test_5.sh: New file.
8672 * testsuite/script_test_5.t: New file.
8676 * archive.cc (Archive::include_member): Update calls to add_symbols.
8677 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8678 the Layout argument.
8679 * dynobj.h (do_add_symbols): Add the Layout argument.
8680 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8682 * object.h (Object::add_symbols): Add the Layout argument.
8683 (Object::do_add_symbols): Add the Layout argument.
8684 (Sized_relobj::do_add_symbols): Add the Layout argument.
8685 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8686 Unify the two versions.
8687 (Add_plugin_symbols): Remove.
8688 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8689 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8690 (Add_plugin_symbols): Remove.
8691 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8692 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8693 (Add_symbols::run): Make it work with Pulginobj.
8697 * object.cc (Sized_relobj::do_layout): Make info message start
8698 with lower case letter.
8702 * binary.cc: Fix file comment.
8704 * options.h (enum Incremental_disposition): Define.
8705 (class General_options): Add new options: --incremental,
8706 --incremental_changed, --incremental_unchanged,
8707 --incremental_unknown. Add incremental_disposition_ and
8708 implicit_incremental_ fields.
8709 (General_options::incremental_disposition): New function.
8710 (class Position_dependent_options): Add incremental_disposition
8712 (Position_dependent_options::copy_from_options): Set incremental
8714 * options.cc (General_options::parse_incremental_changed): New
8716 (General_options::parse_incremental_unchanged): New function.
8717 (General_options::parse_incremental_unknown): New function.
8718 (General_options::General_options): Initialize new fields
8719 incremental_disposition_ and implicit_incremental_.
8720 (General_options::finalize): Check for uasge of --incremental-*
8721 without --incremental.
8725 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8726 pointer and to report location as the file name associated with
8728 (gold_undefined_symbol_at_location): New function to replace the
8729 old gold_undefined_symbol functionality.
8730 * target-reloc.h (relocate_section): Update to use
8731 gold_undefined_symbol_at_location.
8732 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8733 Call gold_undefined_symbol function rather than gold_error.
8734 * errors.h (Errors::undefined_symbol): Take location as a
8735 string, rather than calculating it from a relocation.
8736 * errors.cc (Errors::fatal): Print "fatal error:" before the
8738 (Errors::error, Errors::error_at_location): Print "error: "
8739 before the formatted message.
8740 (Errors::undefined_symbol): Take location as a string, rather
8741 than calculating it from a relocation.
8742 (gold_undefined_symbol_at_location): New function akin to
8743 old gold_undefined_symbol, calculates location from relocation.
8744 (gold_undefined_symbol): Change to take only a Symbol pointer
8745 and to report location as the file name associated with the symbol.
8746 * testsuite/debug_msg.sh: Update for changed error messages.
8747 * testsuite/undef_symbol.sh: Likewise.
8752 * reduced_debug_output.h
8753 (Output_reduced_debug_abbrev_section::failed): Use format for
8755 (Output_reduced_debug_info_section::faild): Likewise.
8759 * script.cc (Lazy_demangler): New class.
8760 (Version_script_info::get_symbol_version_helper): Demangle a
8765 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8767 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8771 * version.cc (version_string): Bump to 1.9.
8773 * gold.h: Include <cstring> and <stdint.h>.
8774 * version.cc: Include <cstdio>.
8775 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8777 * reduced_debug_output.cc (insert_into_vector): Rename from
8778 Insert_into_vector; change all callers. Use Swap_unaligned to
8779 avoid aliasing issue; remove union since it is unnecessary.
8783 * Makefile.am (CCFILES): Add gc.cc.
8785 * Makefile.in: Regenerate.
8786 * gold.cc (Gc_runner): New class.
8787 (queue_initial_tasks): Call garbage collection related tasks
8788 when corresponding options are invoked.
8789 (queue_middle_gc_tasks): New function.
8790 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8791 processed early before laying out sections during garbage collection.
8792 * gold.h (queue_middle_gc_tasks): New function.
8793 (is_prefix_of): Move from "layout.cc".
8794 * i386.cc (Target_i386::gc_process_relocs): New function.
8795 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8796 * main.cc (main): Create object of class "Garbage_collection".
8797 * object.cc (Relobj::copy_symbols_data): New function.
8798 (Relobj::is_section_name_included): New function.
8799 (Sized_relobj::do_layout): Allow this function to be called twice
8800 during garbage collection and defer layout of section during the
8802 * object.h (Relobj::get_symbols_data): New function.
8803 (Relobj::is_section_name_included): New function.
8804 (Relobj::copy_symbols_data): New function.
8805 (Relobj::set_symbols_data): New function.
8806 (Relobj::get_relocs_data): New function.
8807 (Relobj::set_relocs_data): New function.
8808 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8809 (Relobj::gc_process_relocs): New function.
8810 (Relobj::do_gc_process_relocs): New pure virtual function.
8811 (Relobj::sd_): New data member.
8812 (Sized_relobj::is_output_section_offset_invalid): New function.
8813 (Sized_relobj::do_gc_process_relocs): New function.
8814 * options.h (General_options::gc_sections): Modify to not be a no-op.
8815 (General_options::print_gc_sections): New option.
8816 * plugin.cc (Plugin_finish::run): Remove function call to
8817 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8818 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8819 * reloc.cc (Read_relocs::run): Add task to process relocs and
8820 determine unreferenced sections when doing garbage collection.
8821 (Gc_process_relocs): New class.
8822 (Sized_relobj::do_gc_process_relocs): New function.
8823 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8824 sections that are garbage collected.
8825 * reloc.h (Gc_process_relocs): New class.
8826 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8827 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8828 symbols whose corresponding sections are garbage collected.
8829 (Symbol_table::Symbol_table): Add new parameter for the garbage
8831 (Symbol_table::gc_mark_undef_symbols): New function.
8832 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8833 (Symbol_table::gc_mark_dyn_syms): New function.
8834 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8836 (Symbol_table::add_from_object): Likewise.
8837 (Symbol_table::add_from_relobj): When building shared objects, do not
8838 treat externally visible symbols as garbage.
8839 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8840 table information for static and relocatable links.
8841 * symtab.h (Symbol_table::set_gc): New function.
8842 (Symbol_table::gc): New function.
8843 (Symbol_table::gc_mark_undef_symbols): New function.
8844 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8845 (Symbol_table::gc_mark_dyn_syms): New function.
8846 (Symbol_table::gc_): New data member.
8847 * target.h (Sized_target::gc_process_relocs): New pure virtual
8849 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8850 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8854 * options.h (General_options::gc_sections): Define as a no-op for now.
8855 (General_options::no_keep_memory): Ditto.
8856 (General_options::Bshareable): Define.
8857 * options.cc (General_options::finalize): Honor -Bshareable.
8861 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8862 read the value in the contents, since we don't use it. Use the
8863 template endianness when writing.
8864 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8868 * configure.tgt (powerpc64-*): Fix targ_obj.
8872 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8873 local symbols when stripping all symbols.
8877 * output.cc (Output_reloc): Add explicit instantiations.
8881 * archive.cc (Archive::get_elf_object_for_member): Remove call
8882 to File_read::claim_for_plugin.
8883 * descriptors.cc (Descriptors::open): Remove reference to
8885 (Descriptors::claim_for_plugin): Remove.
8886 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8887 (Descriptors::is_claimed): Remove.
8888 (claim_descriptor_for_plugin): Remove.
8889 * fileread.cc (File_read::claim_for_plugin): Remove.
8890 * fileread.h (File_read::claim_for_plugin): Remove.
8891 (File_read::descriptor): Reopen descriptor if necessary.
8892 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8893 (Plugin_manager::all_symbols_read): Add task parameter. Change
8895 (Plugin_manager::get_input_file): New function.
8896 (Plugin_manager::release_input_file): New function.
8897 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8898 corresponding data member.
8899 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8900 and pass to base constructor. Change all callers.
8901 (get_input_file, release_input_file): New functions.
8902 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8903 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8904 (Plugin_manager::all_symbols_read): Add task parameter.
8905 (Plugin_manager::get_input_file): New function.
8906 (Plugin_manager::release_input_file): New function.
8907 (Plugin_manager::task_): New data member.
8908 (Pluginobj::Pluginobj): Add filesize parameter.
8909 (Pluginobj::filename): New function.
8910 (Pluginobj::descriptor): New function.
8911 (Pluginobj::filesize): New function.
8912 (Pluginobj::filesize_): New data member.
8913 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8914 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8915 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8917 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8918 with archive libraries.
8919 * testsuite/Makefile.in: Regenerate.
8920 * testsuite/plugin_test.c (struct sym_info): New type.
8921 (get_input_file, release_input_file): New static variables.
8922 (onload): Capture new transfer vector entries.
8923 (claim_file_hook): Stop reading at end of file according to filesize.
8924 Factor out parsing of readelf output into separate function.
8925 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8926 APIs and get the source file name from the symbol table. Convert
8927 source file name to corresponding object file name. Print info
8928 message when adding new input files.
8929 (parse_readelf_line): New function.
8930 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8931 * testsuite/plugin_test_2.sh: Likewise.
8932 * testsuite/plugin_test_3.sh: Likewise.
8933 * testsuite/plugin_test_4.sh: New test case.
8937 * version.cc (version_string): Bump to 1.8.
8941 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8942 * plugin.cc (Plugin_manager::finish): Rename as
8943 layout_deferred_objects. Move cleanup to separate function.
8944 (Plugin_manager::cleanup): New function.
8945 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8947 * plugin.h (Plugin_manager::finish): Rename as
8948 layout_deferred_objects.
8949 (Plugin_manager::cleanup): New function.
8950 (Plugin_manager::cleanup_done): New field.
8954 * plugin.cc (is_visible_from_outside): New function.
8955 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8956 so we don't return "IR only" status for exported symbols or -r links.
8958 * testsuite/Makefile.am (plugin_test_3): New test case.
8959 * testsuite/Makefile.in: Regenerate.
8960 * testsuite/plugin_test_3.sh: New file.
8964 * object.cc (Sized_relobj::layout_section): New function.
8965 (Sized_relobj::do_layout): Defer layout of input sections until after
8966 plugin has provided replacement files.
8967 (Sized_relobj::do_layout_deferred_sections): New function.
8968 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8969 (Relobj::layout_deferred_sections): New function.
8970 (Relobj::do_layout_deferred_sections): New function.
8971 (Sized_relobj::do_layout_deferred_sections): New function.
8972 (Sized_relobj::layout_section): New function.
8973 (Sized_relobj::Deferred_layout): New structure.
8974 (Sized_relobj::deferred_layout_): New field.
8975 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8976 Change all callers. Layout deferred sections.
8977 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8979 (Plugin_hook::run): Move code from do_plugin_hook inline.
8980 (Plugin_hook::do_plugin_hook): Remove.
8981 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8982 (Plugin_manager::finish): Renamed, was cleanup.
8983 (Plugin_manager::should_defer_layout): New function.
8984 (Plugin_manager::add_deferred_layout_object): New function.
8985 (Plugin_manager::Deferred_layout_list): New type.
8986 (Plugin_manager::deferred_layout_objects_): New field.
8987 (Plugin_hook::do_plugin_hook): Remove.
8991 * options.h (class General_options): Add --no case for
8996 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8998 (Plugin_manager::claim_file): Create plugin object even if
8999 plugin did not call the add_symbols callback.
9000 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9001 asking for more symbols than were added.
9002 * testsuite/Makefile.am (plugin_test_1): Add test case with
9004 (empty.syms): New target.
9005 * testsuite/Makefile.in: Regenerate.
9006 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9007 message. Don't call add_symbols if no globals.
9008 (all_symbols_read_hook): Don't provide replacement for empty
9013 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9014 r_type == 0 for a local symbol with r_sym == 0.
9015 (scan_relocatable_relocs): Pass r_sym to
9016 local_non_section_strategy.
9017 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9020 * configure.ac: Update test for TLS descriptors: they are
9021 supported as of glibc 2.9.
9022 * configure: Rebuild.
9027 * target-reloc.h (Default_scan_relocatable_relocs): For each
9028 function, map r_type == 0 to RELOC_DISCARD.
9032 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9033 object to override a kept COMDAT group from a plugin object.
9038 * yyscript.y (file_cmd): Handle INPUT.
9040 * testsuite/initpri1.c: Change all declarations to be full
9041 prototypes by adding void, to avoid compiler warnings.
9045 * options.cc (General_options::parse_plugin_opt): New.
9046 (General_options::add_plugin): The argument now is just the filename.
9047 (General_options::add_plugin_option): New.
9048 * options.h (plugin_opt): New.
9049 (add_plugin): Change argument name.
9050 (add_plugin_option): New.
9051 * plugin.cc (Plugin::load): Don't parse the plugin option.
9052 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9053 (Plugin::add_option): New.
9054 (Plugin::args_): Change type.
9055 (Plugin::filename_): New.
9056 (Plugin_manager::add_plugin_option): New.
9057 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9058 * testsuite/Makefile.in: Regenerate.
9062 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9063 Handle --strip-lto-sections option.
9064 * options.h (strip_lto_sections): New option.
9068 * plugin.cc (ld_plugin_message): Change format parameter to const.
9069 Fix mismatch between new[] and delete.
9073 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9078 * options.cc (General_options::parse_dynamic_list): New function.
9079 * options.h (General_options): New flags dynamic_list,
9080 dynamic_list_data, dynamic_list_cpp_new, and
9081 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9082 (General_options::in_dynamic_list): New function.
9083 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9084 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9085 (Lex::can_continue_name): Likewise.
9087 (read_script_file): New parameter script_options.
9088 (read_dynamic_list): New function.
9089 (Script_options::define_dynamic_list): New function.
9090 (dynamic_list_keyword_parsecodes): New variable.
9091 (dynamic_list_keywords): New variable.
9092 * script.h (Script_options::define_dynamic_list): New function
9094 (read_dynamic_list): New function prototype.
9095 * symtab.cc (strprefix): New macro.
9096 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9097 dynamic_list_data, dynamic_list_cpp_new, and
9098 dynamic_list_cpp_typeinfo.
9099 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9100 (dynamic_list_expr): New rule.
9101 (dynamic_list_nodes): Likewise.
9102 (dynamic_list_node): Likewise.
9103 * testsuite/Makefile.am (dynamic_list): New test.
9104 * testsuite/Makefile.in: Regenerated.
9105 * testsuite/dynamic_list.t: New file.
9106 * testsuite/dynamic_list.sh: New file.
9110 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9111 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9112 (t11_last): Likewise.
9113 * testsuite/ver_test_6.c (main): Likewise.
9117 * options.c (General_options::finalize): Add check for -static and
9119 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9124 * plugin.cc (make_sized_plugin_object): Fix conditional
9125 compilation to work when not all targets are enabled.
9129 * archive.cc (Archive::get_file_and_offset): Use filename instead
9130 of name to get library path.
9131 (Archive::include_member): Unlock external member of a thin archive.
9133 * testsuite/Makefile.am (TEST_AR): New variable.
9134 (thin_archive_test_1): New test.
9135 (thin_archive_test_2): New test.
9136 * testsuite/Makefile.in: Regenerate.
9137 * testsuite/thin_archive_main.cc: New file.
9138 * testsuite/thin_archive_test_1.cc: New file.
9139 * testsuite/thin_archive_test_2.cc: New file.
9140 * testsuite/thin_archive_test_3.cc: New file.
9141 * testsuite/thin_archive_test_4.cc: New file.
9145 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9146 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9148 (Sized_relobj::do_finalize_local_symbols): Likewise.
9149 (Sized_relobj::map_to_kept_section): Likewise.
9150 * object.h (Sized_relobj::invalid_address): New constant.
9151 (Sized_relobj::do_output_section_offset): Check for invalid_address
9153 * output.cc (Output_reloc::local_section_offset): Use constant
9154 invalid_address instead of -1U.
9155 (Output_reloc::get_address): Likewise.
9156 (Output_section::output_address): Change -1U to -1ULL.
9157 * output.h (Output_reloc::invalid_address): New constant.
9158 * reloc.cc (Sized_relobj::write_sections): Use constant
9159 invalid_address instead of -1U.
9160 (Sized_relobj::relocate_sections): Likewise.
9161 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9162 values for merge sections.
9163 * target-reloc.h (relocate_for_relocatable): Use constant
9164 invalid_address instead of -1U.
9168 Add plugin functionality for link-time optimization (LTO).
9169 * configure.ac (plugins): Add --enable-plugins option.
9170 * configure: Regenerate.
9171 * config.in: Regenerate.
9172 * Makefile.am (LIBDL): New variable.
9173 (CCFILES): Add plugin.cc.
9174 (HFILES): Add plugin.h.
9175 (ldadd_var): Add LIBDL.
9176 * Makefile.in: Regenerate.
9178 * archive.cc: Include "plugin.h".
9179 (Archive::setup): Don't preread archive symbols when using a plugin.
9180 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9181 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9183 (Archive::include_member): Add symbols from plugin objects.
9184 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9185 * descriptors.cc (Descriptors::open): Check for file descriptors
9186 abandoned by plugins.
9187 (Descriptors::claim_for_plugin): New function.
9188 * descriptors.h (Descriptors::claim_for_plugin): New function.
9189 (Open_descriptor::is_claimed): New field.
9190 (claim_descriptor_for_plugin): New function.
9191 * fileread.cc (File_read::claim_for_plugin): New function.
9192 * fileread.h (File_read::claim_for_plugin): New function.
9193 (File_read::descriptor): New function.
9194 * gold.cc: Include "plugin.h".
9195 (queue_initial_tasks): Add task to call plugin hooks for generating
9197 * main.cc: Include "plugin.h".
9198 (main): Load plugin libraries.
9199 * object.h (Pluginobj): Declare.
9200 (Object::pluginobj): New function.
9201 (Object::do_pluginobj): New function.
9202 (Object::set_target): New function.
9203 * options.cc: Include "plugin.h".
9204 (General_options::parse_plugin): New function.
9205 (General_options::General_options): Initialize plugins_ field.
9206 (General_options::add_plugin): New function.
9207 * options.h (Plugin_manager): Declare.
9208 (General_options): Add --plugin option.
9209 (General_options::has_plugins): New function.
9210 (General_options::plugins): New function.
9211 (General_options::add_plugin): New function.
9212 (General_options::plugins_): New field.
9213 * plugin.cc: New file.
9214 * plugin.h: New file.
9215 * readsyms.cc: Include "plugin.h".
9216 (Read_symbols::do_read_symbols): Check for archive before checking
9217 for ELF file. Call plugin hooks to claim files.
9218 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9219 from a real object file; force override when processing replacement
9221 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9222 (Symbol::init_base_object): Likewise.
9223 (Symbol::init_base_output_data): Likewise.
9224 (Symbol::init_base_output_segment): Likewise.
9225 (Symbol::init_base_constant): Likewise.
9226 (Symbol::init_base_undefined): Likewise.
9227 (Symbol::output_section): Assert that object is not a plugin.
9228 (Symbol_table::add_from_pluginobj): New function.
9229 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9231 (Symbol_table::sized_write_globals): Likewise.
9232 (Symbol_table::add_from_pluginobj): Instantiate template.
9233 * symtab.h (Sized_pluginobj): Declare.
9234 (Symbol::in_real_elf): New function.
9235 (Symbol::set_in_real_elf): New function.
9236 (Symbol::in_real_elf_): New field.
9237 (Symbol_table::add_from_pluginobj): New function.
9239 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9240 (LIBDL): New variable.
9242 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9243 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9244 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9245 (MOSTLYCLEANFILES): Likewise.
9246 * testsuite/Makefile.in: Regenerate.
9247 * testsuite/plugin_test.c: New file.
9248 * testsuite/plugin_test_1.sh: New file.
9249 * testsuite/plugin_test_2.sh: New file.
9253 * target-reloc.h (relocate_section): Check whether a symbol is
9254 defined by the ABI before reporting an undefined symbol error.
9255 * target.h (Target::is_defined_by_abi): Make parameter const.
9256 (Target::do_is_defined_by_abi): Likewise.
9257 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9258 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9259 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9260 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9261 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9262 * testsuite/Makefile.in: Rebuild.
9264 * fileread.cc (make_view): Add casts to avoid warning.
9268 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9269 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9273 * options.h (General_options::output_is_executable): New.
9274 (General_options::output_is_pie): New.
9275 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9276 for shared libraries.
9277 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9281 * options.h (origin): New -z option.
9282 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9283 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9288 * fileread.cc (File_read::make_view): Add check for attempt to map
9293 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9294 explicit instantiations.
9299 * options.cc (General_options::finalize): Allow undefined symbols
9300 in shlibs if linking -shared.
9303 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9304 symbols as not needing a dynsym entry.
9308 * fileread.cc (File_read::open): Do not lock the file unless it
9309 was successfully opened.
9313 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9314 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9315 * testsuite/tls_test.cc (struct int128): 128-bit struct
9316 for testing TLS relocs with non-zero addend.
9317 (v12): New TLS variable.
9319 (t_last): Add check for v12.
9320 * testsuite/tls_test.h (t12): New function.
9321 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9325 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9326 set tls_segment_ or relro_segment_.
9327 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9329 * output.h (Output_section::clear_is_relro): New function.
9330 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9331 sections specially even when output_data_ is empty.
9332 (Output_segment::maximum_alignment): When first section is relro,
9333 only force alignment for PT_LOAD segments.
9334 * script.cc (script_data_segment_align): New function.
9335 (script_data_segment_relro_end): New function.
9336 * script-c.h (script_data_segment_align): Declare.
9337 (script_data_segment_relro_end): Declare.
9338 * script-sections.h (class Script_sections): Declare
9339 data_segment_align and data_segment_relro_end. Add fields
9340 segment_align_index_ and saw_relro_end_.
9341 * script-sections.cc (class Sections_element): Add set_is_relro
9342 virtual function. Add new bool* parameter to place_orphan_here.
9343 Add get_output_section virtual function.
9344 (class Output_section_definition): Add set_is_relro. Add new
9345 bool* parameter to place_orphan_here. Add get_output_section.
9346 Add is_relro_ field.
9347 (Output_section_definition::Output_section_definition): Initialize
9348 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9349 and is_relro_ fields.
9350 (Output_section_definition::place_orphan_here): Add is_relro
9352 (Output_section_definition::set_section_addresses): Set relro for
9354 (Output_section_definition::alternate_constraint): Likewise.
9355 (class Orphan_output_section): Add new bool* parameter to
9356 place_orphan_here. Add get_output_section.
9357 (Orphan_output_section::place_orphan_here): Add is_relro
9359 (Script_sections::Script_sections): Initialize
9360 data_segment_align_index_ and saw_relro_end_.
9361 (Script_sections::data_segment_align): New function.
9362 (Script_sections::data_segment_relro_end): New function.
9363 (Script_sections::place_orphan): Set or clear is_relro.
9364 (Script_sections::set_section_addresses): Force alignment of first
9366 * yyscript.y (exp): Call script_data_segment_align and
9367 script_data_segment_relro_end.
9368 * testsuite/relro_script_test.t: New file.
9369 * testsuite/relro_test.cc (using_script): Declare.
9370 (t1, t2): Test using_script.
9371 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9372 (relro_script_test_SOURCES): Define.
9373 (relro_script_test_DEPENDENCIES): Define.
9374 (relro_script_test_LDFLAGS): Define.
9375 (relro_script_test_LDADD): Define.
9376 (relro_script_test.so): New target.
9377 * testsuite/Makefile.in: Rebuild.
9381 * archive.cc (Archive::total_archives, Archive::total_members)
9382 (Archive::total_members_loaded): New variables.
9383 (Archive::setup): Add parameter. Add option to preread
9385 (Archive::read_armap): Add counter.
9386 (Archive::get_file_and_offset): New function.
9387 (Archive::get_elf_object_for_member): New function.
9388 (Archive::read_all_symbols): New function.
9389 (Archive::read_symbols): New function.
9390 (Archive::add_symbols): Add counters.
9391 (Archive::include_all_members): Use armap to find members if it's
9393 (Archive::include_member): Skip reading symbols if already read.
9394 Factored code into Archive::get_file_and_offset and
9395 Archive::get_elf_object_for_member. Changed call to
9396 Mapfile::report_include_archive_member.
9397 (Archive::print_stats): New function.
9398 * archive.h: Declare Object and Read_symbols_data classes.
9399 (Archive::Archive): Add initializers for new members.
9400 (Archive::setup): Add parameter.
9401 (Archive::print_stats): New function.
9402 (Archive::total_archives, Archive::total_members)
9403 (Archive::total_members_loaded): New variables.
9404 (Archive::get_file_and_offset): New function.
9405 (Archive::get_elf_object_for_member): New function.
9406 (Archive::read_all_symbols): New function.
9407 (Archive::read_symbols): New function.
9408 (Archive::Archive_member): New class.
9409 (Archive::members_): New member.
9410 (Archive::num_members_): New member.
9411 * main.cc: Include archive.h.
9412 (main): Call Archive::print_stats.
9413 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9414 archive parameter; member_name is now the fully-decorated name.
9415 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9416 * options.h: (General_options): Add --preread-archive-symbols option.
9417 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9422 * symtab.h (Symbol::use_plt_offset): New function.
9423 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9424 * powerpc.cc (Relocate::relocate): Likewise.
9425 * sparc.cc (Relocate::relocate): Likewise.
9426 * x86_64.cc (Relocate::relocate): Likewise.
9427 * testsuite/weak_plt.sh: New test.
9428 * testsuite/weak_plt_main.cc: New test.
9429 * testsuite/weak_plt_shared.cc: New test.
9430 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9431 (check_PROGRAMS): Add weak_plt.
9432 (check_DATA): Add weak_plt_shared.so.
9433 (weak_plt_main_pic.o, weak_plt): New targets.
9434 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9435 * testsuite/Makefile.in: Rebuild.
9437 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9439 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9440 * testsuite/Makefile.in: Rebuild.
9444 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9445 * Makefile.in: Regenerate.
9446 * po/POTFILES.in: Regenerate.
9450 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9451 symbols before other symbols.
9452 * testsuite/script_test_2.cc (test_addr): Declare.
9453 (test_addr_alias): Declare.
9454 (main): Check that test_addr and test_addr_alias have the right
9456 * testsuite/script_test_2.t: Define test_addr_alias and
9462 * descriptors.cc: New file.
9463 * descriptors.h: New file.
9464 * gold-threads.h (class Hold_optional_lock): New class.
9465 * fileread.cc: Include "descriptors.h".
9466 (File_read::~File_read): Release descriptor rather than closing
9468 (File_read::open) [file]: Call open_descriptor rather than open.
9469 Set is_descriptor_opened_.
9470 (File_read::open) [memory]: Assert that descriptor is not open.
9471 (File_read::reopen_descriptor): New function.
9472 (File_read::release): Release descriptor.
9473 (File_read::do_read): Make non-const. Reopen descriptor.
9474 (File_read::read): Make non-const.
9475 (File_read::make_view): Reopen descriptor.
9476 (File_read::do_readv): Likewise.
9477 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9478 Update declarations.
9479 * layout.cc: Include "descriptors.h".
9480 (Layout::create_build_id): Use open_descriptor rather than open.
9481 * output.cc: Include "descriptors.h".
9482 (Output_file::open): Use open_descriptor rather than open.
9483 * archive.cc (Archive::const_iterator): Change Archive to be
9485 (Archive::begin, Archive::end): Make non-const.
9486 (Archive::count_members): Likewise.
9487 * archive.h (class Archive): Update declarations.
9488 * object.h (Object::read): Make non-const.
9489 * Makefile.am (CCFILES): Add descriptors.cc.
9490 (HFILES): Add descriptors.h.
9491 * Makefile.in: Rebuild.
9494 * gold.h: Always include <clocale>. Add Solaris workarounds
9495 following code in binutils/sysdep.h.
9498 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9499 this->eh_frame_hdr_ is NULL before using it.
9501 * dynobj.cc (Versions::Versions): Update comment.
9503 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9504 the base version name.
9506 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9507 array size plus one.
9508 (Stringpool_template::set_string_offsets): Subtract one from key
9509 before using it as an array index.
9510 (Stringpool_template::get_offset_with_length): Likewise.
9511 (Stringpool_template::write_to_buffer): Likewise.
9512 * stringpool.h (Stringpool_template::get_offset_from_key):
9518 * object.h (Merged_symbol_value::value): Do our best to handle a
9522 * script.cc (Version_script_info::get_versions): Don't add empty
9523 version tag to return value.
9524 (Version_script_info::get_symbol_version_helper): Change return
9525 type to bool. Add pversion parameter. Change all callers.
9526 (script_register_vers_node): Don't require a non-NULL tag.
9527 * script.h (class Version_script_info): Update declarations.
9528 (Version_script_info::get_symbol_version): Change return type to
9529 bool. Add version parameter. Change all callers.
9530 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9531 handling. Handle an empty version from a version script.
9532 (Symbol_table::define_special_symbol): Likewise.
9533 * testsuite/ver_test_10.script: New file.
9534 * testsuite/ver_test_10.sh: New file.
9535 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9536 (check_DATA): Add ver_test_10.syms.
9537 (ver_test_10.syms, ver_test_10.so): New target.
9538 * testsuite/Makefile.in: Rebuild.
9542 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9543 to zero for undefined symbols from dynamic libraries.
9547 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9549 * symtab.h (class Symbol_table): Update declaration.
9550 * testsuite/ver_test_9.cc: New file.
9551 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9552 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9553 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9554 (ver_test_9.so, ver_test_9.o): New targets.
9555 * testsuite/Makefile.in: Rebuild.
9559 * options.h (class General_options): Define --check-sections.
9560 * layout.cc (Layout::set_segment_offsets): Handle
9563 * options.h (class General_options): Define -n/--nmagic and
9565 * options.cc (General_options::finalize): For -n/--nmagic or
9566 -N/--omagic, set -static.
9567 * layout.cc (Layout::attach_allocated_section_to_segment): If
9568 -N/--omagic, don't put read-only and read-write sections in
9570 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9571 finding a read-only segment.
9572 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9573 don't set the minimum segment alignment to the common page size,
9574 and don't set the file offset to the address modulo the page size.
9575 * script-sections.cc (Script_sections::create_segments): If
9576 -n/--omagic, don't put read-only and read-write sections in
9579 * cref.cc: New file.
9581 * options.h (class General_options): Add --print-symbol-counts.
9582 * main.cc (main): Issue defined symbol report if requested.
9583 * archive.cc (Archive::interpret_header): Make into a const member
9585 (Archive::add_symbols): Call Input_objects::archive_start and
9587 (Archive::const_iterator): Define new class.
9588 (Archive::begin, Archive::end): New functions.
9589 (Archive::include_all_members): Rewrite to use iterator.
9590 (Archive::count_members): New function.
9591 * archive.h (class Archive): Update declarations.
9592 (Archive::filename): New function.
9593 * object.cc: Include "cref.h".
9594 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9595 (Sized_relobj::do_get_global_symbol_counts): New function.
9596 (Input_objects::add_object): Add object to cross-referencer.
9597 (Input_objects::archive_start): New function.
9598 (Input_objects::archive_stop): New function.
9599 (Input_objects::print_symbol_counts): New function.
9600 * object.h: Declare Cref and Archive.
9601 (Object::get_global_symbol_counts): New function.
9602 (Object::do_get_global_symbol_counts): New pure virtual function.
9603 (class Sized_relobj): Add defined_count_ field. Update
9605 (class Input_objects): Add cref_ field. Update constructor.
9606 Update declarations.
9607 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9609 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9611 (Sized_dynobj::do_get_global_symbol_counts): New function.
9612 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9613 defined_count_. Update declarations. Define Symbols typedef.
9614 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9615 parameter. Change all callers.
9616 (Symbol_table::add_from_dynobj): Add sympointers and defined
9617 parameters. Change all callers.
9618 * symtab.h (class Symbol_table): Update declarations.
9619 * Makefile.am (CCFILES): Add cref.cc.
9620 (HFILES): Add cref.h.
9621 * Makefile.in: Rebuild.
9625 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9626 to zero when writing undefined symbols.
9630 * output.cc (Output_section::add_input_section): Don't try to
9631 merge empty merge sections.
9635 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9636 Include symbol version in error message.
9640 * configure.ac (gold_cv_c_random_seed): New configured variable.
9641 (RANDOM_SEED_CFLAGS): New substituted variable.
9642 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9643 * configure: Rebuild.
9644 * Makefile.in: Likewise.
9645 * testsuite/Makefile.in: Likewise.
9649 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9650 where we see NAME/NULL and NAME/VERSION as separate symbols.
9651 * testsuite/ver_test_main.cc (main): Call t4.
9652 (t4, t4_2a): Define.
9653 * testsuite/ver_test_2.cc (t4_2): Define.
9654 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9655 * testsuite/ver_test_4.cc (t4_2a): Define.
9656 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9657 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9661 * dynobj.cc (Versions::add_def): If we give an error about a
9662 missing version, go ahead and create the version anyhow.
9666 Handle output sections with more than 0x7fffffff bytes.
9667 * object.h (class Relobj): Change map_to_output_ to
9668 output_sections_, and just keep a section pointer. Change all
9669 uses. Move comdat group support to Sized_relobj.
9670 (Relobj::is_section_specially_mapped): Remove.
9671 (Relobj::output_section): Remove poff parameter. Change all
9673 (Relobj::output_section_offset): New function.
9674 (Relobj::set_section_offset): Rewrite.
9675 (Relobj::map_to_output): Remove.
9676 (Relobj::output_sections): New function.
9677 (Relobj::do_output_section_offset): New pure virtual function.
9678 (Relobj::do_set_section_offset): Likewise.
9679 (class Sized_relobj): Add section_offsets_ field. Add comdat
9680 group support from Relobj. Update declarations.
9681 (Sized_relobj::get_output_section_offset): New function.
9682 (Sized_relobj::do_output_section_offset): New function.
9683 (Sized_relobj::do_set_section_offset): New function.
9684 * object.cc (Relobj::output_section_address): Remove.
9685 (Sized_relobj::Sized_relobj): Initialize new fields.
9686 (Sized_relobj::include_section_group): Cast find_kept_object to
9688 (Sized_relobj::include_linkonce_section): Likewise.
9689 (Sized_relobj::do_layout): Use separate arrays for output section
9691 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9693 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9694 output_sections and section_offsets.
9695 (Sized_relobj::write_local_symbols): Likewise.
9696 (map_to_kept_section): Compute output address directly.
9697 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9698 output_sections and section_offsets.
9699 (Sized_relobj::write_sections): Likewise.
9700 (Sized_relobj::relocate_sections): Likewise.
9701 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9702 * output.h (class Output_reloc): Update declarations. Change
9703 u2_.relobj to Sized_relobj*.
9704 (class Output_data_reloc): Change add functions to use
9706 * output.cc (Output_reloc::Output_reloc): Change relobj to
9708 (Output_reloc::local_section_offset): Change return type to
9709 Elf_Addr. Use get_output_section_offset.
9710 (Output_reloc::get_address): Likewise.
9711 (Output_section::is_input_address_mapped): Don't call
9712 is_section_specially_mapped.
9713 (Output_section::output_offset): Likewise.
9714 (Output_section::output_address): Likewise.
9715 (Output_section::starting_output_address): Likewise.
9716 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9717 parameter to Sized_relobj*.
9718 (Copy_relocs::need_copy_reloc): Likewise.
9719 (Copy_relocs::save): Likewise.
9720 * copy-relocs.h (class Copy_relocs): Update declarations.
9721 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9722 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9723 * target-reloc.h (relocate_for_relocatable): Change
9724 offset_in_output_section type to Elf_Addr. Change code that uses
9726 * layout.cc (Layout::layout): Always set *off.
9727 * mapfile.cc (Mapfile::print_input_section): Use
9728 output_section_offset.
9729 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9731 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9732 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9733 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9737 * layout.cc (Layout::include_section): Do not discard unrecognized
9738 SHT_STRTAB sections.
9742 * script.cc (Lex::can_continue_name): Make '?' allowable in
9743 version-script names.
9744 * testsuite/version_script.map: Change glob pattern to use '?'
9749 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9756 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9757 versions]: Don't try to read the value in the contents, since we
9758 don't use it. Use the template endianness when writing.
9762 * fileread.cc (File_read::make_view): Assert on zero-length view.
9763 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9764 symbol table when there are no symbols to read.
9768 * version.cc (version_string): Bump to 1.7
9772 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9773 constant 0xFFFF to type Valtype.
9774 (Powerpc_relocate_functions::rel16_ha): Likewise.
9778 * output.h (Output_section::Input_section): Initialize p2align_ to
9779 zero for Output_section_data constructors.
9780 (Output_section::Input_section::addralign): If not an input
9781 section, return the alignment of the Output_section_data.
9782 * testsuite/copy_test.cc: New file.
9783 * testsuite/copy_test_1.cc: New file.
9784 * testsuite/copy_test_2.cc: New file.
9785 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9786 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9787 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9788 (copy_test_1_pic.o, copy_test_1.so): New targets.
9789 (copy_test_2_pic.o, copy_test_2.so): New targets.
9790 * testsuite/Makefile.in: Rebuild.
9792 * script-sections.cc (Script_sections::place_orphan): Initialize
9793 local variable exact.
9797 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9802 * powerpc.cc: New file.
9803 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9804 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9805 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9806 * Makefile.in: Rebuild.
9810 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9812 (throwing, orig_terminate): New static variables.
9813 (terminate_handler): New static function.
9814 (t2): Set terminate handler.
9819 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9824 * archive.cc (Archive::include_all_members) Correct to step
9825 over symbol table and extended name table in thin archives.
9830 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9835 * reduced_debug_output.cc: New file.
9836 * reduced_debug_output.h: New file.
9837 * options.h (class General_options): Add --strip-debug-non-line.
9838 * options.cc (General_options::finalize): Add strip_debug_non_line
9839 to the strip heirarchy.
9840 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9842 * layout.cc: Include "reduced_debug_output.h".
9843 (Layout::Layout): Initialize new fields.
9844 (line_only_debug_sections): New static array.
9845 (is_lines_only_debug_sections): New static inline function.
9846 (Layout::include_section): Handle --strip-debug-non-line.
9847 (Layout::make_output_section): If --strip-debug-non-line, build
9848 new output sections for .debug_abbrev and .debug_info.
9849 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9850 gold. Warn about possible overflow.
9851 (read_signed_LEB_128): Likewise.
9852 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9853 (read_signed_LEB_128): Declare.
9854 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9855 (HFILES): Add reduced_debug_output.h.
9856 * Makefile.in: Rebuild.
9860 * mapfile.cc: New file.
9861 * mapfile.h: New file.
9862 * options.h (class General_options): Add -M/--print-map and -Map.
9863 * options.cc (General_options::finalize): Make -M equivalent to
9865 * main.cc: Include <cstdio> and "mapfile.h".
9866 (main): Open mapfile if requested.
9867 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9868 constructor. Change caller.
9869 (queue_initial_tasks): Add mapfile parameter. Change caller.
9870 (queue_middle_tasks): Likewise.
9871 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9873 * archive.cc: Include "mapfile.h".
9874 (Archive::add_symbols): Add mapfile parameter. Change all
9875 callers. Pass mapfile, symbol, and reason to include_member.
9876 (Archive::include_all_members): Add mapfile parameter. Change all
9878 (Archive::include_member): Add mapfile, sym, and why parameters.
9879 Change all callers. Report inclusion to map file.
9880 * archive.h: Include "fileread.h".
9881 (class Archive): Update declarations.
9882 (Archive::file): New const method.
9883 (class Add_archive_symbols): Add mapfile_ field. Update
9884 constructor. Change all callers.
9885 * readsyms.h (class Read_symbols): Likewise.
9886 (class Finish_group): Likewise.
9887 (class Read_script): Likewise.
9888 * common.cc: Include "mapfile.h".
9889 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9891 (Symbol_table::do_allocate_commons): Likewise.
9892 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9893 symbol allocation to mapfile.
9894 * common.h (class Allocate_commons_task): Add mapfile_ field.
9895 Update constructor. Change all callers.
9896 * symtab.h (class Symbol_table): Update declarations.
9897 * layout.cc: Include "mapfile.h".
9898 (Layout_task_runner::run): Print information to mapfile.
9899 (Layout::create_gold_note): Change Output_data_fixed_space to
9900 Output_data_zero_fill.
9901 (Layout::create_build_id): Likewise.
9902 (Layout::print_to_mapfile): New function.
9903 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9904 constructor. Change caller.
9905 (class Layout): Declare print_to_mapfile.
9906 * output.cc (Output_section::Input_section::print_to_mapfile): New
9908 (Output_section::add_input_section): If producing a map, always
9909 add to input_sections_ list.
9910 (Output_section::do_print_to_mapfile): New function.
9911 (Output_segment::print_sections_to_mapfile): New function.
9912 (Output_segment::print_section_list_to_mapfile): New function.
9913 * output.h: Include "mapfile.h".
9914 (Output_data::print_to_mapfile): New function.
9915 (Output_data::do_print_to_mapfile): New virtual function.
9916 (Output_segment_headers::do_print_to_mapfile): New function.
9917 (Output_file_header::do_print_to_mapfile): New function.
9918 (Output_data_const::do_print_to_mapfile): New function.
9919 (class Output_data_const_buffer): Add map_name_ field. Update
9920 constructor. Change all callers. Add do_print_to_mapfile
9922 (class Output_data_fixed_space): Likewise.
9923 (class Output_data_space): Likewise.
9924 (class Output_data_zero_fill): New class.
9925 (Output_data_strtab::do_print_to_mapfile): New function.
9926 (Output_data_reloc_base::do_print_to_mapfile): New function.
9927 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9928 (Output_data_group::do_print_to_mapfile): New function.
9929 (Output_data_got::do_print_to_mapfile): New function.
9930 (Output_data_dynamic::do_print_to_mapfile): New function.
9931 (Output_symtab_xindex::do_print_to_mapfile): New function.
9932 (class Output_section): Declare do_print_to_mapflie. Declare
9933 print_to_mapfile in Input_section.
9934 (class Output_segment): Declare new functions.
9935 * object.h (Sized_relobj::symbol_count): New function.
9936 * script-sections.cc
9937 (Output_section_element_dot_assignment::set_section_addresses):
9938 Change Output_data_fixed_space to Output_data_zero_fill.
9939 (Output_data_expression::do_print_to_mapfile): New function.
9940 * script.cc (read_input_script): Add mapfile parameter. Change
9942 * script.h (read_input_script): Update declaration.
9943 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9944 (Eh_frame::do_print_to_mapfile): New function.
9945 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9946 (Output_merge_string::do_print_to_mapfile): New function.
9947 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9949 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9951 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9953 * Makefile.am (CCFILES): Add mapfile.cc.
9954 (HFILES): Add mapfile.h.
9955 * Makefile.in: Rebuild.
9959 * options.h (class General_options): Add -z relro.
9960 * layout.cc (Layout::Layout): Initialize relro_segment_.
9961 (Layout::add_output_section_data): Return the output section.
9962 (Layout::make_output_section): Rcognize relro sections and mark
9964 (Layout::attach_allocated_section_to_segment): Put relro sections
9965 in a PT_GNU_RELRO segment.
9966 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9968 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9970 (Layout::linkonce_mapping): Map d.rel.ro.local to
9972 (Layout::output_section_name): Us .data.rel.ro.local for any
9973 section which begins with that.
9974 * layout.h (class Layout): Update add_output_section_data
9975 declaration. Add relro_segment_ field.
9976 * output.cc (Output_section::Output_section): Initialize is_relro_
9977 and is_relro_local_ fields.
9978 (Output_segment::add_output_section): Group relro sections.
9979 (Output_segment::is_first_section_relro): New function.
9980 (Output_segment::maximum_alignment): If there is a relro section,
9981 align the segment to the common page size.
9982 (Output_segment::set_section_addresses): Track whether we are
9983 looking at relro sections. If the last section is a relro
9984 section, align to the common page size.
9985 (Output_segment::set_section_list_addresses): Add in_relro
9986 parameter. Change all callers. Align to the page size when
9987 moving from relro to non-relro section.
9988 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9990 * output.h (class Output_section): Add is_relro_ and
9991 is_relro_local_ fields.
9992 (Output_section::is_relro): New function.
9993 (Output_section::set_is_relro): New function.
9994 (Output_section::is_relro_local): New function.
9995 (Output_section::set_is_relro_local): New function.
9996 (class Output_segment): Update declarations.
9997 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9998 * sparc.cc (Target_sparc::got_section): Likewise.
9999 * x86_64.cc (Target_x86_64::got_section): Likewise.
10000 * testsuite/relro_test_main.cc: New file.
10001 * testsuite/relro_test.cc: New file.
10002 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10003 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10004 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10005 (relro_test.so, relro_test_pic.o): New targets.
10006 * testsuite/Makefile.in: Rebuild.
10010 * output.cc (Output_segment::add_output_section): Remove front
10012 * output.h (class Output_segment): Remove
10013 add_initial_output_section and overloaded add_output_section.
10014 Update declaration of remaining add_output_section.
10015 * layout.cc (Layout::create_interp): Call add_output_section
10016 rather than add_initial_output_section.
10017 (Layout::finish_dynamic_section): Likewise.
10019 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10020 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10021 know the dynamic type.
10022 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10023 field. Initialize it in constructor.
10024 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10025 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10026 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10029 * output.cc (Output_reloc::get_address): Change return type to
10031 * output.h (class Output_reloc): Update get_address declaration.
10032 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10033 for section addresses.
10038 * gold.cc (gold_nomem): Use return value of write.
10042 * symtab.c (Symbol::init_base_output_data): Add version
10043 parameter. Change all callers.
10044 (Symbol::init_base_output_segment): Likewise.
10045 (Symbol::init_base_constant): Likewise.
10046 (Symbol::init_base_undefined): Likewise.
10047 (Sized_symbol::init_output_data): Likewise.
10048 (Sized_symbol::init_output_segment): Likewise.
10049 (Sized_symbol::init_constant): Likewise.
10050 (Sized_symbol::init_undefined): Likewise.
10051 (Symbol_table::do_define_in_output_data): If the new symbol has a
10052 version, mark it as the default.
10053 (Symbol_table::do_define_in_output_segment): Likewise.
10054 (Symbol_table::do_define_as_constant): Likewise.
10055 * symtab.h (class Symbol): Update declarations.
10056 (class Sized_symbol): Likewise.
10057 * resolve.cc (Symbol::override_version): New function.
10058 (Symbol::override_base): Call override_version.
10059 (Symbol::override_base_with_special): Likewise.
10060 * testsuite/ver_script_8.script: New file.
10061 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10062 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10063 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10064 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10069 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10071 (class General_options): Remove existing --undefined, and add
10072 --no-undefined instead. Add new --undefined as synonym for -u.
10073 * archive.cc (Archive::add_symbols): Check whether symbol was
10075 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10076 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10077 all uses. Add IS_UNDEFINED. Update declarations to split
10078 different versions of init_base. Declare init_base_undefined.
10079 (Symbol::is_defined): Handle IS_UNDEFINED.
10080 (Symbol::is_undefined): Likewise.
10081 (Symbol::is_weak_undefined): Call is_undefined.
10082 (Symbol::is_absolute): Handle IS_CONSTANT.
10083 (class Sized_symbol): Update declarations to split different
10084 versions of init. Declare init_undefined.
10085 (class Symbol_table): Declare new functions.
10086 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10087 Change all callers.
10088 (Symbol::init_base_output_data): Likewise.
10089 (Symbol::init_base_output_segment): Likewise.
10090 (Symbol::init_base_constant): Likewise.
10091 (Symbol::init_base_undefined): New function.
10092 (Sized_symbol::init_object): Rename from init. Change all
10094 (Sized_symbol::init_output_data): Likewise.
10095 (Sized_symbol::init_output_segment): Likewise.
10096 (Sized_symbol::init_constant): Likewise.
10097 (Sized_symbol::init_undefined): New function.
10098 (Symbol_table::add_undefined_symbols_from_command_line): New
10100 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10102 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10103 (Symbol::output_section): Likewise.
10104 (Symbol::set_output_section): Likewise.
10105 (Symbol_table::sized_finalize_symbol): Likewise.
10106 (Symbol_table::sized_write_globals): Likewise.
10107 * resolve.cc (Symbol_table::should_override): Likewise.
10108 (Symbol::override_base_with_special): Likewise.
10110 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10111 symbol, change it to have default visibility.
10112 * testsuite/protected_1.cc: New file.
10113 * testsuite/protected_2.cc: New file.
10114 * testsuite/protected_3.cc: New file.
10115 * testsuite/protected_main_1.cc: New file.
10116 * testsuite/protected_main_2.cc: New file.
10117 * testsuite/protected_main_3.cc: New file.
10118 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10119 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10120 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10121 (protected_1.so): New target.
10122 (protected_1_pic.o, protected_2_pic.o): New targets.
10123 (protected_3_pic.o): New target.
10124 (check_PROGRAMS): Add protected_2.
10125 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10126 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10127 * testsuite/Makefile.in: Rebuild.
10129 * options.h (DEFINE_var): Add set_user_set_##varname__.
10130 (DEFINE_bool_alias): New macro.
10131 (class General_options): Define -Bstatic using DEFINE_bool_alias
10132 rather than DEFINE_special. Add --undefined as an alias for -z
10134 * options.cc (General_options::parse_Bstatic): Remove.
10136 * options.h (class General_options): Add --fatal-warnings.
10137 * main.cc (main): Implement --fatal-warnings.
10138 * errors.h (Errors::warning_count): New function.
10140 * options.h (class General_options): Add -Bsymbolic-functions.
10141 * symtab.h (Symbol::is_preemptible): Check for
10142 -Bsymbolic-functions.
10146 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10147 as noVARNAME rather than no-VARNAME.
10148 (class General_options): Add option -z combreloc.
10149 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10151 (Output_reloc::sort_before) [SHT_REL]: New function.
10152 (Output_reloc::sort_before) [SHT_RELA]: New function.
10153 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10154 Sort_relocs_comparison.
10155 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10156 parameter. Change all callers.
10157 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10158 sort_relocs parameter. Change all callers.
10159 * output.cc (Output_reloc::get_address): New function, broken out
10161 (Output_reloc::write_rel): Call it.
10162 (Output_reloc::compare): New function.
10163 (Output_data_reloc_base::do_write): Optionally sort relocs.
10165 * configure.ac: If targ_extra_obj is set, link it in.
10166 * configure.tgt: Initialize all variables.
10167 (x86_64*): Set targ_extra_obj and targ_extra_size.
10168 * configure: Rebuild.
10170 * object.cc (Sized_relobj::include_section_group): Adjust section
10171 indexes read from group data. Build vector to pass to
10173 * layout.cc (Layout::layout_group): Add flags and shndxes
10174 parameters. Remove contents parameter. Change caller. Update
10175 explicit instantiations.
10176 * layout.h (class Layout): Update layout_group declaration.
10177 * output.cc (Output_data_group::Output_data_group): Add flags and
10178 input_shndxes parameters. Remove contents parameter. Change
10180 (Output_data_group::do_write): Change input_sections_ to
10182 * output.h (class Output_data_group): Update constructor
10183 declaration. Rename input_sections_ to input_shndxes_.
10184 * testsuite/many_sections_test.cc: Add template.
10188 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10190 * layout.cc (Layout::include_section): Refactored check for debug
10192 (Layout::add_comdat): Add new parameters. Change type
10193 of signature parameter. Add object and shndx to signatures table.
10194 (Layout::find_kept_object): New function.
10195 * layout.h: Include <cstring>.
10196 (Layout::is_debug_info_section): New function.
10197 (Layout::add_comdat): Add new parameters.
10198 (Layout::find_kept_object): New function.
10199 (Layout::Kept_section): New struct.
10200 (Layout::Signatures): Change type of map range.
10201 * object.cc (Relobj::output_section_address): New function.
10202 (Sized_relobj::include_section_group): Add new parameters. Change
10203 calls to Layout::add_comdat. Change to build table of kept comdat
10204 groups and table mapping discarded sections to kept sections.
10205 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10206 (Sized_relobj::do_layout): Change calls to include_section_group and
10207 include_linkonce_section.
10208 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10209 value to zero when section is discarded.
10210 (Sized_relobj::map_to_kept_section): New function.
10211 * object.h (Relobj::output_section_address): New function.
10212 (Relobj::Comdat_group): New type.
10213 (Relobj::find_comdat_group): New function.
10214 (Relobj::Comdat_group_table): New type.
10215 (Relobj::Kept_comdat_section): New type.
10216 (Relobj::Kept_comdat_section_table): New type.
10217 (Relobj::add_comdat_group): New function.
10218 (Relobj::set_kept_comdat_section): New function.
10219 (Relobj::get_kept_comdat_section): New function.
10220 (Relobj::comdat_groups_): New field.
10221 (Relobj::kept_comdat_sections_): New field.
10222 (Symbol_value::input_value): Update comment.
10223 (Sized_relobj::map_to_kept_section) New function.
10224 (Sized_relobj::include_linkonce_section): Add new parameter.
10225 * target-reloc.h (Comdat_behavior): New type.
10226 (get_comdat_behavior): New function.
10227 (relocate_section): Add code to map a discarded section to the
10228 corresponding kept section when applying a relocation.
10232 * dwarf_reader.cc (next_generation_count): New static var.
10233 (Addr2line_cache_entry): New struct.
10234 (addr2line_cache): New static var.
10235 (Dwarf_line_info::one_addr2line): Added caching.
10236 (Dwarf_line_info::clear_addr2line_cache): New function.
10237 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10238 cache-size parameter.
10239 (Dwarf_line_info::one_addr2line_cache): New function.
10240 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10241 new cache-size argument to one_addr2line(), and clear cache.
10245 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10246 R_386_PC8 relocations.
10250 * object.cc (Sized_relobj::include_section_group): Check for
10251 invalid section group.
10253 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10256 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10257 than read for file header.
10258 * archive.cc (Archive::include_member): Likewise.
10262 * aclocal.m4: Regenerate.
10263 * configure: Regenerate.
10267 * version.cc (version_string): Bump to 1.6.
10269 * testsuite/Makefile.am (many_sections_r_test): New target.
10270 (many_sections_r_test_SOURCES): Remove.
10271 (many_sections_r_test_DEPENDENCIES): Remove.
10272 (many_sections_r_test_LDFLAGS): Remove.
10273 (many_sections_r_test_LDADD): Remove.
10275 * object.cc (Sized_relobj::do_add_symbols): Always pass
10276 local_symbol_count_ to add_from_relobj.
10278 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10279 every thousand variables.
10280 * testsuite/Makefile.in: Rebuild.
10282 * object.cc (Xindex::initialize_symtab_xindex): New function.
10283 (Xindex::read_symtab_xindex): New function.
10284 (Xindex::sym_xindex_to_shndx): New function.
10285 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10287 (Sized_relobj::do_initialize_xindex): New function.
10288 (Sized_relobj::do_read_symbols): Adjust section links.
10289 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10290 parameter. Change all callers.
10291 (Sized_relobj::include_section_group): Adjust section links and
10292 symbol section indexes.
10293 (Sized_relobj::do_layout): Adjust section links.
10294 (Sized_relobj::do_count_local_symbols): Adjust section links and
10295 symbol section indexes.
10296 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10297 ordinary and special symbols.
10298 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10299 dynsym_xindex parameters. Change all callers. Adjust section
10300 links. Use SHN_XINDEX when needed.
10301 (Sized_relobj::get_symbol_location_info): Adjust section links.
10302 Don't get fooled by special symbols.
10303 * object.h (class Xindex): Define.
10304 (class Object): Add xindex_ parameter. Declare virtual functoin
10305 do_initialize_xindex.
10306 (Object::adjust_sym_shndx): New function.
10307 (Object::set_xindex): New protected function.
10308 (class Symbol_value): Add is_ordinary_shndx_ field.
10309 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10310 (Symbol_value::value): Assert ordinary section.
10311 (Symbol_value::initialize_input_to_output_map): Likewise.
10312 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10313 Change all callers.
10314 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10316 (class Sized_relobj): Update declarations.
10317 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10318 parameter. Change all callers.
10319 (Sized_relobj::adjust_shndx): New function.
10320 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10322 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10323 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10324 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10325 (Sized_dynobj::read_dynsym_section): Adjust section links.
10326 (Sized_dynobj::read_dynamic): Likewise.
10327 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10329 (Sized_dynobj::do_initialize_xindex): New function.
10330 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10331 do_initialize_xindex.
10332 (Sized_dynobj::adjust_shndx): New function.
10333 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10334 dynsym_xindex_ fields.
10335 (Layout::finalize): Add a call to set_section_indexes before
10336 creating the symtab sections.
10337 (Layout::set_section_indexes): Don't do anything if the section
10338 already has a section index.
10339 (Layout::create_symtab_sections): Add shnum parameter. Change
10340 caller. Create .symtab_shndx section if needed.
10341 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10343 (Layout::allocated_output_section_count): New function.
10344 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10346 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10347 fields. Update declarations.
10348 (Layout::symtab_xindex): New function.
10349 (Layout::dynsym_xindex): New function.
10350 (class Write_symbols_task): Add layout_ field.
10351 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10353 * output.cc (Output_section_headers::Output_section_headers): Add
10354 shstrtab_section parameter. Change all callers.
10355 (Output_section_headers::do_sized_write): Store overflow values
10356 for section count and section string table section index in
10357 section header zero.
10358 (Output_file_header::do_sized_write): Check for overflow of
10359 section count and section string table section index.
10360 (Output_symtab_xindex::do_write): New function.
10361 (Output_symtab_xindex::endian_do_write): New function.
10362 * output.h (class Output_section_headers): Add shstrtab_section_.
10363 Update declarations.
10364 (class Output_symtab_xindex): Define.
10365 (Output_section::has_out_shndx): New function.
10366 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10368 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10369 Change all callers.
10370 (Sized_symbol::init): Likewise.
10371 (Symbol::output_section): Check for ordinary symbol.
10372 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10373 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10375 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10376 Change all callers. Simplify handling of symbols from sections
10377 not included in the link.
10378 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10380 (Weak_alias_sorter::operator()): Assert that symbols are
10382 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10384 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10385 parameters. Change all callers.
10386 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10387 symbol distinction. Use SHN_XINDEX when needed.
10388 (Symbol_table::write_section_symbol): Add symtab_xindex
10389 parameter. Change all callers.
10390 (Symbol_table::sized_write_section_symbol): Likewise. Use
10391 SHN_XINDEX when needed.
10392 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10394 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10395 (Symbol::is_defined): Check is_ordinary.
10396 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10397 (Symbol::is_absolute, Symbol::is_common): Likewise.
10398 (class Sized_symbol): Update declarations.
10399 (class Symbol_table): Update declarations.
10400 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10401 parameters. Change all callers.
10402 (Sized_symbol::override): Likewise.
10403 (Symbol_table::override): Likewise.
10404 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10405 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10406 is_ordinary, and orig_st_shndx parameters. Change all callers.
10407 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10408 to be in an ordinary section.
10409 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10410 object and is_ordinary parameters. Change all callers.
10411 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10412 Change all callers. Don't add undefined or non-ordinary symbols
10414 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10415 Change all callers.
10416 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10418 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10419 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10420 (Sized_relobj::relocate_sections): Likewise.
10421 * target-reloc.h (scan_relocs): Adjust section symbol index.
10422 (scan_relocatable_relocs): Likewise.
10423 * i386.cc (Scan::local): Check for ordinary symbols.
10424 * sparc.cc (Scan::local): Likewise.
10425 * x86_64.cc (Scan::local): Likewise.
10426 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10427 to symbol_section_and_value.
10428 * testsuite/many_sections_test.cc: New file.
10429 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10430 (check_PROGRAMS): Add many_sections_test.
10431 (many_sections_test_SOURCES): Define.
10432 (many_sections_test_DEPENDENCIES): Define.
10433 (many_sections_test_LDFLAGS): Define.
10434 (BUILT_SOURCES): Add many_sections_define.h.
10435 (many_sections_define.h): New target.
10436 (BUILT_SOURCES): Add many_sections_check.h.
10437 (many_sections_check.h): New target.
10438 (check_PROGRAMS): Add many_sections_r_test.
10439 (many_sections_r_test_SOURCES): Define.
10440 (many_sections_r_test_DEPENDENCIES): Define.
10441 (many_sections_r_test_LDFLAGS): Define.
10442 (many_sections_r_test_LDADD): Define.
10443 (many_sections_r_test.o): New target.
10444 * testsuite/Makefile.in: Rebuild.
10448 * errors.cc (Errors::info): New function.
10449 (gold_info): New function.
10450 * errors.h (Errors::info): New function.
10451 * gold.h (gold_info): New function.
10452 * object.cc (Input_objects::add_object): Print trace output.
10453 * options.cc (options::parse_set): New function.
10454 (General_options::parse_wrap): Deleted.
10455 (General_options::General_options): Deleted initializer.
10456 * options.h (options::String_set): New typedef.
10457 (options::parse_set): New function.
10458 (DEFINE_set): New macro.
10459 (General_options::wrap): Changed to use DEFINE_set. Changed
10460 callers of any_wrap_symbols and is_wrap_symbol.
10461 (General_options::trace, General_options::trace_symbol):
10463 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10464 (General_options::wrap_symbols_): Deleted.
10465 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10469 * options.cc (General_options::parse_V): New function.
10470 * options.h: Add entries for -V and -Qy.
10474 * common.cc (Symbol_table::allocate_commons): Remove options
10475 parameter. Change caller.
10476 (Symbol_table::do_allocate_commons): Remove options parameter.
10477 Change caller. Just call do_allocate_commons_list twice.
10478 (Symbol_table::do_allocate_commons_list): New function, broken out
10479 of do_allocate_commons.
10480 * common.h (class Allocate_commons_task): Remove options_ field.
10481 Update constructor.
10482 * symtab.cc (Symbol_table::Symbol_table): Initialize
10484 (Symbol_table::add_from_object): Put TLS common symbols on
10486 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10487 which are IN_OUTPUT_DATA.
10488 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10489 allocate_commons and do_allocate_commons declarations. Declare
10490 do_allocate_commons_list.
10491 * gold.cc (queue_middle_tasks): Update creation of
10492 Allocate_commons_task to not pass options.
10493 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10494 (TLS_TEST_C_FLAGS): New variable.
10495 (tls_test_c_pic.o): New target.
10496 (tls_test_shared.so): Link in tls_test_c_pic.o.
10497 (tls_test_c_pic_ie.o): New target.
10498 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10499 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10500 (tls_test_c.o): New target.
10501 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10502 (tls_pic_test_LDADD): Likewise.
10503 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10504 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10505 (tls_test_c_gnu2.o): New target.
10506 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10508 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10509 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10510 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10511 * testsuite/tls_test.cc: Include "config.h".
10512 (t_last): Call t11_last.
10513 * testsuite/tls_test.h (t11, t11_last): Declare.
10514 * testsuite/tls_test_c.c: New file.
10515 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10516 * configure.ac: Check for OpenMP support.
10517 * configure, config.in, Makefile.in: Rebuild.
10518 * testsuite/Makefile.in: Rebuild.
10522 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10523 (Target_i386::tls_base_symbol_defined_): New field.
10524 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10525 (Target_i386::Scan::global): Likewise.
10526 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10527 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10528 (Target_x86_64::tls_base_symbol_defined_): New field.
10529 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10530 (Target_x86_64::Scan::global): Likewise.
10534 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10535 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10536 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10537 building shared libraries.
10538 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10539 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10540 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10541 * testsuite/Makefile.in: Rebuild.
10542 * testsuite/weak_undef.h: New file.
10543 * testsuite/weak_undef_file1.cc: Add extra test cases.
10544 * testsuite/weak_undef_file2.cc: Likewise.
10545 * testsuite/weak_undef_test.cc: Likewise.
10549 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10550 Add issued_non_pic_error_ field. Declare check_non_pic.
10551 (Target_sparc::Scan::check_non_pic): New function.
10552 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10553 (Target_sparc::Scan::global): Likewise.
10555 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10556 * configure: Rebuild.
10558 * options.h (DEFINE_enable): New macro.
10559 (new_dtags): New enable option.
10560 (initfirst, interpose, loadfltr, nodefaultlib,
10561 nodelete, nodlopen, nodump): New -z options.
10562 * layout.cc (Layout:finish_dynamic_section): If new
10563 dtags enabled, emit DT_RUNPATH. Also, emit a
10564 DT_FLAGS_1 containing any specified -z flags.
10568 * copy-relocs.cc: New file.
10569 * copy-relocs.h: New file.
10570 * reloc.cc: Remove Copy_relocs code.
10571 * reloc.h: Likewise.
10572 * reloc-types.h (struct Reloc_types) [both versions]: Add
10573 get_reloc_addend_noerror.
10574 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10575 variants of add_global which take an addend which must be zero.
10576 * i386.cc: Include "copy-relocs.h".
10577 (class Target_i386): Change type of copy_relocs_ to variable,
10578 update initializer.
10579 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10580 Change all callers.
10581 (Target_i386::do_finalize_sections): Change handling of
10583 * sparc.cc: Include "copy-relocs.h".
10584 (class Target_sparc): Change type of copy_relocs_ to variable,
10585 update initializer.
10586 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10587 Change all callers.
10588 (Target_sparc::do_finalize_sections): Change handling of
10590 * x86_64.cc: Include "copy-relocs.h".
10591 (class Target_x86_64): Change type of copy_relocs_ to variable,
10592 update initializer.
10593 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10594 class. Change all callers.
10595 (Target_x86_64::do_finalize_sections): Change handling of
10597 * Makefile.am (CCFILES): Add copy-relocs.cc.
10598 (HFILES): Add copy-relocs.h.
10600 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10602 * testsuite/script_test_4.sh: Permit leading zeroes.
10606 * script-sections.cc (Script_sections::create_segments): Use
10607 header_size_adjustment even when there is enough room for the
10609 * testsuite/script_test_4.sh: New file.
10610 * testsuite/script_test_4.t: New file.
10611 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10612 (check_DATA): Add script_test_4.stdout.
10613 (MOSTLYCLEANFILES): Likewise.
10614 (script_test_4): New target.
10615 (script_test_4.stdout): New target.
10616 * testsuite/Makefile.in: Rebuild.
10618 * sparc.cc: Add definitions for Output_data_plt_sparc class
10623 * sparc.cc: New file.
10624 * Makefile.am (TARGETSOURCES): Add sparc.cc
10625 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10626 * configure.tgt: Document targ_extra_size and
10627 targ_extra_big_endian. Add entries for sparc-* and
10629 * configure.ac: Handle targ_extra_size and
10630 targ_extra_big_endian.
10631 * Makefile.in: Rebuild.
10632 * configure: Likewise.
10633 * po/POTFILES.in: Likewise.
10634 * po/gold.pot: Likewise.
10638 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10639 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10640 in the name/type/flags to section mapping. Don't call
10641 allocate_output_section.
10642 (Layout::choose_output_section): Change parameter from adjust_name
10643 to is_input_section. Don't permit input sections after sections
10644 are attached to segments. Don't call allocate_output_section.
10645 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10646 not write_enable_output_section.
10647 (Layout::make_output_section): Don't push to
10648 unattached_section_list_ nor call attach_to_segment. Call
10649 attach_section_to_segment if sections are attached.
10650 (Layout::attach_sections_to_segments): New function.
10651 (Layout::attach_section_to_segment): New function.
10652 (Layout::attach_allocated_section_to_segment): Rename from
10653 attach_to_segment. Remove flags parameter.
10654 (Layout::allocate_output_section): Remove function.
10655 (Layout::write_enable_output_section): Remove function.
10656 * layout.h (class Layout): Update for above changes. Add new
10657 field sections_are_attached_.
10658 * output.h (Output_section::update_flags_for_input_section): New
10660 * output.cc (Output_section::add_input_section): Call
10661 update_flags_for_input_section.
10662 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10666 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10667 thought unnecessary.
10668 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10672 * output.h (class Output_section_data): Remove inline definition
10674 * output.cc (Output_section_data::set_addralign): New function.
10678 Add support for TLS descriptors for i386 and x86_64.
10679 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10680 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10681 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10683 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10684 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10685 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10687 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10688 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10689 Fix problem with initial-exec relocations.
10690 (Target_i386::Relocate::relocate_tls): Likewise.
10691 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10693 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10694 support for section-plus-offset dynamic table entries.
10695 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10696 (Output_data_dynamic::Dynamic_entry): Add support for
10697 section-plus-offset dynamic table entries.
10698 (Output_data_dynamic::Classification): Likewise.
10699 (Output_data_dynamic::classification_): Renamed offset_.
10700 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10701 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10702 (Target_x86_64::make_plt_section): New function.
10703 (Target_x86_64::reserve_tlsdesc_entries): New function.
10704 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10705 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10706 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10707 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10708 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10709 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10710 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10711 add extra PLT entry for TLS descriptors.
10712 (Output_data_plt_x86_64::got_): New field.
10713 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10714 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10716 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10718 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10719 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10720 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10721 R_386_TLS_DESC_CALL relocations.
10722 (Target_x86_64::Scan::global): Likewise.
10723 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10724 for TLS descriptors.
10725 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10726 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10727 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10728 GD-to-IE relaxation.
10729 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10730 and TLS_DESCRIPTORS.
10731 * Makefile.in: Rebuild.
10732 * configure: Rebuild.
10733 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10734 (tls_test_shared2.so): New target.
10735 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10736 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10737 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10738 (tls_shared_gd_to_ie_test_LDADD): New variable.
10739 (tls_shared_gnu2_gd_to_ie_test): New target.
10740 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10742 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10743 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10744 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10745 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10746 (tls_shared_gnu2_test): New target.
10747 (tls_test_gnu2_shared.so): New target.
10748 (tls_shared_gnu2_test_SOURCES): New variable.
10749 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10750 (tls_shared_gnu2_test_LDFLAGS): New variable.
10751 (tls_shared_gnu2_test_LDADD): New variable.
10752 * testsuite/Makefile.in: Rebuild.
10753 * testsuite/Makefile.
10757 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10759 * testsuite/Makefile.in: Rebuild.
10761 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10763 * testsuite/script_test_2.cc (main): Adjust test.
10768 * options.h (General_options): Add entries for '-Y' and
10770 * options.cc (General_options:finalize): If -Y was used, add those
10771 entries to the library path instead of the default "/lib" and
10776 * testsuite/justsyms.t: Start at 0x100.
10777 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10778 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10780 * testsuite/script_test_2.cc: Adjust string and section length
10786 * script-sections.cc (Sections_element::allocate_to_segment): Add
10788 (Output_section_definition::allocate_to_segment): Likewise.
10789 (Orphan_output_section::allocate_to_segment): Likewise.
10790 (Script_sections::attach_sections_using_phdrs_clause): Don't
10791 propagate non-PT_LOAD segments to orphan sections.
10792 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10793 readelf rather than objdump.
10794 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10795 .interp section and PT_INTERP segment are the same size.
10796 * testsuite/Makefile.in: Rebuild.
10798 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10799 aliases for symbols defined in the same object.
10800 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10801 (weak_alias_test_SOURCES): New variable.
10802 (weak_alias_test_DEPENDENCIES): New variable.
10803 (weak_alias_test_LDFLAGS): New variable.
10804 (weak_alias_test_LDADD): New variable.
10805 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10806 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10807 (weak_alias_test_3.o): New target.
10808 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10809 * testsuite/weak_alias_test_main.cc: New file.
10810 * testsuite/weak_alias_test_1.cc: New file.
10811 * testsuite/weak_alias_test_2.cc: New file.
10812 * testsuite/weak_alias_test_3.cc: New file.
10816 * options.h (class General_options): Add --noinhibit-exec option.
10817 * main.cc (main): Check --noinhibit-exec.
10819 * options.h (class General_options): Define --wrap as a special
10820 option. Add wrap_symbols_ field.
10821 (General_options::any_wrap_symbols): New function.
10822 (General_options::is_wrap_symbol): New function.
10823 * options.cc (General_options::parse_wrap): New function.
10824 (General_options::General_options): Initialize wrap_symbols_.
10825 * symtab.cc (Symbol_table::wrap_symbol): New function.
10826 (Symbol_table::add_from_object): Handle --wrap.
10827 * symtab.h (class Symbol_table): Declare wrap_symbol.
10828 * target.h (Target::wrap_char): New function.
10829 (Target::Target_info): Add wrap_char field.
10830 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10831 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10832 * testsuite/testfile.cc (Target_test::test_target_info):
10835 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10838 * layout.h (class Layout): Add added_eh_frame_data_ field.
10839 * layout.cc (Layout::Layout): Initialize new field.
10840 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10841 output section until we find a section we merged successfully.
10842 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10843 that the size be non-zero.
10845 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10850 * configure.ac: Export new conditional variable HAVE_ZLIB.
10851 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10853 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10854 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10858 * version.cc (version_string): Set to "1.5".
10860 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10861 Add issued_non_pic_error_ field. Declare check_non_pic.
10862 (Target_x86_64::Scan::check_non_pic): New function.
10863 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10864 (Target_x86_64::Scan::global): Likewise.
10866 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10867 addend parameter. Change caller. Handle merge sections.
10868 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10869 Address to Addend. Don't add in the result of
10870 local_section_offset, pass down the addend and use the returned
10872 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10873 Update declarations of local_section_offset and symbol_value.
10874 * testsuite/two_file_test_1.cc (t18): New function.
10875 * testsuite/two_file_test_2.cc (f18): New function.
10876 * testsuite/two_file_test_main.cc (main): Call t18.
10877 * testsuite/two_file_test.h (t18, f18): Declare.
10879 * configure.ac: Don't test for objdump, c++filt, or readelf.
10880 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10882 (TEST_READELF): New variable.
10883 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10884 (check_PROGRAMS): Add two_file_strip_test.
10885 (two_file_strip_test): New target.
10886 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10887 (two_file_same_shared_strip_test_SOURCES): New variable.
10888 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10889 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10890 (two_file_same_shared_strip_test_LDADD): New variable.
10891 (two_file_shared_strip.so): New target.
10892 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10893 (ver_test_5.syms, ver_test_7.syms): Likewise.
10894 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10895 (strip_test_3.stdout): Use TEST_OBJDUMP.
10896 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10900 * symtab.h (Symbol::is_weak_undefined): New function.
10901 (Symbol::is_strong_undefined): New function.
10902 (Symbol::is_absolute): New function.
10903 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10904 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10906 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10907 (weak_undef_test): New target.
10908 * testsuite/Makefile.in: Rebuild.
10909 * testsuite/weak_undef_file1.cc: New file.
10910 * testsuite/weak_undef_file2.cc: New file.
10911 * testsuite/weak_undef_test.cc: New file.
10915 * compressed_output.h (class Output_compressed_section): Use
10917 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10919 (zlib_compressed_suffix): Removed.
10920 (Output_compressed_section::set_final_data_size): Use unsigned
10922 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10923 Fix linker invocation.
10924 (flagstest_o_specialfile_and_compress_debug_sections):
10926 * testsuite/Makefile.in: Regenerated.
10930 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10931 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10939 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10940 parameters. Update for new key type to views_. Change all
10942 (File_read::read): Adjust for byteshift in returned view.
10943 (File_read::add_view): New function, broken out of
10944 find_and_make_view.
10945 (File_read::make_view): New function, broken out of
10946 find_and_make_view.
10947 (File_read::find_or_make_view): Add offset and aligned
10948 parameters. Rewrite accordingly. Change all callers.
10949 (File_read::get_view): Add offset and aligned parameters. Adjust
10950 for byteshift in return value.
10951 (File_read::get_lasting_view): Likewise.
10952 * fileread.h (class File_read): Update declarations.
10953 (class File_read::View): Add byteshift_ field. Add byteshift to
10954 constructor. Add byteshift method.
10955 * archive.h (Archive::clear_uncached_views): New function.
10956 (Archive::get_view): Add aligned parameter. Change all callers.
10957 * object.h (Object::get_view): Add aligned parameter. Change all
10959 (Object::get_lasting_view): Likewise.
10961 * fileread.cc (File_read::release): Don't call clear_views if
10962 there are multiple objects.
10963 * fileread.h (File_read::clear_uncached_views): New function.
10964 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10969 Add thin archive support.
10970 * archive.cc (Archive::armagt): New const.
10971 (Archive::setup): Remove task parameter and calls to unlock.
10972 (Archive::unlock_nested_archives): New function.
10973 (Archive::read_header): Add nested_off parameter. Change
10975 (Archive::interpret_header): Likewise.
10976 (Archive::include_all_members): Change to handle thin
10978 (Archive::include_member): Likewise.
10979 * archive.h (Archive::Archive): Add new parameters and
10981 (Archive::armagt): New const.
10982 (Archive::setup): Remove task parameter.
10983 (Archive::unlock_nested_archives): New function.
10984 (Archive::read_header): Add nested_off parameter.
10985 (Archive::interpret_header): Likewise.
10986 (Archive::Nested_archive_table): New typedef.
10987 (Archive::is_thin_archive_): New field.
10988 (Archive::nested_archives_): New field.
10989 (Archive::options_): New field.
10990 (Archive::dirpath_): New field.
10991 (Archive::task_): New field.
10992 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10993 for thin archives. Pass additional parameters to
10994 Archive::Archive. Unlock the archive file after calling
10999 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11000 version symbol to be local.
11001 * testsuite/ver_test_4.sh: New file.
11002 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11003 (check_DATA): Add ver_test_4.syms.
11004 (ver_test_4.syms): New target.
11005 * testsuite/Makefile.in: Rebuild.
11008 (Output_section::Input_section_sort_entry::has_priority): New
11010 (Output_section::Input_section_sort_entry::match_file_name): New
11012 (Output_section::Input_section_sort_entry::match_section_name):
11014 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11016 (Output_section::Input_section_sort_entry::match_section_file):
11018 (Output_section::Input_section_sort_compare::operator()): Rewrite
11019 using new Input_section_sort_entry functions. Sort crtbegin and
11020 crtend first. Sort sections with no priority before sections with
11022 * testsuite/initpri1.c (d3): Check j != 4.
11023 (cd5): New constructor/destructor function.
11024 (main): Check j != 2.
11026 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11027 new symbol when resolving, don't call set_is_default.
11028 * testsuite/ver_test_7.cc: New file.
11029 * testsuite/ver_test_7.sh: New file.
11030 * testsuite/Makefile.am (ver_test_7.so): New target.
11031 (ver_test_7.o): New target.
11032 (check_SCRIPTS): Add ver_test_7.sh.
11033 (check_DATA): Add ver_test_7.syms.
11034 (ver_test_7.syms): New target.
11038 * layout.cc (Layout::layout): If we see an input section with a
11039 name that needs sorting, set the must_sort flag for the output
11041 (Layout::make_output_section): If the name of the output section
11042 indicates that it might require sorting, set the may_sort flag.
11043 * output.h (Output_section::may_sort_attached_input_sections): New
11045 (Output_section::set_may_sort_attached_input_sections): New
11047 (Output_section::must_sort_attached_input_sections): New
11049 (Output_section::set_must_sort_attached_input_sections): New
11051 (class Output_section): Declare Input_section_sort_entry. Define
11052 Input_section_sort_compare. Declare
11053 sort_attached_input_sections. Add new fields:
11054 may_sort_attached_input_sections_,
11055 must_sort_attached_input_sections_,
11056 attached_input_sections_are_sorted_.
11057 * output.cc (Output_section::Output_section): Initialize new
11059 (Output_section::add_input_section): Add an entry to
11060 input_sections_ if may_sort or must_sort are true.
11061 (Output_section::set_final_data_size): Call
11062 sort_attached_input_sections if necessary.
11063 (Output_section::Input_section_sort_entry): Define new class.
11064 (Output_section::Input_section_sort_compare::operator()): New
11066 (Output_section::sort_attached_input_sections): New function.
11067 * configure.ac: Check whether the compiler supports constructor
11068 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11069 * testsuite/initpri1.c: New file.
11070 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11071 CONSTRUCTOR_PRIORITY.
11072 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11073 (initpri1_LDFLAGS): New variable.
11074 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11078 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11079 * testsuite/common_test_1.c: New file.
11080 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11081 (common_test_1_SOURCES): New variable.
11082 (common_test_1_DEPENDENCIES): New variable.
11083 (common_test_1_LDFLAGS): New variable.
11085 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11086 and commons_ correctly when NAME/VERSION does not override
11088 * testsuite/ver_test_6.c: New file.
11089 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11090 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11091 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11095 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11096 of an undefined symbol from a version script.
11097 * testsuite/Makefile.am (ver_test_5.so): New target.
11098 (ver_test_5.o): New target.
11099 (check_SCRIPTS): Add ver_test_5.sh.
11100 (check_DATA): Add ver_test_5.syms.
11101 (ver_test_5.syms): New target.
11102 * testsuite/ver_test_5.cc: New file.
11103 * testsuite/ver_test_5.script: New file.
11104 * testsuite/ver_test_5.sh: New file.
11105 * Makefile.in, testsuite/Makefile.in: Rebuild.
11108 Fix problems building gold with gcc 4.3.0.
11109 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11110 (gold_error_at_location, gold_warning_at_location): Use it.
11111 * configure.ac: Check whether we can compile and use a template
11112 function with a printf attribute.
11113 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11114 when jumping over bytes.
11115 * object.cc: Instantiate Object::read_section_data.
11116 * debug.h: Include <cstring>
11117 * dwarf_reader.cc: Include <algorithm>
11118 * main.cc: Include <cstring>.
11119 * options.cc: Include <cstring>.
11120 * output.cc: Include <cstring>.
11121 * script.cc: Include <cstring>.
11122 * script.h: Include <string>.
11123 * symtab.cc: Include <cstring> and <algorithm>.
11124 * target-select.cc: Include <cstring>.
11125 * version.cc: Include <string>.
11126 * testsuite/testmain.cc: Include <cstdlib>.
11127 * configure, config.in: Rebuild.
11131 * options.cc: Include "../bfd/bfdver.h".
11132 (options::help): Print bug reporting address.
11134 * version.cc (print_version): Adjust output for current value of
11135 BFD_VERSION_STRING.
11139 * options.cc (options::help): Print list of supported targets.
11140 * target-select.h: Include <vector>.
11141 (class Target_selector): Make machine_, size_, and is_big_endian_
11142 fields const. Add bfd_name_ and instantiated_target_ fields.
11143 (Target_selector::Target_selector): Add bfd_name parameter.
11144 (Target_selector::recognize): Make non-virtual, call
11146 (Target_selector::recognize_by_name): Make non-virtual, call
11147 do_recognize_by_name.
11148 (Target_selector::supported_names): New function.
11149 (Target_selector::bfd_name): New function.
11150 (Target_selector::do_instantiate_target): New pure virtual
11152 (Target_selector::do_recognize): New virtual function.
11153 (Target_selector::do_recognize_by_name): New virtual function.
11154 (Target_selector::instantiate_target): New private function.
11155 (supported_target_names): Declare.
11156 * target-select.cc (Target_selector::Target_selector): Update for
11157 new parameter and fields.
11158 (select_target_by_name): Check that the name matches before
11159 calling recognize_by_name.
11160 (supported_target_names): New function.
11161 * i386.cc (class Target_selector_i386): Update Target_selector
11162 constructor call. Remove recognize and recognize_by_name. Add
11163 do_instantiate_target.
11164 * x86_64.cc (class Target_selector_x86_64): Likewise.
11165 * testsuite/testfile.cc (class Target_selector_test): Update for
11166 changes to Target_selector.
11168 * README: Rewrite, with some notes on unsupported features.
11172 * i386.cc (Target_i386::Got_type): New enum declaration.
11173 (Target_i386::Scan::local): Updated callers of Output_data_got
11175 (Target_i386::Scan::global): Likewise.
11176 (Target_i386::Relocate::relocate): Likewise.
11177 (Target_i386::Relocate::relocate_tls): Likewise.
11178 * object.h (Got_offset_list): New class.
11179 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11180 (Sized_relobj::local_got_offset): Likewise.
11181 (Sized_relobj::set_local_got_offset): Likewise.
11182 (Sized_relobj::local_has_tls_got_offset): Removed.
11183 (Sized_relobj::local_tls_got_offset): Removed.
11184 (Sized_relobj::set_local_tls_got_offset): Removed.
11185 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11186 * output.cc (Output_data_got::add_global): Added got_type parameter.
11187 (Output_data_got::add_global_with_rel): Likewise.
11188 (Output_data_got::add_global_with_rela): Likewise.
11189 (Output_data_got::add_global_pair_with_rel): New function.
11190 (Output_data_got::add_global_pair_with_rela): New function.
11191 (Output_data_got::add_local): Added got_type parameter.
11192 (Output_data_got::add_local_with_rel): Likewise.
11193 (Output_data_got::add_local_with_rela): Likewise.
11194 (Output_data_got::add_local_pair_with_rel): New function.
11195 (Output_data_got::add_local_pair_with_rela): New function.
11196 (Output_data_got::add_global_tls): Removed.
11197 (Output_data_got::add_global_tls_with_rel): Removed.
11198 (Output_data_got::add_global_tls_with_rela): Removed.
11199 (Output_data_got::add_local_tls): Removed.
11200 (Output_data_got::add_local_tls_with_rel): Removed.
11201 (Output_data_got::add_local_tls_with_rela): Removed.
11202 * output.h (Output_data_got::add_global): Added got_type parameter.
11203 (Output_data_got::add_global_with_rel): Likewise.
11204 (Output_data_got::add_global_with_rela): Likewise.
11205 (Output_data_got::add_global_pair_with_rel): New function.
11206 (Output_data_got::add_global_pair_with_rela): New function.
11207 (Output_data_got::add_local): Added got_type parameter.
11208 (Output_data_got::add_local_with_rel): Likewise.
11209 (Output_data_got::add_local_with_rela): Likewise.
11210 (Output_data_got::add_local_pair_with_rel): New function.
11211 (Output_data_got::add_local_pair_with_rela): New function.
11212 (Output_data_got::add_global_tls): Removed.
11213 (Output_data_got::add_global_tls_with_rel): Removed.
11214 (Output_data_got::add_global_tls_with_rela): Removed.
11215 (Output_data_got::add_local_tls): Removed.
11216 (Output_data_got::add_local_tls_with_rel): Removed.
11217 (Output_data_got::add_local_tls_with_rela): Removed.
11218 * resolve.cc (Symbol::override_base_with_special): Removed
11219 reference to has_got_offset_ field.
11220 * symtab.cc (Symbol::init_fields): Replaced initialization
11221 of got_offset_ with got_offsets_. Removed initialization
11223 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11224 (Symbol::got_offset): Likewise.
11225 (Symbol::set_got_offset): Likewise.
11226 (Symbol::has_tls_got_offset): Removed.
11227 (Symbol::tls_got_offset): Removed.
11228 (Symbol::set_tls_got_offset): Removed.
11229 (Symbol::got_offset_): Removed.
11230 (Symbol::tls_mod_got_offset_): Removed.
11231 (Symbol::tls_pair_got_offset_): Removed.
11232 (Symbol::got_offsets_): New field.
11233 (Symbol::has_got_offset): Removed.
11234 (Symbol::has_tls_mod_got_offset): Removed.
11235 (Symbol::has_tls_pair_got_offset): Removed.
11236 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11237 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11239 (Target_x86_64::Scan::global): Likewise.
11240 (Target_x86_64::Relocate::relocate): Likewise.
11241 (Target_x86_64::Relocate::relocate_tls): Likewise.
11245 * yyscript.y: Fix spelling error in comment.
11249 * options.h (class General_options): Define build_id option.
11250 * layout.h (class Layout): Declare write_build_id, create_note,
11251 create_build_id. Add build_id_note_ member.
11252 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11253 "libiberty.h", "md5.h", "sha1.h".
11254 (Layout::Layout): Initialize eh_frame_data_,
11255 eh_frame_hdr_section_, and build_id_note_.
11256 (Layout::finalize): Call create_build_id.
11257 (Layout::create_note): New function, broken out of
11258 Layout::create_gold_note.
11259 (Layout::create_gold_note): Call create_note.
11260 (Layout::create_build_id): New function.
11261 (Layout::write_build_id): New function.
11262 (Close_task_runner::run): Call write_build_id.
11264 * x86_64.cc: Correct license to GPLv3.
11268 * options.cc: Include "demangle.h".
11269 (parse_optional_string): New function.
11270 (parse_long_option): Handle takes_optional_argument.
11271 (parse_short_option): Update dash_z initializer. Handle
11272 takes_optional_argument.
11273 (General_options::General_options): Initialize do_demangle_.
11274 (General_options::finalize): Set do_demangle_. Handle demangling
11276 * options.h (parse_optional_string): Declare.
11277 (struct One_option): Add optional_arg field. Update constructor.
11278 Update call constructor calls. Add takes_optional_argument
11280 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11281 (DEFINE_optional_string): Define.
11282 (General_options::demangle): Change from DEFINE_bool to
11283 DEFINE_optional_string.
11284 (General_options::no_demangle): New function.
11285 (General_options::do_demangle): New function.
11286 (General_options::set_do_demangle): New function.
11287 (General_options::execstack_status_): Move definition to end of
11289 (General_options::static_): Likewise.
11290 (General_options::do_demangle_): New field.
11291 * object.cc (big_endian>::get_symbol_location_info): Call
11292 Options::do_demangle, not Options::demangle.
11293 * symtab.cc (demangle): Likewise.
11297 * gold.h: Include <cstddef> and <sys/types.h>
11298 * options.h: Include <cstring>.
11302 * Added source code to GNU binutils.