3 * object.h (Relobj::local_symbol_value): New function.
4 (Relobj::local_plt_offset): New function.
5 (Relobj::local_has_got_offset): New function.
6 (Relobj::local_got_offset): New function.
7 (Relobj::set_local_got_offset): New function.
8 (Relobj::do_local_symbol_value): New pure virtual function.
9 (Relobj::do_local_plt_offset): Likewise.
10 (Relobj::do_local_has_got_offset): Likewise.
11 (Relobj::do_local_got_offset): Likewise.
12 (Relobj::do_set_local_got_offset): Likewise.
13 (Sized_relobj::do_local_has_got_offset): Rename from
15 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
16 (Sized_relobj::do_set_local_got_offset): Rename from
18 (Sized_relobj_file::do_local_plt_offset): Rename from
20 (Sized_relobj_file::do_local_symbol_value): New function.
21 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
23 * output.cc (Output_data_got::Got_entry::write): Change object to
24 Relobj. Use local_symbol_value.
25 (Output_data_got::add_global_with_rel): Change rel_dyn to
26 Output_data_reloc_generic*. Use add_global_generic.
27 (Output_data_got::add_global_with_rela): Remove. Change all
28 callers to use add_global_with_rel.
29 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
30 Output_data_reloc_generic*. Use add_global_generic.
31 (Output_data_got::add_global_pair_with_rela): Remove. Change all
32 callers to use add_global_pair_with_rel.
33 (Output_data_got::add_local): Change object to Relobj*.
34 (Output_data_got::add_local_plt): Likewise.
35 (Output_data_got::add_local_with_rel): Change object to Relobj*,
36 change rel_dyn to Output_data_reloc_generic*. Use
38 (Output_data_got::add_local_with_rela): Remove. Change all
39 callers to use all_local_with_rel.
40 (Output_data_got::add_local_pair_with_rel): Change object to
41 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
42 add_output_section_generic.
43 (Output_data_got::add_local_pair_with_rela): Remove. Change all
44 callers to use add_local_pair_with_rel.
45 (Output_data_got::reserve_local): Change object to Relobj*.
46 * output.h: (class Output_data_reloc_generic): Add pure virtual
47 declarations for add_global_generic, add_local_generic,
48 add_output_section_generic.
49 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
50 functions for Output_data_reloc_generic. Update declarations for
51 changes listed in output.cc.
52 (class Output_data_got): Change template parameter to got_size.
53 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
54 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
56 (Sized_relobj_incr::do_local_plt_offset): New function.
57 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
62 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
63 * resolve.cc (Symbol_table::resolve): Likewise.
64 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
66 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
70 * output.h (Output_data_reloc_generic::add): Only call
71 add_dynamic_reloc if this is a dynamic reloc section.
76 * target-reloc.h (apply_relocation): Replace <64, false> with
81 * po/it.po: New Italian translation.
85 * script.cc (script_include_directive): Implement.
86 (read_script_file): New local variables name and search_path. Update
87 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
88 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
89 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
93 * yyscript.y (section_cmd): Add support for INCLUDE directive.
94 (file_or_sections_cmd): Likewise.
98 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
99 if --just-symbols is given.
104 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
105 when processing data relocs.
106 * reloc.h (Relocate_functions::rel_unaligned): New method.
107 (Relocate_functions::pcrel_unaligned): Ditto.
108 (Relocate_functions::rel32_unaligned): Ditto.
109 (Relocate_functions::pcrel32_unaligned): Ditto.
114 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
115 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
116 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
117 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
118 (Relocate_functions::rel_unaligned): New.
119 (Relocate_functions::rel32_unaligned): New.
120 * target-reloc.h (relocate_for_relocatable): Add code to handle
121 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
122 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
123 arm_unaligned_reloc_r): New targets.
124 * testsuite/Makefile.in: Regenerate.
125 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
130 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
132 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
133 * options.cc (General_options::finalize): Use library search path
134 from configure script if specified. If not native and no sysroot,
135 only search TOOLLIBDIR.
136 * options.h (Search_directory::Search_directory): Change name to
138 (General_options::add_to_library_path_with_sysroot): Change arg to
140 * configure, Makefile.in, config.in: Rebuild.
144 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
145 we are working around the ARM1176 Erratum.
146 * options.h (General_options::fix_arm1176): Add option.
147 * testsuite/Makefile.am: Add testcases, and keep current ones
149 * testsuite/Makefile.in: Regenerate.
150 * testsuite/arm_fix_1176.s: New file.
151 * testsuite/arm_fix_1176.sh: Likewise.
155 * arm.cc (Target_arm::Target_arm): Remove initialisation of
157 (Target_arm::may_use_blx): Remove method.
158 (Target_arm::set_may_use_blx): Likewise.
159 (Target_arm::may_use_v4t_interworking): New method.
160 (Target_arm::may_use_v5t_interworking): Likewise.
161 (Target_arm::may_use_blx_): Remove member variable.
162 (Arm_relocate_functions::arm_branch_common): Check for v5T
164 (Arm_relocate_functions::thumb_branch_common): Likewise.
165 (Reloc_stub::stub_type_for_reloc): Likewise.
166 (Target_arm::do_finalize_sections): Correct interworking checks.
167 * testsuite/Makefile.am: Add new tests.
168 * testsuite/Makefile.in: Regenerate.
169 * testsuite/arm_farcall_arm_arm.s: New test.
170 * testsuite/arm_farcall_arm_arm.sh: Likewise.
171 * testsuite/arm_farcall_arm_thumb.s: Likewise.
172 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
173 * testsuite/arm_farcall_thumb_arm.s: Likewise.
174 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
175 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
176 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
181 * expression.cc (Expression::eval_with_dot): Add
182 is_section_dot_assignment parameter.
183 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
184 absolute and assigning to dot within a section.
186 (Output_section_element_assignment::set_section_addresses): Pass
187 dot_section to set_if_absolute.
188 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
189 as is_section_dot_assignment flag to eval_with_dot.
190 (Output_section_element_dot_assignment::set_section_addresses):
192 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
193 parameter. Also set value if relative to dot_section; set the
194 symbol's output_section.
195 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
196 parameter. Adjust all callers.
197 (Expression::eval_maybe_dot): Likewise.
198 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
200 * testsuite/script_test_2.t: Test assignment of an absolute value
201 to dot within an output section element.
205 * options.h (class General_options): Add --[no-]gnu-unique options.
206 * symtab.cc (Symbol_table::sized_write_globals): Convert
207 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
212 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
213 unnecessary assertion.
214 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
218 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
220 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
222 Change to just keep the section associated with symbol.
223 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
224 they are externally visible and --export-dynamic is turned on.
225 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
231 (Output_section_element_dot_assignment::needs_output_section): New
237 * layout.cc (Layout::segment_precedes): Don't assert failure if a
238 --section-start option was seen.
239 * options.h (General_options::any_section_start): New function.
244 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
245 member to track relocation locations that have moved during TLS
247 (Target_sparc::Relocate::Relocate): Initialize to NULL.
248 (Target_sparc::Relocate::relocate): Adjust view down by 4
249 bytes if it matches reloc_adjust_addr_.
250 (Target_sparc::Relocate::relocate_tls): Always move the
251 __tls_get_addr call delay slot instruction forward 4 bytes when
252 performing relaxation.
256 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
257 (Output_file::map_no_anonymous): Check for non-zero
258 return code from posix_fallocate.
263 * plugin.cc (is_visible_from_outside): Check for symbols
264 referenced from dynamic objects.
265 * resolve.cc (Symbol_table::resolve): Don't count references
266 from dynamic objects as references from real ELF files.
267 * testsuite/plugin_test_2.sh: Adjust expected result.
271 * gold.cc: Include timer.h.
272 (queue_middle_tasks): Stamp time.
273 (queue_final_tasks): Likewise.
274 * main.cc (main): Store timer in parameters. Print timers
276 * parameters.cc (Parameters::Parameters): Initialize timer_.
277 (Parameters::set_timer): New function.
278 (set_parameters_timer): New function.
279 * parameters.h (Parameters::set_timer): New function.
280 (Parameters::timer): New function.
281 (Parameters::timer_): New data member.
282 (set_parameters_timer): New function.
283 * timer.cc (Timer::stamp): New function.
284 (Timer::get_pass_time): New function.
285 * timer.h (Timer::stamp): New function.
286 (Timer::get_pass_time): New function.
287 (Timer::pass_times_): New data member.
291 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
292 task for members of lib groups.
297 * fileread.cc (File_read::find_view): Add assert.
298 (File_read::make_view): Move bounds check (replace with assert)...
299 (File_read::find_or_make_view): ... to here.
303 * output.cc (Output_file::open_base_file): Handle case where
304 ::read returns less than requested size.
308 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
309 Initialize defined_count_.
310 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
311 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
312 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
313 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
314 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
315 * incremental.h (Sized_relobj_incr::defined_count_): New data
317 (Sized_incr_dynobj::defined_count_): New data member.
318 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
319 Return zeroes instead of internal error.
324 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
325 (Output_reloc::symbol_value): Return PLT offset if flag is set.
326 * output.h (class Output_reloc): Add use_plt_offset flag.
327 (Output_reloc::type_): Adjust size of bit field.
328 (Output_reloc::use_plt_offset_): New bit field.
329 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
330 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
331 flag. Adjust all callers.
332 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
333 creating RELATIVE relocations.
337 * po/es.po: Updated Spanish translation.
338 * po/fi.po: Updated Finnish translation.
342 * options.cc (parse_uint): Fix dereference of RETVAL.
346 * layout.h (section_order_map_): New member.
347 (get_section_order_map): New member function.
348 * output.cc (Output_section::add_input_section): Check for patterns
349 only when --section-ordering-file is specified.
350 * gold.cc (queue_middle_tasks): Delay updating order of sections till
351 output_sections have been formed.
352 * layout.cc (Layout_Layout): Initialize section_order_map_.
353 * plugin.cc (update_section_order): Store order in order_map. Do not
355 * testsuite/Makefile.am: Add test case for plugin_final_layout.
356 * testsuite/Makefile.in: Regenerate.
357 * testsuite/plugin_section_order.c: New file.
358 * testsuite/plugin_final_layout.cc: New file.
359 * testsuite/plugin_final_layout.sh: New file.
363 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
365 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
366 symbols during incremental update.
367 (Symbol_table::add_from_dynobj): Likewise.
372 * symtab.cc (Symbol_table::define_special_symbol): Always
373 canonicalize version string.
377 * gold.cc (queue_initial_tasks): Move option checks ...
378 * options.cc (General_options::finalize): ... to here. Disable
379 some options; make others fatal.
384 * plugin.cc (get_symbols_v2): New function.
385 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
386 (is_referenced_from_outside): New function.
387 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
388 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
389 (get_symbols): Pass version parameter.
390 (get_symbols_v2): New function.
391 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
393 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
394 (onload): Add LDPT_GET_SYMBOLS_V2.
395 (all_symbols_read_hook): Use get_symbols_v2; check for
396 LDPR_PREVAILING_DEF_IRONLY_EXP.
397 * testsuite/plugin_test_3.sh: Update expected results.
401 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
402 configuration options.
403 * configure: Regenerate.
404 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
405 * Makefile.in: Regenerate.
406 * testsuite/Makefile.in: Regenerate.
410 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
414 * incremental.cc (can_incremental_update): Fix typo in comment.
415 * incremental.h (can_incremental_update): Likewise.
419 * incremental.cc (can_incremental_update): New function.
420 * incremental.h (can_incremental_update): New function.
421 * layout.cc (Layout::init_fixed_output_section): Call it.
422 (Layout::make_output_section): Don't allow patch space in .eh_frame.
423 * object.cc (Sized_relobj_file::do_layout): Call
424 can_incremental_update.
428 * configure.ac: Check for glibc support for gnu_indirect_function
429 support with static linking, setting automake conditional
431 * Makefile.in: Regenerate.
432 * configure: Regenerate.
434 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
435 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
437 * testsuite/Makefile.in: Regenerate.
441 * incremental.cc (Sized_relobj_incr::do_layout): Call
442 report_comdat_group for kept comdat sections.
443 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
444 * testsuite/Makefile.in: Regenerate.
445 * testsuite/incr_comdat_test_1.cc: New source file.
446 * testsuite/incr_comdat_test_2_v1.cc: New source file.
447 * testsuite/incr_comdat_test_2_v2.cc: New source file.
448 * testsuite/incr_comdat_test_2_v3.cc: New source file.
452 * object.cc (Sized_relobj_file::do_layout): Remove unused local
453 variable external_symbols_offset.
457 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
458 triggered if object has no symbols.
462 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
463 (Output_fill_debug_line::do_write): Likewise.
467 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
468 casts to match formatting specs.
469 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
473 * layout.cc (Free_list::allocate): Provide guarantee of minimum
474 remaining hole size when allocating.
475 (Layout::make_output_section): Set fill methods for debug sections.
476 * layout.h (Free_list::Free_list_node): Move from private to
478 (Free_list::set_min_hole_size): New function.
479 (Free_list::begin, Free_list::end): New functions.
480 (Free_list::min_hole_): New data member.
481 * output.cc: Include dwarf.h.
482 (Output_fill_debug_info::do_minimum_hole_size): New function.
483 (Output_fill_debug_info::do_write): New function.
484 (Output_fill_debug_line::do_minimum_hole_size): New function.
485 (Output_fill_debug_line::do_write): New function.
486 (Output_section::Output_section): Initialize new data member.
487 (Output_section::set_final_data_size): Ensure patch space is larger
488 than minimum hole size.
489 (Output_section::do_write): Fill holes in debug sections.
490 * output.h (Output_fill): New class.
491 (Output_fill_debug_info): New class.
492 (Output_fill_debug_line): New class.
493 (Output_section::set_free_space_fill): New function.
494 (Output_section::free_space_fill_): New data member.
495 * testsuite/Makefile.am (incremental_test_3): Add
496 --incremental-patch option.
497 (incremental_test_4): Likewise.
498 (incremental_test_5): Likewise.
499 (incremental_test_6): Likewise.
500 (incremental_copy_test): Likewise.
501 (incremental_common_test_1): Likewise.
502 * testsuite/Makefile.in: Regenerate.
506 * po/es.po: Updated Spanish translation.
510 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
511 * gold/testsuite/Makefile.in: Regenerate.
512 * gold/testsuite/justsyms_exec.c: New source file.
513 * gold/testsuite/justsyms_lib.c: New source file.
517 * layout.cc (Layout::set_segment_offsets): Don't realign text
518 segment if -Ttext was specified.
519 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
521 * object.h (Sized_relobj_file::e_type): New function.
522 (Sized_relobj_file::e_type_): New data member.
523 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
524 base address for ET_EXEC files.
525 * target.cc (Target::do_make_elf_object_implementation): Allow
526 ET_EXEC files with --just-symbols option.
530 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
531 Add thread_number parameter.
532 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
533 * workqueue-threads.cc
534 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
535 current thread if its thread number is greater than desired thread
537 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
538 Add thread_number parameter.
539 (Workqueue::should_cancel_thread): Likewise.
540 (Workqueue::find_runnable_or_wait): Pass thread_number to
541 should_cancel_thread.
542 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
547 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
548 only after checking if it cannot be forced local.
549 * symtab.h (is_externally_visible): Check if the symbol is not forced
554 * options.h (class General_options): Add --print-output-format.
555 Move -EL next to -EB, for better --help output.
556 * target-select.cc: Include <cstdio>, "options.h", and
558 (Target_selector::do_target_bfd_name): New function.
559 (print_output_format): New function.
560 * target-select.h (class Target_selector): Update declarations.
561 (Target_selector::target_bfd_name): New function.
562 (print_output_format): Declare.
563 * main.cc: Include "target-select.h".
564 (main): Handle --print-output-format.
565 * gold.cc: Include "target-select.h".
566 (queue_initial_tasks): Handle --print-output-format when there are
568 * parameters.cc (parameters_force_valid_target): Give a better
569 error message if -EB/-EL does not match target.
570 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
575 * i386.cc (class Output_data_plt_i386): Add layout_ field.
576 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
577 (Output_data_plt_i386::do_write): Write address of .dynamic
578 section to first entry in .got.plt section.
579 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
580 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
582 (Output_data_plt_x86_64::do_write): Write address of .dynamic
583 section to first entry in .got.plt section.
584 * layout.h (Layout::dynamic_section): New function.
588 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
590 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
591 input_section_position_, and input_section_glob_.
592 (read_layout_from_file): Call function section_ordering_specified.
593 * layout.h (is_section_ordering_specified): New function.
594 (section_ordering_specified): New function.
595 (section_ordering_specified_): New boolean member.
596 * main.cc(main): Call load_plugins after layout object is defined.
597 * output.cc (Output_section::add_input_section): Use
598 function section_ordering_specified to check if section ordering is
600 * output.cc (Output_section::add_relaxed_input_section): Use
601 function section_ordering_specified to check if section ordering is
603 (Output_section::update_section_layout): New function.
604 (Output_section::sort_attached_input_sections): Check if input section
606 * output.h (Output_section::update_section_layout): New function.
607 * plugin.cc (get_section_count): New function.
608 (get_section_type): New function.
609 (get_section_name): New function.
610 (get_section_contents): New function.
611 (update_section_order): New function.
612 (allow_section_ordering): New function.
613 (Plugin::load): Add the new interfaces to the transfer vector.
614 (Plugin_manager::load_plugins): New parameter.
615 (Plugin_manager::all_symbols_read): New parameter.
616 (Plugin_manager::claim_file): New parameter. Save the elf object for
618 (Plugin_manager::get_elf_object): New function.
619 (Plugin_manager::get_view): Change to directly use the bool to check
620 if get_view is called from claim_file_hook.
621 * plugin.h (input_objects): New function
622 (Plugin__manager::load_plugins): New parameter.
623 (Plugin_manager::claim_file): New parameter.
624 (Plugin_manager::get_elf_object): New function.
625 (Plugin_manager::in_claim_file_handler): New function.
626 (Plugin_manager::in_claim_file_handler_): New member.
627 (layout): New function.
628 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
629 handler with an extra parameter. Make the elf object before calling
631 * testsuite/plugin_test.c (get_section_count): New function pointer.
632 (get_section_type): New function pointer.
633 (get_section_name): New function pointer.
634 (get_section_contents): New function pointer.
635 (update_section_order): New function pointer.
636 (allow_section_ordering): New function pointer.
637 (onload): Check if the new interfaces exist.
641 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
643 * x86_64.cc (Target_x86_64::got_section): Likewise.
644 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
645 (relro_now_test_SOURCES): New variable.
646 (relro_now_test_DEPENDENCIES): New variable.
647 (relro_now_test_LDFLAGS): New variable.
648 (relro_now_test_LDADD): New variable.
649 (relro_now_test.so): New target.
650 * testsuite/Makefile.in: Rebuild.
655 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
656 GLOB_DAT relocation rather than a RELATIVE relocation for a
657 protected symbol when creating a shared library.
658 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
659 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
660 * testsuite/protected_main_1.cc (main): Test that protected
661 function has same address.
666 * options.h (class General_options): Add -Bgroup.
667 * options.cc (General_options::finalize): If -Bgroup is set,
668 default to --unresolved-symbols=report-all.
669 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
670 * target-reloc.h (issue_undefined_symbol_error): Handle
671 --unresolved-symbols=report-all.
676 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
677 if linker script discards key sections.
678 (Layout::create_dynamic_symtab): Likewise.
679 (Layout::assign_local_dynsym_offsets): Likewise.
680 (Layout::sized_create_version_sections): Likewise.
681 (Layout::create_interp): Likewise.
682 (Layout::finish_dynamic_section): Likewise.
683 (Layout::set_dynamic_symbol_size): Likewise.
688 * options.h (class General_options): Add --unresolved-symbols.
689 * target-reloc.h (issue_undefined_symbol_error): Check
690 --unresolved-symbols. Add comments.
694 * testsuite/odr_violation2.cc (Ordering::operator()): Make
695 expression more complex.
700 * target-reloc.h (issue_undefined_symbol_error): New inline
701 function, broken out of relocate_section.
702 (relocate_section): Call issue_undefined_symbol_error.
703 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
704 there is no TLS segment if we are about to issue an undefined
706 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
711 * resolve.cc (Symbol_table::should_override): Add fromtype
712 parameter. Change all callers. Give error when linking together
713 TLS and non-TLS symbol.
714 (Symbol_table::should_override_with_special): Add fromtype
715 parameter. Change all callers.
716 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
717 there is no TLS segment if we have reported some errors.
718 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
723 * target.h (Target::plt_address_for_global): New function.
724 (Target::plt_address_for_local): New function.
725 (Target::plt_section_for_global): Remove.
726 (Target::plt_section_for_local): Remove.
727 (Target::do_plt_address_for_global): New virtual function.
728 (Target::do_plt_address_for_local): New virtual function.
729 (Target::do_plt_section_for_global): Remove.
730 (Target::do_plt_section_for_local): Remove.
731 (Target::register_global_plt_entry): Add Symbol_table and Layout
733 * output.cc (Output_data_got::Got_entry::write): Use
734 plt_address_for_global and plt_address_for_local.
735 * layout.cc (Layout::add_target_dynamic_tags): Use size and
736 address of output section.
737 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
738 got_irelative_, and irelative_count_ fields. Update
740 (Output_data_plt_i386::has_irelative_section): New function.
741 (Output_data_plt_i386::entry_count): Add irelative_count_.
742 (Output_data_plt_i386::set_final_data_size): Likewise.
743 (class Target_i386): Add got_irelative_ and rel_irelative_
744 fields. Update declarations.
745 (Target_i386::Target_i386): Initialize new fields.
746 (Target_i386::do_plt_address_for_global): New function replacing
747 do_plt_section_for_global.
748 (Target_i386::do_plt_address_for_local): New function replacing
749 do_plt_section_for_local.
750 (Target_i386::got_section): Create got_irelative_.
751 (Target_i386::rel_irelative_section): New function.
752 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
753 fields. Don't define __rel_iplt_{start,end}.
754 (Output_data_plt_i386::add_entry): Add symtab and layout
755 parameters. Change all callers. Use different PLT and GOT for
757 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
758 layout parameters. Change all callers. Use different PLT and
760 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
761 (Output_data_plt_i386::rel_irelative): New function.
762 (Output_data_plt_i386::address_for_global): New function.
763 (Output_data_plt_i386::address_for_local): New function.
764 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
765 IRELATIVE GOT when changing IFUNC GOT entries.
766 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
768 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
769 if we didn't create an IRELATIVE GOT.
770 (Target_i386::Relocate::relocate): Use plt_address_for_global and
771 plt_address_for_local.
772 (Target_i386::do_dynsym_value): Use plt_address_for_global.
773 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
774 got_irelative_, and irelative_count_ fields. Update
776 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
777 Initialize new fields. Remove symtab parameter. Change all
779 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
781 (Output_data_plt_x86_64::has_irelative_section): New function.
782 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
783 (class Target_x86_64): Add got_irelative_ and rel_irelative_
784 fields. Update declarations.
785 (Target_x86_64::Target_x86_64): Initialize new fields.
786 (Target_x86_64::do_plt_address_for_global): New function replacing
787 do_plt_section_for_global.
788 (Target_x86_64::do_plt_address_for_local): New function replacing
789 do_plt_section_for_local.
790 (Target_x86_64::got_section): Create got_irelative_.
791 (Target_x86_64::rela_irelative_section): New function.
792 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
793 all callers. Don't create __rel_iplt_{start,end}.
794 (Output_data_plt_x86_64::add_entry): Add symtab and layout
795 parameters. Change all callers. Use different PLT and GOT for
797 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
798 layout parameters. Change all callers. Use different PLT and
800 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
801 parameters. Change all callers. Use different PLT and GOT for
803 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
804 (Output_data_plt_x86_64::rela_irelative): New function.
805 (Output_data_plt_x86_64::address_for_global): New function.
806 (Output_data_plt_x86_64::address_for_local): New function.
807 (Output_data_plt_x86_64::set_final_data_size): Likewise.
808 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
809 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
810 (Target_x86_64::register_global_plt_entry): Add symtab and layout
812 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
814 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
815 symbols if we didn't create an IRELATIVE GOT.
816 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
817 plt_address_for_local.
818 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
819 * testsuite/ifuncvar1.c: New test file.
820 * testsuite/ifuncvar2.c: New test file.
821 * testsuite/ifuncvar3.c: New test file.
822 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
823 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
824 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
825 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
826 * testsuite/Makefile.in: Rebuild.
830 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
831 (two_file_test_1_ndebug.o): Likewise.
832 (two_file_test_1b_ndebug.o): Likewise.
833 (two_file_test_2_ndebug.o): Likewise.
834 (two_file_test_main_ndebug.o): Likewise.
835 (incremental_test_2): Link with no-debug versions.
839 * gold/incremental.cc
840 (Output_section_incremental_inputs::write_info_blocks): Check for
841 hidden and internal symbols.
845 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
846 Check disposition for startup file.
847 (Incremental_inputs::report_command_line): Ignore
848 --incremental-startup-unchanged option.
849 * options.cc (General_options::parse_incremental_startup_unchanged):
851 (General_options::General_options): Initialize new data member.
852 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
853 (General_options): Add --incremental-startup-unchanged option.
854 (General_options::incremental_startup_disposition): New function.
855 (General_options::incremental_startup_disposition_): New data member.
859 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
860 input file index to Script_info ctor.
861 (Sized_incremental_binary::do_file_has_changed): Find the
862 command-line argument for files named in scripts.
863 * incremental.h (Script_info::Script_info): New ctor
864 with input file index.
865 (Script_info::input_file_index): New function.
866 (Script_info::input_file_index_): New data member.
867 (Incremental_binary::get_library): Add const.
868 (Incremental_binary::get_script_info): Add const.
869 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
870 * testsuite/Makefile.am (incremental_test_5): New test case.
871 (incremental_test_6): New test case.
872 * testsuite/Makefile.in: Regenerate.
876 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
877 debug output when command lines differ.
881 * incremental.cc (Incremental_inputs::report_command_line): Ignore
882 --incremental-patch option.
883 * layout.cc (Free_list::allocate): Extend allocation beyond original
885 (Layout::make_output_section): Mark sections that should get
887 * options.cc (parse_percent): New function.
888 * options.h (parse_percent): New function.
889 (DEFINE_percent): New macro.
890 (General_options): Add --incremental-patch option.
891 * output.cc (Output_section::Output_section): Initialize new data
893 (Output_section::add_input_section): Print section name when out
895 (Output_section::add_output_section_data): Likewise.
896 (Output_section::set_final_data_size): Add patch space when
897 doing --incremental-full.
898 (Output_section::do_reset_address_and_file_offset): Remove patch
900 (Output_segment::set_section_list_addresses): Print debug output
901 only if --incremental-update.
902 * output.h (Output_section::set_is_patch_space_allowed): New function.
903 (Output_section::is_patch_space_allowed_): New data member.
904 (Output_section::patch_space_): New data member.
905 * parameters.cc (Parameters::incremental_full): New function.
906 * parameters.h (Parameters::incremental_full): New function
907 * testsuite/Makefile.am (incremental_test_2): Add test for
908 --incremental-patch option.
909 * testsuite/Makefile.in: Regenerate.
910 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
911 (t18): Remove function body.
916 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
917 Arm_Address type for relocation result.
918 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
920 (Arm_relocate_functions::abs32): Use unaligned access.
921 (Arm_relocate_functions::rel32): Ditto.
922 (Arm_relocate_functions::prel31): Ditto.
923 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
924 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
925 static data relocations.
926 * testsuite/Makefile.in: Regnerate.
927 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
932 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
933 symbols if necessary.
934 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
939 * resolve.cc (Symbol::override_base_with_special): Simply override
940 version with special symbol version, ignoring previous version.
944 * object.cc (Sized_relobj_file::include_section_group): Add
945 information to comment about signature location.
950 * options.h (class General_options): Add -f and -F.
951 * options.cc (General_options::finalize): Fatal error if -f/-F
952 are used without -shared.
953 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
957 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
963 * resolve.cc (Symbol::override_base_with_special): Don't override
964 the version if the overriding symbol has a different name.
965 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
966 all callers. If we give an error about an undefined version,
967 define the base version if necessary.
968 * dynobj.h (class Versions): Update declaration.
969 * testsuite/weak_alias_test_5.cc: New file.
970 * testsuite/weak_alias_test.script: New file.
971 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
972 and versioned_alias have the right value, and call t2.
973 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
974 weak_alias_test_5.so.
975 (weak_alias_test_LDADD): Likewise.
976 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
977 * testsuite/Makefile.in: Rebuild.
982 * options.h (class General_options): Support -z notext.
983 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
985 (two_file_shared_nonpic.so): Likewise.
986 (two_file_shared_mixed.so): Likewise.
987 (two_file_shared_mixed_1.so): Likewise.
988 (weak_undef_lib_nonpic.so): Likewise.
989 (alt/weak_undef_lib_nonpic.so): Likewise.
990 (tls_test_shared_nonpic.so): Likewise.
991 * testsuite/Makefile.in: Rebuild.
996 * configure.ac: Test whether static linking works, setting
997 the automake conditional HAVE_STATIC.
998 * testsuite/Makefile.am: Disable tests using -static if
999 HAVE_STATIC is not true.
1000 * configure, testsuite/Makefile.in: Rebuild.
1005 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1006 Assert if we see DW_EH_PE_indirect.
1007 * target.h (Target::ehframe_datarel_base): New function.
1008 (Target::do_ehframe_datarel_base): New target function.
1009 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1010 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1016 * options.h (class General_options): Add
1017 --ld-generated-unwind-info.
1018 * ehframe.cc (Fde::write): Add address parameter. Change all
1019 callers. If associated with PLT, fill in address and size.
1020 (Cie::set_output_offset): Only add merge mapping if there is an
1022 (Cie::write): Add address parameter. Change all callers.
1023 (Eh_frame::add_ehframe_for_plt): New function.
1024 * ehframe.h (class Fde): Update declarations. Move shndx_ and
1025 input_offset_ fields into union u_, with new plt field.
1026 (Fde::Fde): Adjust for new union field.
1027 (Fde::Fde) [Output_data version]: New constructor.
1028 (Fde::add_mapping): Only add merge mapping if there is an object.
1029 (class Cie): Update declarations.
1030 (class Eh_frame): Declare add_ehframe_for_plt.
1031 * layout.cc (Layout::layout_eh_frame): Break out code into
1032 make_eh_frame_section, and call it.
1033 (Layout::make_eh_frame_section): New function.
1034 (Layout::add_eh_frame_for_plt): New function.
1035 * layout.h (class Layout): Update declarations.
1036 * merge.cc (Merge_map::add_mapping): Add assertion.
1037 * i386.cc: Include "dwarf.h".
1038 (class Output_data_plt_i386): Make first_plt_entry,
1039 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
1040 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1041 and plt_eh_frame_fde.
1042 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1043 boundary. Call add_eh_frame_for_plt if appropriate.
1044 * x86_64.cc: Include "dwarf.h".
1045 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
1046 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
1047 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1048 and plt_eh_frame_fde.
1049 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1055 * object.cc (Sized_relobj_file::layout_section): Change shdr
1056 parameter to be const.
1057 (Sized_relobj_file::layout_eh_frame_section): New function, broken
1059 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1060 appropriate. Call layout_eh_frame_section.
1061 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1063 * object.h (class Sized_relobj_file): Update declarations.
1068 * script.cc (Token::integer_value): Accept trailing M/m/K/k
1070 (Lex::gather_token): Accept trailing M/m/K/k for integers.
1075 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1077 * layout.cc (Layout::layout_eh_frame): Likewise.
1082 * layout.cc (Layout::symtab_section_shndx): New function.
1083 * layout.h (class Layout): Declare symtab_section_shndx.
1084 * output.cc (Output_section::write_header): Call it.
1089 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1090 symbols which are not used in a relocation.
1095 * layout.cc (Layout::segment_precedes): Don't crash if a linker
1096 script create indistinguishable segments.
1097 (Layout::set_segment_offsets): Use stable_sort when sorting
1098 segments. Pass this to Compare_segments constructor.
1099 * layout.h (class Layout): Make segment_precedes non-static.
1100 (class Compare_segments): Change from struct to class. Add
1101 layout_ field. Add constructor.
1102 * script-sections.cc
1103 (Script_sections::attach_sections_using_phdrs_clause): Rename
1104 local orphan to is_orphan. Don't report failure to put empty
1105 section in segment. On attachment failure, report name of
1106 section, and attach to first PT_LOAD segment.
1111 * target-select.cc (Target_selector::Target_selector): Add
1112 emulation parameter. Change all callers.
1113 (select_target_by_bfd_name): Rename from select_target_by_name.
1115 (select_target_by_emulation): New function.
1116 (supported_emulation_names): New function.
1117 * target-select.h (class Target_selector): Add emulation_ field.
1118 Update declarations.
1119 (Target_selector::recognize_by_bfd_name): Rename from
1120 recognize_by_name. Change all callers.
1121 (Target_selector::supported_bfd_names): Rename from
1122 supported_names. Change all callers.
1123 (Target_selector::recognize_by_emulation): New function.
1124 (Target_selector::supported_emulations): New function.
1125 (Target_selector::emulation): New function.
1126 (Target_selector::do_recognize_by_bfd_name): Rename from
1127 do_recognize_by_name. Change all callers.
1128 (Target_selector::do_supported_bfd_names): Rename from
1129 do_supported_names. Change all callers.
1130 (Target_selector::do_recognize_by_emulation): New function.
1131 (Target_selector::do_supported_emulations): New function.
1132 (select_target_by_bfd_name): Change name in declaration.
1133 (select_target_by_emulation): Declare.
1134 (supported_emulation_names): Declare.
1135 * parameters.cc (parameters_force_valid_target): Try to find
1136 target based on emulation from -m option.
1137 * options.h (class General_options): Change doc string for -m.
1138 * options.cc (help): Print emulations.
1139 (General_options::parse_V): Likewise.
1140 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1141 Add emulation parameter. Change all callers.
1145 * target.h (class Target): Add osabi_ field.
1146 (Target::osabi): New function.
1147 (Target::set_osabi): New function.
1148 (Target::Target): Initialize osabi_.
1149 (Target::do_adjust_elf_header): Make pure virtual.
1150 (Sized_target::do_adjust_elf_header): Declare.
1151 * target.cc (Sized_target::do_adjust_elf_header): New function.
1152 (class Sized_target): Instantiate all versions.
1153 * freebsd.h (class Target_freebsd): Remove.
1154 (Target_selector_freebsd::do_recognize): Call set_osabi on
1156 (Target_selector_freebsd::do_recognize_by_name): Likewise.
1157 (Target_selector_freebsd::set_osabi): Remove.
1158 * i386.cc (class Target_i386): Inherit from Sized_target rather
1159 than Target_freebsd.
1160 * x86_64.cc (class Target_x86_64): Likewise.
1164 * target.h (Target::can_check_for_function_pointers): Rewrite.
1166 (Target::can_icf_inline_merge_sections): Likewise.
1167 (Target::section_may_have_icf_unsafe_poineters): Likewise.
1168 (Target::Target_info): Add can_icf_inline_merge_sections field.
1169 (Target::do_can_check_for_function_pointers): New virtual
1171 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1172 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1173 from can_check_for_function_pointers, move in file.
1174 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1175 section_may_have_icf_unsafe_poineters, move in file.
1176 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1177 * i386.cc (Target_i386::do_can_check_for_function_pointers):
1178 Rename from can_check_for_function_pointers, move in file.
1179 (Target_i386::can_icf_inline_merge_sections): Remove.
1180 (Target_i386::i386_info): Initialize
1181 can_icf_inline_merge_sections.
1182 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1183 Initialize can_icf_inline_merge_sections.
1184 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1185 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1186 Rename from can_check_for_function_pointers, move in file.
1187 (Target_x86_64::can_icf_inline_merge_sections): Remove.
1188 (Target_x86_64::x86_64_info): Initialize
1189 can_icf_inline_merge_sections.
1190 * testsuite/testfile.cc (Target_test::test_target_info):
1192 * icf.cc (get_section_contents): Correct formatting.
1196 * symtab.cc (Symbol::versioned_name): New function.
1197 (Symbol_table::add_to_final_symtab): Use versioned_name when
1199 (Symbol_table::sized_write_symbol): Likewise.
1200 * symtab.h (class Symbol): Declare versioned_name.
1201 * stringpool.h (class Stringpool_template): Add variant of add
1202 which takes a std::basic_string.
1203 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1204 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1205 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1206 (ver_test_12.o): New target.
1207 * testsuite/Makefile.in: Rebuild.
1211 * arm.cc (Arm_relocate_functions::thm_jump8,
1212 Arm_relocate_functions::thm_jump11): Use a wider signed
1213 type to compute offset.
1214 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1216 * testsuite/Makefile.in: Regenerate.
1217 * testsuite/arm_branch_in_range.sh: Check test results of
1218 arm_thm_jump11 and arm_thm_jump8.
1219 * testsuite/arm_thm_jump11.s: New test source file.
1220 * testsuite/arm_thm_jump11.t: New linker script.
1221 * testsuite/arm_thm_jump8.s: New test source file.
1222 * testsuite/arm_thm_jump8.t: New linker script.
1226 * layout.cc: Include "object.h".
1227 (ctors_sections_in_init_array): New static variable.
1228 (Layout::is_ctors_in_init_array): New function.
1229 (Layout::layout): Add entry to ctors_sections_in_init_array if
1231 * layout.h (class Layout): Declare is_ctors_in_init_array.
1232 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1233 is_ctors_reverse_view is set.
1234 (Sized_relobj_file::write_sections): Add layout parameter. Change
1235 all callers. Set is_ctors_reverse_view field of View_size.
1236 (Sized_relobj_file::reverse_words): New function.
1237 * object.h (Sized_relobj_file::View_size): Add
1238 is_ctors_reverse_view field.
1239 (class Sized_relobj_file): Update declarations.
1240 * testsuite/initpri3.c: New test.
1241 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1243 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1244 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1245 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1246 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1247 * testsuite/Makefile.in: Rebuild.
1251 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1252 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1253 (debug_msg_cdebug.err): New targets.
1254 * testsuite/Makefile.in: Regenerate.
1255 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1256 Fix checks for link with shared library.
1260 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1261 skip empty text sections.
1262 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1267 * options.h (class General_options): Add --ctors-in-init-array.
1268 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1269 friends as SHT_PROGBITS for merging sections.
1270 (Layout::layout): Remove special handling of .init_array and
1271 friends. Don't sort if doing relocatable link. Sort for .ctors
1272 and .dtors if ctors_in_init_array.
1273 (Layout::make_output_section): Force correct section types for
1274 .init_array and friends. Don't sort if doing relocatable link,
1275 Don't sort .ctors and .dtors if ctors_in_init_array.
1276 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1277 (Layout::output_section_name): Add relobj parameter. Change all
1278 callers. Handle .ctors. and .dtors. in code rather than table.
1279 Handle .ctors and .dtors if ctors_in_init_array.
1280 (Layout::match_file_name): New function, moved from output.cc.
1281 * layout.h (class Layout): Update declarations.
1282 * output.cc: Include "layout.h".
1283 (Input_section_sort_entry::get_priority): New function.
1284 (Input_section_sort_entry::match_file_name): Just call
1285 Layout::match_file_name.
1286 (Output_section::Input_section_sort_init_fini_compare::operator()):
1287 Handle .ctors and .dtors. Sort by explicit priority rather than
1289 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1290 * testsuite/initpri2.c: New test.
1291 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1292 (check_PROGRAMS): Add initpri2.
1293 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1294 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1295 * configure, testsuite/Makefile.in: Rebuild.
1300 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1301 .interp section to a PT_INTERP segment even if we have seen a
1302 --dynamic-linker option. Don't do it if we have seen a PHDRS
1303 clause in a linker script.
1304 (Layout::finalize): Don't create a .interp section if we've
1305 already create a PT_INTERP segment.
1306 (Layout::create_interp): Always call choose_output_section (revert
1307 patch of 2011-06-17). Don't create PT_INTERP segment.
1308 * script-sections.cc
1309 (Script_sections::create_note_and_tls_segments): Add a .interp
1310 section to a PT_INTERP segment even if we have seen a
1311 --dynamic-linker option.
1315 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1316 merely because a non-PT_LOAD segment has a dynamic reloc.
1320 * layout.cc (Layout::finish_dynamic_section): Don't create
1321 DT_FLAGS entry if not needed.
1326 * layout.cc (Layout::layout_eh_frame): Correct handling of
1327 writable .eh_frame section.
1332 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1333 symbol is redefined with the exact same object and value.
1338 * layout.h (class Layout): Add interp_segment_ field.
1339 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1340 (Layout::attach_allocated_section_to_segment): If making shared
1341 library, put .interp section in PT_INTERP segment.
1342 (Layout::finalize): Also call create_interp if -dynamic-linker
1344 (Layout::create_interp): Assert that there is no PT_INTERP
1345 segment. If not using a SECTIONS clause, use make_output_section.
1346 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1347 * script-sections.cc
1348 (Script_sections::create_note_and_tls_segments): If making shared
1349 library, put .interp section in PT_INTERP segment.
1353 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1354 when making a shared library.
1358 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1359 parameter. Change all callers. Don't issue warning about PC32
1360 against locally defined symbol.
1364 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1365 occurs in same object.
1369 * po/POTFILES.in: Regenerate.
1373 * script-sections.cc
1374 (Orphan_output_section::set_section_addresses): For a relocatable
1375 link set address to 0.
1380 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1381 used with --compress-debug-sections.
1382 * gold/object.cc (Sized_relobj_file::do_layout): Report
1383 uncompressed size of compressed input sections.
1388 * testsuite/two_file_test_2_v1.cc: Change initialization of
1389 v2 to keep it in .data.
1393 * common.cc (Symbol_table::do_allocate_commons_list): Call
1395 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1396 (Errors::fallback): New function.
1397 (gold_fallback): New function.
1398 * errors.h (Errors::fallback): New function.
1399 * gold.cc (gold_exit): Change status parameter to enum; adjust
1401 (queue_initial_tasks): Call gold_fallback.
1402 * gold.h: Include cstdlib.
1403 (Exit_status): New enum type.
1404 (gold_exit): Change status parameter to enum.
1405 (gold_fallback): New function.
1406 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1407 (Layout::create_symtab_sections): Likewise.
1408 (Layout::create_shdrs): Likewise.
1409 * main.cc (main): Adjust call to gold_exit.
1410 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1411 (Output_data_got::add_got_entry_pair): Likewise.
1412 (Output_section::add_input_section): Likewise.
1413 (Output_section::add_output_section_data): Likewise.
1414 (Output_segment::set_section_list_addresses): Likewise.
1415 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1419 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1420 for incremental links.
1421 * output.cc (Output_segment::set_section_list_addresses): Remove
1422 FIXME and test for TLS or BSS.
1426 * testsuite/Makefile.am: Add incremental_copy_test,
1427 incremental_common_test_1.
1428 * testsuite/Makefile.in: Regenerate.
1429 * testsuite/common_test_1_v1.c: New source file.
1430 * testsuite/common_test_1_v2.c: New source file.
1431 * testsuite/copy_test_v1.cc: New source file.
1435 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1436 update, allocate common from bss section's free list.
1437 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1438 linker-defined symbols.
1439 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1440 Skip GOT and PLT entries that are no longer referenced.
1441 (Output_section_incremental_inputs::write_info_blocks): Mark
1442 linker-defined symbols.
1443 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1444 * output.cc (Output_section::allocate): New function.
1445 * output.h (Output_section::allocate): New function.
1446 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1447 linker-defined symbols.
1448 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1449 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1450 (Symbol::init_base_output_data): Likewise.
1451 (Symbol::init_base_output_segment): Likewise.
1452 (Symbol::init_base_constant): Likewise.
1453 (Sized_symbol::init_output_data): Likewise.
1454 (Sized_symbol::init_output_segment): Likewise.
1455 (Sized_symbol::init_constant): Likewise.
1456 (Symbol_table::do_define_in_output_data): Likewise.
1457 (Symbol_table::do_define_in_output_segment): Likewise.
1458 (Symbol_table::do_define_as_constant): Likewise.
1459 * symtab.h (Symbol::is_predefined): New function.
1460 (Symbol::init_base_output_data): Add is_predefined parameter.
1461 (Symbol::init_base_output_segment): Likewise.
1462 (Symbol::init_base_constant): Likewise.
1463 (Symbol::is_predefined_): New data member.
1464 (Sized_symbol::init_output_data): Add is_predefined parameter.
1465 (Sized_symbol::init_output_segment): Likewise.
1466 (Sized_symbol::init_constant): Likewise.
1467 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1471 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1472 instead of emit_copy_reloc.
1473 (Copy_relocs::emit_copy_reloc): Refactor.
1474 (Copy_relocs::make_copy_reloc): New function.
1475 (Copy_relocs::add_copy_reloc): Remove.
1476 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1478 (Copy_relocs::make_copy_reloc): New function.
1479 (Copy_relocs::add_copy_reloc): Remove.
1480 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1481 unchanged input files.
1482 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1483 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1484 Reserve BSS space for COPY relocations.
1485 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1486 (Output_section_incremental_inputs::write_info_blocks): Record
1487 whether a symbol is copied from a shared object.
1488 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1489 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1490 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1491 (Incremental_input_entry_reader::get_output_symbol_index): Add
1493 (Incremental_binary::emit_copy_relocs): New function.
1494 (Incremental_binary::do_emit_copy_relocs): New function.
1495 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1497 (Sized_incremental_binary::add_copy_reloc): New function.
1498 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1499 (Sized_incremental_binary::Copy_reloc): New struct.
1500 (Sized_incremental_binary::Copy_relocs): New typedef.
1501 (Sized_incremental_binary::copy_relocs_): New data member.
1502 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1503 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1504 * target.h (Sized_target::emit_copy_reloc): New function.
1505 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1510 * gold/archive.cc (Archive::Archive): Initialize new data member.
1511 (Archive::include_all_members): Return if archive has already been
1513 * gold/archive.h (Archive::include_all_members_): New data member.
1517 * dynobj.h: Fix spelling mistake in comment.
1518 * output.cc: Likewise.
1524 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1525 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1526 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1527 redundant arm_exidx_test.so.
1528 * testsuite/Makefile.in: Regenerate.
1529 (check_SCRIPTS): Add pr12826.sh
1530 (check_DATA): Add pr12826.stdout
1531 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1532 * testsuite/pr12826.sh: New file.
1533 * testsuite/pr12826_1.s: Ditto.
1534 * testsuite/pr12826_1.s: Ditto.
1538 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1544 * testsuite/Makefile.am: Use different file name for two_file_test
1545 temporary file for each incremental test.
1546 * testsuite/Makefile.in: Rebuild.
1550 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1551 binary input file is empty.
1555 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1556 (ver_test_9.so): Likewise.
1557 * testsuite/Makefile.in: Rebuild.
1561 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1562 * incremental.cc (Incremental_inputs::report_input_section): Fix
1563 comment, indentation.
1564 (Incremental_inputs::report_comdat_group): New function.
1565 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1566 of data for incremental input file entry.
1567 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1568 group count, COMDAT group signatures.
1569 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1570 an unchanged input file.
1571 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1572 Initialize new data member.
1573 (Incremental_object_entry::add_comdat_group): New function.
1574 (Incremental_object_entry::get_comdat_group_count): New function.
1575 (Incremental_object_entry::get_comdat_signature_key): New function.
1576 (Incremental_object_entry::groups_): New data member.
1577 (Incremental_inputs::report_comdat_group): New function.
1578 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1579 data for incremental input file entry.
1580 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1581 (Incremental_input_entry_reader::get_input_section): Adjust size of
1582 data for incremental input file entry.
1583 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1584 (Incremental_input_entry_reader::get_comdat_group_signature): New
1586 * object.cc (Sized_relobj::include_section_group): Report kept
1587 COMDAT groups for incremental links.
1591 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1592 with name parameter. Add found_name parameter.
1593 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1594 * dirsearch.h (class Dirsearch): Update declaration.
1598 * archive.cc (Library_base::should_include_member): Pull in object
1599 from archive if it defines the entry symbol.
1600 * parameters.cc (Parameters::entry): New function.
1601 * parameters.h (class Parameters): Declare entry.
1602 * output.h (class Output_file_header): Remove entry_ field.
1603 * output.cc (Output_file_header::Output_file_header): Remove entry
1604 parameter. Change all callers.
1605 (Output_file_header::entry): Use parameters->entry.
1606 * gold.cc (queue_middle_tasks): Likewise.
1607 * plugin.cc (Plugin_hook::run): Likewise.
1611 * gold.cc (queue_initial_tasks): Pass incremental base filename
1612 to Output_file::open_base_file; don't print error message.
1613 * incremental-dump.cc (main): Adjust call to
1614 Output_file::open_for_modification.
1615 * incremental-dump.cc (main): Likewise.
1616 * incremental.cc (Incremental_inputs::report_command_line):
1617 Ignore --incremental-base option when comparing command lines.
1618 Ignore parameter when given as separate argument.
1619 * options.h (class General_options): Add --incremental-base.
1620 * output.cc (Output_file::Output_file):
1621 (Output_file::open_base_file): Add base_name and writable parameters;
1622 read base file into new file; print error message here.
1623 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1625 * output.h (Output_file::open_for_modification): Rename to...
1626 (Output_file::open_base_file): ...this; add base_name and
1627 writable parameters; adjust all callers.
1628 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1630 * testsuite/Makefile.am (incremental_test_4): Test
1632 * testsuite/Makefile.in: Regenerate.
1636 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1638 * testsuite/Makefile.in: Regenerate.
1639 * testsuite/two_file_test_1_v1.cc: New test source file.
1640 * testsuite/two_file_test_1b_v1.cc: New test source file.
1641 * testsuite/two_file_test_2_v1.cc: New test source file.
1645 * dynobj.h (Dynobj::do_dynobj): New function.
1646 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1647 flag and soname for shared objects.
1648 * incremental.cc (Incremental_inputs::report_object): Make
1649 either Incremental_object_entry or Incremental_dynobj_entry; add
1650 soname to string table.
1651 (Incremental_inputs::report_input_section): Add assertion.
1652 (Output_section_incremental_inputs::set_final_data_size): Adjust
1653 type of input file entry for shared libraries; adjust size of
1654 shared library info entry.
1655 (Output_section_incremental_inputs::write_input_files): Write
1656 as_needed flag for shared libraries.
1657 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1658 of input file entry for shared libraries; write soname.
1659 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1660 soname from incremental info.
1661 * incremental.h (enum Incremental_input_flags): Add
1662 INCREMENTAL_INPUT_AS_NEEDED.
1663 (Incremental_input_entry::Incremental_input_entry): Initialize new
1665 (Incremental_input_entry::set_as_needed): New function.
1666 (Incremental_input_entry::as_needed): New function.
1667 (Incremental_input_entry::do_dynobj_entry): New function.
1668 (Incremental_input_entry::as_needed_): New data member.
1669 (Incremental_object_entry::Incremental_object_entry): Don't check
1671 (Incremental_object_entry::do_type): Likewise.
1672 (class Incremental_dynobj_entry): New class.
1673 (Incremental_input_entry_reader::as_needed): New function.
1674 (Incremental_input_entry_reader::get_soname): New function.
1675 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1676 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1677 size of shared library info entry.
1678 * layout.cc (Layout::finish_dynamic_section): Don't test for
1679 incremental link when adding DT_NEEDED entries.
1680 * object.h (Object::Object): Initialize new data member.
1681 (Object::dynobj): New function.
1682 (Object::set_as_needed): New function.
1683 (Object::as_needed): New function.
1684 (Object::do_dynobj): New function.
1685 (Object::as_needed_): New data member.
1689 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1690 info; adjust display of GOT entries.
1691 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1692 vector of input objects; remove file_status_.
1693 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1694 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1695 got_plt reader; call target hooks to reserve GOT entries.
1696 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1697 of input file info header and GOT info entry.
1698 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1700 (Got_plt_view_info::got_descriptor): Remove.
1701 (Got_plt_view_info::sym_index): New data member.
1702 (Got_plt_view_info::input_index): New data member.
1703 (Local_got_offset_visitor::visit): Write input file index.
1704 (Global_got_offset_visitor::visit): Write 0 for input file index.
1705 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1706 with sym_index and input_index.
1707 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1708 incremental info GOT entry; replace got_descriptor with input_index.
1709 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1710 map from input file index to object.
1711 (Sized_relobj_incr::do_layout): Replace direct data member reference
1712 with accessor function.
1713 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1714 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1715 Adjust size of input file info header.
1716 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1717 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1718 (Incremental_input_entry_reader::get_input_section): Adjust size of
1719 input file info header.
1720 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1721 of incremental info GOT entry.
1722 (Incremental_got_plt_reader::get_got_desc): Remove.
1723 (Incremental_got_plt_reader::get_got_symndx): New function.
1724 (Incremental_got_plt_reader::get_got_input_index): New function.
1725 (Sized_incremental_binary::Sized_incremental_binary): Remove
1726 file_status_; add input_objects_.
1727 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1728 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1729 (Sized_incremental_binary::file_is_unchanged): Remove.
1730 (Sized_incremental_binary::set_input_object): New function.
1731 (Sized_incremental_binary::input_object): New function.
1732 (Sized_incremental_binary::file_status_): Remove.
1733 (Sized_incremental_binary::input_objects_): New data member.
1734 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1736 (Sized_relobj_incr::invalid_address): Move to base class.
1737 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1739 (Sized_relobj_incr::do_output_section_offset): Likewise.
1740 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1741 (Sized_relobj_incr::section_offsets_): Likewise.
1742 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1744 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1745 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1746 with accessor function.
1747 (Sized_relobj_file::do_layout): Likewise.
1748 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1749 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1750 (Sized_relobj_file::compute_final_local_value): Replace refs to
1751 section_offsets_ with accessor function.
1752 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1753 * object.h (Relobj::Relobj): Initialize new data members.
1754 (Relobj::add_dyn_reloc): New function.
1755 (Relobj::first_dyn_reloc): New function.
1756 (Relobj::dyn_reloc_count): New function.
1757 (Relobj::first_dyn_reloc_): New data member.
1758 (Relobj::dyn_reloc_count_): New data member.
1759 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1761 (Sized_relobj::Address): New typedef.
1762 (Sized_relobj::invalid_address): Move here from child class.
1763 (Sized_relobj::Sized_relobj): Initialize new data members.
1764 (Sized_relobj::sized_relobj): New function.
1765 (Sized_relobj::is_output_section_offset_invalid): Move here from
1767 (Sized_relobj::get_output_section_offset): Likewise.
1768 (Sized_relobj::local_has_got_offset): Likewise.
1769 (Sized_relobj::local_got_offset): Likewise.
1770 (Sized_relobj::set_local_got_offset): Likewise.
1771 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1772 (Sized_relobj::clear_got_offsets): New function.
1773 (Sized_relobj::section_offsets): Move here from child class.
1774 (Sized_relobj::do_output_section_offset): Likewise.
1775 (Sized_relobj::do_set_section_offset): Likewise.
1776 (Sized_relobj::Local_got_offsets): Likewise.
1777 (Sized_relobj::local_got_offsets_): Likewise.
1778 (Sized_relobj::section_offsets_): Likewise.
1779 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1781 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1783 (Sized_relobj_file::sized_relobj): New function
1784 (Sized_relobj_file::local_has_got_offset): Move to base class.
1785 (Sized_relobj_file::local_got_offset): Likewise.
1786 (Sized_relobj_file::set_local_got_offset): Likewise.
1787 (Sized_relobj_file::get_output_section_offset): Likewise.
1788 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1789 (Sized_relobj_file::do_output_section_offset): Likewise.
1790 (Sized_relobj_file::do_set_section_offset): Likewise.
1791 (Sized_relobj_file::Local_got_offsets): Likewise.
1792 (Sized_relobj_file::local_got_offsets_): Likewise.
1793 (Sized_relobj_file::section_offsets_): Likewise.
1794 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1796 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1797 (Output_reloc::get_symbol_index): Likewise.
1798 (Output_reloc::local_section_offset): Likewise.
1799 (Output_reloc::get_address): Likewise.
1800 (Output_reloc::symbol_value): Likewise.
1801 (Output_data_got::reserve_slot): Move to class definition.
1802 (Output_data_got::reserve_local): New function.
1803 (Output_data_got::reserve_slot_for_global): Remove.
1804 (Output_data_got::reserve_global): New function.
1805 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1806 (all constructors, two instantiations).
1807 (Output_reloc::get_relobj): New function (two instantiations).
1808 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1809 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1810 (Output_data_reloc::add_global): Adjust type of relobj.
1811 (Output_data_reloc::add_global_relative): Likewise.
1812 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1813 (Output_data_reloc::add_local): Likewise.
1814 (Output_data_reloc::add_local_relative): Likewise.
1815 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1816 (Output_data_reloc::add_local_section): Likewise.
1817 (Output_data_reloc::add_output_section): Likewise.
1818 (Output_data_reloc::add_absolute): Likewise.
1819 (Output_data_reloc::add_target_specific): Likewise.
1820 (Output_data_got::reserve_slot): Move definition here.
1821 (Output_data_got::reserve_local): New function.
1822 (Output_data_got::reserve_global): New function.
1823 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1824 section_offsets_ with accessor function.
1825 (Sized_relobj_file::write_sections): Likewise.
1826 (Sized_relobj_file::do_relocate_sections): Likewise.
1827 * target.h (Sized_target::reserve_local_got_entry): New function.
1828 (Sized_target::reserve_global_got_entry): New function.
1829 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1830 (Target_x86_64::reserve_global_got_entry): New function.
1831 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1835 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1836 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1837 bit when checking got_type.
1838 * incremental.cc (Sized_incremental_binary::setup_readers):
1839 Store symbol table and string table locations; initialize bit vector
1840 of file status flags.
1841 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1843 (Sized_incremental_binary::do_process_got_plt): New function.
1844 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1845 (Output_section_incremental_inputs::set_final_data_size): Record
1846 file index for each input file.
1847 (Output_section_incremental_inputs::write_got_plt): Store file index
1848 instead of input entry offset for each GOT entry.
1850 (Incremental_input_entry::Incremental_input_entry): Initialize new
1852 (Incremental_input_entry::set_offset): Store file index.
1853 (Incremental_input_entry::get_file_index): New function.
1854 (Incremental_input_entry::file_index_): New data member.
1855 (Incremental_binary::process_got_plt): New function.
1856 (Incremental_binary::do_process_got_plt): New function.
1857 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1859 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1860 (Sized_incremental_binary::set_file_is_unchanged): New function.
1861 (Sized_incremental_binary::file_is_unchanged): New function.
1862 (Sized_incremental_binary::do_process_got_plt): New function.
1863 (Sized_incremental_binary::file_status_): New data member.
1864 (Sized_incremental_binary::main_symtab_loc_): New data member.
1865 (Sized_incremental_binary::main_strtab_loc_): New data member.
1866 * output.cc (Output_data_got::Got_entry::write): Add case
1868 (Output_data_got::add_global): Call add_got_entry.
1869 (Output_data_got::add_global_plt): Likewise.
1870 (Output_data_got::add_global_with_rel): Likewise.
1871 (Output_data_got::add_global_with_rela): Likewise.
1872 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1873 (Output_data_got::add_global_pair_with_rela): Likewise.
1874 (Output_data_got::add_local): Call add_got_entry.
1875 (Output_data_got::add_local_plt): Likewise.
1876 (Output_data_got::add_local_with_rel): Likewise.
1877 (Output_data_got::add_local_with_rela): Likewise.
1878 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1879 (Output_data_got::add_local_pair_with_rela): Likewise.
1880 (Output_data_got::reserve_slot): New function.
1881 (Output_data_got::reserve_slot_for_global): New function.
1882 (Output_data_got::add_got_entry): New function.
1883 (Output_data_got::add_got_entry_pair): New function.
1884 (Output_section::add_output_section_data): Edit FIXME.
1886 (Output_section_data_build::Output_section_data_build): New
1887 constructor with size parameter.
1888 (Output_data_space::Output_data_space): Likewise.
1889 (Output_data_got::Output_data_got): Initialize new data member; new
1890 constructor with size parameter.
1891 (Output_data_got::add_constant): Call add_got_entry.
1892 (Output_data_got::reserve_slot): New function.
1893 (Output_data_got::reserve_slot_for_global): New function.
1894 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1895 (Output_data_got::add_got_entry): New function.
1896 (Output_data_got::add_got_entry_pair): New function.
1897 (Output_data_got::free_list_): New data member.
1898 * target.h (Sized_target::init_got_plt_for_update): New function.
1899 (Sized_target::register_global_plt_entry): New function.
1900 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1901 Initialize new data member; call init; add constructor with PLT count.
1902 (Output_data_plt_x86_64::init): New function.
1903 (Output_data_plt_x86_64::add_relocation): New function.
1904 (Output_data_plt_x86_64::reserve_slot): New function.
1905 (Output_data_plt_x86_64::free_list_): New data member.
1906 (Target_x86_64::init_got_plt_for_update): New function.
1907 (Target_x86_64::register_global_plt_entry): New function.
1908 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1909 incremental updates.
1910 (Output_data_plt_x86_64::add_relocation): New function.
1911 * testsuite/object_unittest.cc (Object_test): Set default options.
1915 * options.h (class General_options): Make -i a synonym for -r.
1919 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1923 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1928 * layout.cc (Layout::layout): If the output section flags change,
1929 update the ordering.
1933 * incremental-dump.cc (dump_incremental_inputs): Print local
1934 symbol info for each input file.
1936 (Output_section_incremental_inputs::set_final_data_size): Add local
1937 symbol info to input file entries in incremental info.
1938 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1939 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1940 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1941 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1943 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1944 (Sized_incr_relobj::do_relocate): Write the local symbols.
1945 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1946 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1947 Adjust size of input file header.
1948 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1949 (Incremental_inputs_reader::get_local_symbol_count): New function.
1950 (Incremental_inputs_reader::get_input_section): Adjust size of input
1952 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1953 (Sized_incr_relobj::This): New typedef.
1954 (Sized_incr_relobj::sym_size): New const data member.
1955 (Sized_incr_relobj::Local_symbol): New struct.
1956 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1957 (Sized_incr_relobj::do_local_symbol_offset): New function.
1958 (Sized_incr_relobj::local_symbol_count_): New data member.
1959 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1960 (Sized_incr_relobj::local_symbol_index_): New data member.
1961 (Sized_incr_relobj::local_symbol_offset_): New data member.
1962 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1963 (Sized_incr_relobj::local_symbols_): New data member.
1964 * object.h (Relobj::output_local_symbol_count): New function.
1965 (Relobj::local_symbol_offset): New function.
1966 (Relobj::do_output_local_symbol_count): New function.
1967 (Relobj::do_local_symbol_offset): New function.
1968 (Sized_relobj::do_output_local_symbol_count): New function.
1969 (Sized_relobj::do_local_symbol_offset): New function.
1973 * descriptors.cc (set_close_on_exec): New function.
1974 (Descriptors::open): Use set_close_on_exec.
1975 * output.cc (S_ISLNK): Define if not defined.
1979 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1981 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1982 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1983 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1985 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1986 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1987 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1989 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1991 (Incremental_binary::apply_incremental_relocs): New function.
1992 (Incremental_binary::do_apply_incremental_relocs): New function.
1993 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1995 (Sized_incremental_binary::add_global_symbol): New function.
1996 (Sized_incremental_binary::global_symbol): New function.
1997 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1998 (Sized_incremental_binary::symbol_map_): New data member.
1999 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2000 * target.h (Sized_target::apply_relocation): New function.
2001 * target-reloc.h (apply_relocation): New function.
2002 * x86_64.cc (Target_x86_64::apply_relocation): New function.
2006 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2007 flag of a SHT_ARM_EXIDX section.
2008 * testsuite/Makefile.am (arm_exidx_test): New test rules.
2009 * testsuite/Makefile.in: Regenerate.
2010 * testsuite/arm_exidx_test.s: New file.
2011 * testsuite/arm_exidx_test.sh: Same.
2016 * archive.h (Incremental_archive_entry::Archive_member):
2017 Initialize arg_serial_ (second constructor).
2021 * object.cc (Relocate_info::location): Simplify location string.
2022 * errors.cc (Errors::error_at_location): Don't print program
2024 (Errors::warning_at_location): Likewise.
2025 (Errors::undefined_symbol): Likewise.
2026 * testsuite/debug_msg.sh: Update accordingly.
2030 * gold/layout.cc (Layout::symtab_section_offset): New function.
2031 * gold/layout.h (Layout::symtab_section_offset): New function.
2032 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2036 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
2037 with MREMAP_MAYMOVE.
2038 * output.h (class Output_file): Add map_is_allocated_ field.
2039 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
2040 not available, provide stubs. If mremap is not available, #define
2042 (MREMAP_MAYMOVE): Define if not defined.
2043 (Output_file::Output_file): Initialize map_is_allocated_.
2044 (Output_file::resize): Check map_is_allocated_.
2045 (Output_file::map_anonymous): If mmap fails, use malloc.
2046 (Output_file::unmap): Don't do anything for an anonymous map.
2047 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
2048 is not available, provide stubs.
2049 (File_read::View::~View): Use free rather than delete[].
2050 (File_read::make_view): Use malloc rather than new[]. If mmap
2052 (File_read::find_or_make_view): Use malloc rather than new[].
2053 * gold.h: Remove HAVE_REMAP code.
2054 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
2055 exists. Rename mremap to gold_mremap. If mmap is not available
2057 * configure, config.in: Rebuild.
2061 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2062 initialize local variable v.
2066 * archive.cc (Archive::include_member): Adjust call to
2068 (Add_archive_symbols::run): Track argument serial numbers.
2069 (Lib_group::include_member): Likewise.
2070 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2071 * archive.h (Incremental_archive_entry::Archive_member):
2072 Initialize arg_serial_.
2073 (Archive_member::arg_serial_): New data member.
2074 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2075 (Sized_dynobj::do_add_symbols): Track symbols when doing an
2077 (Sized_dynobj::do_for_all_local_got_entries): New function.
2078 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2080 * fileread.cc (get_mtime): New function.
2081 * fileread.h (get_mtime): New function.
2082 * gold.cc (queue_initial_tasks): Check for incremental update.
2083 (process_incremental_input): New function.
2084 (queue_middle_tasks): Don't force valid target for incremental
2086 * incremental-dump.cc (find_input_containing_global): Adjust
2087 size of symbol info entry.
2088 (dump_incremental_inputs): Dump argument serial number and
2089 in_system_directory flag; bias shndx by 1; print symbol names
2090 when dumping per-file symbol lists; use new symbol info readers.
2092 (Output_section_incremental_inputs:update_data_size): New function.
2093 (Sized_incremental_binary::setup_readers): Setup input readers
2094 for each input file; build maps for files added from libraries
2096 (Sized_incremental_binary::check_input_args): New function.
2097 (Sized_incremental_binary::do_check_inputs): Build map of argument
2098 serial numbers to input arguments.
2099 (Sized_incremental_binary::do_file_has_changed): Rename
2100 do_file_is_unchanged to this; compare file modification times.
2101 (Sized_incremental_binary::do_init_layout): New function.
2102 (Sized_incremental_binary::do_reserve_layout): New function.
2103 (Sized_incremental_binary::do_get_input_reader): Remove.
2104 (Sized_incremental_binary::get_symtab_view): New function.
2105 (Incremental_checker::can_incrementally_link_output_file): Remove.
2106 (Incremental_inputs::report_command_line): Exclude --debug options.
2107 (Incremental_inputs::report_archive_begin): Add parameter; track
2108 argument serial numbers; don't put input file entry for archive
2109 before archive members.
2110 (Incremental_inputs::report_archive_end): Put input file entry
2111 for archive after archive members.
2112 (Incremental_inputs::report_object): Add parameter; track argument
2113 serial numbers and in_system_directory flag.
2114 (Incremental_inputs::report_script): Add parameter; track argument
2116 (Output_section_incremental_inputs::set_final_data_size): Adjust
2117 size of symbol info entry; check for forwarding symbols.
2118 (Output_section_incremental_inputs::write_input_files): Write
2119 in_system_directory flag and argument serial number.
2120 (Output_section_incremental_inputs::write_info_blocks): Map section
2121 indices between incremental info and original input file; store
2122 input section index for each symbol.
2123 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2124 change operator() to visit().
2125 (class Global_got_offset_visitor): Likewise.
2126 (class Global_symbol_visitor_got_plt):
2127 (Output_section_incremental_inputs::write_got_plt): Use new visitor
2129 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2130 (Sized_incr_relobj::do_read_symbols): New function.
2131 (Sized_incr_relobj::do_layout): New function.
2132 (Sized_incr_relobj::do_layout_deferred_sections): New function.
2133 (Sized_incr_relobj::do_add_symbols): New function.
2134 (Sized_incr_relobj::do_should_include_member): New function.
2135 (Sized_incr_relobj::do_for_all_global_symbols): New function.
2136 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2137 (Sized_incr_relobj::do_section_size): New function.
2138 (Sized_incr_relobj::do_section_name): New function.
2139 (Sized_incr_relobj::do_section_contents): New function.
2140 (Sized_incr_relobj::do_section_flags): New function.
2141 (Sized_incr_relobj::do_section_entsize): New function.
2142 (Sized_incr_relobj::do_section_address): New function.
2143 (Sized_incr_relobj::do_section_type): New function.
2144 (Sized_incr_relobj::do_section_link): New function.
2145 (Sized_incr_relobj::do_section_info): New function.
2146 (Sized_incr_relobj::do_section_addralign): New function.
2147 (Sized_incr_relobj::do_initialize_xindex): New function.
2148 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2149 (Sized_incr_relobj::do_read_relocs): New function.
2150 (Sized_incr_relobj::do_gc_process_relocs): New function.
2151 (Sized_incr_relobj::do_scan_relocs): New function.
2152 (Sized_incr_relobj::do_count_local_symbols): New function.
2153 (Sized_incr_relobj::do_finalize_local_symbols): New function.
2154 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2155 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2156 (Sized_incr_relobj::do_relocate): New function.
2157 (Sized_incr_relobj::do_set_section_offset): New function.
2158 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2159 (Sized_incr_dynobj::do_read_symbols): New function.
2160 (Sized_incr_dynobj::do_layout): New function.
2161 (Sized_incr_dynobj::do_add_symbols): New function.
2162 (Sized_incr_dynobj::do_should_include_member): New function.
2163 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2164 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2165 (Sized_incr_dynobj::do_section_size): New function.
2166 (Sized_incr_dynobj::do_section_name): New function.
2167 (Sized_incr_dynobj::do_section_contents): New function.
2168 (Sized_incr_dynobj::do_section_flags): New function.
2169 (Sized_incr_dynobj::do_section_entsize): New function.
2170 (Sized_incr_dynobj::do_section_address): New function.
2171 (Sized_incr_dynobj::do_section_type): New function.
2172 (Sized_incr_dynobj::do_section_link): New function.
2173 (Sized_incr_dynobj::do_section_info): New function.
2174 (Sized_incr_dynobj::do_section_addralign): New function.
2175 (Sized_incr_dynobj::do_initialize_xindex): New function.
2176 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2177 (make_sized_incremental_object): New function.
2178 (Incremental_library::copy_unused_symbols): New function.
2179 (Incremental_library::do_for_all_unused_symbols): New function.
2180 * incremental.h (enum Incremental_input_flags): New type.
2181 (class Incremental_checker): Remove.
2182 (Incremental_input_entry::Incremental_input_entry): Add argument
2184 (Incremental_input_entry::arg_serial): New function.
2185 (Incremental_input_entry::set_is_in_system_directory): New function.
2186 (Incremental_input_entry::is_in_system_directory): New function.
2187 (Incremental_input_entry::arg_serial_): New data member.
2188 (Incremental_input_entry::is_in_system_directory_): New data member.
2189 (class Script_info): Move here from script.h.
2190 (Script_info::Script_info): Add filename parameter.
2191 (Script_info::filename): New function.
2192 (Script_info::filename_): New data member.
2193 (Incremental_script_entry::Incremental_script_entry): Add argument
2195 (Incremental_object_entry::Incremental_object_entry): Likewise.
2196 (Incremental_object_entry::add_input_section): Build list of input
2197 sections with map to original shndx.
2198 (Incremental_object_entry::get_input_section_index): New function.
2199 (Incremental_object_entry::shndx_): New data member.
2200 (Incremental_object_entry::name_key_): Rename; adjust all refs.
2201 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2202 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2204 (Incremental_inputs::report_archive_begin): Likewise.
2205 (Incremental_inputs::report_object): Likewise.
2206 (Incremental_inputs::report_script): Likewise.
2207 (class Incremental_global_symbol_reader): New class.
2208 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2209 and store flags and input file type.
2210 (Incremental_input_entry_reader::arg_serial): New function.
2211 (Incremental_input_entry_reader::type): Extract type from flags.
2212 (Incremental_input_entry_reader::is_in_system_directory): New function.
2213 (Incremental_input_entry_reader::get_input_section_count): Call
2214 accessor function for type.
2215 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2216 function for type; adjust size of global symbol entry.
2217 (Incremental_input_entry_reader::get_global_symbol_count): Call
2218 accessor function for type.
2219 (Incremental_input_entry_reader::get_object_count): Likewise.
2220 (Incremental_input_entry_reader::get_object_offset): Likewise.
2221 (Incremental_input_entry_reader::get_member_count): Likewise.
2222 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2223 (Incremental_input_entry_reader::get_member_offset): Likewise.
2224 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2225 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2226 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2227 (Incremental_input_entry_reader::get_global_symbol_reader): New
2229 (Incremental_input_entry_reader::get_output_symbol_index): New
2231 (Incremental_input_entry_reader::type_): Remove.
2232 (Incremental_input_entry_reader::flags_): New data member.
2233 (Incremental_inputs_reader::input_file_offset): New function.
2234 (Incremental_inputs_reader::input_file_index): New function.
2235 (Incremental_inputs_reader::input_file): Call input_file_offset.
2236 (Incremental_inputs_reader::input_file_at_offset): New function.
2237 (Incremental_relocs_reader::get_r_type): Reformat.
2238 (Incremental_relocs_reader::get_r_shndx): Reformat.
2239 (Incremental_relocs_reader::get_r_offset): Reformat.
2240 (Incremental_relocs_reader::data): New function.
2241 (Incremental_binary::Incremental_binary): Initialize new data members.
2242 (Incremental_binary::check_inputs): Add cmdline parameter.
2243 (Incremental_binary::file_is_unchanged): Remove.
2244 (Input_reader::arg_serial): New function.
2245 (Input_reader::get_unused_symbol_count): New function.
2246 (Input_reader::get_unused_symbol): New function.
2247 (Input_reader::do_arg_serial): New function.
2248 (Input_reader::do_get_unused_symbol_count): New function.
2249 (Input_reader::do_get_unused_symbol): New function.
2250 (Incremental_binary::input_file_count): New function.
2251 (Incremental_binary::get_input_reader): Change signature to use
2252 index instead of filename.
2253 (Incremental_binary::file_has_changed): New function.
2254 (Incremental_binary::get_input_argument): New function.
2255 (Incremental_binary::get_library): New function.
2256 (Incremental_binary::get_script_info): New function.
2257 (Incremental_binary::init_layout): New function.
2258 (Incremental_binary::reserve_layout): New function.
2259 (Incremental_binary::output_file): New function.
2260 (Incremental_binary::do_check_inputs): New function.
2261 (Incremental_binary::do_file_is_unchanged): Remove.
2262 (Incremental_binary::do_file_has_changed): New function.
2263 (Incremental_binary::do_init_layout): New function.
2264 (Incremental_binary::do_reserve_layout): New function.
2265 (Incremental_binary::do_input_file_count): New function.
2266 (Incremental_binary::do_get_input_reader): Change signature.
2267 (Incremental_binary::input_args_map_): New data member.
2268 (Incremental_binary::library_map_): New data member.
2269 (Incremental_binary::script_map_): New data member.
2270 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2272 (Sized_incremental_binary::output_section): New function.
2273 (Sized_incremental_binary::inputs_reader): Add const.
2274 (Sized_incremental_binary::symtab_reader): Add const.
2275 (Sized_incremental_binary::relocs_reader): Add const.
2276 (Sized_incremental_binary::got_plt_reader): Add const.
2277 (Sized_incremental_binary::get_symtab_view): New function.
2278 (Sized_incremental_binary::Inputs_reader): New typedef.
2279 (Sized_incremental_binary::Input_entry_reader): New typedef.
2280 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2281 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2282 (Sized_incremental_binary::do_file_has_changed): New function.
2283 (Sized_incremental_binary::do_init_layout): New function.
2284 (Sized_incremental_binary::do_reserve_layout): New function.
2285 (Sized_input_reader::Inputs_reader): Remove.
2286 (Sized_input_reader::Input_entry_reader): Remove.
2287 (Sized_input_reader::do_arg_serial): New function.
2288 (Sized_input_reader::do_get_unused_symbol_count): New function.
2289 (Sized_input_reader::do_get_unused_symbol): New function.
2290 (Sized_incremental_binary::do_input_file_count): New function.
2291 (Sized_incremental_binary::do_get_input_reader): Change signature;
2292 use index instead of filename.
2293 (Sized_incremental_binary::section_map_): New data member.
2294 (Sized_incremental_binary::input_entry_readers_): New data member.
2295 (class Sized_incr_relobj): New class.
2296 (class Sized_incr_dynobj): New class.
2297 (make_sized_incremental_object): New function.
2298 (class Incremental_library): New class.
2299 * layout.cc (Free_list::num_lists): New static data member.
2300 (Free_list::num_nodes): New static data member.
2301 (Free_list::num_removes): New static data member.
2302 (Free_list::num_remove_visits): New static data member.
2303 (Free_list::num_allocates): New static data member.
2304 (Free_list::num_allocate_visits): New static data member.
2305 (Free_list::init): New function.
2306 (Free_list::remove): New function.
2307 (Free_list::allocate): New function.
2308 (Free_list::dump): New function.
2309 (Free_list::print_stats): New function.
2310 (Layout_task_runner::run): Resize output file for incremental updates.
2311 (Layout::Layout): Initialize new data members.
2312 (Layout::set_incremental_base): New function.
2313 (Layout::init_fixed_output_section): New function.
2314 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2315 incremental updates.
2316 (Layout::create_gold_note): Do not create gold note section for
2317 incremental updates.
2318 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2319 for incremental updates.
2320 (Layout::set_section_offsets): For incremental updates, allocate space
2322 (Layout::create_symtab_sections): Layout with offsets relative to
2323 start of section; for incremental updates, allocate space from free
2325 (Layout::create_shdrs): For incremental updates, allocate space from
2327 (Layout::finish_dynamic_section): For incremental updates, do not
2328 check --as-needed (fixed in subsequent patch).
2329 * layout.h (class Free_list): New class.
2330 (Layout::set_incremental_base): New function.
2331 (Layout::incremental_base): New function.
2332 (Layout::init_fixed_output_section): New function.
2333 (Layout::allocate): New function.
2334 (Layout::incremental_base_): New data member.
2335 (Layout::free_list_): New data member.
2336 * main.cc (main): Print Free_list statistics.
2337 * object.cc (Relobj::finalize_incremental_relocs): Add
2338 clear_counts parameter; clear counts only when clear_counts is set.
2339 (Sized_relobj::Sized_relobj): Initialize new base class.
2340 (Sized_relobj::do_layout): Don't report special sections.
2341 (Sized_relobj::do_for_all_local_got_entries): New function.
2342 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2343 symtab_off to all symbol table offsets.
2344 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2345 * object.h (class Got_offset_list): Move to top of file.
2346 (Object::Object): Allow case where input_file == NULL.
2347 (Object::~Object): Likewise.
2348 (Object::input_file): Assert that input_file != NULL.
2349 (Object::lock): Allow case where input_file == NULL.
2350 (Object::unlock): Likewise.
2351 (Object::is_locked): Likewise.
2352 (Object::token): Likewise.
2353 (Object::release): Likewise.
2354 (Object::is_incremental): New function.
2355 (Object::get_mtime): New function.
2356 (Object::for_all_local_got_entries): New function.
2357 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2358 (Object::set_is_in_system_directory): New function.
2359 (Object::is_in_system_directory): New function.
2360 (Object::do_is_incremental): New function.
2361 (Object::do_get_mtime): New function.
2362 (Object::do_for_all_local_got_entries): New function.
2363 (Object::is_in_system_directory_): New data member.
2364 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2365 (class Sized_relobj_base): New class.
2366 (class Sized_relobj): Derive from Sized_relobj_base.
2367 (class Sized_relobj::Symbols): Redeclare from base class.
2368 (class Sized_relobj::local_got_offset_list): Remove.
2369 (class Sized_relobj::Output_sections): Redeclare from base class.
2370 (class Sized_relobj::do_for_all_local_got_entries): New function.
2371 (class Sized_relobj::write_local_symbols): Add offset parameter.
2372 (class Sized_relobj::local_symbol_offset_): Update comment.
2373 (class Sized_relobj::local_dynsym_offset_): Update comment.
2374 * options.cc (Input_arguments::add_file): Remove const.
2375 * options.h (Input_file_argument::Input_file_argument):
2376 Initialize arg_serial_ (all constructors).
2377 (Input_file_argument::set_arg_serial): New function.
2378 (Input_file_argument::arg_serial): New function.
2379 (Input_file_argument::arg_serial_): New data member.
2380 (Input_arguments::Input_arguments): Initialize file_count_.
2381 (Input_arguments::add_file): Remove const.
2382 (Input_arguments::number_of_input_files): New function.
2383 (Input_arguments::file_count_): New data member.
2384 (Command_line::number_of_input_files): Call
2385 Input_arguments::number_of_input_files.
2386 * output.cc (Output_segment_headers::Output_segment_headers):
2388 (Output_section::Input_section::current_data_size): New function.
2389 (Output_section::Output_section): Initialize new data members.
2390 (Output_section::add_input_section): Don't do merge sections for
2391 an incremental link; allocate space from free list for an
2393 (Output_section::add_output_section_data): Allocate space from
2394 free list for an incremental update.
2395 (Output_section::update_data_size): New function.
2396 (Output_section::set_fixed_layout): New function.
2397 (Output_section::reserve): New function.
2398 (Output_segment::set_section_addresses): Remove const.
2399 (Output_segment::set_section_list_addresses): Remove const; allocate
2400 space from free list for an incremental update.
2401 (Output_segment::set_offset): Adjust size of RELRO segment for an
2403 * output.h (Output_data::current_data_size): Move here from
2405 (Output_data::pre_finalize_data_size): New function.
2406 (Output_data::update_data_size): New function.
2407 (Output_section_headers::update_data_size): new function.
2408 (Output_section_data_build::current_data_size): Move to Output_data.
2409 (Output_data_strtab::update_data_size): New function.
2410 (Output_section::current_data_size): Move to Output_data.
2411 (Output_section::set_fixed_layout): New function.
2412 (Output_section::has_fixed_layout): New function.
2413 (Output_section::reserve): New function.
2414 (Output_section::update_data_size): New function.
2415 (Output_section::has_fixed_layout_): New data member.
2416 (Output_section::free_list_): New data member.
2417 (Output_segment::set_section_addresses): Remove const.
2418 (Output_segment::set_section_list_addresses): Remove const.
2419 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2421 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2423 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2424 parameter when calling Add_symbols constructor; store argument
2425 serial number for members of a lib group.
2426 (Add_symbols::locks): Allow case where token == NULL.
2427 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2428 (Read_member::~Read_member): New function.
2429 (Read_member::is_runnable): New function.
2430 (Read_member::locks): New function.
2431 (Read_member::run): New function.
2432 (Check_script::~Check_script): New function.
2433 (Check_script::is_runnable): New function.
2434 (Check_script::locks): New function.
2435 (Check_script::run): New function.
2436 (Check_library::~Check_library): New function.
2437 (Check_library::is_runnable): New function.
2438 (Check_library::locks): New function.
2439 (Check_library::run): New function.
2440 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2441 (Add_symbols::library_): New data member.
2442 (class Read_member): New class.
2443 (class Check_script): New class.
2444 (class Check_library): New class.
2445 * reloc.cc (Read_relocs::is_runnable): Allow case where
2447 (Read_relocs::locks): Likewise.
2448 (Scan_relocs::locks): Likewise.
2449 (Relocate_task::locks): Likewise.
2450 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2452 (Sized_relobj::incremental_relocs_scan): Fix comment.
2453 (Sized_relobj::do_relocate): Pass output file offset to
2454 write_local_symbols.
2455 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2456 from class declaration.
2457 * script.cc (read_input_script): Allocate Script_info; pass
2458 argument serial number to report_script.
2459 * script.h (class Script_info): Move to incremental.h.
2460 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2461 * symtab.h (Symbol_table::add_from_incrobj): New function.
2462 (Symbol_table::set_file_offset): New function.
2466 * incremental-dump.cc (dump_incremental_inputs): Change signature
2467 to take a Sized_incremental_binary; change caller. Use readers
2468 in Sized_incremental_binary.
2470 (Sized_incremental_binary::find_incremental_inputs_sections):
2471 Rename do_find_incremental_inputs_sections to this.
2472 (Sized_incremental_binary::setup_readers): New function.
2473 (Sized_incremental_binary::do_check_inputs): Check
2474 has_incremental_info_ flag; move setup code to setup_readers;
2476 (Sized_incremental_binary::do_file_is_unchanged): New function.
2477 (Sized_incremental_binary::do_get_input_reader): New function.
2478 * incremental.h (class Incremental_binary): Move to end of file.
2479 (Incremental_binary::file_is_unchanged): New function.
2480 (Incremental_binary::do_file_is_unchanged): New function.
2481 (Incremental_binary::Input_reader): New class.
2482 (Incremental_binary::get_input_reader): New function.
2483 (class Sized_incremental_binary): Move to end of file.
2484 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2485 input section reader classes.
2486 (Sized_incremental_binary::has_incremental_info): New function.
2487 (Sized_incremental_binary::inputs_reader): New function.
2488 (Sized_incremental_binary::symtab_reader): New function.
2489 (Sized_incremental_binary::relocs_reader): New function.
2490 (Sized_incremental_binary::got_plt_reader): New function.
2491 (Sized_incremental_binary::do_file_is_unchanged): New function.
2492 (Sized_incremental_binary::Sized_input_reader): New class.
2493 (Sized_incremental_binary::get_input_reader): New function.
2494 (Sized_incremental_binary::find_incremental_inputs_sections):
2495 Rename do_find_incremental_inputs_sections to this.
2496 (Sized_incremental_binary::setup_readers): New function.
2497 (Sized_incremental_binary::has_incremental_info_): New data member.
2498 (Sized_incremental_binary::inputs_reader_): New data member.
2499 (Sized_incremental_binary::symtab_reader_): New data member.
2500 (Sized_incremental_binary::relocs_reader_): New data member.
2501 (Sized_incremental_binary::got_plt_reader_): New data member.
2502 (Sized_incremental_binary::current_input_file_): New data member.
2507 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2512 * archive.cc (Archive::include_member): Adjust call to report_object.
2513 (Add_archive_symbols::run): Add script_info to call to
2514 report_archive_begin.
2515 (Lib_group::include_member): Adjust call to report_object.
2516 (Add_lib_group_symbols::run): Adjust call to report_object.
2517 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2518 blocks. Add object count for script input files.
2519 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2520 script_info parameter; change all callers.
2521 (Incremental_inputs::report_object): Add script_info parameter;
2523 (Incremental_inputs::report_script): Store backpointer to
2524 incremental info entry.
2525 (Output_section_incremental_inputs::set_final_data_size): Record
2526 additional information for scripts.
2527 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2528 * incremental.h (Incremental_script_entry::add_object): New function.
2529 (Incremental_script_entry::get_object_count): New function.
2530 (Incremental_script_entry::get_object): New function.
2531 (Incremental_script_entry::objects_): New data member; adjust
2533 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2534 (Incremental_inputs::report_object): Add script_info parameter.
2535 (Incremental_inputs_reader::get_object_count): New function.
2536 (Incremental_inputs_reader::get_object_offset): New function.
2537 * options.cc (Input_arguments::add_file): Return reference to
2539 * options.h (Input_argument::set_script_info): New function.
2540 (Input_argument::script_info): New function.
2541 (Input_argument::script_info_): New data member; adjust all
2543 (Input_file_group::add_file): Return reference to new input argument.
2544 (Input_file_lib::add_file): Likewise.
2545 (Input_arguments::add_file): Likewise.
2546 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2547 * script.cc (Parser_closure::Parser_closure): Add script_info
2548 parameter; adjust all callers.
2549 (Parser_closure::script_info): New function.
2550 (Parser_closure::script_info_): New data member.
2551 (read_input_script): Report scripts earlier to incremental info.
2552 (script_add_file): Set script_info in Input_argument.
2553 (script_add_library): Likewise.
2554 * script.h (Script_options::Script_info): Rewrite class.
2558 * archive.cc (Library_base::should_include_member): Move
2559 method here from class Archive.
2560 (Archive::Archive): Initialize base class.
2561 (Archive::should_include_member): Move to base class.
2562 (Archive::do_for_all_unused_symbols): New function.
2563 (Add_archive_symbols::run): Remove redundant access to
2565 (Lib_group::Lib_group): Initialize base class.
2566 (Lib_group::do_filename): New function.
2567 (Lib_group::include_member): Pass pointer to Lib_group to
2569 (Lib_group::do_for_all_unused_symbols): New function.
2570 (Add_lib_group_symbols::run): Report archive information for
2572 * archive.h (class Library_base): New base class.
2573 (class Archive): Derive from Library_base.
2574 (Archive::filename): Move to base class.
2575 (Archive::set_incremental_info): Likewise.
2576 (Archive::incremental_info): Likewise.
2577 (Archive::Should_include): Likewise.
2578 (Archive::should_include_member): Likewise.
2579 (Archive::Armap_entry): Remove.
2580 (Archive::Unused_symbol_iterator): Remove.
2581 (Archive::unused_symbols_begin): Remove.
2582 (Archive::unused_symbols_end): Remove.
2583 (Archive::do_filename): New function.
2584 (Archive::do_get_mtime): New function.
2585 (Archive::do_for_all_unused_symbols): New function.
2586 (Archive::task_): Move to base class.
2587 (Archive::incremental_info_): Likewise.
2588 (class Lib_group): Derive from Library_base.
2589 (Lib_group::do_filename): New function.
2590 (Lib_group::do_get_mtime): New function.
2591 (Lib_group::do_for_all_unused_symbols): New function.
2592 (Lib_group::task_): Move to base class.
2593 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2595 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2597 * incremental.cc (Incremental_inputs::report_archive_begin):
2598 Use Library_base; call library's get_mtime; add incremental inputs
2599 entry before members.
2600 (class Unused_symbol_visitor): New class.
2601 (Incremental_inputs::report_archive_end): Use Library_base; use
2602 visitor class to record unused symbols; don't add incremental inputs
2603 entry after members.
2604 (Incremental_inputs::report_object): Use Library_base.
2606 (Incremental_archive_entry::Incremental_archive_entry): Remove
2607 unused Archive parameter.
2608 (Incremental_inputs::report_archive_begin): Use Library_base.
2609 (Incremental_inputs::report_archive_end): Likewise.
2610 (Incremental_inputs::report_object): Likewise.
2611 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2613 * object.h (Object::for_all_global_symbols): New function.
2614 (Object::do_for_all_global_symbols): New function.
2615 (Sized_relobj::do_for_all_global_symbols): New function.
2616 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2618 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2623 * archive.cc (Archive::interpret_header): Return -1 if something
2624 goes wrong. Change callers accordingly.
2628 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2629 * testsuite/Makefile.in: Regenerate.
2633 * plugin.cc (get_view): New.
2634 (Plugin::load): Pass get_view to the plugin.
2635 (Plugin_manager::get_view): New.
2639 * testsuite/final_layout.sh: Rewrite to not use dc.
2640 * testsuite/relro_test.sh: Fail if dc is not present.
2644 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2646 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2647 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2649 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2650 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2654 * script-sections.cc (Sort_output_sections::script_compare):
2655 Rename from is_before, change return type.
2656 (Sort_output_sections::operator()): Adjust accordingly.
2661 * testsuite/odr_violation2.cc: Add comment to make all error line
2662 numbers double digits.
2663 * testsuite/debug_msg.sh: Adjust expected errors.
2667 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2668 but mark earlier ones as non-canonical
2669 (offset_to_iterator): Update search target and example
2670 (do_addr2line): Return extra lines in a vector*
2671 (format_file_lineno): Extract from do_addr2line
2672 (one_addr2line): Add vector* out-param
2673 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2674 when a lineno entry appeared last for its instruction
2675 (Dwarf_line_info): Add vector* out-param
2676 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2677 * symtab.cc (Odr_violation_compare): Include the lineno in the
2679 (linenos_from_loc): New. Combine the canonical line for an
2680 address with its other lines.
2681 (True_if_intersect): New. Helper functor to make
2682 std::set_intersection a query.
2683 (detect_odr_violations): Compare sets of lines instead of just
2684 one line for each function. This became less deterministic, but
2685 has fewer false positives.
2686 * symtab.h: Declarations.
2687 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2688 mix an optimized and non-optimized object in the same binary
2689 (odr_violation2.so): Same.
2690 * testsuite/Makefile.in: Regenerate from Makefile.am.
2691 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2692 * testsuite/debug_msg.sh: Update line numbers and add
2694 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2695 non-optimized context.
2696 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2697 isn't inlined, and use OdrDerived in an optimized context.
2698 * testsuite/odr_header1.h: Defines OdrDerived, where
2699 optimization will change the
2700 first-instruction-in-the-destructor's file and line number.
2701 * testsuite/odr_header2.h: Defines OdrBase.
2705 * fileread.cc (File_read::clear_views): Don't delete the whole
2711 * fileread.cc: #include <climits>.
2712 (GOLD_IOV_MAX): Define.
2713 (File_read::read_multiple): Limit number of entries by iov_max.
2714 * fileread.h (class File_read): Always set max_readv_entries to
2720 * options.h (class General_options): Add -dy and -dn.
2724 * testsuite/script_test_9.t: Add TLS segment.
2728 * configure.ac: Add check for gnu_indirect_function support in
2729 the toolchain building binutils.
2730 * configure: Rebuild.
2734 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2735 plugin only symbols.
2736 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2737 in plugin files as not needed in the symbol table.
2741 * output.cc (Output_section::add_input_section): Delay fill
2742 generation for section ordering.
2747 * object.h (class Sized_relobj): Remove clear_local_symbols.
2748 * reloc.cc (Sized_relobj::do_relocate): Don't call
2749 clear_local_symbols.
2753 * plugin.cc (is_visible_from_outside): Return true for symbols
2758 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2763 * icf.h (is_section_foldable_candidate): Change type of parameter
2765 * icf.cc (Icf::find_identical_sections): Change type of local variable
2766 section_name to be std::string.
2767 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2771 * script.cc (script_add_extern): Rewrite to use
2772 add_symbol_reference.
2776 * icf.cc (get_section_contents): Always lock section's object.
2780 * options.h (class General_options): Accept
2781 --no-detect-odr-violations.
2785 * version.cc (version_string): Bump to 1.11.
2789 * plugin.cc (class Plugin_rescan): Define new class.
2790 (Plugin_manager::claim_file): Set any_claimed_.
2791 (Plugin_manager::save_archive): New function.
2792 (Plugin_manager::save_input_group): New function.
2793 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2795 (Plugin_manager::new_undefined_symbol): New function.
2796 (Plugin_manager::rescan): New function.
2797 (Plugin_manager::rescannable_defines): New function.
2798 (Plugin_manager::add_input_file): Set any_added_.
2799 * plugin.h (class Plugin_manager): define new fields rescannable_,
2800 undefined_symbols_, any_claimed_, and any_added_. Declare
2801 Plugin_rescan as friend. Declare new functions.
2802 (Plugin_manager::Rescannable): Define type.
2803 (Plugin_manager::Rescannable_list): Define type.
2804 (Plugin_manager::Undefined_symbol_list): Define type.
2805 (Plugin_manager::Plugin_manager): Initialize new fields.
2806 * archive.cc (Archive::defines_symbol): New function.
2807 (Add_archive_symbols::run): Pass archive to plugins if any.
2808 * archive.h (class Archive): Declare defines_symbol.
2809 * readsyms.cc (Input_group::~Input_group): New function.
2810 (Finish_group::run): Pass input_group to plugins if any.
2811 * readsyms.h (class Input_group): Declare destructor.
2812 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2817 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2819 (Layout::set_segment_offsets): Reset increase_relro before calling
2820 set_section_addresses a second time.
2824 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2825 sections before NOBITS sections.
2829 * version.cc (print_version): Update copyright to 2011.
2833 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2834 of OS to this->add. Add OD parameter to second form of the function.
2838 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2839 second of two consecutive entries with same offset.
2843 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2844 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2845 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2846 to avoid unneeded links against $(LDADD).
2847 * testsuite/Makefile.in: Regenerate.
2852 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2853 for R_X86_64_32 and R_X86_64_PC32.
2854 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2855 ver_matching_def_pic.o.
2856 (ver_matching_def_pic.o): New target.
2860 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2861 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2862 Move definition before File_read::View member definitions.
2863 (File_read::View::~View): Initialize and hold lock before
2864 updating current_mapped_bytes.
2868 * dwarf_reader.cc: Remove outdated comment.
2869 * gold-threads.cc: Fix typo in error message.
2870 * archive.cc: Fix typos in comments.
2871 * archive.h: Likewise.
2872 * arm-reloc-property.cc: Likewise.
2873 * arm-reloc-property.h: Likewise.
2874 * arm-reloc.def: Likewise.
2876 * attributes.h: Likewise.
2877 * cref.cc: Likewise.
2878 * ehframe.cc: Likewise.
2879 * fileread.h: Likewise.
2881 * i386.cc: Likewise.
2883 * incremental.h: Likewise.
2884 * int_encoding.cc: Likewise.
2885 * layout.h: Likewise.
2886 * main.cc: Likewise.
2887 * merge.h: Likewise.
2888 * object.cc: Likewise.
2889 * object.h: Likewise.
2890 * options.cc: Likewise.
2891 * readsyms.cc: Likewise.
2892 * reduced_debug_output.cc: Likewise.
2893 * reloc.cc: Likewise.
2894 * script-sections.cc: Likewise.
2895 * sparc.cc: Likewise.
2896 * symtab.h: Likewise.
2897 * target-reloc.h: Likewise.
2898 * target.cc: Likewise.
2899 * target.h: Likewise.
2900 * timer.cc: Likewise.
2901 * timer.h: Likewise.
2902 * x86_64.cc: Likewise.
2906 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2908 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2909 parameter; change all callers.
2910 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2911 * options.h (warn_execstack): New option.
2915 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2916 like function call relocations.
2920 * archive.cc (Archive::get_elf_object_for_member): Permit
2921 punconfigured to be NULL.
2922 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2923 (Archive::include_member): Pass NULL to get_elf_object_for_member
2924 if we searched for the archive and this is the first included
2929 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2930 track_relocs_type_ field.
2931 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2932 Set track_relocs_type_.
2933 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2934 contents when using RELA relocs.
2935 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2937 * reloc.cc (Track_relocs::next_addend): New function.
2938 * reloc.h (class Track_relocs): Declare next_addend.
2942 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2947 * README: Update compilers known to work and fail.
2951 * configure.in: For --enable-gold, handle value `default' instead of
2952 `both*'. Always install ld as ld.bfd, install as ld if gold is
2954 * configure: Regenerate.
2958 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2959 and right_alignment to be zero. Store result alignment only if it is
2960 greater than existing alignment.
2965 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2966 Check for ".zdebug_line".
2971 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2972 by reference; adjust all callers.
2973 * output.cc (Output_segment::set_section_addresses): Adjust references
2974 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2976 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2977 end at page boundary.
2982 * layout.cc (Layout::choose_output_section): Transform names of
2983 compressed sections even when using a script with a SECTIONS clause.
2984 (Layout::output_section_name): Remove code to transform
2985 compressed debug section names.
2986 * output.cc (Output_section::add_input_section): Use uncompressed
2987 section size when tracking input sections.
2991 * symtab.h (Symbol::NON_PIC_REF): Remove.
2992 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2993 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2994 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2995 (Symbol::use_plt_offset): Take a flags argument and pass it
2996 directly to needs_dynamic_reloc. Restrict check for undefined
2997 weak symbols to function calls.
2998 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2999 (Target_arm::Scan::global): Use it.
3000 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3001 (Target_arm::Relocate::relocate): Likewise.
3002 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3003 parameter with an r_type parameter. Use get_reference_flags
3005 (Target_arm::Relocate::relocate): Update accordingly.
3006 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3007 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3008 (Target_i386::Scan::global): Likewise.
3009 (Target_i386::Relocate::relocate): Likewise.
3010 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3011 parameter with an r_type parameter. Use get_reference_flags
3013 (Target_i386::Relocate::relocate): Update accordingly.
3014 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3015 (Target_powerpc::Scan::global): Use it.
3016 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3017 (Target_powerpc::Relocate::relocate): Likewise.
3018 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3019 (Target_sparc::Scan::global): Use it.
3020 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3021 (Target_sparc::Relocate::relocate): Likewise.
3022 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3023 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3024 (Target_x86_64::Scan::global): Likewise.
3025 (Target_x86_64::Relocate::relocate): Likewise.
3030 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3031 (Arm_exidx_merge_section::section_contents_): New data member.
3032 (Arm_input_section::Arm_input_section): Initialize original_contents_.
3033 (Arm_input_section::~Arm_input_section): De-allocate memory.
3034 (Arm_input_section::original_contents_): New data member.
3035 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3036 in parameters instead of calling Object::section_contents without
3038 (Arm_output_section::group_section): New parameter TASK. Pass it
3039 to callees that need locking objects.
3040 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
3041 to lock EXIDX input sections. Fix a formatting issue. Call
3042 Arm_exidx_merged_section::build_contents to create merged section
3044 (Arm_output_section::create_stub_group): New parameter TASK. Use it
3045 to lock object of stub table owner.
3046 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3047 TEXT_SIZE to initialize data member TEXT_SIZE_.
3048 (Arm_exidx_input_section::addralign): Fix typo in comment.
3049 (Arm_exidx_input_section::text_size): New method.
3050 (Target_arm::do_relax): New parameter TASK. Pass it to callees
3051 that require locking objects. Lock objects before scanning for stubs
3052 and updating local symbols.
3053 (Arm_input_section<big_endian>::init): Copy contents of original
3055 (Arm_input_section<big_endian>::do_write): Use saved contents of
3056 original input section instead of calling Object::section_contents
3058 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3059 size without calling Object::section_size().
3060 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3061 for size. Allocate a buffer for merged EXIDX entries.
3062 (Arm_exidx_merged_section::build_contents): New method.
3063 (Arm_exidx_merged_section::do_write): Move merge section contents
3064 building code to Arm_exidx_merged_section::build_contetns. Write
3065 out contetns in buffer instead of building it on the fly.
3066 (Arm_relobj::make_exidx_input_section): Also pass text section size
3067 to Arm_exidx_input_section constructor.
3068 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
3069 (Arm_dynobj::do_read_symbols): Fix memory leak.
3070 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3071 * target.h: (class Task): Add forward declaration.
3072 (Target::relax): Add new parameter TASK and pass it to
3074 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
3079 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3080 object when reading from the file.
3081 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3083 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3084 when reading section contents.
3085 (get_section_contents): Likewise.
3086 (icf::find_identical_sections): Likewise.
3087 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3088 object when reading from the file.
3089 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3090 the object when doing deferred section layout.
3095 * script.h (class Symbol_assignment: name): New member. Returns
3096 the name of the symbol.
3097 * scrfipt.cc (Script_options::is_pending_assignment): New member.
3098 Returns true if the given symbol name is on the list of
3099 assignments wating to be processed.
3100 * archive.cc (should_incldue_member): If the symbol is undefined,
3101 check to see if it is on the list of symbols pending assignment.
3105 * script-sections.cc (Script_sections::find_memory_region): Check
3106 for a NULL output section pointer.
3110 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3111 Output_section::add_relaxed_input_section.
3112 * output.cc (Output_section::add_relaxed_input_section): Add new
3113 arguments LAYOUT and NAME. Set section order index.
3114 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3115 Copy section order index.
3116 * output.h (Output_section::add_relaxed_input_section): Add new
3117 arguments LAYOUT and NAME.
3121 * testsuite/Makefile.am: Move gcctestdir/ld rule to
3122 NATIVE_OR_CROSS_LINKER.
3123 * testsuite/Makefile.in: Regenerate.
3127 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3128 without SHF_LINK_ORDER flags.
3129 * layout.cc (Layout::choose_output_section): Do not filter
3130 SHF_LINK_ORDER flag in a relocatable link.
3134 * output.h (Output_segment::set_section_addresses): Change function
3135 signature. Update all callers.
3136 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3138 (Output_segment::set_section_addresses): Align after last TLS
3139 section. Add padding before last relro section instead of after.
3143 * gold/arm.cc (Target_arm::got_section): Use correct order and set
3144 GOT output section to be writable.
3148 * debug.h (DEBUG_INCREMENTAL): New flag.
3149 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3150 * gold.cc (queue_initial_tasks): Check parameters for incremental link
3152 * incremental.cc (report_command_line): Ignore all forms of
3154 * layout.cc (Layout::Layout): Check parameters for incremental link
3156 * options.cc (General_options::parse_incremental): New function.
3157 (General_options::parse_no_incremental): New function.
3158 (General_options::parse_incremental_full): New function.
3159 (General_options::parse_incremental_update): New function.
3160 (General_options::incremental_mode_): New data member.
3161 (General_options::finalize): Check incremental_mode_.
3162 * options.h (General_options): Update help text for --incremental.
3163 Add --no-incremental, --incremental-full, --incremental-update.
3164 (General_options::Incremental_mode): New enum type.
3165 (General_options::incremental_mode): New function.
3166 (General_options::incremental_mode_): New data member.
3167 * parameters.cc (Parameters::incremental_mode_): New data member.
3168 (Parameters::set_options): Set incremental_mode_.
3169 (Parameters::set_incremental_full): New function.
3170 (Parameters::incremental): New function.
3171 (Parameters::incremental_update): New function.
3172 (set_parameters_incremental_full): New function.
3173 * parameters.h (Parameters::set_incremental_full): New function.
3174 (Parameters::incremental): New function.
3175 (Parameters::incremental_update): New function.
3176 (Parameters::incremental_mode_): New data member.
3177 (set_parameters_incremental_full): New function.
3178 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3179 incremental link mode.
3180 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3181 (Sized_relobj::do_relocate_sections): Likewise.
3182 * testsuite/Makefile.am (incremental_test): Use --incremental-full
3184 * testsuite/Makefile.in: Regenerate.
3185 * testsuite/incremental_test.sh: Filter all forms of --incremental.
3189 * script-sections.h (class Script_sections): Make
3190 Sections_elements typedef public.
3191 * script-sections.cc (class Sort_output_sections): Add elements_
3192 field. Add constructor which sets it; change all callers.
3193 (Sort_output_sections::is_before): New function.
3194 (Sort_output_sections::operator()): Call is_before.
3195 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3197 * testsuite/script_test_10.sh: New test. Test script section
3199 * testsuite/script_test_10.t: Likewise.
3200 * testsuite/script_test_10.s: Likewise.
3201 * testsuite/Makefile.am: Wrap the cross linker tests and the
3202 common tests into NATIVE_OR_CROSS_LINKER.
3203 (check_SCRIPTS): Add script_test_10.sh.
3204 (check_DATA): Add script_test_10.stdout.
3205 (script_test_10.o, script_test_10): New targets.
3206 (script_test_10.stdout): New target.
3207 * configure, testsuite/Makefile.in: Regenerate.
3211 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3212 error for the deprecated relocations.
3213 (Target_arm::Scan::global): Likewise.
3214 (Target_arm::Relocate::relocate): Likewise.
3218 * fileread.cc (Input_file::find_file): Initialize *found_name
3219 and *namep when using the fallback search for case 4.
3223 * options.h (class General_options): Redefine -z lazy as an alias for
3224 the negation of -z now.
3228 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3233 * script-sections.cc(class Memory_region): Remove
3234 current_lma_offset_ field. Rename current_vma_offset_ to
3235 current_offset_. Add last_section_ field.
3236 (Memory_region::get_current_vma_address): Rename to
3237 get_current_address.
3238 (Memory_region::get_current_lma_address): Delete.
3239 (Memory_region::increment_vma_offset): Rename to
3241 (Memory_region::increment_lma_offset): Delete.
3242 (Memory_region::attributes_compatible): New method. Returns
3243 true if the provided section is compatible with the region.
3244 (Memory_region::get_last_section): New method. Returns the last
3245 section to use the region.
3246 (Memory_region::set_last_section): New method. Stores the last
3247 section to use the region.
3248 (Script_sections::block_in_region): New method. Returns true if
3249 a block of memory is contained within a region.
3250 (Script_sections::find_memory_region): New method. Locates a
3251 memory region to be used to set a VMA or LMA address.
3252 (Output_section_definition::set_section_addresses): Add code to
3253 check for addresses set by memory regions.
3254 (Output_segment::set_section_addresses): Remove memory region
3256 (Script_sections::create_segment): Add a warning if a header
3257 segment is created outside of any region.
3258 * script-sections.h (class Script_sections): Add prototypes for
3259 find_memory_region and block_in_region methods.
3260 * testsuite/memory_test.s: Use .long instead of .word.
3261 * testsuite/memory_test.t: Add some more output sections.
3262 * testsuite/memory_test.sh: Update expected output.
3266 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3267 defintion to symtab.h
3268 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3269 declaration to defintion.
3273 * expression.cc (eval): Replace dummy argument with NULL.
3274 (eval_maybe_dot): Check for a NULL result section pointer.
3275 (Symbol_expression::value): Likewise.
3276 (Dot_expression::value): Likewise.
3277 (BINARY_EXPRESSION): Likewise.
3278 (Max_expression::value): Likewise.
3279 (Min_expression::value): Likewise.
3280 (Absolute_expression::value): Likewise.
3281 (Addr_expression::value_from_output_section): Likewise.
3282 (Loaddddr_expression::value_from_output_section): Likewise.
3283 (Segment_start_expression::value): Likewise.
3284 * script-sections.cc
3285 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3287 (Sections_elememt_dot_assignment::set_section_addresses):
3289 (Output_data_expression::do_write_to_buffer): Likewise.
3290 (Output_section_definition::finalize_symbols): Likewise.
3291 (Output_section_definition::set_section_addresses): Likewise.
3295 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3299 * target.h (Target::can_icf_inline_merge_sections): New virtual
3301 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3303 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3305 * icf.cc (get_section_contents): Inline merge sections only when
3310 * configure: Regenerate.
3314 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3315 * testsuite/Makefile.am (memory_test.o): New target.
3316 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3318 * testsuite/Makefile.in: Rebuild.
3322 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3323 defintion if relocation uses GOT entries of the symbol.
3324 * testsuite/icf_safe_test.sh: Fix test.
3325 * testsuite/icf_safe_so_test.sh: Fix test.
3329 * script_sections.cc (class Memory_region): Remove "NULL" from
3330 vector initializations.
3334 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3335 Resolve forwarding symbols.
3339 * gold/testsuite/script_test_3.t: Add ARM special sections.
3340 * gold/testsuite/script_test_4.t: Same.
3341 * gold/testsuite/script_test_5.t: Same.
3342 * gold/testsuite/script_test_6.t: Same.
3343 * gold/testsuite/script_test_7.t: Same.
3344 * gold/testsuite/script_test_7.t: Same.
3345 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3349 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3350 (Target_x86_64::Relocate::relocate_tls): Replace check for
3351 saw_tls_block_reloc_ with test for executable section.
3355 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3356 position-independent executables to shared libraries need dynamic
3358 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3359 position-independent executables.
3360 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3361 * testsuite/Makefile.in: Regenerate.
3366 * testsuite/memory_test.t: Discard any sections that are not
3372 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3373 "This::" to work around a bug in gcc 4.2.
3375 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3379 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3380 sections with different PF_X flags in the same segment.
3381 (Layout::find_first_load_seg): Search all segments to find the first
3383 * options.h (rosegment): New.
3387 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3391 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3392 (Arm_relobj::do_relocate_sections): Add new parameter for output
3393 file to match the parent.
3394 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3395 of local symbols instead of input values. Update code to track
3396 changes in gold::relocate_section.
3397 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3398 (Sized_relobj::compute_final_local_value_internal): New methods.
3399 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3400 body into private version of Sized_relobj::compute_final_local_value.
3401 Call the inline method.
3402 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3403 merged symbol value if there is one.
3404 (Symbol_value::has_output_value): New method defintiion.
3405 (Sized_relobj::Compute_final_local_value_status): New enum type.
3406 (Sized_relobj::compute_final_local_value): New methods.
3407 (Sized_relobj::compute_final_local_value_internal): New methods.
3408 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3409 and arm_cortex_a8.sh.
3410 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3411 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3413 * Makefile.in: Regenerate.
3414 * testsuite/arm_bl_out_of_range.s: Update test.
3415 * testsuite/thumb_bl_out_of_range.s: Ditto.
3416 * testsuite/thumb_blx_out_of_range.s: Ditto.
3417 * testsuite/arm_branch_out_of_range.sh: New file.
3418 * testsuite/arm_cortex_a8.sh: Ditto.
3419 * testsuite/arm_cortex_a8_b.s: Ditto.
3420 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3421 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3422 * testsuite/arm_cortex_a8_bl.s: Ditto.
3423 * testsuite/arm_cortex_a8_blx.s: Ditto.
3424 * testsuite/arm_cortex_a8_local.s: Ditto.
3425 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3426 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3430 * Makefile.am (memory_test.stdout): Run readelf with -W.
3431 * Makefile.in: Regenerate.
3432 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3437 * script-sections.cc (Script_sections::add_memory_region): Convert
3438 field precision to int.
3439 * script.cc (script_set_section_region, script_set_section_region):
3440 Convert field precision to int.
3444 * arm.cc (do_finalize_sections): Create the __exidx_start and
3445 __exdix_end symbols even when the section is missing.
3449 * README: Remove claim that MEMORY is not supported.
3450 * expression.cc (script_exp_function_origin)
3451 (script_exp_function_length): Move from here to ...
3452 * script.cc: ... here.
3453 (script_set_section_region, script_add_memory)
3454 (script_parse_memory_attr, script_include_directive): New
3456 * script-sections.cc
3457 (class Memory_region): New class.
3458 (class Output_section_definition): Add set_memory_region,
3459 set_section_vma, set_section_lma and get_section_name methods.
3460 (class Script_Sections): Add add_memory_region,
3461 find_memory_region, find_memory_region_origin,
3462 find_memory_region_length and set_memory_region methods.
3463 Have set_section_addresses method walk the list of set memory
3465 Extend the print methos to display memory regions.
3466 * script-sections.h: Add prototypes for new methods.
3467 Add enum for MEMORY region attributes.
3468 * yyscript.y: Add support for parsing MEMORY regions.
3469 * script-c.h: Add prototypes for new functions.
3470 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3471 * testsuite/Makefile.in: Regenerate.
3472 * testsuite/memory_test.sh: New script.
3473 * testsuite/memory_test.s: New assembler source file.
3474 * testsuite/memory_test.t: New linker script.
3478 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3479 reference override an existing dynamic weak reference.
3480 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3481 * testsuite/Makefile.in: Regenerate.
3482 * testsuite/dyn_weak_ref.sh: New file.
3483 * testsuite/dyn_weak_ref_1.c: Ditto.
3484 * testsuite/dyn_weak_ref_2.c: Ditto.
3488 * incremental.h (class Incremental_input_entry): Add virtual
3493 * testsuite/start_lib_test_3.c: Mark t3 as used.
3497 * options.cc (version_script): Fix small typo in previous
3502 * archive.cc: Formatting fixes: Remove whitespace between
3503 typename and following asterisk. Remove whitespace between
3504 function name and opening parenthesis.
3505 * archive.h: Likewise.
3507 * attributes.cc: Likewise.
3508 * attributes.h: Likewise.
3509 * common.cc: Likewise.
3510 * copy-relocs.cc: Likewise.
3511 * dirsearch.h: Likewise.
3512 * dynobj.cc: Likewise.
3513 * ehframe.cc: Likewise.
3514 * ehframe.h: Likewise.
3515 * expression.cc: Likewise.
3516 * fileread.cc: Likewise.
3517 * fileread.h: Likewise.
3519 * gold-threads.cc: Likewise.
3520 * gold.cc: Likewise.
3521 * i386.cc: Likewise.
3523 * incremental-dump.cc: Likewise.
3524 * incremental.cc: Likewise.
3525 * layout.cc: Likewise.
3526 * layout.h: Likewise.
3527 * main.cc: Likewise.
3528 * merge.cc: Likewise.
3529 * merge.h: Likewise.
3530 * object.cc: Likewise.
3531 * object.h: Likewise.
3532 * options.cc: Likewise.
3533 * options.h: Likewise.
3534 * output.cc: Likewise.
3535 * output.h: Likewise.
3536 * plugin.cc: Likewise.
3537 * plugin.h: Likewise.
3538 * powerpc.cc: Likewise.
3539 * reloc.cc: Likewise.
3540 * script-c.h: Likewise.
3541 * script-sections.cc: Likewise.
3542 * script.cc: Likewise.
3543 * stringpool.cc: Likewise.
3544 * symtab.cc: Likewise.
3545 * symtab.h: Likewise.
3546 * target.cc: Likewise.
3547 * timer.cc: Likewise.
3548 * timer.h: Likewise.
3549 * version.cc: Likewise.
3550 * x86_64.cc: Likewise.
3555 * layout.cc (segment_precedes): Sort segments by their physical
3556 addresses, if they have been set.
3560 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3562 (Lib_group::include_member): Unlock object after deleting its
3564 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3570 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3571 constructor, and set_blocker.
3572 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3574 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3575 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3576 * testsuite/Makefile.am (start_lib_test): New test case.
3577 * testsuite/Makefile.in: Regenerate.
3578 * testsuite/start_lib_test_main.c: New file.
3579 * testsuite/start_lib_test_1.c: New file.
3580 * testsuite/start_lib_test_2.c: New file.
3581 * testsuite/start_lib_test_3.c: New file.
3585 * Makefile.in: Rebuild with automake 1.11.1.
3586 * aclocal.m4: Likewise.
3587 * testsuite/Makefile.in: Likewise.
3592 * i386.cc (class Output_data_plt_i386): Update declarations.
3593 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3594 local_ifuncs_ fields.
3595 (Target_i386::do_plt_section_for_global): New function.
3596 (Target_i386::do_plt_section_for_local): New function.
3597 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3598 parameter; change all callers. Initialize global_ifuncs_ and
3599 local_ifuncs_. If doing a static link define __rel_iplt_start and
3601 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3602 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3603 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3605 (Target_i386::make_plt_section): New function, broken out of
3606 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3607 (Target_i386::make_plt_entry): Call make_plt_section.
3608 (Target_i386::make_local_ifunc_plt_entry): New function.
3609 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3610 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3611 R_386_IRELATIVE to switch.
3612 (Target_i386::Scan::global): Likewise.
3613 (Target_i386::Relocate::relocate): Likewise.
3614 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3616 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3617 (Target_x86_64::do_plt_section_for_global): New function.
3618 (Target_x86_64::do_plt_section_for_local): New function.
3619 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3620 parameter; change all callers. If doing a static link define
3621 __rela_iplt_start and __rela_iplt_end.
3622 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3623 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3624 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3626 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3627 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3629 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3630 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3631 R_X86_64_IRELATIVE to switch.
3632 (Target_x86_64::Scan::global): Likewise.
3633 (Target_x86_64::Relocate::relocate): Likewise.
3634 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3636 * target.h (class Target): Add plt_section_for_global and
3637 plt_section_for_local functions. Add do_plt_section_for_global
3638 and do_plt_section_for_local virtual functions.
3639 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3640 clarifying comments.
3641 (Symbol::use_plt_offset): Handle IFUNC symbol.
3642 * object.cc (Sized_relobj::Sized_relobj): Initialize
3644 (Sized_relobj::local_has_plt_offset): New function.
3645 (Sized_relobj::local_plt_offset): New function.
3646 (Sized_relobj::set_local_plt_offset): New function.
3647 (Sized_relobj::do_count): Handle IFUNC symbol.
3648 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3649 a bit away from input_shndx_ field. Add set_is_func_symbol and
3650 is_ifunc_symbol functions.
3651 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3652 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3653 local_plt_offsets_ field.
3654 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3655 * output.h (class Output_section_data): Add non-const
3656 output_section function.
3657 (class Output_data_got): Update declarations.
3658 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3659 Add use_plt_offset parameter to global and local constructors.
3660 Change all callers. Change local_sym_index_ field to 31 bits.
3661 Change GSYM_CODE and CONSTANT_CODE accordingly.
3662 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3663 doing a static link don't set sh_link field.
3664 (Output_data_got::Got_entry::write): Use PLT offset if
3666 (Output_data_got::add_global_plt): New function.
3667 (Output_data_got::add_local_plt): New function.
3668 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3669 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3670 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3671 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3672 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3674 * testsuite/ifunc-sel.h: New file.
3675 * testsuite/ifuncmain1.c: New file.
3676 * testsuite/ifuncmain1vis.c: New file.
3677 * testsuite/ifuncmod1.c: New file.
3678 * testsuite/ifuncdep2.c: New file.
3679 * testsuite/ifuncmain2.c: New file.
3680 * testsuite/ifuncmain3.c: New file.
3681 * testsuite/ifuncmod3.c: New file.
3682 * testsuite/ifuncmain4.c: New file.
3683 * testsuite/ifuncmain5.c: New file.
3684 * testsuite/ifuncmod5.c: New file.
3685 * testsuite/ifuncmain6pie.c: New file.
3686 * testsuite/ifuncmod6.c: New file.
3687 * testsuite/ifuncmain7.c: New file.
3688 * configure, testsuite/Makefile.in: Rebuild.
3693 (Output_section_incremental_inputs::write_input_files): Add cast
3694 to avoid signed/unsigned comparison warning.
3695 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3699 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3703 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3708 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3709 defintion overrides non-weak undef, remember that the original undef
3711 * symtab.cc (Symbol_table::sized_write_global): For undef without
3712 an original weak binding, set binding to global in output.
3713 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3714 * testsuite/Makefile.in: Regenerate.
3715 * testsuite/strong_ref_weak_def.sh: New file.
3716 * testsuite/strong_ref_weak_def_1.c: Ditto.
3717 * testsuite/strong_ref_weak_def_2.c: Ditto.
3721 * testsuite/incremental_test.sh: Rewrite.
3722 * testsuite/incremental_test_1.c: Rewrite.
3723 * testsuite/incremental_test_2.c: Rewrite.
3727 * arm.cc (Target_arm::got_size): Add const.
3728 (Target_arm::got_entry_count): New function.
3729 (Target_arm::plt_entry_count): New function.
3730 (Target_arm::first_plt_entry_offset): New function.
3731 (Target_arm::plt_entry_size): New function.
3732 (Output_data_plt_arm::entry_count): New function.
3733 (Output_data_plt_arm::first_plt_entry_offset): New function.
3734 (Output_data_plt_arm::get_plt_entry_size): New function.
3735 * i386.cc (Target_i386::got_size): Add const.
3736 (Target_i386::got_entry_count): New function.
3737 (Target_i386::plt_entry_count): New function.
3738 (Target_i386::first_plt_entry_offset): New function.
3739 (Target_i386::plt_entry_size): New function.
3740 (Output_data_plt_i386::entry_count): New function.
3741 (Output_data_plt_i386::first_plt_entry_offset): New function.
3742 (Output_data_plt_i386::get_plt_entry_size): New function.
3743 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3744 find_incremental_inputs_sections. Dump incremental_got_plt section.
3745 * incremental.cc: Include target.h.
3746 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3747 parameter. Adjust all callers. Find incremental_got_plt section.
3748 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3750 (Output_section_incremental_inputs::set_final_data_size): Calculate
3751 size of incremental_got_plt section.
3752 (Output_section_incremental_inputs::do_write): Write the
3753 incremental_got_plt section.
3754 (Got_plt_view_info): New struct.
3755 (Local_got_offset_visitor): New class.
3756 (Global_got_offset_visitor): New class.
3757 (Global_symbol_visitor_got_plt): New class.
3758 (Output_section_incremental_inputs::write_got_plt): New function.
3759 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3760 Add parameter. Adjust all callers.
3761 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3762 (Incremental_inputs::got_plt_section): New function.
3763 (Incremental_inputs::got_plt_section_): New data member.
3764 (Incremental_got_plt_reader): New class.
3765 * layout.cc (Layout::create_incremental_info_sections): Add the
3766 incremental_got_plt section.
3767 * object.h (Got_offset_list::get_list): New function.
3768 (Got offset_list::for_all_got_offsets): New function.
3769 (Sized_relobj::local_got_offset_list): New function.
3770 * powerpc.cc (Target_powerpc::got_size): Add const.
3771 (Target_powerpc::got_entry_count): New function.
3772 (Target_powerpc::plt_entry_count): New function.
3773 (Target_powerpc::first_plt_entry_offset): New function.
3774 (Target_powerpc::plt_entry_size): New function.
3775 (Output_data_plt_powerpc::entry_count): New function.
3776 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3777 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3778 * sparc.cc (Target_sparc::got_size): Add const.
3779 (Target_sparc::got_entry_count): New function.
3780 (Target_sparc::plt_entry_count): New function.
3781 (Target_sparc::first_plt_entry_offset): New function.
3782 (Target_sparc::plt_entry_size): New function.
3783 (Output_data_plt_sparc::entry_count): New function.
3784 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3785 (Output_data_plt_sparc::get_plt_entry_size): New function.
3786 * symtab.h (Symbol::got_offset_list): New function.
3787 (Symbol_table::for_all_symbols): New function.
3788 * target.h (Sized_target::got_entry_count): New function.
3789 (Sized_target::plt_entry_count): New function.
3790 (Sized_target::plt_entry_size): New function.
3791 * x86_64.cc (Target_x86_64::got_size): Add const.
3792 (Target_x86_64::got_entry_count): New function.
3793 (Target_x86_64::plt_entry_count): New function.
3794 (Target_x86_64::first_plt_entry_offset): New function.
3795 (Target_x86_64::plt_entry_size): New function.
3796 (Output_data_plt_x86_64::entry_count): New function.
3797 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3798 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3802 * archive.cc: Include incremental.h.
3803 (Archive::Archive): Initialize incremental_info_.
3804 (Archive::include_member): Record archive members in incremental info.
3805 (Add_archive_symbols::run): Record begin and end of an archive in
3807 (Lib_group::include_member): Record objects in incremental info.
3808 * archive.h (Incremental_archive_entry): Forward declaration.
3809 (Archive::set_incremental_info): New member function.
3810 (Archive::incremental_info): New member function.
3811 (Archive::Unused_symbol_iterator): New class.
3812 (Archive::unused_symbols_begin): New member function.
3813 (Archive::unused_symbols_end): New member function.
3814 (Archive::incremental_info_): New data member.
3815 * incremental-dump.cc (find_input_containing_global): New function.
3816 (dump_incremental_inputs): Dump new incremental info sections.
3817 * incremental.cc: Include symtab.h.
3818 (Output_section_incremental_inputs): New class.
3819 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3820 new incremental info sections.
3821 (Sized_incremental_binary::do_check_inputs): Likewise.
3822 (Incremental_inputs::report_archive): Remove.
3823 (Incremental_inputs::report_archive_begin): New function.
3824 (Incremental_inputs::report_archive_end): New function.
3825 (Incremental_inputs::report_object): New function.
3826 (Incremental_inputs::finalize_inputs): Remove.
3827 (Incremental_inputs::report_input_section): New function.
3828 (Incremental_inputs::report_script): Rewrite.
3829 (Incremental_inputs::finalize): Do nothing but finalize string table.
3830 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3831 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3832 (Incremental_inputs::create_data_sections): New function.
3833 (Incremental_inputs::relocs_entsize): New function.
3834 (Output_section_incremental_inputs::set_final_data_size): New function.
3835 (Output_section_incremental_inputs::do_write): New function.
3836 (Output_section_incremental_inputs::write_header): New function.
3837 (Output_section_incremental_inputs::write_input_files): New function.
3838 (Output_section_incremental_inputs::write_info_blocks): New function.
3839 (Output_section_incremental_inputs::write_symtab): New function.
3840 * incremental.h (Incremental_script_entry): Forward declaration.
3841 (Incremental_object_entry): Forward declaration.
3842 (Incremental_archive_entry): Forward declaration.
3843 (Incremental_inputs): Forward declaration.
3844 (Incremental_inputs_header_data): Remove.
3845 (Incremental_inputs_header): Remove.
3846 (Incremental_inputs_header_write): Remove.
3847 (Incremental_inputs_entry_data): Remove.
3848 (Incremental_inputs_entry): Remove.
3849 (Incremental_inputs_entry_write): Remove.
3850 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3851 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3852 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3853 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3855 (Incremental_input_entry): New class.
3856 (Incremental_script_entry): New class.
3857 (Incremental_object_entry): New class.
3858 (Incremental_archive_entry): New class.
3859 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3860 (Incremental_inputs::report_inputs): Remove.
3861 (Incremental_inputs::report_archive): Remove.
3862 (Incremental_inputs::report_archive_begin): New function.
3863 (Incremental_inputs::report_archive_end): New function.
3864 (Incremental_inputs::report_object): Change prototype.
3865 (Incremental_inputs::report_input_section): New function.
3866 (Incremental_inputs::report_script): Change prototype.
3867 (Incremental_inputs::get_reloc_count): New function.
3868 (Incremental_inputs::set_reloc_count): New function.
3869 (Incremental_inputs::create_data_sections): New function.
3870 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3871 (Incremental_inputs::inputs_section): New function.
3872 (Incremental_inputs::symtab_section): New function.
3873 (Incremental_inputs::relocs_section): New function.
3874 (Incremental_inputs::get_stringpool): Add const.
3875 (Incremental_inputs::command_line): Add const.
3876 (Incremental_inputs::inputs): Remove.
3877 (Incremental_inputs::command_line_key): New function.
3878 (Incremental_inputs::input_file_count): New function.
3879 (Incremental_inputs::input_files): New function.
3880 (Incremental_inputs::relocs_entsize): New function.
3881 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3882 (Incremental_inputs::finalize_inputs): Remove.
3883 (Incremental_inputs::Input_info): Remove.
3884 (Incremental_inputs::lock_): Remove.
3885 (Incremental_inputs::inputs_): Change type.
3886 (Incremental_inputs::inputs_map_): Remove.
3887 (Incremental_inputs::current_object_entry_): New data member.
3888 (Incremental_inputs::inputs_section_): New data member.
3889 (Incremental_inputs::symtab_section_): New data member.
3890 (Incremental_inputs::relocs_section_): New data member.
3891 (Incremental_inputs::reloc_count_): New data member.
3892 (Incremental_inputs_reader): New class.
3893 (Incremental_symtab_reader): New class.
3894 (Incremental_relocs_reader): New class.
3895 * layout.cc (Layout::finalize): Move finalization of incremental info
3896 and creation of incremental info sections to follow finalization of
3897 symbol table. Set offsets for postprocessing sections.
3898 (Layout::create_incremental_info_sections): Call
3899 Incremental_inputs::create_data_sections. Add incremental symtab
3900 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3901 sections to layout after input sections.
3902 * layout.h (struct Timespec): Forward declaration.
3903 (Layout::incremental_inputs): Add const.
3904 (Layout::create_incremental_info_sections): Add parameter.
3905 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3906 * object.cc: Include incremental.h.
3907 (Relobj::finalize_incremental_relocs): New function.
3908 (Sized_relobj::do_layout): Record input sections in incremental info.
3909 * object.h (Object::output_section): New function.
3910 (Object::output_section_offset): Moved from Relobj.
3911 (Object::get_incremental_reloc_base): New function.
3912 (Object::get_incremental_reloc_count): New function.
3913 (Object::do_output_section): New function.
3914 (Object::do_output_section_offset): Moved from Relobj.
3915 (Object::do_get_incremental_reloc_base): New function.
3916 (Object::do_get_incremental_reloc_count): New function.
3917 (Object::Object): Initialize new data members.
3918 (Relobj::output_section): Renamed do_output_section and moved to
3920 (Relobj::output_section_offset): Moved to Object.
3921 (Relobj::do_get_incremental_reloc_base): New function.
3922 (Relobj::do_get_incremental_reloc_count): New function.
3923 (Relobj::allocate_incremental_reloc_counts): New function.
3924 (Relobj::count_incremental_reloc): New function.
3925 (Relobj::finalize_incremental_relocs): New function.
3926 (Relobj::next_incremental_reloc_index): New function.
3927 (Relobj::reloc_counts_): New data member.
3928 (Relobj::reloc_bases_): New data member.
3929 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3930 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3931 (Sized_relobj::incremental_relocs_scan): New function.
3932 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3933 (Sized_relobj::incremental_relocs_write): New function.
3934 (Sized_relobj::incremental_relocs_write_reltype): New function.
3935 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3937 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3938 archives and object files elsewhere.
3939 (Add_symbols::run): Report object files here.
3940 (Finish_group::run): Report end of archive at end of group.
3941 * reloc.cc: Include layout.h, incremental.h.
3942 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3943 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3944 (Sized_relobj::incremental_relocs_scan): New function.
3945 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3946 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3947 (Sized_relobj::incremental_relocs_write): New function.
3948 (Sized_relobj::incremental_relocs_write_reltype): New function.
3949 * script.cc (read_input_script): Rewrite test for incremental link.
3950 Change call to Incremental_inputs::report_script.
3951 * symtab.h (Symbol_table::first_global_index): New function.
3952 (Symbol_table::output_count): New function.
3956 * arm.cc (Target_arm::merge_object_attributes): Check command line
3957 options --no-wchar-size-warning and --no-enum-size-warning.
3958 * options.h (General_options): Add ld-compatible options
3959 --no-enum-size-warning and --no-wchar-size-warning.
3963 * x86_64.cc (Target_x86_64::Scan::local): Use
3964 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3965 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3966 (Target_x86_64::Scan::global): Likewise.
3967 (Target_x86_64::Relocate::relocate): Likewise.
3968 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3973 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3974 to reserve space in merged_strings vector. Keep total input size
3976 (Output_merge_string::do_print_merge_stats): Print total input size.
3977 * merge.h (Output_merge_string): Add input_size_ field.
3978 * stringpool.cc (Stringpool_template::string_length): Move
3979 implementations out of Stringpool_template class and place in
3981 * stringpool.h (string_length): Move out of Stringpool_template.
3986 * layout.cc (relaxation_loop_body): If address of load segment is
3987 set, adjust address to include headers if possible.
3991 * version.cc (version_string): Bump to 1.10.
3996 * layout.h (enum Output_section_order): Define.
3997 (class Layout): Update declarations.
3998 * layout.cc (Layout::get_output_section): Add order parameter.
3999 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4000 is_first_non_relro parameters. Change all callers.
4001 (Layout::choose_output_section): Likewise.
4002 (Layout::add_output_section_data): Likewise.
4003 (Layout::make_output_section): Likewise. Set order.
4004 (Layout::default_section_order): New function.
4005 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4006 * output.cc (Output_section::Output_section): Initialize order_.
4007 Don't initialize deleted fields.
4008 (Output_segment::Output_segment): Don't initialize deleted
4010 (Output_segment::add_output_section_to_load): New function
4011 replacing add_output_section. Change all callers to call this or
4012 add_output_section_to_nonload.
4013 (Output_segment::add_output_section_to_nonload): New function.
4014 (Output_segment::remove_output_section): Rewrite.
4015 (Output_segment::add_initial_output_data): Likewise.
4016 (Output_segment::has_any_data_sections): Likewise.
4017 (Output_segment::is_first_section_relro): Likewise.
4018 (Output_segment::maximum_alignment): Likewise.
4019 (Output_segment::has_dynamic_reloc): New function replacing
4020 dynamic_reloc_count. Change all callers.
4021 (Output_segment::has_dynamic_reloc_list): New function replacing
4022 dynamic_reloc_count_list. Change all callers.
4023 (Output_segment::set_section_addresses): Rewrite.
4024 (Output_segment::set_offset): Rewrite.
4025 (Output_segment::find_first_and_last_list): Remove.
4026 (Output_segment::set_tls_offsets): Rewrite.
4027 (Output_segment::first_section_load_address): Likewise.
4028 (Output_segment::output_section_count): Likewise.
4029 (Output_segment::section_with_lowest_load_address): Likewise.
4030 (Output_segment::write_section_headers): Likewise.
4031 (Output_segment::print_sections_to_map): Likewise.
4032 * output.h (class Output_data): Remove dynamic_reloc_count_
4033 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
4034 (Output_data::add_dynamic_reloc): Rewrite.
4035 (Output_data::has_dynamic_reloc): New function.
4036 (Output_data::dynamic_reloc_count): Remove.
4037 (class Output_section): Add order_ field. Remvoe is_relro_local_,
4038 is_last_relro_, is_first_non_relro_, is_interp_,
4039 is_dynamic_linker_section_ fields. Add order and set_order
4040 functions. Remove is_relro_local, set_is_relro_local,
4041 is_last_relro, set_is_last_relro, is_first_non_relro,
4042 set_is_first_non_relro functions, is_interp, set_is_interp,
4043 is_dynamic_linker_section, and set_is_dynamic_linker_section
4045 (class Output_segment): Change Output_data_list from std::list to
4046 std:;vector. Add output_lists_ field. Remove output_data_ and
4047 output_bss_ fields. Update declarations.
4051 * arm.cc (Target_arm::gc_process_relocs): Use typename.
4052 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4053 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4058 * script.cc (Script_options::Script_options): Initialize
4059 symbol_definitions_ and symbol_references_.
4060 (Script_options::add_symbol_assignment): Update
4061 symbol_definitions_ and symbol_references_.
4062 (Script_options::add_symbol_reference): New function.
4063 (script_symbol): New function.
4064 * script.h (class Script_options): Add symbol_definitions_ and
4065 symbol_references_ fields.
4066 (Script_options::referenced_const_iterator): New type.
4067 (Script_options::referenced_begin): New function.
4068 (Script_options::referenced_end): New function.
4069 (Script_options::is_referenced): New function.
4070 (Script_options::any_unreferenced): New function.
4071 * script-c.h (script_symbol): Declare.
4072 * yyscript.y (exp): Call script_symbol.
4073 * symtab.cc: Include "script.h".
4074 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4075 Change all callers. Check symbols referenced by scripts.
4076 (Symbol_table::add_undefined_symbols_from_command_line): Add
4077 layout parameter. Change all callers.
4078 (Symbol_table::do_add_undefined_symbols_from_command_line):
4079 Likewise. Break out loop body. Check symbols referenced by
4081 (Symbol_table::add_undefined_symbol_from_command_line): New
4082 function broken out of
4083 do_add_undefined_symbols_from_command_line.
4084 * symtab.h (class Symbol_table): Update declarations.
4085 * archive.cc: Include "layout.h".
4086 (Archive::should_include_member): Add layout parameter. Change
4087 all callers. Check for symbol mentioned in expression.
4088 * archive.h (class Archive): Update declaration.
4089 * object.cc (Sized_relobj::do_should_include_member): Add layout
4091 * object.h (Object::should_include_member): Add layout parameter.
4093 (Object::do_should_include_member): Add layout parameter.
4094 (class Sized_relobj): Update declaration.
4095 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4097 * dynobj.h (class Sized_dynobj): Update declaration.
4098 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4100 * plugin.h (class Sized_pluginobj): Update declaration.
4105 * output.cc (Output_segment::set_offset): Search for the first and
4106 last sections rather than assuming that the list is in order.
4107 (Output_segment::find_first_and_last_list): New function.
4108 * output.h (class Output_segment): Update declarations.
4109 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4110 (relro_strip_test_SOURCES): New variable.
4111 (relro_strip_test_DEPENDENCIES): New variable.
4112 (relro_strip_test_LDFLAGS): New variable.
4113 (relro_strip_test_LDADD): New variable.
4114 (relro_strip_test.so): New target.
4118 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4119 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4120 (Target_i386::got_tlsdesc_section): New function.
4121 (Target_i386::got_section): Create space for GOT entries for
4122 TLSDESC relocations.
4123 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4125 (Target_i386::Scan::global): Likewise.
4126 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4128 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4129 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4130 (Target_x86_64::got_tlsdesc_section): New function.
4131 (Target_x86_64::got_section): Create space for GOT entries for
4132 TLSDESC relocations.
4133 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4135 (Target_x86_64::Scan::global): Likewise.
4136 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4141 * testsuite/final_layout.sh: Use dc to convert from hex to
4146 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4147 paramter to the call to gold::gc_process_relocs.
4148 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4149 paramter to the call to gold::gc_process_relocs.
4150 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4151 parameter to the call to gold::gc_process_relocs.
4152 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4153 template parameter to the call to gold::gc_process_relocs.
4154 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4155 paramter to the call to gold::gc_process_relocs.
4156 * gc.h (get_embedded_addend_size): New function.
4157 (gc_process_relocs): Save the size of the reloc for use by ICF.
4158 * icf.cc (get_section_contents): Get the addend from the text section
4159 for SHT_REL relocation sections.
4160 * icf.h (Icf::Reloc_addend_size_info): New typedef.
4161 (Icf::Reloc_info): Add new member reloc_addend_size_info.
4162 * int_encoding.h (read_from_pointer): New overloaded function.
4163 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4164 * testsuite/icf_sht_rel_addend_test.sh: New file.
4165 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4166 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4170 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4171 * Makefile.in: Regenerate.
4172 * testsuite/Makefile.in: Regenerate.
4176 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4177 * gold/testsuite/debug_msg.cc: Likewise.
4178 * gold/testsuite/odr_violation1.cc
4179 * gold/testsuite/odr_violation2.cc
4183 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4184 string, and length fields.
4185 (Output_merge_string::Merged_strings_list): New type.
4186 (Output_merge_string::Merged_strings_lists): New typedef.
4187 (Output_merge_string): Replace merged_strings_ with
4188 merged_strings_lists_.
4189 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4190 Merged_strings_list per input object and section. Don't store pointer
4191 to the string. Don't store length with each merged string entry.
4192 (Output_merge_string::finalize_merged_data): Loop over list of merged
4193 strings lists. Recompute length of each merged string.
4197 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4202 * descriptors.cc (Descriptors::open): Report correct name in error
4207 * arm.cc (Arm_input_section::Arm_input_section): For a
4208 SHT_ARM_EXIDX section, always keeps the input sections.
4209 (Arm_input_section::set_exidx_section_link): New method.
4210 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4211 has_errors_ to false.
4212 (Arm_exidx_input_section::has_errors,
4213 Arm_exidx_input_section::set_has_errors): New methods.
4214 (Arm_exidx_input_section::has_errors_): New data member.
4215 (Arm_relobj::get_exidx_shndx_list): New method.
4216 (Arm_output_section::append_text_sections_to_list): Do not skip
4217 section without SHF_EXECINSTR.
4218 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4220 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4221 section header. Make error messages more verbose. Check for
4222 a non-executable section linked to an EXIDX section.
4223 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4224 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4225 check that there is no deferred EXIDX section if we exit early.
4226 Instead of not making an EXIDX section in case of an error, make one
4227 and set the has_errors flag of it.
4228 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4229 in a relocatable link.
4230 (Target_arm::do_relax): Look for the EXIDX output section instead of
4231 assuming that it is called .ARM.exidx.
4232 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4233 section list. Do not check for SHF_EXECINSTR section flags but
4234 skip any input section with errors.
4235 * output.cc (Output_section::Output_section): Initialize
4236 always_keeps_input_sections_ to false.
4237 (Output_section::add_input_section): Check for
4238 always_keeps_input_sections_.
4239 * output.h (Output_section::always_keeps_input_sections,
4240 Output_section::set_always_keeps_input_sections): New methods.
4241 (Output_section::always_keeps_input_sections): New data member.
4245 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4246 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4251 * output.h (Output_section_lookup_maps::add_merge_section):
4252 Correct check of whether value was inserted.
4253 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4254 (Output_section_lookup_maps::add_relaxed_input_section):
4256 * arm.cc (Target_arm::got_section): Remove used local os.
4257 * i386.cc (Target_i386::got_section): Likewise.
4258 * x86_64.cc (Target_x86_64::got_section): Likewise.
4259 * sparc.cc (Target_sparc::got_section): Likewise.
4260 (Target_sparc::relocate): Remove unused local have_got_offset.
4261 * powerpc.cc (Target_powerpc::relocate): Likewise.
4265 * compressed_output.cc (zlib_decompress): Fix signature in
4268 * archive.cc (Archive::include_member): Unlock an external member
4269 of a thin archive. Don't bother to delete an object we know is
4274 * compressed_output.cc (zlib_decompress): New function.
4275 (get_uncompressed_size): New function.
4276 (decompress_input_section): New function.
4277 * compressed_output.h (get_uncompressed_size): New function.
4278 (decompress_input_section): New function.
4279 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4280 Handle compressed debug sections.
4281 * layout.cc (is_compressed_debug_section): New function.
4282 (Layout::output_section_name): Map compressed section names to
4284 * layout.h (is_compressed_debug_section): New function.
4285 (is_debug_info_section): Recognize compressed debug sections.
4286 * merge.cc: Include compressed_output.h.
4287 (Output_merge_data::do_add_input_section): Handle compressed
4289 (Output_merge_string::do_add_input_section): Handle compressed
4291 * object.cc: Include compressed_output.h.
4292 (Sized_relobj::Sized_relobj): Initialize new data members.
4293 (build_compressed_section_map): New function.
4294 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4295 * object.h (Object::section_is_compressed): New method.
4296 (Object::do_section_is_compressed): New method.
4297 (Sized_relobj::Compressed_section_map): New type.
4298 (Sized_relobj::do_section_is_compressed): New method.
4299 (Sized_relobj::compressed_sections_): New data member.
4300 * output.cc (Output_section::add_input_section): Handle compressed
4302 * reloc.cc: Include compressed_output.h.
4303 (Sized_relobj::write_sections): Handle compressed debug sections.
4307 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4308 weak when resolving to a dynamic def.
4309 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4310 for weak undef/dynamic def cases. Adjust callers.
4311 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4312 undef_binding_weak_.
4313 (Symbol_table::sized_write_globals): Adjust symbol binding.
4314 (Symbol_table::sized_write_symbol): Add binding parameter.
4315 * symtab.h (Symbol::set_undef_binding): New method.
4316 (Symbol::is_undef_binding_weak): New method.
4317 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4318 (Symbol_table::should_override): Add new parameter.
4319 (Symbol_table::sized_write_symbol): Add new parameter.
4321 * testsuite/weak_undef_file1.cc: Add new test case.
4322 * testsuite/weak_undef_file2.cc: Fix header comment.
4323 * testsuite/weak_undef_test.cc: Add new test case.
4327 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4328 Initialize USE_SYMBOL_.
4329 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4331 (Arm_reloc_property::uses_symbol_): New data member declaration.
4332 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4333 uses symbol value and symbol is undefined but not weakly undefined.
4337 * plugin.cc (Plugin::load): Use dlerror.
4341 * symtab.cc (detect_odr_violations): When reporting an ODR
4342 violation, report an object where the symbol is defined.
4346 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4347 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4349 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4350 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4351 target hook to detect function points.
4352 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4353 * icf.h (Icf::check_section_for_function_pointers): Change type of
4354 parameter SECTION_NAME to const reference to std::string. Use
4355 target hook to determine if section may have unsafe pointers.
4356 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4361 * fileread.cc (Input_file::find_fie): New
4362 (Input_file::open): Use Input_file::find_fie.
4363 * fileread.h (Input_file::find_fie): New
4364 * plugin.cc (set_extra_library_path): New.
4365 (Plugin::load): Add set_extra_library_path to the transfer vector.
4366 (Plugin_manager::set_extra_library_path): New.
4367 (Plugin_manager::add_input_file): Use the extra search path if set.
4368 (set_extra_library_path(): New.
4369 * plugin.h (Plugin_manager): Add set_extra_library_path and
4374 * layout.cc (gdb_sections): Add .debug_types.
4375 (lines_only_debug_sections): Likewise.
4379 * plugin.cc (add_input_file,add_input_library)
4380 (Plugin_manager::add_input_file): Make filename arguments const.
4381 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4386 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4387 .ARM.attributes section if we have not merged any input
4388 attributes sections.
4392 * arm.cc: Allow combining objects with no EABI version
4397 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4401 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4402 (struct iovec): Correct !HAVE_READV definition.
4406 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4407 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4409 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4412 * symtab.h (Symbol::is_placeholder): New member function.
4413 * target-reloc.h (relocate_section): Check for placeholder symbols.
4415 * testsuite/Makefile.am (plugin_test_8): New test.
4416 (plugin_test_9): New test.
4417 * testsuite/Makefile.in: Regenerate.
4421 * yyscript.y (input_list_element): Allow strings prefixed with
4422 the '-' character. Treat these as libraries.
4423 * script.cc (script_add_library): New function. Adds a library
4424 specified by "-l<name>" found in an input script.
4425 * script-c.h: Add prototype for script_add_library.
4429 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4430 Restrict stub-group size to be within long conditional branch
4431 range when working around cortex-A8 erratum.
4435 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4442 (Output_section::Input_section_sort_entry::compare_section_ordering):
4443 Change to return non-zero correctly.
4444 (Output_section::Input_section_sort_section_order_index_compare
4445 ::operator()): Change to fix ambiguity in comparisons.
4449 * gold.h (is_wildcard_string): New function.
4450 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4451 (Layout::layout_eh_frame): Ditto.
4452 (Layout::find_section_order_index): New method.
4453 (Layout::read_layout_from_file): New method.
4454 * layout.h (Layout::find_section_order_index): New method.
4455 (Layout::read_layout_from_file): New method.
4456 (Layout::input_section_position_): New private member.
4457 (Layout::input_section_glob_): New private member.
4458 * main.cc (main): Call read_layout_from_file here.
4459 * options.h (--section-ordering-file): New option.
4460 * output.cc (Output_section::input_section_order_specified_): New
4462 (Output_section::Output_section): Initialize new member.
4463 (Output_section::add_input_section): Add new parameter.
4464 Keep input sections when --section-ordering-file is used.
4465 (Output_section::set_final_data_size): Sort input sections when
4466 section ordering file is specified.
4467 (Output_section::Input_section_sort_entry): Add new parameter.
4469 (Output_section::Input_section_sort_entry::compare_section_ordering):
4471 (Output_section::Input_section_sort_compare::operator()): Change to
4472 consider section_order_index.
4473 (Output_section::Input_section_sort_init_fini_compare::operator()):
4474 Change to consider section_order_index.
4475 (Output_section::Input_section_sort_section_order_index_compare
4476 ::operator()): New method.
4477 (Output_section::sort_attached_input_sections): Change to sort
4478 according to section order when specified.
4479 (Output_section::add_input_section<32, true>): Add new parameter.
4480 (Output_section::add_input_section<64, true>): Add new parameter.
4481 (Output_section::add_input_section<32, false>): Add new parameter.
4482 (Output_section::add_input_section<64, false>): Add new parameter.
4483 * output.h (Output_section::add_input_section): Add new parameter.
4484 (Output_section::input_section_order_specified): New
4486 (Output_section::set_input_section_order_specified): New method.
4487 (Input_section::Input_section): Initialize section_order_index_.
4488 (Input_section::section_order_index): New method.
4489 (Input_section::set_section_order_index): New method.
4490 (Input_section::section_order_index_): New member.
4491 (Input_section::Input_section_sort_section_order_index_compare): New
4493 (Output_section::input_section_order_specified_): New member.
4494 * script-sections.cc (is_wildcard_string): Delete and move modified
4496 (Output_section_element_input::Output_section_element_input): Modify
4497 call to is_wildcard_string.
4498 (Output_section_element_input::Input_section_pattern
4499 ::Input_section_pattern): Ditto.
4500 (Output_section_element_input::Output_section_element_input): Ditto.
4501 * testsuite/Makefile.am (final_layout): New test case.
4502 * testsuite/Makefile.in: Regenerate.
4503 * testsuite/final_layout.cc: New file.
4504 * testsuite/final_layout.sh: New file.
4508 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4512 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4513 visibility of symbols.
4517 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4518 from start of output section instead of address for a local symbol
4519 in a merged or relaxed section when doing a relocatable link.
4524 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4525 adding sections the garbage collector removed.
4526 * gold/testsuite/Makefile.am: Add test.
4527 * gold/testsuite/Makefile.in: Regenerate.
4528 * gold/testsuite/plugin_test_7.sh: New.
4529 * gold/testsuite/plugin_test_7_1.c: New.
4530 * gold/testsuite/plugin_test_7_2.c: New.
4534 * script-sections.cc (Output_section_definition::set_section_addresses):
4535 Check for --section-start.
4539 * arm.cc (Arm_scan_relocatable_relocs): New class.
4540 (Target_arm::relocate_special_relocatable): New method.
4541 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4542 (Arm_relocate_functions::thumb_branch_common): Same.
4543 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4544 instead of Default_scan_relocatable_relocs.
4545 * target-reloc.h (relocate_for_relocatable): Let target handle
4546 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4547 * target.h (Sized_target::relocate_special_relocatable): New method.
4551 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4555 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4557 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4558 with a direct branch, not a conditional branch, to a stub.
4559 * merge.cc (Output_merge_base::record_input_section): New method
4561 (Output_merge_data::do_add_input_section): Record input section if
4562 keeps-input-sections flag is set.
4563 (Output_merge_string::do_add_input_section): Ditto.
4564 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4565 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4567 (Output_merge_base::keeps_input_sections,
4568 Output_merge_base::set_keeps_input_sections,
4569 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4571 (Output_merge_base::Input_sections): New type declaration.
4572 (Output_merge_base::input_sections_begin,
4573 Output_merge_base::input_sections_end,
4574 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4575 (Output_merge_base::bool keeps_input_sections_,
4576 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4577 Output_merge_base::input_sections_): New data members.
4578 (Output_merge_data::do_set_keeps_input_sections): New method
4580 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4581 * output.cc (Output_section::Input_section::relobj): Move method
4582 defintion from class declaration to here and handle merge sections.
4583 (Output_section::Input_section::shndx): Ditto.
4584 (Output_section::Output_section): Remove initializations of removed
4585 data members and initialize new data member LOOKUP_MAPS_.
4586 (Output_section::add_input_section): Set keeps-input-sections flag
4587 for a newly created merge output section as appropriate. Adjust code
4588 to use Output_section_lookup_maps class.
4589 (Output_section::add_relaxed_input_section): Adjst code for lookup
4590 maps code refactoring.
4591 (Output_section::add_merge_input_section): Add a new parameter
4592 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4593 class. If adding input section to a newly created merge output
4594 section fails, remove the new merge section.
4595 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4596 Adjust code for use of the Output_section_lookup_maps class.
4597 (Output_section::find_merge_section): Ditto.
4598 (Output_section::build_lookup_maps): New method defintion.
4599 (Output_section::find_relaxed_input_section): Adjust code to use
4600 Output_section_lookup_maps class.
4601 (Output_section::get_input_sections): Export merge sections. Adjust
4602 code to use Output_section_lookup_maps class.
4603 (Output_section:::add_script_input_section): Adjust code to use
4604 Output_section_lookup_maps class. Update lookup maps for merge
4606 (Output_section::discard_states): Use Output_section_lookup_maps.
4607 (Output_section::restore_states): Same.
4608 * output.h (Merge_section_properties): Move class defintion out of
4610 (Output_section_lookup_maps): New class.
4611 (Output_section::Input_section::is_merge_section): New method
4613 (Output_section::Input_section::relobj): Move defintion out of class
4614 defintion. Declare method only.
4615 (Output_section::Input_section::shndx): Ditto.
4616 (Output_section::Input_section::output_merge_base): New method defintion.
4617 (Output_section::Input_section::u2_.pomb): New union field.
4618 (Output_section::Merge_section_by_properties_map,
4619 Output_section::Output_section_data_by_input_section_map,
4620 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4622 (Output_section::add_merge_input_section): Add new parameter
4623 KEEPS_INPUT_SECTIONS.
4624 (Output_section::build_lookup_maps): New method declaration.
4625 (Output_section::merge_section_map_,
4626 Output_section::merge_section_by_properties_map_,
4627 Output_section::relaxed_input_section_map_,
4628 Output_section::is_relaxed_input_section_map_valid_): Remove data
4630 (Output_section::lookup_maps_): New data member.
4635 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4636 avoid a compilation error.
4640 * script-sections.cc (Output_section_definition::allocate_to_segment):
4641 Update the phdrs_list even when the output section is NULL.
4642 * testsuite/Makefile.am: Add test.
4643 * testsuite/Makefile.in: Regenerate.
4644 * testsuite/script_test_9.cc: New.
4645 * testsuite/script_test_9.sh: New.
4646 * testsuite/script_test_9.t: New.
4650 * arm.cc (Arm_input_section::original_size): New method.
4651 (Arm_input_section::do_addralign): Add a cast.
4652 (Arm_input_section::do_output_offset): Remove static cast.
4653 (Arm_input_section::original_addralign,
4654 Arm_input_section::original_size_): Change type to uint32_t.
4655 (Arm_input_section::init): Add safe casts for section alignment
4657 (Arm_input_section::set_final_data_size): Do not set address and
4658 offset of stub table.
4659 (Arm_output_section::fix_exidx_coverage): Change use of of
4660 Output_section::Simple_input_section to that of
4661 Output_section::Input_section.
4662 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4663 except for the first pass.
4664 * output.cc (Output_section::get_input_sections): Change type of
4665 input_sections to std::list<Input_section>.
4666 (Output_section::add_script_input_section): Rename from
4667 Output_section::add_simple_input_section. Change type of SIS
4668 parameter from Simple_input_section to Input_section.
4669 * output.h (Output_section::Simple_input_section): Remove class.
4670 (Output_section::Input_section): Change class visibility to public.
4671 (Output_section::Input_section::addralign): Use stored alignments
4672 for special input sections if set.
4673 (Output_section::Input_section::set_addralign): New method.
4674 (Output_section::get_input_sections): Change parameter type from
4675 list of Simple_input_section to list of Input_section.
4676 (Output_section::add_script_input_section): Rename from
4677 Output_section::add_simple_input_section. Change first parameter's
4678 type from Simple_input_section to Input_section and remove the
4679 second and third parameters.
4680 * script-sections.cc (Input_section::Input_section_list): Change
4681 type to list of Output_section::Input_section/
4682 (Input_section_info::Input_section_info): Change parameter type of
4683 INPUT_SECTION to Output_section::Input_section.
4684 (Input_section_info::input_section): Change return type.
4685 (Input_section_info::input_section_): Change type to
4686 Output_section::Input_section.
4687 (Output_section_element_input::set_section_addresses): Adjust code
4688 to use Output_section::Input_section instead of
4689 Output_section::Simple_input_section. Adjust code for renaming
4690 of Output_section::add_simple_input_section.
4691 (Orphan_output_section::set_section_addresses): Ditto.
4695 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4696 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4700 * options.cc (General_options::finalize): Handle -nostdlib.
4701 * options.h (nostdlib): New option.
4702 * script.cc (script_add_search_dir): Handle -nostdlib.
4706 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4707 attributes section only if there no attributes section after merging.
4708 (Target_arm::merge_object_attributes): Move value of
4709 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4710 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4711 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4712 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4713 and arm_attr_merge_7.stdout.
4714 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4715 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4716 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4717 arm_attr_merge_7b.o): New rules.
4718 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4720 * testsuite/Makefile.in: Regenerate.
4721 * testsuite/arm_attr_merge.sh: New file.
4722 * testsuite/arm_attr_merge_[67][ab].s: Same.
4726 * po/es.po: Updated Spanish translation.
4730 * Makefile.am (install-exec-local): Properly install gold as
4731 default cross linker.
4732 * Makefile.in: Regenerated.
4737 * configure.ac (install_as_default): Define and set to false
4738 unless --enable-gold or --enable-gold=both/gold has been
4740 * configure: Regenerate.
4742 * Makefile.am (install-exec-local): Install the executable as
4743 'ld.gold'. If install_as_default is true then also install it as
4745 * Makefile.in: Regenerated.
4749 * layout.cc (Layout::layout_reloc): In relocatable link don't
4750 combine reloc sections for grouped sections.
4754 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4755 sections that are not ordinary to icf.
4756 * icf.cc (get_section_contents): Handle relocation pointing to section
4757 with no object or shndx information.
4758 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4759 * testsuite/Makefile.in: Regenerate.
4760 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4761 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4765 * expression.cc (Expression::Expression_eval_info): Add
4766 result_alignment_pointer field.
4767 (Expression::eval_with_dot): Add result_alignment_pointer
4768 parameter. Change all callers.
4769 (Expression::eval_maybe_dot): Likewise.
4770 (class Binary_expression): Add alignment_pointer parameter to
4771 left_value and right_value. Change all callers.
4772 (BINARY_EXPRESSION): Set result alignment.
4773 (class Trinary_expression): Add alignment_pointer parameter to
4774 arg2_value and arg3_value. Change all callers.
4775 (Trinary_cond::value): Set result alignment.
4776 (Max_expression::value, Min_expression::value): Likewise.
4777 (Align_expression::value): Likewise.
4778 * script-sections.cc (class Sections_element): Add dot_alignment
4779 parameter to set_section_addresses virtual function. Update
4781 (class Output_section_element): Likewise.
4782 (Script_sections::create_segments): Add dot_alignment parameter.
4784 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4785 (Script_sections::set_phdrs_clause_addresses): Likewise.
4786 * script-sections.h: Update declarations.
4787 * script.h: Update declarations.
4788 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4790 * testsuite/script_test_3.t: Set large alignment.
4791 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4792 segment has expected alignment.
4796 * po/gold.pot: Updated by the Translation project.
4797 * po/vi.po: Updated Vietnamese translation.
4801 * testsuite/Makefile.am (check_PROGRAMS): Add
4802 icf_virtual_function_folding_test.
4803 * testsuite/Makefile.in: Regenerated.
4807 * options.h (merge_exidx_entries): New option.
4808 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4809 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4810 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4811 (Target_arm::merge_exidx_entries): New function.
4812 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4813 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4814 to Arm_exidx_fixup constructor.
4815 Add new arg, merge_exidx_entries.
4816 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4817 Arm_output_section::fix_exidx_coverage.
4821 * icf.cc (get_section_contents): Check for preemptible functions.
4822 Ignore addend when appropriate.
4823 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4825 (add_from_relobj): Check for section folded.
4826 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4827 * symtab.h (should_add_dynsym_entry): Add new parameter.
4828 * target-reloc.h (scan_relocs): Check for section folded.
4829 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4830 Check reloc types for function pointers in shared objects.
4831 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4833 (icf_preemptible_functions_test): New test case.
4834 (icf_string_merge_test): New test case.
4835 * testsuite.Makefile.in: Regenerate.
4836 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4837 bar_glob. Refactor code.
4838 * testsuite/icf_preemptible_functions_test.cc: New file.
4839 * testsuite/icf_preemptible_functions_test.sh: New file.
4840 * testsuite/icf_string_merge_test.cc: New file.
4841 * testsuite/icf_string_merge_test.sh: New file.
4842 * testsuite/icf_virtual_function_folding_test.cc: New file.
4843 * testsuite/icf_virtual_function_folding_test.sh: New file.
4847 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4848 for local symbol recounting if we remove a section due to ICF.
4849 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4850 there are no regular objects in input.
4854 * arm.cc (Arm_input_section::set_final_data_size): Compute
4855 accurate final data size instead of using current data size.
4859 * layout.cc (Layout::choose_output_section): Handle script section
4861 (Layout::make_output_section_for_script): Add section type parameter.
4862 Handle script section types.
4863 * layout.h (Layout::make_output_section_for_script): Add section
4865 * output.cc (Output_section::Output_section): Initialize data member
4867 (Output_section::do_reset_address_and_file_offset): Do not set address
4868 to 0 if section is a NOLOAD section.
4869 * output.h (Output_section::is_noload): New method.
4870 (Output_section::set_is_noload): Ditto.
4871 (Output_section::is_noload_): New data member.
4872 * script-c.h (Script_section_type): New enum type.
4873 (struct Parser_output_section_header): Add new file section_type.
4874 * script-sections.cc (Sections_element::output_section_name): Add
4875 parameter for returning script section type.
4876 (Output_section_definition::output_section_name): Ditto.
4877 (Output_section_definition::section_type)P; New method.
4878 (Output_section_definiton::script_section_type_name): Ditto.
4879 (Output_section_definition::script_section_type_): New data member.
4880 (Output_section_definition::Output_section_definition): Initialize
4881 data member Output_section_definition::script_section_type_.
4882 (Output_section_definition::create_sections): Pass script section type
4883 to Layout::make_output_section_for_script.
4884 (Output_section_definition::output_section_name): Return script
4885 section type to caller.
4886 (Output_section_definition::set_section_address): Do not advance
4887 dot value and load address if section type is NOLOAD. Set address
4888 of NOLOAD sections regardless of section flags.
4889 (Output_section_definition::print): Print section type if it is
4890 not SCRIPT_SECTION_TYPE_NONE.
4891 (Output_section_definition::section_type): New method.
4892 (Output_section_definition::script_section_type_name): Ditto.
4893 (Script_sections::output_section_name): Add new parameter
4894 PSECTION_TYPE for returning script section type. Pass it to
4895 section elements. Handle discard sections.
4896 (Sort_output_sections::operator()): Handle NOLOAD sections.
4897 * script-sections.h (Script_sections::Section_type): New enum type.
4898 (Script_sections::output_section_name): Add a new parameter for
4899 returning script section type.
4900 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4902 * yyscript.y (union): Add new field SECTION_TYPE.
4903 (COPY, DSECT, INFO, NOLOAD): New tokens.
4904 (opt_address_and_section_type): Change type to output_section_header.
4905 (section_type): New non-terminal
4906 (section_header): Handle section type.
4907 (opt_address_and_section_type): Return section type value.
4911 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4912 * testsuite/plugin_common_test_2.c (foo): Likewise.
4916 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4918 * output.cc (Output_section::add_merge_input_section): Simplify
4919 code and return status of Output_merge_base::add_input_section.
4920 Update merge section map only if Output_merge_base::add_input_section
4925 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4926 if section is marked as containing instructions but has no mapping
4928 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4929 correct section index.
4930 (Arm_relobj::find_linked_text_section): Ditto.
4934 * archive.cc (include_member): Destroy Read_symbols_data object before
4936 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4937 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4938 (Read_symbols_data::~Read_symbols_data) New destructor.
4939 (Section_relocs::Section_relocs) New constructor.
4940 (Section_relocs::~Section_relocs) New destructor.
4941 (Read_relocs_data::Read_relocs_data) New constructor.
4942 (Read_relocs_data::~Read_relocs_data) New destructor.
4943 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4944 pointers to NULL after deleting.
4948 * arm.cc: Replace "endianity" with "endianness" in comments.
4949 (Arm_exidx_cantunwind): Ditto.
4950 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4951 (Arm_relobj::merge_flags_and_attributes): New method.
4952 (Arm_relobj::merge_flags_and_attributes_): New data member.
4953 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4954 (Arm_relobj::scan_sections_for_stubs): Ditto.
4955 (Arm_relobj::do_read_symbols): Check to see if we really want to
4956 merge processor-specific flags and attributes. Exit early if
4957 an object is empty except for section names and the undefined symbol.
4958 (Target_arm::do_finalize_sections): Move check for ELF format to
4959 Arm_relobj::do_read_symbols. Merge processor specific flags and
4960 attributes from a regular object only when we have determined that
4961 it is aapropriate. Do not create an .ARM.attributes section in
4962 output if there is no regular input object.
4963 (Target_arm::merge_processor_specific_flags): Check
4964 --warn-mismatch before printing any error.
4965 (Target_arm::merge_object_attributes): Ditto.
4966 * gold.cc (queue_middle_tasks): Handle the case in which there is
4967 no regular object in input.
4968 * options.cc (General_options::parse_EB): New method.
4969 (General_options::parse_EL): Same.
4970 (General_options::General_options): Initialize endianness_.
4971 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4973 (General_options::Endianness): New enum.
4974 (General_options::endianness): New method.
4975 (General_options::endianness_): New data member.
4976 * parameters.cc (Parameters::set_options): Check target endianness.
4977 (Parameters::set_target_once): Ditto.
4978 (Parameters::check_target_endianness): New method.
4979 (parameters_force_valid_target): If either -EL or -EB is specified,
4980 use it to define endianness of default target.
4981 * parameters.h (Parameters::check_target_endianness): New method
4983 * target.h (class Target): Change "endianity" to "endianness"
4988 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4989 * configure: Regenerate.
4990 * Makefile.in: Regenerate.
4991 * testsuite/Makefile.in: Regenerate.
4996 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4997 prevailing definitions of common symbols.
4998 * testsuite/plugin_test_6.sh: New test case.
4999 * testsuite/plugin_common_test_1.c: New test case.
5000 * testsuite/plugin_common_test_2.c: New test case.
5001 * testsuite/Makefile.am (plugin_test_6): New test case.
5002 * testsuite/Makefile.in: Regenerate.
5006 * po/vi.po: New Vietnamese translation.
5010 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5014 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5015 to avoid a conversion warning on a 32-bit host.
5019 * testsuite/script_test_3.t: Add a TLS segment.
5020 * testsuite/Makefile.am (check_PROGRAMS): Add
5021 tls_phdrs_script_test.
5022 (tls_phdrs_script_test_SOURCES): Define.
5023 (tls_phdrs_script_test_DEPENDENCIES): Define.
5024 (tls_phdrs_script_test_LDFLAGS): Define.
5025 (tls_phdrs_script_test_LDADD): Define.
5026 * testsuite/Makefile.in: Rebuild.
5030 * fileread.cc (find_or_make_view): Fix comment.
5034 * script-sections.cc (class Orphan_section_placement): Define
5035 PLACE_TLS and PLACE_TLS_BSS.
5036 (Orphan_section_placement::Orphan_section_placement): Initialize
5038 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5039 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5040 (tls_script_test_SOURCES): Define.
5041 (tls_script_test_DEPENDENCIES): Define.
5042 (tls_script_test_LDFLAGS): Define.
5043 (tls_script_test_LDADD): Define.
5044 * testsuite/Makefile.in: Rebuild.
5048 * arm.cc (Arm_relocate_functions::abs8,
5049 Arm_relocate_functions::abs16): Use correct check for overflow
5050 specified in the ARM ELF specs.
5051 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
5052 target of a BLX instruction specially.
5053 (Reloc_stub::stub_type_for_reloc): Ditto.
5054 (Relocate::relocate): Use symbolic names instead of numeric relocation
5055 codes to report error.
5056 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5058 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5059 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5060 thumb2_blx_out_of_range.stdout
5061 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5062 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5063 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5064 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5065 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5066 thumb2_blx_in_range, thumb2_blx_in_range.o,
5067 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5068 thumb2_blx_out_of_range.o): New rules.
5069 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5070 thumb2_blx_in_range and thumb2_blx_out_of_range.
5071 * testsuite/Makefile.in: Regenerate.
5072 * arm_branch_in_range.sh: Add tests for THUMB BLX.
5073 * testsuite/thumb_blx_in_range.s: New file.
5074 * testsuite/thumb_blx_out_of_range.s: New file.
5078 * archive.cc (Should_include): Move to archive.h.
5079 (should_include_member): Make it a member of Archive.
5081 (Add_lib_group_symbols): New.
5082 * archive.h: Include options.h.
5083 (Archive_member): Moved from Archive.
5084 (Should_include): Moved from archive.cc.
5086 (Add_lib_group_symbols): New.
5087 * dynobj.cc (do_should_include_member): New.
5088 * dynobj.h (do_should_include_member): New.
5089 * gold.cc (queue_initial_tasks): Update call to queue.
5090 * main.cc (main): Print lib group stats.
5091 * object.cc (do_should_include_member): New.
5092 * object.h: Include archive.h.
5093 (Object::should_include_member): New.
5094 (Object::do_should_include_member): New.
5095 (Sized_relobj::do_should_include_member): New.
5096 * options.cc (General_options::parse_start_lib): New.
5097 (General_options::parse_end_lib): New.
5098 (Input_arguments::add_file): Handle lib groups.
5099 (Input_arguments::start_group): Check we are not in a lib.
5100 (Input_arguments::start_lib): New.
5101 (Input_arguments::end_lib): New.
5102 * options.h (General_options): Add start_lib and end_lib.
5103 (Input_argument::lib_): New.
5104 (Input_argument::lib): New.
5105 (Input_argument::is_lib): New.
5106 (Input_file_lib): New.
5107 (Input_arguments::in_lib_): New.
5108 (Input_arguments::in_lib): New.
5109 (Input_arguments::start_lib): New.
5110 (Input_arguments::end_lib_): New.
5111 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5112 in unused members as preempted.
5113 (Sized_pluginobj::do_should_include_member): New.
5114 * plugin.h (Sized_pluginobj::do_should_include_member): New.
5115 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5117 (Read_symbols::do_whole_lib_group): New.
5118 (Read_symbols::do_lib_group): New.
5119 (Read_symbols::do_read_symbols): Handle lib groups.
5120 (Read_symbols::get_name): Handle lib groups.
5121 * readsyms.h (Read_symbols): Add an archive member pointer.
5122 (Read_symbols::do_whole_lib_group): New.
5123 (Read_symbols::do_lib_group): New.
5124 (Read_symbols::member_): New.
5125 * script.cc (read_input_script): Update call to queue_soon.
5129 * arm.cc (Stub_table::Stub_table): Initialize new data members
5130 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5131 (Stub_table::add_reloc_stub): Assign stub offset and update
5132 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5133 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5135 (Stub_table::update_data_size_and_addralign): Use
5136 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5137 instead of going over all reloc stubs.
5138 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5139 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5140 Stringpool_template::offset_ to size of Stringpool_char.
5141 (Stringpool_template::new_key_offset): Remove code to initialize
5142 Stringpool_template::offset_.
5143 * stringpool.h (Stringpool_template::set_no_zero_null): Set
5144 Stringpool_template::offset_ to zero.
5148 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5150 (Stringpool_template::new_key_offset): New method.
5151 (Stringpool_template::add_string): Assign offsets when adding new
5153 (Stringpool_template::set_string_offsets): Do not set string offsets
5154 when not optimizing.
5155 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5157 (Chunked_vector::clear): Clear size_.
5158 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5159 (Chunked_vector::size): Return size_.
5160 (Chunked_vector::push_back): Use size_ to find insert position.
5161 (Chunked_vector::size_): New data member.
5162 (Stringpool_template::set_no_zero_null): Assert string set is empty.
5163 (Stringpool_template::new_key_offset): New method declaration.
5164 (Stringpool_template::offset_): New data member.
5168 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5169 Add_symbols' constructor.
5170 * readsyms.h (Add_symbols): Remove the input_group member.
5174 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5175 target to ask whether a reference to a symbol requires a stack
5177 * target.h (Target::is_call_to_non_split): New function.
5178 (Target::do_is_call_to_non_split): Declare virtual function.
5179 * target.cc: Include "symtab.h".
5180 (Target::do_is_call_to_non_split): New function.
5181 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5185 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5186 (File_read::open[1]): Remove initial mapping of whole_file_view_.
5187 (File_read::open[2]): Add whole_file_view_ to list of views.
5188 (File_read::make_view): Remove test of whole_file_view_.
5189 (File_read::find_or_make_view): Create whole_file_view_ if
5191 (File_read::clear_views): Replace bool parameter with enum;
5192 adjust all callers. Don't delete views with permanent data;
5193 do delete cached views and views from archives if
5194 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
5195 if clearing the corresponding view.
5196 * fileread.h (File_read::Clear_views_mode): New enum.
5197 (File_read::View::is_permanent_view): New method.
5198 (File_read::clear_views): Replace bool parameter
5199 with enum; adjust all callers.
5200 * options.h (General_options): Change keep_files_mapped option;
5201 add map_whole_files.
5202 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5204 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5209 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5213 * icf.cc (get_section_contents): Add '@' marker after processing the
5218 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5219 due to a conversion warning.
5220 (Arm_relobj::update_output_local_symbol_count): Check for local
5221 symbol with unset output index.
5225 * options.h (class General_options): Add --spare-dynamic-tags.
5226 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5227 --spare-dynamic-tags.
5231 * incremental.cc: Include "libiberty.h".
5235 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5236 function, is_info_ member.
5237 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5238 (Versions::Versions): Update caller.
5239 (Versions::define_base_version): Likewise.
5240 (Versions::add_def): Likewise.
5244 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5245 (Scan::possible_function_pointer_reloc): New function.
5246 (Scan::local_reloc_may_be_function_pointer): Change to call
5247 possible_function_pointer_reloc.
5248 (Scan::global_reloc_may_be_function_pointer): Ditto.
5249 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5250 relocations in ".data.rel.ro._ZTV" section.
5251 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5252 * testsuite/icf_safe_so_test.cc: Ditto.
5253 * testsuite/icf_safe_test.cc: Ditto.
5254 * testsuite/icf_safe_test.sh: Ditto.
5259 * target-reloc.h (relocate_section): Check the symbol table index
5260 for -1U before setting the local symbol index.
5261 (scan_relocatable_relocs): If copying the relocation, record that
5262 the local symbol is required.
5263 * object.h (Symbol_value::is_output_symtab_index_set): New
5265 (Symbol_value::may_be_discarded_from_output_symtab): New
5267 (Symbol_value::has_output_symtab_entry): New function.
5268 (Symbol_value::needs_output_symtab_entry): Remove.
5269 (Symbol_value::output_symtab_index): Make sure the symbol index is
5271 (Symbol_value::set_output_symtab_index): Make sure the symbol
5272 index is not set. Make sure the new index is valid.
5273 (Symbol_value::set_must_have_output_symtab_entry): New function.
5274 (Symbol_value::has_output_dynsym_entry): New function.
5275 (Symbol_value::set_output_dynsym_index): Make sure the new index
5277 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5278 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5279 local symbol if permitted.
5280 (Sized_relobj::do_finalize_local_symbols): Call
5281 is_output_symtab_index_set rather than needs_output_symtab_entry.
5282 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5283 rather than needs_output_symtab_entry. Call
5284 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5285 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5286 is_output_symtab_index_set rather than needs_output_symtab_entry.
5287 * testsuite/discard_locals_relocatable_test.c: New file.
5288 * testsuite/discard_locals_test.sh: Test -r.
5289 * testsuite/Makefile.am (check_DATA): Add
5290 discard_locals_relocatable_test1.syms,
5291 discard_local_relocatable_test2.syms.
5292 (MOSTLYCLEANFILES): Likewise. Also add
5293 discard_locals_relocatable_test1.lout and
5294 discard_locals_relocatable_test2.out.
5295 (discard_locals_relocatable_test1.syms): New target.
5296 (discard_locals_relocatable_test.o): New target.
5297 (discard_locals_relocatable_test1.out): New target.
5298 (discard_locals_relocatable_test2.syms): New target.
5299 (discard_locals_relocatable_test2.out): New target.
5300 (various): Add missing ../ld-new dependencies.
5301 * testsuite/Makefile.in: Rebuild.
5305 * po/fi.po: New Finnish translation.
5309 * layout.cc (Layout::Layout): Force section types of .init_array*,
5310 .preinit_array* and .fini_array* sections.
5311 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5312 Fix check of return value of std::string::find.().
5313 (Output_section::Input_section_sort_compare::operator()): Remove
5314 comment about .init_array.
5315 (Output_section::Input_section_sort_init_fini_compare::operator()):
5317 (Output_section::sort_attached_input_sections): Handle .init_array
5318 and .fini_array specially.
5319 * output.h (Output_section::Inut_section_sort_compare): Update
5321 (Output_section::Input_section_sort_init_fini_compare): New struct.
5325 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5326 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5327 * testsuite/debug_msg.sh: Avoid matching source line number for
5328 use of global variable undef_int.
5332 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5333 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5334 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5335 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5336 * options.cc (General_options::General_options): Initialize member
5338 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5339 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5340 and rm_no_fix_v4bx.stdout
5341 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5342 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5343 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5344 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5345 and arm_no_fix_v4bx.
5346 * Makefile.in: Regenerate.
5347 * testsuite/arm_fix_v4bx.s: New file.
5348 * testsuite/arm_fix_v4bx.sh: Ditto.
5352 * arm.cc (Target_arm::got_section): Make the .got section the first
5353 non RELRO section in the data segment.
5354 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5355 suffixes of section names.
5359 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5360 flags and attributes merging if an input file is a binary file.
5361 * fileread.cc (Input_file::open): Record format of original file.
5362 * fileread.h (Input_file::Format): New enum type.
5363 (Input_file::Input_file): Initialize data member format_.
5364 (Input_file::format): New method definition.
5365 (Input_file::format_):: New data member.
5369 * arm.cc (Arm_output_data_got): New class.
5370 (ARM_TCB_SIZE): New constant
5371 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5372 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5373 If user uses a script with a SECTIONS clause, issue only a warning
5374 for a misplaced EXIDX input section. Otherwise, issue an error.
5375 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5377 (Target_arm::got_mode_index_entry): Handle static linking.
5378 (Target_arm::Scan::local): Ditto.
5379 (Target_arm::Scan::global): Ditto.
5380 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5381 all incorrectly implemented relocations.
5382 (Target_arm::fix_exidx_coverage): Pass layout to
5383 Arm_output_section::fix_exidx_coverage.
5384 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5385 from ".ARM.exidx." and ".ARM.extab.".
5389 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5390 section if it does not already exist.
5391 * attributes.cc (Attributes_section_data::Attributes_section_data):
5392 Don't crash if size is zero.
5397 * gold.cc (queue_middle_tasks): If no input files were opened,
5399 * workqueue.h (Task_function::Task_function): Assert that there is
5404 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5405 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5406 types to avoid warnings due to different uint64_t implementations
5411 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5412 handling of the maximum backward branch offset.
5413 (Arm_relocate_functions::thumb_branch_common): Ditto.
5414 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5415 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5416 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5417 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5418 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5419 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5420 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5421 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5422 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5423 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5424 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5425 thumb2_bl_out_of_range.o): New rules.
5426 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5427 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5428 thumb2_bl_out_of_range
5429 * testsuite/Makefile.in: Regenerate.
5430 * testsuite/arm_bl_in_range.s: New file.
5431 * testsuite/arm_bl_out_of_range.s: Ditto.
5432 * testsuite/arm_branch_in_range.sh: Ditto.
5433 * testsuite/arm_branch_range.t: Ditto.
5434 * testsuite/thumb2_branch_range.t: Ditto.
5435 * testsuite/thumb_bl_in_range.s: Ditto.
5436 * testsuite/thumb_bl_out_of_range.s: Ditto.
5437 * testsuite/thumb_branch_range.t: Ditto.
5441 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5442 Add reloc offset information.
5443 * icf.cc (get_section_contents): Change iterators to point to the new
5444 vectors. Add reloc offset information to the contents.
5445 * icf.h (Icf::Sections_reachable_info): New typedef.
5446 (Icf::Sections_reachable_list): New typedef.
5447 (Icf::Offset_info): New typedef.
5448 (Icf::Reloc_info): New struct typedef.
5449 (Icf::Reloc_info_list): New typedef.
5450 (Icf::symbol_reloc_list): Delete method.
5451 (Icf::addend_reloc_list): Delete method.
5452 (Icf::section_reloc_list): Delete method.
5453 (Icf::reloc_info_list): New method.
5454 (Icf::reloc_info_list_): New member.
5458 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5459 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5460 * arm.cc (Arm_relocation_functions): New forward declaration.
5461 (Target_arm::Target_arm): Initialize new data members
5462 got_mod_index_offset_ and tls_base_symbol_defined_.
5463 (Target_arm::Relocate::relocate_tls): New method.
5464 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5465 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5467 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5468 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5469 (Target_arm::got_mod_index_offset_,
5470 Target_arm::tls_base_symbol_defined_): New data members.
5471 (Target_arm::Scan::local, Target::Scan::global,
5472 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5477 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5478 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5479 text section as a parameter becuase some broken tools may not set
5480 the link in section header.
5481 (Target_arm::has_got_section): New method.
5482 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5483 without any mapping symbol as data only. Remove warning.
5484 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5485 link in its section header, try to discover the link by inspecting the
5486 REL31 relocation at the beginning of the section.
5487 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5489 (Target_arm::Scan::global): Treat any reference to the symbol
5490 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5494 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5495 (Scan::global_reloc_may_be_function_pointer): New function.
5496 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5497 (Scan::global_reloc_may_be_function_pointer): New function.
5498 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5499 (Scan::global_reloc_may_be_function_pointer): New function.
5500 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5501 (Scan::global_reloc_may_be_function_pointer): New function.
5502 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5503 (Scan::global_reloc_may_be_function_pointer): New function.
5504 (Scan::possible_function_pointer_reloc): New function.
5505 (Target_x86_64::can_check_for_function_pointers): New function.
5506 * gc.h (gc_process_relocs): Scan relocation types to determine if
5507 function pointers were taken for targets that support it.
5508 * icf.cc (Icf::find_identical_sections): Include functions for
5509 folding in safe ICF whose pointer is not taken.
5510 * icf.h (Secn_fptr_taken_set): New typedef.
5511 (fptr_section_id_): New member.
5512 (section_has_function_pointers): New function.
5513 (set_section_has_function_pointers): New function.
5514 (check_section_for_function_pointers): New function.
5515 * options.h: Fix comment for safe ICF option.
5516 * target.h (can_check_for_function_pointers): New function.
5517 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5518 Modify icf_safe_test for X86-64.
5519 * testsuite/Makefile.in: Regenerate.
5520 * testsuite/icf_safe_so_test.cc: New file.
5521 * testsuite/icf_safe_so_test.sh: New file.
5522 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5523 (main): Change to take pointer to function kept_func_3.
5524 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5525 folding is done correctly for X86-64.
5529 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5530 is_symbolless parameter.
5531 (Output_reloc<SHT_REL>::is_symbolless): New.
5532 (Output_reloc<SHT_REL>::is_symbolless_): New.
5533 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5534 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5535 (Output_reloc<SHT_RELA>::is_symbolless): New.
5536 (Output_data_reloc::add_global): Handle is_symbolless.
5537 (Output_data_reloc::add_global_relative): Likewise.
5538 (Output_data_reloc::add_local): Likewise.
5539 (Output_data_reloc::add_local_relative): Likewise.
5540 (Output_data_reloc::add_symbolless_global_addend): New.
5541 (Output_data_reloc::add_symbolless_local_addend): New.
5542 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5544 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5545 instead of ->is_relative_
5546 (Output_reloc::write): Likewise.
5547 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5548 (Output_reloc::write_rel): Simplify.
5550 * sparc.cc (Target_sparc::Scan::local): Use
5551 ->add_symbolless_local_addend as needed.
5552 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5553 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5554 based upon relocation offset.
5558 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5559 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5560 beginning of function.
5561 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5562 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5563 parameter is_32bit in calls to should_apply_static_reloc.
5564 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5565 (check_DATA): Add arm_abs_global.stdout.
5566 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5567 arm_abs_global.stdout): New rules.
5568 (MOSTLLYCLEANFILES): Add arm_abs_global
5569 * Makefile.in: Regenerate.
5570 * testsuite/arm_abs_global.s: New file.
5571 * testsuite/arm_abs_global.sh: Ditto.
5572 * testsuite/arm_abs_lib.s: Ditto.
5576 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5578 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5579 Allocate_commons_task first.
5580 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5581 task, rather than symtab_lock_.
5582 (Gc_process_relocs::~Gc_process_relocs): New function.
5583 (Gc_process_relocs::is_runnable): Check this_blocker_.
5584 (Gc_process_relocs::locks): Use next_blocker_ rather than
5586 (Scan_relocs::~Scan_relocs): New function.
5587 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5589 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5591 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5592 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5593 constructor accordingly.
5594 (class Gc_process_relocs): Likewise.
5595 (class Scan_relocs): Likewise.
5596 * common.h (class Allocate_commons_task): Remove symtab_lock_
5597 field, and corresponding constructor parameter.
5598 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5600 (Allocate_commons_task::locks): Likewise.
5604 * gold-threads.h (class Once): Define.
5605 (class Initialize_lock): Rewrite as child of Once.
5606 * gold-threads.cc (class Once_initialize): Define.
5607 (once_pointer_control): New static variable.
5608 (once_pointer, once_arg): New static variables.
5609 (c_run_once): New static function.
5610 (Once::Once, Once::run_once, Once::internal_run): New functions.
5611 (class Initialize_lock_once): Remove.
5612 (initialize_lock_control): Remove.
5613 (initialize_lock_pointer): Remove.
5614 (initialize_lock_once): Remove.
5615 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5616 (Initialize_lock::initialize): Rewrite.
5617 (Initialize_lock::do_run_once): New function.
5618 * archive.cc (Archive::interpret_header): Only clear name if it is
5620 * fileread.cc: Include "gold-threads.h"
5621 (file_counts_lock): New static variable.
5622 (file_counts_initialize_lock): Likewise.
5623 (File_read::release): Only increment counts when using --stats.
5624 Use a lock around the increment.
5625 * parameters.cc (class Set_parameters_target_once): Define.
5626 (set_parameters_target_once): New static variable.
5627 (Parameters::Parameters): Move here from parameters.h.
5628 (Parameters::set_target): Rewrite.
5629 (Parameters::set_target_once): New function.
5630 (Parameters::clear_target): Move here and rewrite.
5631 * parameters.h (class Parameters): Update declarations. Add
5632 set_parameters_target_once_ field.
5633 (Parameters::Parameters): Move to parameters.cc.
5634 (Parameters::clear_target): Likewise.
5635 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5637 (Start_group::~Start_group): New function.
5638 (Start_group::is_runnable): New function.
5639 (Start_group::locks, Start_group::run): New functions.
5640 (Finish_group::run): Change saw_undefined to size_t.
5641 * readsyms.h (class Start_group): Define.
5642 (class Finish_group): Change saw_undefined_ field to size_t.
5643 (Finish_group::Finish_group): Remove saw_undefined and
5644 this_blocker parameters. Change all callers.
5645 (Finish_group::set_saw_undefined): New function.
5646 (Finish_group::set_blocker): New function.
5647 * symtab.h (class Symbol_table): Change saw_undefined to return
5648 size_t. Change saw_undefined_ field to size_t.
5649 * target-select.cc (Set_target_once::do_run_once): New function.
5650 (Target_selector::Target_selector): Initialize set_target_once_
5651 field. Don't initialize lock_ and initialize_lock_ fields.
5652 (Target_selector::instantiate_target): Rewrite.
5653 (Target_selector::set_target): New function.
5654 * target-select.h (class Set_target_once): Define.
5655 (class Target_selector): Update declarations. Make
5656 Set_target_once a friend. Remove lock_ and initialize_lock_
5657 fields. Add set_target_once_ field.
5661 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5663 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5664 (queue_middle_tasks): Add all blockers before queueing any tasks.
5665 (queue_final_tasks): Likewise.
5666 * token.h (Task_token::add_blockers): New function.
5667 * object.h (Input_objects::number_of_relobjs): New function.
5671 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5672 shared, not if not position independent.
5673 * x86_64.cc (Relocate::relocate_tls): Likewise.
5674 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5675 (tls_pie_pic_test): New target.
5676 * testsuite/Makefile.in: Rebuild.
5678 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5679 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5680 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5681 * testsuite/Makefile.in: Rebuild.
5685 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5686 R_SPARC_RELATIVE using ->add_local_relative().
5687 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5689 * output.h (Output_data_dynamic::add_section_size): New method
5690 that takes two Output_data objects.
5691 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5692 entry param. Handle it in initializers.
5693 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5694 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5695 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5697 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5698 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5699 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5700 for dynrel_includes_plt.
5701 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5702 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5703 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5705 (Target_sparc::do_finalize_sections): Update to pass true for
5706 dynrel_includes_plt.
5707 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5708 output before .rela.plt
5709 (Target_powerpc::do_finalize_sections): Update to pass true for
5710 dynrel_includes_plt when 32-bit.
5714 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5716 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5717 Arm_relobj::scan_section_for_cortex_a8_stubs,
5718 Arm_relobj::do_relocation_section): Instead of calling
5719 Output_section::output_address, use faster
5720 Arm_relobj::simple_input_section_output_address.
5724 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5725 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5726 relocation helper function.
5728 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5729 just like R_SPARC_GOT{10,13,22}.
5730 (Target_sparc::Scan::local): Likewise.
5731 (Target_sparc::Relocate:relocate): Likewise.
5735 * configure.ac: Rewrite targetobjs duplicate removal code to use
5736 only shell constructs.
5737 * configure: Rebuild.
5742 * arm.cc (Arm_relobj::section_is_scannable): New method.
5743 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5744 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5749 * arm-reloc-property.cc (cstdio): Include.
5750 * configure.ac (targetobjs): Remove duplicates.
5751 * configure: Regenerate.
5752 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5753 big and little endian version for a given address size.
5757 * arm-reloc-property.cc
5758 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5760 * arm-reloc-property.h
5761 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5762 New method definition.
5763 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5765 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5767 (GOT_PREL): Change implemented to Y.
5768 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5769 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5770 (Arm_relocate_functions::movw_abs_nc): Remove method.
5771 (Arm_relocate_functions::movt_abs): Ditto.
5772 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5773 (Arm_relocate_functions::thm_movt_abs): Ditto.
5774 (Arm_relocate_functions::movw_rel_nc): Ditto.
5775 (Arm_relocate_functions::movw_rel): Ditto.
5776 (Arm_relocate_functions::movt_rel): Ditto.
5777 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5778 (Arm_relocate_functions:thm_movw_rel): Ditto.
5779 (Arm_relocate_functions:thm_movt_rel): Ditto.
5780 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5781 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5782 New method definitions.
5783 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5784 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5785 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5786 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5787 (Target_arm::Relocate::relocate): Check for non-static or
5788 unimplemented relocation code and exit early. Change calls to
5789 Target_arm::reloc_uses_thumb_bit and
5790 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5791 instead. Refactor code to handle similar relocations to increase
5792 code sharing. Remove check for unsupported relocation code in switch
5794 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5795 relocation property table to find out size. Change error message to
5796 print out the name of a relocation code instead of the numeric value.
5797 (Target_arm::scan_reloc_for_stub): Use relocation property table
5798 instead of calling Target_arm::reloc_uses_thumb_bit().
5802 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5803 types of relaxed input section.
5807 * Makefile.am (HFILES): Add arm-reloc-property.h.
5809 (TARGETSOURCES): Add arm-reloc-property.cc
5810 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5811 (libgold_a_SOURCES): $(DEFFILES)
5812 * Makefile.in: Regenerate.
5813 * arm-reloc-property.cc: New file.
5814 * arm-reloc-property.h: New file.
5815 * arm-reloc.def: New file.
5816 * arm.cc: Update comments.
5817 (arm-reloc-property.h): New included header.
5818 (arm_reloc_property_table): New global variable.
5819 (Target_arm::do_select_as_default_target): New method definition.
5820 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5821 arm-reloc-property to targ_extra_obj.
5822 * parameters.cc (set_parameters_target): Call
5823 Target::select_as_default_target().
5824 * target.h (Target::select_as_default_target): New method definition.
5825 (Target::do_select_as_default_target): Same.
5829 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5830 first_output_text_section_.
5831 (Arm_exidx_fixup::first_output_text_section): New method definition.
5832 (Arm_exidx_fixup::first_output_text_section_): New data member.
5833 (Arm_exidx_fixup::process_exidx_section): Record the first text
5834 output section seen.
5835 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5836 and entsize in output section header.
5840 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5841 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5842 (Arm_relocate_functions::thm_alu11): New Method.
5843 (Arm_relocate_functions::thm_pc8): New Method.
5844 (Arm_relocate_functions::thm_pc12): New Method.
5845 (Target_arm::Scan::local): Handle the relocations.
5846 (Target_arm::Scan::global): Likewise.
5847 (Target_arm::Relocate::relocate): Likewise.
5848 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5852 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5853 of relocation types as ld.
5857 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5859 (Arm_relocate_functions::thumb_branch_common): Ditto.
5860 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5861 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5862 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5863 Arm_relocate_functions::jump24): Remove.
5864 (Target_arm::Relocate::relocate): Adjust code to call
5865 Arm_relocation_functions::arm_branch_common and
5866 Arm_relocation_functions::thumb_branch_common instead of their removed
5867 wrappers. Merge switch-cases together to reduce source code size.
5871 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5872 output_local_symbol_count_needs_update_.
5873 (Arm_relobj::output_local_symbol_count_needs_update,
5874 Arm_relobj::set_output_local_symbol_count_needs_update,
5875 Arm_relobj::update_output_local_symbol_count): New methods.
5876 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5878 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5879 of pointed function as in a R_ARM_PREL31 relocation.
5880 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5881 for output local symbol count updating.
5882 (Target_arm::do_relax): Update output local symbol counts in objects
5884 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5888 * arm.cc: Added support for the ARM relocations:
5889 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5890 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5891 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5893 (Arm_relocate_functions::movw_rel): New method.
5894 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5895 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5897 (Arm_relocate_functions::thm_movw_rel): New method.
5898 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5900 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5902 (Target_arm::Scan::global): Likewise.
5903 (Target_arm::Relocate::relocate): Likewise.
5904 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5909 * arm.cc: Added support for ARM group relocations.
5910 (Target_arm::reloc_needs_sym_origin): New method.
5911 (Arm_relocate_functions::calc_grp_kn): New method.
5912 (Arm_relocate_functions::calc_grp_residual): New method.
5913 (Arm_relocate_functions::calc_grp_gn): New method.
5914 (Arm_relocate_functions::arm_grp_alu): New Method.
5915 (Arm_relocate_functions::arm_grp_ldr): New Method.
5916 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5917 (Arm_relocate_functions::arm_grp_ldc): New Method.
5918 (Target_arm::Scan::local): Handle the ARM group relocations.
5919 (Target_arm::Scan::global): Likewise.
5920 (Target_arm::Relocate::relocate): Likewise.
5921 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5926 * arm.cc (set): Include.
5927 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5929 (Arm_output_section::Text_section_list): New type.
5930 (Arm_output_section::append_text_sections_to_list): New method.
5931 (Arm_output_section::fix_exidx_coverage): Ditto.
5932 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5933 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5934 Relobj::set_section_offset() instead of
5935 Sized_relobj::invalidate_section_offset().
5936 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5937 parameter for section headers. Ignore relocation sections for
5938 unallocated sections and EXIDX sections.
5939 (Target_arm::fix_exidx_coverage): New method.
5940 (Target_arm::output_section_address_less_than): New type.
5941 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5942 linked text section instead of the EXIDX section.
5943 (Arm_output_section::create_stub_group): Add an assertion to check
5944 that this is not an EXIDX output section.
5945 (Arm_output_section::append_text_sections_to_list): New method.
5946 (Arm_output_section::fix_exidx_coverage): Ditto.
5947 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5948 Arm_relobj::section_needs_reloc_stub_scanning.
5949 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5951 (Target_arm::fix_exidx_coverage): New method.
5952 * object.h (Relobj::set_output_section): New method.
5953 (Sized_relobj::invalidate_section_offset): Remove method.
5954 (Sized_relobj::do_invalidate_section_offset): Remove method.
5955 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5959 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5960 Fix warning due to signed and unsigned comparison on a 32-bit host.
5964 * arm.cc (Target_arm::do_relax): Record an output section for section
5965 offset adjustment it contains any stub table that has changed.
5966 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5967 offsets in an output section if necessary.
5968 * output.cc (Output_section::Output_section): Initialize
5969 section_offsets_need_adjustments_.
5970 (Output_section::add_input_section_for_script): Renamed to
5971 Output_section::add_simple_input_section.
5972 (Output_section::save_states): Add a comment.
5973 (Output_section::discard_states): New method defintion.
5974 (Output_section::adjust_section_offsets): Same.
5975 * output.h (Output_section::add_input_section_for_script): Renamed to
5976 Output_section::add_simple_input_section.
5977 (Output_section::discard_states): New method declaration.
5978 (Output_section::adjust_section_offsets): Same.
5979 (Output_section::section_offsets_need_adjustment,
5980 Output_section::set_section_offsets_need_adjustment): New method
5982 (Output_section::section_offsets_need_adjustment_): New data member.
5983 * script-sections.cc
5984 (Output_section_element_input::set_section_address): Adjust code for
5985 renaming of Output_section::add_input_section_for_script.
5986 (Orphan_output_section::set_section_address): Same.
5990 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5991 Fix_v4bx enum values .
5992 * gold/options.h (General_options): New option definitions.
5993 (General_options::fix_v4bx): New method.
5994 (General_options::Fix_v4bx): New enum.
5995 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5996 (General_options::parse_fix_v4bx_interworking): New method.
6000 * arm.cc (Arm_exidx_fixup): New class.
6004 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6006 (Arm_exidx_section_offset_map): New type.
6010 * arm.cc (Arm_exidx_input_section): New class.
6011 (Arm_relobj::exidx_input_section_by_link,
6012 Arm_relobj::exidx_input_section_by_shndx,
6013 Arm_relobj::make_exidx_input_section): New methods.
6014 (read_arm_attributes_section): Remove.
6015 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6016 information about them.
6017 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6022 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6023 Input_section_specifier to Section_id.
6024 (Target_arm::new_arm_input_section: Adjust code for change of key
6026 (Target_arm::find_arm_input_section): Ditto.
6027 * gc.h (object.h): Include for Section_id nand Section_id_hash.
6028 (Section_id): Remove.
6029 (Garbage_collection::Section_id_hash): Remove.
6030 * icf.h (object.h): Include for Section_id nand Section_id_hash.
6031 (Section_id): Remove.
6032 (Icf::Section_id_hash): Remove.
6033 * object.h (Section_id, Const_section_id, Section_id_hash,
6034 Const_section_id_hash): New type definitions.
6035 * output.cc (Output_section::add_relaxed_input_section): Change to
6036 use Const_section_id instead of Input_section_specifier as key type.
6037 (Output_section::add_merge_input_section): Ditto.
6038 (Output_section::build_relaxation_map): Change to use Section_id
6039 instead of Input_section_specifier as key type.
6040 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6042 (Output_section::convert_input_sections_to_relaxed_sections): Change
6043 to use Const_section_id instead of Input_section_specifier as key type.
6044 (Output_section::find_merge_section): Ditto.
6045 (Output_section::find_relaxed_input_section): Ditto.
6046 * output.h (Input_section_specifier): Remove class.
6047 (Output_section::Output_section_data_by_input_section_map): Change
6048 key type to Const_section_id.
6049 (Output_section::Output_relaxed_input_section_by_input_section_map):
6051 (Output_section::Relaxation_map): Change key type to Section_id.
6055 * gold/arm.cc: Added support for R_ARM_V4BX relocation
6056 (class Arm_v4bx_stub): New class.
6057 (DEF_STUBS): Updated definition to support v4_veneer_bx.
6058 (Stub_factory::make_arm_v4bx_stub): New method.
6059 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6060 (Stub_table::empty): Handle v4bx stubs.
6061 (Stub_table::add_arm_v4bx_stub): New method.
6062 (Stub_table::find_arm_v4bx_stub): New method.
6063 (Arm_relocate_functions::v4bx): New method.
6064 (Target_arm::fix_v4bx): New method.
6065 (Target_arm::Target_arm): Handle R_ARM_V4BX.
6066 (Stub_table::relocate_stubs): Likewise.
6067 (Stub_table::do_write): Likewise.
6068 (Stub_table::update_data_size_and_addralign): Likewise.
6069 (Stub_table::finalize_stubs): Likewise.
6070 (Target_arm::Scan::local): Likewise.
6071 (Target_arm::Scan::global): Likewise.
6072 (Target_arm::do_finalize_sections): Likewise.
6073 (Target_arm::Relocate::relocate): Likewise.
6074 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6076 (Target_arm::scan_reloc_for_stub): Likewise.
6077 (Target_arm::scan_reloc_section_for_stubs): Likewise.
6081 * output.cc (Output_section_headers::do_sized_write): Write large
6082 segment count to sh_info field.
6083 (Output_file_header::do_sized_write): For large segment count,
6084 write PN_XNUM to e_phnum field.
6088 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6089 (Arm_relocate_functions::thm_jump8): New function.
6090 (Arm_relocate_functions::thm_jump11): New function.
6091 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6093 (Target_arm::Scan::global): Likewise.
6094 (Target_arm::Relocate::relocate): Likewise.
6095 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6100 * arm.cc (map, utility): Include headers.
6101 (Target_arm::apply_cortex_a8_workaround): New method.
6102 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6103 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6104 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6105 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6106 the --[no-]fix-cortex-a8 command line options.
6107 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6108 (Target_arm::relocate_stub): Use addend in instruction template.
6109 * options.h (DEFINE_bool): Set the user-set flag.
6110 (General_options): Add --[no-]-fix-cortex options.
6111 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6112 : Update fast look-up map after conversion.
6116 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6117 in the first pass of do_layout.
6121 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6122 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6123 apparent compiler problem of not folding static constant integral
6124 data members of elfcpp::Elf_sizes<32>.
6128 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6129 Arm_relobj::section_needs_cortex_a8_stub_scanning,
6130 Arm_relobj::scan_section_for_cortex_a8_erratum,
6131 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6132 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6133 sections to scan for relocation stubs into a new method
6134 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
6135 relocation and Cortex-A8 stub scanning.
6136 (Target_arm::do_relax): Force stubs to be after stubbed sections
6137 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
6138 the beginning of a new relaxation pass. Update a comment.
6139 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6143 * target-reloc.h (visibility_error): New inline function.
6144 (relocate_section): Call visibility_error.
6145 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6146 (MOSTLYCLEANFILES): Likewise.
6147 (protected_4_pic.o, protected_3.err): New targets.
6148 * testsuite/protected_4.cc: New file.
6152 * arm.cc (Cortex_a8_reloc): New class.
6153 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6154 and cortex_a8_relocs_info_.
6155 (Target_arm::fix_cortex_a8): New method definition.
6156 (Target_arm::Cortex_a8_relocs_info): New type.
6157 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6158 New data member declarations.
6159 (Target_arm::scan_reloc_for_stub): Record information about
6160 relocations for THUMB branches that might be exempted from the
6161 Cortex-A8 workaround.
6162 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6163 at the beginning of a relaxation pass.
6167 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6168 (Arm_relobj::Mapping_symbol_position,
6169 Arm_reloj::Mapping_symbol_position_less,
6170 Arm_relobj::Mapping_symbols_info): New types.
6171 (Target_arm::is_mapping_symbol_name): New method definition.
6172 (Arm_relobj::do_count_local_symbols): Save information about mapping
6177 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6178 Arm_relocate_functions::thumb32_branch_upper,
6179 Arm_relocate_functions::thumb32_branch_lower,
6180 Arm_relocate_functions::thumb32_cond_branch_offset,
6181 Arm_relocate_functions::thumb32_cond_branch_upper,
6182 Arm_relocate_functions::thumb32_cond_branch_lower,
6183 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6184 branch offset encoding.
6185 (Arm_relocate_functions::thumb_branch_common): Use new branch
6186 offset encoding methods to avoid code duplication.
6187 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6188 (Stub_addend_reader::operator()): Use new branch encoding method
6189 to avoid code duplication.
6193 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6194 (Target_arm::do_finalize_sections): Define special EXIDX section
6195 symbols only if referenced.
6196 * gc.h (Garbage_collection::add_reference): New method.
6197 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6202 * script.cc (Version_script_info::build_expression_list_lookup):
6203 Change complaing about duplicate wildcard match from error to
6206 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6208 (Version_script_info::Version_script_info): Initialize globs_,
6209 default_version_, default_is_global_, and exact_. Don't
6210 initialize globals_ or locals_.
6211 (Version_script_info::build_lookup_tables): Build local symbols
6213 (Version_script_info::unquote): New function.
6214 (Version_script_info::add_exact_match): New function.
6215 (Version_script_info::build_expression_list_lookup): Remove lookup
6216 parameter. Add is_global parameter. Change all callers. Handle
6217 wildcard pattern specially. Unquote pattern. Call
6219 (Version_script_info::get_name_to_match): New function.
6220 (Version_script_info::get_symbol_version): New function.
6221 (Version_script_info::get_symbol_version_helper): Remove.
6222 (Version_script_info::check_unmatched_names): Call unquote.
6223 * script.h (class Version_script_info): Change get_symbol_version
6224 to be non-inline and add is_global parameter; change all callers.
6225 Rewrite symbol_is_local. Update declarations. Define struct
6226 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6227 Remove globals_ and locals_ members. Add exact_, globs_,
6228 default_version_, is_global_.
6229 (Version_script_info::Glob): Remove pattern, add expression and
6230 is_global. Update constructor. Change all callers.
6231 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6233 (Versions::symbol_section_contents): If a symbol is undefined, or
6234 defined in a dynamic object, set the version index to
6236 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6238 (Symbol_table::add_from_pluginobj): Likewise.
6239 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6243 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6244 (incremental_dump_LDADD): Add linking option for libintl.
6245 * Makefile.in: Regenerate.
6250 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6252 * testsuite/Makefile.in: Regenerated.
6256 * options.h (DEFINE_var): Use parentheses around argument varname__
6257 in macro body to avoid any unintended subsequent substitutions.
6261 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6262 candidates before doing symbol resolution.
6264 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6265 ODR candidates if only one is weak.
6269 * script.cc (Version_script_info::build_expression_list_lookup):
6270 Don't warn about ambiguous version, just record the ambiguity.
6271 (Version_script_info::get_symbol_version_helper): Give error if
6272 version is ambiguous.
6276 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6277 prev_data_size_ and prev_addralign_. Remove initializer for
6278 deleted data member has_been_changed_.
6279 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6280 to determine if the table is empty.
6281 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6283 (Stub_table::add_reloc_stub): Define method in class definition
6284 instead of just declaring it there.
6285 (Stub_table::add_cortex_a8_stub): New method definition.
6286 (Stub_table::update_data_size_and_addralign): Ditto.
6287 (Stub_table::finalize_stubs): Ditto.
6288 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6289 (Stub_table::do_addralign_): Return address alignment in the
6290 (Stub_table::do_reset_address_and_file_offset): Define method in
6291 class definition instead of declaring it there. Set current data
6292 size to be the data size of the previous pass.
6293 (Stub_table::set_final_data_size): Use current data size as the
6295 (Stub_table::relocate_stub): Change parameter type of stub from
6296 Reloc_stub pointer to Stub pointer.
6297 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6298 (Stub_table::Cortex_a8_stub_list): New typedef.
6299 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6300 Stub_table::prev_addralign_): New data member.
6301 (Arm_relobj::Arm_relobj): Initialize data member
6302 section_has_cortex_a8_workaround_.
6303 (Arm_relobj::section_has_cortex_a8_workaround,
6304 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6306 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6308 (Target_arm::relocate_stub): Change parameter type of stub from
6309 Reloc_stub pointer to Stub pointer.
6310 (Insn_template::size, Insn_template::alignment): Handle
6311 THUMB16_SPECIAL_TYPE.
6312 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6313 Stub_table::update_data_size_and_addralign,
6314 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6316 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6317 (Stub_table::do_write): Ditto.
6318 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6323 * symtab.h (class Symbol): Remove fields is_target_special_ and
6324 has_plt_offset_. Add field is_defined_in_discarded_section_.
6325 (Symbol::is_defined_in_discarded_section): New function.
6326 (Symbol::set_is_defined_in_discarded_section): New function.
6327 (Symbol::has_plt_offset): Rewrite.
6328 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6329 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6330 Don't initialize is_target_special_ or has_plt_offset_.
6331 Initialize is_defined_in_discarded_section_.
6332 (Symbol_table::add_from_relobj): If appropriate, set
6333 is_defined_in_discarded_section.
6334 * resolve.cc (Symbol::override_base_with_special): Don't test
6335 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6336 * target-reloc.h (relocate_section): Do special handling for
6337 symbols defined in discarded sections for global symbols as well
6342 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6343 the SHT_SYMTAB case.
6347 * object.cc (Sized_relobj::do_layout): Don't get confused if
6348 layout_eh_frame returns NULL.
6353 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6354 dynamic symbol table, use the normal symbol table.
6355 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6361 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6366 * version.cc (print_version): Change to "Copyright 2010".
6372 * i386.cc (class Target_i386): Change return type of plt_section
6374 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6375 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6376 tls_desc_rel_ field.
6377 (Output_data_plt_i386::rel_tls_desc): New function.
6378 (Target_i386::rel_tls_desc_section): New function.
6379 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6380 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6381 R_386_TLS_DESC reloc in rel_tls_desc_section.
6382 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6383 Define struct Tlsdesc_info.
6384 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6385 (Target_x86_64::do_reloc_symbol_index): New function.
6386 (Target_x86_64::add_tlsdesc_info): New function.
6387 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6388 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6390 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6392 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6393 (Target_x86_64::rela_tlsdesc_section): New function.
6394 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6396 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6397 (Target_x86_64::do_reloc_addend): New function.
6398 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6399 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6400 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6401 (Output_reloc::type): New function.
6402 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6403 (Output_reloc::is_target_specific): New function.
6404 (Output_reloc::target_arg): New function.
6405 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6406 absolute relocs and target specific relocs.
6407 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6408 add_target_specific.
6409 (class Output_data_reloc) [SHT_RELA]: Likewise.
6410 * output.cc (Output_reloc::Output_reloc): Add four new versions
6411 for absolute relocs and target specific relocs.
6412 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6413 (Output_reloc::get_symbol_index): Likewise.
6414 (Output_reloc::local_section_offset): Check that local_sym_index_
6415 is not TARGET_CODE or 0.
6416 (Output_reloc::symbol_value): Likewise.
6417 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6419 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6420 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6422 * layout.cc (add_target_dynamic_tags): Use output section for
6423 DT_PLTRELSZ and DT_JMPREL.
6428 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6430 (class Output_data_reloc_generic): Define.
6431 (class Output_data_reloc_base): Change base class to
6432 Output_data_reloc_generic. Change add() method to call
6433 bump_relative_reloc_count for a relative reloc. Remove
6435 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6437 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6438 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6440 * layout.h (class Layout): Update declaration.
6444 * output.h (class Output_data): Add const version of
6445 output_section and do_output_section.
6446 (class Output_section_data): Add const version of
6448 (class Output_section): Likewise.
6449 * layout.cc (Layout::add_target_dynamic_tags): New function.
6450 * layout.h (class Layout): Update declarations.
6451 * arm.cc (Target_arm::do_finalize_sections): Use
6452 add_target_dynamic_tags.
6453 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6454 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6455 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6456 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6461 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6468 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6469 Xindex::read_symtab_xindex.
6473 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6474 (Insn_template::thumb16_bcond_insn): New method declaration.
6475 (Insn_template): Fix spelling.
6476 (Stub::thumb16_special): New method declaration.
6477 (Stub::do_write): Define virtual method which was previously pure
6479 (Stub::do_thumb16_special): New method declaration.
6480 (Stub::do_fixed_endian_write): New template member.
6481 (Reloc_stub::do_write): Remove.
6482 (Reloc_stub::do_fixed_endian_write): Remove.
6483 (Cortex_a8_stub): New class definition.
6484 (Stub_factory::make_cortex_a8_stub): New method definition.
6485 (Stub_factory::Stub_factory): Add missing static storage class
6486 qualifier for elf32_arm_stub_a8_veneer_blx.
6491 * options.h (class General_options): Add --warn-unresolved-symbols
6492 and --error-unresolved-symbols.
6493 * errors.cc (Errors::undefined_symbol): Implement
6494 --warn-unresolved-symbols.
6496 * options.h (class General_options): Add -z text and -z textoff.
6497 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6501 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6502 (Garbage_collection::cident_sections): New function.
6503 (Garbage_collection::add_cident_section): New function.
6504 (Garbage_collection::cident_sections_): New member.
6505 (gc_process_relocs): Add references to sections whose names are C
6507 * gold.h (cident_section_start_prefix): New constant.
6508 (cident_section_stop_prefix): New constant.
6509 (is_cident): New function.
6510 * layout.cc (Layout::define_section_symbols): Replace string constants
6511 with the newly defined constants.
6512 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6514 * testsuite/Makefile.am: Add gc_orphan_section_test.
6515 * testsuite/Makefile.in: Regenerate.
6516 * testsuite/gc_orphan_section_test.cc: New file.
6517 * testsuite/gc_orphan_section_test.sh: New file.
6522 * options.h (class General_options): Add --warn-shared-textrel.
6523 * layout.cc (Layout::finish_dynamic_section): Implement
6524 --warn-shared-textrel.
6527 * options.h (class General_options): Add --warn-multiple-gp.
6531 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6532 $(THREADSLIB) and $(LIBDL).
6533 * Makefile.in: Rebuild.
6538 * options.cc (General_options::parse_section_start): New function.
6539 (General_options::section_start): New function.
6540 (General_options::General_options): Initialize all members.
6541 * options.h: Include <map>
6542 (class General_options): Add --section-start. Add section_starts_
6544 * layout.cc (Layout::attach_allocated_section_to_segment): If
6545 --section-start was used, set the address of the segment. Remove
6546 local sort_sections.
6547 (Layout::relaxation_loop_body): If the address of the load segment
6548 has been set by --section-start, don't use it.
6549 * output.h (Output_segment::update_flags_for_output_section): New
6551 * output.cc (Output_segment::add_output_section): Call
6552 update_flags_for_output_section.
6557 * options.h (class General_options): Add --undefined-version.
6558 * script.cc (struct Version_expression): Add was_matched_by_symbol
6560 (Version_script_info::matched_symbol): New function.
6561 (Version_script_info::get_symbol_version_helper): Call
6563 (Version_script_info::check_unmatched_names): New function.
6564 * script.h (class Version_script_info): Update declarations.
6565 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6567 * options.h (class General_options): Use DEFINE_bool_alias for
6568 allow_multiple_definition.
6569 * resolve.cc (Symbol_table::should_override): Don't test
6570 allow_multiple_definition.
6573 * options.h (class General_options): Add --cref.
6574 * main.cc (main): Print cref table if --cref. Don't close mapfile
6575 until after printing cref table.
6576 * cref.cc: Include "symtab.h".
6577 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6578 (Cref_table_compare::operator()): New function.
6579 (Cref_inputs::gather_cref): New function.
6580 (filecol): New static const.
6581 (Cref_inputs::print_cref): New function.
6582 (Cref::print_cref): New function.
6583 * cref.h: Include <cstdio>.
6584 (class Cref): Update declarations.
6585 * mapfile.h (Mapfile::file): New function.
6586 * object.h (class Object): Define Symbols. Declare virtual
6587 do_get_global_symbols.
6588 (Object::get_global_symbols): New function.
6589 * object.cc (Input_objects::add_object): Pass object to cref_ if
6591 (Input_objects::archive_start): Likewise.
6592 (Input_objects::archive_stop): Likewise.
6593 (Input_objects::print_cref): New function.
6594 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6595 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6597 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6599 * plugin.h (class Sized_pluginobj): Update declarations.
6603 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6604 to is_default_version. Rename insdef to insdefault.
6605 (Symbol_table::add_from_relobj): Rename def to is_default_version
6606 and local to is_forced_local.
6607 (Symbol_table::add_from_pluginobj): Likewise.
6608 (Symbol_table::add_from_dynobj): Likewise.
6609 (Symbol_table::define_special_symbol): Rename insdef to
6615 * options.h (class General_options): Add
6616 --allow-multiple-definition and -z muldefs.
6617 * resolve.cc (Symbol_table::should_override): Don't warn about a
6618 multiple symbol definition if --allow-multiple-definition or -z
6622 * options.h (class General_options): Add --add-needed and
6623 --copy-dt-needed-entries. Tweak --as-needed help entry.
6624 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6625 error if --copy-dt-needed-entries aka --add-needed is used and
6626 would cause a change in behaviour.
6629 * options.h (class General_options): Add -G as a short version of
6630 --shared. Add no-op options -assert, -g, and -i.
6634 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6635 check for .text or .gnu.linkonce.t sections.
6636 * icf.cc (Icf::find_identical_sections): Ditto.
6637 Change the detection for mangled function name within the section
6639 * icf.h (is_section_foldable_candidate): New function.
6644 * options.h (class General_options): Permit two dashes with
6645 --retain-symbols-file.
6650 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6651 don't put the file header and segment headers in the text
6655 * common.cc (Sort_commons::operator()): Stabilize sort when both
6657 (Symbol_table::do_allocate_commons_list): When allocating common
6658 symbols, skip a symbol which is no longer common.
6659 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6660 an object before checking its type.
6661 * testsuite/common_test_2.c: New file.
6662 * testsuite/common_test_3.c: New file.
6663 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6664 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6665 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6666 (common_test_2_pic.o, common_test_2.so): New targets.
6667 (common_test_3_pic.o, common_test_3.so): New targets.
6668 * testsuite/Makefile.in: Rebuild.
6671 * script.cc (read_input_script): If we see a new SECTIONS clause,
6672 and we have added an input section, give an error.
6673 * layout.h (class Layout): Add have_added_input_section function.
6674 Add have_added_input_section_ field.
6675 * layout.cc (Layout::Layout): Initialize
6676 have_added_input_section_.
6677 (Layout::layout): Set have_added_input_section_.
6678 (Layout::layout_eh_frame): Likewise.
6683 * options.h (class General_options): Add --sort-common option.
6684 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6685 * common.cc (Sort_common): Add sort_order parameter to
6686 constructor. Add sort_order_ field.
6687 (Sort_commons::operator): Check sort_order_.
6688 (Symbol_table::allocate_commons): Determine the sort order.
6689 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6691 (Symbol_table::do_allocate_commons_list): Likewise.
6696 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6697 symbols from this object, don't change the visibility of an
6699 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6704 * script.h (class Version_script_info): Define Language enum.
6705 Update declarations. Define Glob, Exact, and Lookup types. Add
6706 new fields globals_, locals_, and is_finalized_.
6707 * script.cc: Various formatting fixes.
6708 (class Parser_closure): Change language_stack_ from a vector of
6709 std::string to one of Version_script_info::Language. Adjust all
6711 (class Lazy_demangler): Remove.
6712 (struct Version_expression): Change language from std::string to
6713 Version_script_info::Language.
6714 (Version_script_info::Version_script_info): New function.
6715 (Version_script_info::~Version_script_info): Don't call clear.
6716 (Version_script_info::finalize): New function.
6717 (Version_script_info::build_lookup_tables): New function.
6718 (Version_script_info::build_expression_list_lookup): New
6720 (Version_script_info::get_symbol_version_helper): Rewrite to use
6722 (Version_script_info::print_expression_list): Adjust to use
6723 Version_script_info::Language.
6724 (script_push_lex_into_version_mode): Check that the version script
6725 has not been finalized.
6726 (version_script_push_lang): Change language string to
6727 Version_script_info::Language.
6728 * options.cc (Command_line::version_script): New function.
6729 * options.h (class General_options): Add finalize_dynamic_list
6730 function. Change version_script from declaration to definition.
6731 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6732 * testsuite/version_script.map: Remove duplicate def of foo.
6733 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6735 * testsuite/Makefile.in: Rebuild.
6740 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6741 if the input symbol index is 0, make the output symbol index 0.
6746 * options.h (class General_options): Add -x/--discard-all.
6747 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6748 --discard-all. If the local symbol needs a dynamic entry, check
6749 that before handling --discard-locals.
6754 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6756 (Output_segment::add_output_section): Don't change the flags if
6760 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6761 GNU hash table if they need a dynamic value. Otherwise, don't add
6762 them if they are defined in a dynamic object or are forced local.
6767 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6768 .gnu.hash table for a 32-bit target.
6771 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6772 regular and a dynamic object only needs a dynamic symbol table
6773 entry if it is externally visible.
6776 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6777 constructor. Add global_offset_table_ field.
6778 (Target_i386::got_section): Set global_offset_table_.
6779 (Target_i386::do_finalize_sections): Set global_offset_table_
6781 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6782 in constructor. Add global_offset_table_ field.
6783 (Target_x86_64::got_section): Set global_offset_table_.
6784 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6787 * layout.cc (Layout::Layout): Initialize increase_relro_.
6788 (Layout::get_output_section): Add is_relro, is_last_relro, and
6789 is_first_non_relro parameters. Change all callers.
6790 (Layout::choose_output_section): Likewise.
6791 (Layout::add_output_section_data): Likewise.
6792 (Layout::make_output_section): Likewise.
6793 (Layout::set_segment_offsets): Clear increase_relro when using a
6795 * layout.h (class Layout): Add increase_relro method. Add
6796 increase_relro_ field. Update declarations.
6797 * output.cc (Output_section::Output_section): Initialize
6798 is_last_relro_ and is_first_non_relro_.
6799 (Output_segment::add_output_section): Group relro sections is
6800 do_sort is true. Handle is_last_relro and is_first_non_relro.
6801 (Output_segment::maximum_alignment): Remove relro handling.
6802 (Output_segment::set_section_addresses): Add increase_relro
6803 parameter. Change all callers. Add initial alignment to align
6804 relro sections on separate page. Remove old relro handling.
6805 (Output_segment::set_section_list_addresses): Remove in_relro
6806 parameter. Change all callers.
6807 (Output_segment::set_offset): Add increase parameter. Change all
6808 callers. Remove old relro handling.
6809 * output.h (class Output_section): Add new methods: is_last_relro,
6810 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6811 Add is_last_relro_ and is_first_non_relro_ fields.
6812 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6813 Create separate .got.plt section. Call increase_relro.
6814 * x86_64.cc (Target_x86_64::got_section): Likewise.
6815 * testsuite/relro_script_test.t: Add .got.plt.
6818 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6819 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6820 (Layout::finalize): Call set_dynamic_symbol_size.
6821 (Layout::set_dynamic_symbol_size): New function.
6822 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6823 set_dynamic_symbol_size.
6826 * output.h (class Output_section): Add is_entsize_zero_ field.
6827 * output.cc (Output_section::Output_section): Initialize
6829 (Output_section::set_entsize): If two different entsizes are
6830 requested, force it to zero.
6831 (Output_section::add_input_section): Set flags for .debug_str
6832 before updating section flags. Set entsize.
6833 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6834 and SHF_STRING if all input sections have those flags.
6838 * main.cc (main): Fix the sys time reporting.
6839 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6844 * options.cc (General_options::parse_version): Allow -v to exit
6845 without an error if there is nothing to link.
6849 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6850 using a version of gcc before 4.1.
6851 * configure: Rebuild.
6855 * attributes.cc (Output_attributes_section_data::do_write): Use
6856 std::vector::front rather than std::vector::data.
6860 * symtab.h (class Symbol_table): Add enum Defined.
6861 * resolve.cc (Symbol_table::should_override): Add defined
6862 parameter. Change all callers. Test whether object is NULL
6863 before calling a method on it.
6864 (Symbol_table::report_resolve_problem): Add defined parameter.
6866 (Symbol_table::should_override_with_special): Likewise.
6867 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6868 parameter. Change all callers.
6869 (Symbol_table::do_define_in_output_data): Likewise.
6870 (Symbol_table::define_in_output_segment): Likewise.
6871 (Symbol_table::do_define_in_output_segment): Likewise.
6872 (Symbol_table::define_as_constant): Likewise.
6873 (Symbol_table::do_define_as_constant): Likewise.
6874 * script.h (class Symbol_assignment): Add is_defsym parameter to
6875 constructor; change all callers.
6876 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6877 parameter. Change all callers. Add is_defsym_ field.
6878 (class Parser_closure): Add parsing_defsym parameter to
6879 constructor; change all callers. Add parsing_defsym accessor
6880 function. Add parsing_defsym_ field.
6884 * gold.cc (queue_middle_tasks): Fix formatting.
6885 * object.cc (Relobj::is_section_name_included): Likewise.
6889 * i386.cc (Target_i386::do_calls_non_split): Recognize
6890 -fsplit-stack prologue for a function with a static chain.
6891 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6892 -fsplit-stack prologue when using %r11.
6896 * options.cc (General_options::parse_version): Make -v continue and do
6897 the link like GNU ld does.
6901 * Makefile.am (CCFILES): Add timer.cc.
6902 (HFILES): Add timer.h.
6903 * configure.ac: Check for sysconf and times.
6904 * main.cc: include timer.h.
6905 (main): Use Timer instead of get_run_time.
6908 * workqueue.cc: include timer.h.
6909 (Workqueue::find_and_run_task):
6910 Report user, sys and wall time.
6911 * Makefile.in: Regenerate.
6912 * config.in: Regenerate.
6913 * configure: Regenerate.
6917 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6919 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6920 relaxed input sections.
6921 * output.cc (Output_section::find_relaxed_input_section): Change
6922 return type to Output_relaxed_input_section pointer. Adjust code
6923 for new type of relaxed_input_section_map_.
6924 * output.h (Output_section::find_relaxed_input_section): Change
6925 return type to Output_relaxed_input_section pointer.
6926 (Output_section::Output_relaxed_input_section_by_input_section_map):
6928 (Output_section::relaxed_input_section_map_): Change type to
6929 Output_section::Output_relaxed_input_section_by_input_section_map.
6930 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6935 * layout.cc (Layout::create_shstrtab): Only write out after input
6936 sections if we are compressing debug sections.
6940 * archive.cc (Archive::add_symbols): Only look up a symbol without
6941 a version if there is, in fact, a version.
6945 Revert -Wshadow changes, all changes from:
6948 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6952 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6954 * attributes.cc (Object_attribute::size): Ditto.
6955 (Attributes_section_data::size): Ditto.
6956 (Attributes_section_data::Attributes_section_data): Ditto.
6957 (Output_attributes_section_data::do_write): Ditto.
6958 * attributes.h (Object_attribute::set_type): Ditto.
6959 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6963 * archive.cc: Fix shadowed variable warnings.
6965 * compressed_output.cc: Likewise.
6966 * compressed_output.h: Likewise.
6967 * configure: Likewise.
6968 * dwarf_reader.cc: Likewise.
6969 * dynobj.cc: Likewise.
6970 * dynobj.h: Likewise.
6971 * ehframe.cc: Likewise.
6972 * ehframe.h: Likewise.
6973 * errors.cc: Likewise.
6974 * expression.cc: Likewise.
6975 * fileread.cc: Likewise.
6976 * fileread.h: Likewise.
6977 * freebsd.h: Likewise.
6978 * i386.cc: Likewise.
6980 * incremental.h: Likewise.
6981 * layout.cc: Likewise.
6982 * layout.h: Likewise.
6983 * mapfile.cc: Likewise.
6984 * merge.cc: Likewise.
6985 * merge.h: Likewise.
6986 * object.cc: Likewise.
6987 * object.h: Likewise.
6988 * options.h: Likewise.
6989 * output.cc: Likewise.
6990 * output.h: Likewise.
6991 * parameters.cc: Likewise.
6992 * plugin.cc: Likewise.
6993 * powerpc.cc: Likewise.
6994 * reduced_debug_output.cc: Likewise.
6995 * reduced_debug_output.h: Likewise.
6996 * reloc.cc: Likewise.
6997 * reloc.h: Likewise.
6998 * resolve.cc: Likewise.
6999 * script-sections.cc: Likewise.
7000 * script.cc: Likewise.
7001 * script.h: Likewise.
7002 * sparc.cc: Likewise.
7003 * symtab.cc: Likewise.
7004 * symtab.h: Likewise.
7005 * target-select.cc: Likewise.
7006 * target-select.h: Likewise.
7007 * token.h: Likewise.
7008 * workqueue.cc: Likewise.
7009 * workqueue.h: Likewise.
7010 * x86_64.cc: Likewise.
7014 * arm.cc (attributes.h): New include.
7015 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7016 (Arm_relobj::~Arm_relobj): Delete object pointed by
7017 attributes_section_data_.
7018 (Arm_relobj::attributes_section_data): New method definition.
7019 (Arm_relobj::attributes_section_data_): New data member declaration.
7020 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7021 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7022 attributes_section_data_.
7023 (Arm_dynobj::attributes_section_data): New method definition.
7024 (Arm_dynobj::attributes_section_data_): New data member declaration.
7025 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
7026 initialization value of may_use_blx_ to false.
7027 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7028 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7029 object attributes to compute results instead of hard-coding.
7030 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7031 Target_arm::get_secondary_compatible_arch,
7032 Target_arm::set_secondary_compatible_arch
7033 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7034 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7035 New method declarations.
7036 (Target_arm::get_aeabi_object_attribute): New method definition.
7037 (Target_arm::attributes_section_data_): New data member declaration.
7038 (read_arm_attributes_section): New template definition.
7039 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7040 (Arm_dynobj::do_read_symbols): Ditto.
7041 (Target_arm::do_finalize_sections): Merge attributes sections from
7042 input. Check for BLX use after attributes section merging.
7043 Fix __exidx_start and __exidx_end visibility. Create an
7044 .ARM.attributes section if necessary.
7045 (Target_arm::get_secondary_compatible_arch,
7046 Target_arm::set_secondary_compatible_arch,
7047 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7048 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7049 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7050 New method definitions.
7054 * plugin.cc (Plugin::load): Don't cast from void* to a function
7059 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7064 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7065 Replace two_file_shared_1.so with two_file_shared_2.so.
7066 * testsuite/Makefile.in: Regenerated.
7070 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7071 (HFILES): Add attributes.h and int_encoding.h.
7072 * Makefile.in: Regenerate.
7073 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7074 function definitions to int_encoding.cc
7075 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7076 prototypes to int_encoding.h
7077 * reduced_debug_output.cc (int_encoding.h): New include.
7078 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7079 function definitions to int_encoding.cc
7080 (insert_into_vector, read_from_pointer): Move template definitions to
7082 * attributes.cc: New file.
7083 * attributes.h: New file.
7084 * int_encoding.cc: New file.
7085 * int_encoding.h: New file.
7090 * incremental-dump.cc (dump_incremental_inputs): New.
7091 (main): Use dump_incremental_inputs.
7096 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7097 checking elfcpp::STT_FUNC.
7098 (Target_i386::Relocate::relocate): Likewise.
7099 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7101 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7102 symbols from shared libraries into normal FUNC symbols.
7104 * symtab.h (Symbol): Add is_func and use it.
7108 * arm.cc (Target_arm::arm_info): Initialize new fields
7109 attributes_section and attributes_vendor.
7110 * i386.cc (Target_i386::i386_info): Same.
7111 * object.cc (Sized_relobj::do_layout): Skip attribute section.
7112 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7113 fields attributes_section and attributes_vendor.
7114 * sparc.cc (Target_sparc::sparc_info): Same.
7115 * target.h (Target::attributes_section, Target::attributes_vendor,
7116 Target::is_attributes_section, Target::attribute_arg_type,
7117 Target::attributes_order): New method definitions.
7118 (Target::Target_info::attributes_section,
7119 Target::Target_info::attributes_vendor): New fields.
7120 (Target::do_attribute_arg_type, Target::do_attributes_order): New
7121 virtual method definitions.
7122 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7123 attributes_section and attributes_vendor.
7124 * testsuite/testfile.cc (Target_test::test_target_info): Same.
7128 * arm.cc: Update comments about interworking and stub generation.
7129 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7130 considered as non-PIC.
7131 (Arm_relocate_functions::base_abs): Fix formatting.
7132 (Arm_relocate_functions::got_prel): Fix comment. Change interface
7133 of function to use GOT entry address instead of offset.
7134 (Target_arm::Scan::global): Issue an error if a symbol would need a
7135 PLT does not get one because it is untyped. Remove code to create
7136 dynamic symbols for relative branches.
7137 (Target_arm::Relocate::relocate: Use 0 instead of false since function
7138 takes unsigned integer instead of boolean.
7142 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7143 (two_file_test_LDADD): Likewise.
7144 (common_test_1_LDADD): Likewise.
7145 (exception_test_LDADD) Likewise.
7146 (weak_test_LDADD): Likewise.
7147 (many_sections_test_LDADD): Likewise.
7148 (initpri1_LDADD): Likewise.
7149 (script_test_1_LDADD): Likewise.
7150 (script_test_2_LDADD): Likewise.
7151 (justsyms_LDADD): Likewise.
7152 (binary_test_LDADD): Likewise.
7153 (large_LDADD): Likewise.
7154 * testsuite/Makefile.in: Regenerated.
7158 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7159 (Symbol_table::override_with_special): Likewise.
7160 (Symbol_table::add_from_object): Likewise.
7164 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7165 Don't set the data_offset twice.
7169 * testsuite/Makefile.in: Regenerate.
7173 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7174 (Target_arm::do_finalize_sections): Add parameter for symbol table
7175 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
7176 * i386.cc (Target_i386::do_finalize_sections): Add an additional
7177 parameter for symbol table pointer.
7178 * layout.cc (Layout::finalize): Call Target::finalize_sections with
7179 an additional parameter for a pointer to symbol table.
7180 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7181 parameter for a symbol table pointer.
7182 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7183 * target.h (Target::finalize_sections, Target::do_finalize_sections):
7185 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7186 parameter for a symbol table pointer.
7190 * incremental.cc (Incremental_inputs_header)
7191 (Incremental_inputs_header_write, Incremental_inputs_entry)
7192 (Incremental_inputs_entry_write): Move ...
7193 * incremental.h (Incremental_inputs_header)
7194 (Incremental_inputs_header_write, Incremental_inputs_entry)
7195 (Incremental_inputs_entry_write): here.
7199 * incremental.cc (make_sized_incremental_binary): Set the target.
7200 Error if it is incompatible.
7201 * output.h (Output_file): Add filename method.
7205 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7206 from the get_* methods.
7210 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7211 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7212 Write 0 for the data_offset of scripts.
7216 * testsuite/Makefile.am: Add the incremental_test.sh test.
7217 * testsuite/incremental_test.sh: New.
7218 * testsuite/incremental_test_1.c: New.
7219 * testsuite/incremental_test_2.c: New.
7223 * incremental-dump.cc (main): Fix typos.
7228 * incremental-dump.cc (main): Use llu to print 64 bit values.
7233 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7235 (incremental_dump_LDADD): Likewise.
7236 * Makefile.in: Regenerated.
7244 * arm.cc (Target_arm::Target_arm): Move method definition
7245 outside of class definition. Add code to handle
7246 --target1-rel, --target1-abs and --target2= options.
7247 (Target_arm::get_reloc_reloc_type): Change method to be
7248 non-static and const.
7249 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7250 New data member declaration.
7251 (Target_arm::Scan::local, Target_arm::Scan::global,
7252 Target_arm::Relocate::relocate,
7253 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7254 Adjust call to Target_arm::get_real_reloc_type.
7255 (Target_arm::get_real_reloc_type): Use command line options
7256 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7257 * options.h (--target1-rel, --target1-abs, --target2): New
7262 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7263 class definition. Add code to handle --target1-rel, --target1-abs
7264 and --target2= options.
7265 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7267 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7269 (Target_arm::Scan::local, Target_arm::Scan::global,
7270 Target_arm::Relocate::relocate,
7271 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7272 call to Target_arm::get_real_reloc_type.
7273 (Target_arm::get_real_reloc_type): Use command line options to
7274 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7275 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7280 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7281 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7282 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7284 (Arm_relocate_functions::thm_call): Replace body with a call to
7285 Arm_relocate_functions::thumb_branch_common.
7286 (Arm_relocate_functions::thm_jump24,
7287 Arm_relocate_functions::thm_xpc22): New method definitions.
7288 (Arm_relocate_functions::thumb_branch_common): New method definition.
7289 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7291 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7292 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7296 * Makefile.am: Build incremental-dump
7297 * Makefile.in: Regenerate.
7298 * incremental-dump.cc: New.
7299 * incremental.cc (Incremental_inputs_header_data,
7300 Incremental_inputs_entry_data): Move to incremental.h
7301 * incremental.h: (Incremental_inputs_header_data,
7302 Incremental_inputs_entry_data): Move from incremental.cc
7306 * incremental.cc (Incremental_inputs_header,
7307 Incremental_inputs_header_write, Incremental_inputs_entry,
7308 Incremental_inputs_entry_write): Add a typedef with the data type.
7312 * incremental.cc (Incremental_inputs_header,
7313 Incremental_inputs_header_write, Incremental_inputs_entry,
7314 Incremental_inputs_entry_write): Update comment about which
7315 type has the filed descriptions.
7319 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7320 (Arm_relocate_functions::arm_branch_common): Change method defintion
7321 in class definition to a method declaration and update list of formal
7323 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7324 Arm_relocation_functions::jump24): Adjust call to
7325 Arm_relocate_functions::arm_branch_common. Update list of formal
7327 (Arm_relocate_functions::xpc25): New method definition.
7328 (Arm_relocate_functions::arm_branch_common): Move method defintion
7329 out from class definition. Use stubs for mode-switching and extending
7331 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7332 specially. Change code to enable use of stubs in ARM branches.
7336 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7337 in method declaration.
7338 (Target_arm::relocate_stub): New method declaration.
7339 (Target_arm::default_target): Change to return a pointer instead of
7341 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7342 Target_arm::default_target.
7343 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7345 (Target_arm::relocate_section): Adjust view.
7346 (Target_arm::relocate_stub): New method definition.
7350 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7352 * incremental.cc (open_incremental_binary): Initialized local
7353 variables to avoid warnings.
7354 * object.cc (make_elf_object): Ditto.
7355 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7361 * testsuite/plugin_test.c: Include "config.h".
7365 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7366 (arm_symbol_value): Remove.
7367 (Arm_relocate_functions::arm_branch_common,
7368 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7369 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7370 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7371 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7372 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7373 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7374 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7375 Arm_relocate_functions::thm_mobw_abs_nc,
7376 Arm_relocate_functions::thm_mov_abs,
7377 Arm_relocate_functions::movw_prel_nc,
7378 Arm_relocate_functions::thm_movt_abs,
7379 Arm_relocate_functions::movt_prel,
7380 Arm_relocate_functions::thm_movw_prel_nc,
7381 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7382 (Target_arm::Relocate::relocate): Only decompose address into two
7383 parts if relocation type uses the thumb-bit and pass the actual
7384 bit instead of a flag indicating that the thumb-bit is used. Adjust
7385 calls to methods in Arm_relocate_functions for this change.
7390 * reloc.cc: Instantiate
7391 Sized_relobj::initialize_input_to_output_maps and
7392 Sized_relobj:free_input_to_output_maps.
7397 * defstd.cc (in_segment): Set only_if_ref true for "end".
7401 * arm.cc (class Reloc_stub): Correct a comment.
7402 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7403 (Target_arm::scan_section_for_stubs): New method declaration.
7404 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7405 Change methods from private to protected.
7406 (Target_arm::do_may_relax): New method definition.
7407 (Target_arm::do_relax, Target_arm::group_sections,
7408 Target_arm::scan_reloc_for_stub,
7409 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7410 (Target_arm::arm_input_section_map_): New data member declaration.
7411 (Target_arm::scan_reloc_for_stub,
7412 Target_arm::scan_reloc_section_for_stubs,
7413 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7414 Target_arm::do_relax): New method definitions.
7418 * configure.ac: Check for (struct stat)::st_mtim
7419 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7420 * config.in: Regenerate.
7421 * configure: Regenerate.
7426 * output.cc (Output_segment::add_output_section): Add missing
7432 * object.h (class Object): Add is_needed and set_is_needed
7433 methods. Add is_needed_ field. Make bool fields into bitfields.
7434 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7435 defined in a dynamic object and referenced by a regular object,
7436 set is_needed for the dynamic object.
7437 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7438 if the file is marked with as_needed and it is not needed.
7443 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7444 tags if data is discarded by linker script.
7445 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7446 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7447 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7448 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7452 * layout.cc (Layout::get_output_section): Add is_interp and
7453 is_dynamic_linker_section parameters. Change all callers.
7454 (Layout::choose_output_section): Likewise.
7455 (Layout::make_output_section): Likewise.
7456 (Layout::add_output_section_data): Add is_dynamic_linker_section
7457 parameter. Change all callers.
7458 * layout.h (class Layout): Update declarations.
7459 * output.h (class Output_section): Add is_interp, set_is_interp,
7460 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7461 Add is_interp_, is_dynamic_linker_section_ fields. Change
7462 generate_code_fills_at_write_ to a bitfield.
7463 * output.cc (Output_section::Output_sections): Initialize new
7465 (Output_segment::add_output_section): Add do_sort parameter.
7471 * options.h (class General_options): Add --warn-common.
7472 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7473 merging two common symbols.
7474 (Symbol_table::should_override): Handle --warn-common when merging
7475 a common symbol with a defined symbol. Use report_resolve_problem
7476 for multiple definitions.
7477 (Symbol_table::report_resolve_problem): New function.
7478 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7482 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7484 (Target_arm::stub_factory): New method definition.
7485 (Target_arm::new_arm_input_section,
7486 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7487 Target_arm::reloc_uses_thumb_bit): New method declarations.
7488 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7489 New type definitions.
7490 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7491 member declarations.
7492 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7493 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7494 New method definitions.
7498 * options.h (class General_options): Add --warn_constructors.
7503 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7504 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7509 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7510 --msgid-bugs-address.
7511 (install-pdf): New target.
7512 (install-data_yes): Look up one directory to find mkinstalldirs.
7516 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7521 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7525 * arm.cc (Stub_addend_reader): New struct template definition
7526 and partial specializations.
7527 (Stub_addend_reader::operator()): New method definition for a
7528 partially specialized template.
7532 * arm.cc (Arm_relobj::processor_specific_flags): New method
7534 (Arm_relobj::do_read_symbols): New method declaration.
7535 (Arm_relobj::processor_specific_flags_): New data member declaration.
7536 (Arm_dynobj): New class definition.
7537 (Target_arm::do_finalize_sections): Add input_objects parameter.
7538 (Target_arm::do_adjust_elf_header): New method declaration.
7539 (Target_arm::are_eabi_versions_compatible,
7540 (Target_arm::merge_processor_specific_flags): New method declaration.
7541 (Target_arm::do_make_elf_object): New overloaded method definitions
7543 (Arm_relobj::do_read_symbols): New method definition.
7544 (Arm_dynobj::do_read_symbols): Ditto.
7545 (Target_arm::do_finalize_sections): Add input_objects parameters.
7546 Merge processor-specific flags from all input objects.
7547 (Target_arm::are_eabi_versions_compatible,
7548 Target_arm::merge_processor_specific_flags,
7549 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7550 New method definitions.
7551 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7552 Input_objects pointer type parameter.
7553 * layout.cc (Layout::finalize): Pass input objects to target's.
7554 finalize_sections function.
7555 * output.cc (Output_file_header::do_sized_write): Set ELF file
7556 header's processor-specific flags.
7557 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7558 Input_objects pointer type parameter.
7559 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7560 * target.h (Input_objects): New forward class declaration.
7561 (Target::processor_specific_flags,
7562 Target::are_processor_specific_flags_sect): New method definitions.
7563 (Target::finalize_sections): Add input_objects parameter.
7564 (Target::Target): Initialize processor_specific_flags_ and
7565 are_processor_specific_flags_set_.
7566 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7568 (Target::set_processor_specific_flags): New method definition.
7569 (Target::processor_specific_flags_,
7570 Target::are_processor_specific_flags_set_): New data member
7572 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7573 Input_objects pointer type parameter.
7577 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7581 * object.h (class Relobj): Drop options parameter from
7582 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7583 do_scan_relocs, do_relocate. Change all callers.
7584 (class Sized_relobj): Drop options parameters from
7585 do_gc_process_relocs, do_scan_relocs, do_relocate,
7586 do_relocate_sections, relocate_sections, emit_relocs_scan,
7587 emit_relocs_scan_reltype. Change all callers.
7588 (struct Relocate_info): Remove options field and all references to
7590 * reloc.h (class Read_relocs): Remove options constructor
7591 parameter and options_ field. Change all callers.
7592 (class Gc_process_relocs, class Scan_relocs): Likewise.
7593 (class Relocate_task): Likewise.
7594 * target-reloc.h (scan_relocs): Remove options parameter. Change
7596 (scan_relocatable_relocs): Likewise.
7597 * target.h (class Sized_target): Remove options parameter from
7598 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7600 * gc.h (gc_process_relocs): Remove options parameter. Change all
7602 * arm.cc: Update functions to remove options parameters.
7603 * i386.cc: Likewise.
7604 * powerpc.cc: Likewise.
7605 * sparc.cc: Likewise.
7606 * x86_64.cc: Likewise.
7607 * testsuite/testfile.cc: Likewise.
7611 * arm.cc (Arm_relobj): New class definition.
7612 (Arm_relobj::scan_sections_for_stubs,
7613 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7614 New method definitions.
7618 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7619 (Plugin::cleanup_done_): New member.
7620 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7621 (Plugin_manager::cleanup_done_): Remove.
7622 (Plugin_manager::add_input_file): Edit error message.
7623 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7624 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7628 * fileread.cc: (File_read::View::~View): Use the new
7629 data_ownership_ filed.
7630 (File_read::~File_read): Dispose the new whole_file_view_.
7631 (File_read::open): Mmap the whole file if needed.
7632 (File_read::open): Use whole_file_view_ instead of contents_.
7633 (File_read::find_view): Use whole_file_view_ if applicable.
7634 (File_read::do_read): Use whole_file_view_ instead of contents_.
7635 (File_read::make_view): Use whole_file_view_ instead of contents_,
7636 update File_read::View::View call.
7637 (File_read::find_or_make_view): Update File_read::View::View
7639 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7641 (File_read::View::Data_ownership): New enum.
7642 (File_read::View::View): Replace bool mapped_ with Data_ownership
7644 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7645 (File_read::View::data_ownership_): New field.
7646 (File_read::contents_): Remove (replaced by whole_file_view_).
7647 (File_read::whole_file_view_): New field.
7648 * options.h (class General_options): Add --keep-files-mapped.
7652 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7653 * testsuite/Makefile.am (plugin_test_5): New test case.
7654 * testsuite/Makefile.in: Regenerate.
7658 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7659 from private to protected to allow access by child class.
7660 (Sized_relobj::do_relocate_sections): New method declaration.
7661 (Sized_relobj::relocate_sections): Virtualize.
7662 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7663 Sized_relobj::relocate_sections. Instantiate template explicitly
7664 for different target sizes and endianity.
7668 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7669 (Arm_input_section::as_arm_input_section): New method.
7670 (Arm_output_section): New class definition.
7671 (Arm_output_section::create_stub_group,
7672 Arm_output_section::group_sections): New method definitions.
7676 * arm.cc (Arm_input_section): New class definition.
7677 (Arm_input_section::init, Arm_input_section:do_write,
7678 Arm_input_section::set_final_data_size,
7679 Arm_input_section::do_reset_address_and_file_offset): New method
7684 * arm.cc (Stub_table, Arm_input_section): New forward class
7686 (Stub_table): New class defintion.
7687 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7688 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7689 New method definition.
7693 * arm.cc: Update copyright comments.
7694 (Target_arm): New forward class template declaration.
7695 (Arm_address): New type.
7696 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7697 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7698 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7700 (Insn_template): Same.
7701 (DEF_STUBS): New macro.
7702 (Stub_type): New enum type.
7703 (Stub_template): New class definition.
7706 (Stub_factory): Same.
7707 (Target_arm::Target_arm): Initialize may_use_blx_ and
7708 should_force_pic_veneer_.
7709 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7710 Target_arm::should_force_pic_veneer,
7711 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7712 Target_arm::using_thumb_only, Target_arm:;default_target): New
7714 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7715 New data member declarations.
7716 (Insn_template::size, Insn_template::alignment): New method defintions.
7717 (Stub_template::Stub_template): New method definition.
7718 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7719 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7720 (Stub_factory::Stub_factory): New method definition.
7721 * gold.h (string_hash): New template.
7722 * output.h (Input_section_specifier::hash_value): Use
7724 (Input_section_specifier::string_hash): Remove.
7725 * stringpool.cc (Stringpool_template::string_hash): Use
7730 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7731 symbols of relaxed input sections.
7732 * output.h (Output_section::find_relaxed_input_section): Make
7737 * dynobj.cc (Versions::Versions): Initialize version_script_.
7738 Only insert base version symbol definition for a shared object
7739 if version script defines any version versions.
7740 (Versions::define_base_version): New method definition.
7741 (Versions::add_def): Check that base version is not needed.
7742 (Versions::add_need): Define base version lazily.
7743 * dynobj.h (Versions::define_base_version): New method declaration.
7744 (Versions::needs_base_version_): New data member declaration.
7745 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7746 (check_DATA): Add no_version_test.stdout.
7747 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7749 * testsuite/Makefile.in: Regenerate.
7750 * testsuite/no_version_test.c: New file.
7751 * testsuite/no_version_test.sh: Ditto.
7755 * expression.cc (class Segment_start_expression): New class definition.
7756 (Segment_start_expression::value): New method definition.
7757 (script_exp_function_segment_start): Return a new
7758 Segment_start_expression.
7759 * gold/script-c.h (script_saw_segment_start_expression): New function
7761 * script-sections.cc (Script_sections::Script_sections): Initialize
7762 SAW_SEGMENT_START_EXPRESSION_ to false.
7763 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7764 and -Tbbs options to specify section addresses if given in
7765 command line and no SEGMENT_START expression is seen in a script.
7766 * script-sections.h (Script_sections::saw_segment_start_expression,
7767 Script_sections::set_saw_segment_start_expression): New method
7769 (Script_sections::saw_segment_start_expression_): New data member
7771 * script.cc (script_saw_segment_start_expression): New function.
7772 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7773 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7774 script_test_7.sh and script_test_8.sh.
7775 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7776 script_test_8.stdout.
7777 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7778 (script_test_6, script_test_6.stdout, script_test_7,
7779 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7780 * Makefile.in: Regenerate.
7781 * testsuite/script_test_6.sh: New file.
7782 * testsuite/script_test_6.t: Same.
7783 * testsuite/script_test_7.sh: Same.
7784 * testsuite/script_test_7.t: Same.
7785 * testsuite/script_test_8.sh: Same.
7789 * output.cc (Output_segment::set_section_list_address): Cast
7790 expressions to unsigned long long type to avoid format warnings.
7794 * script.cc (Script_options::add_symbol_assignment): Always add a
7795 dot assignment to script_sections_.
7796 * script-sections.cc (Script_sections::add_dot_assignment):
7797 Initialize if necessary.
7799 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7800 program headers with no load segment if there is a linker script.
7802 * layout.cc (Layout::set_segment_offsets): Align the file offset
7803 to the segment aligment for -N or -n with no load segment.
7804 * output.cc (Output_segment::add_output_section): Don't crash if
7805 the first section is a TLS section.
7806 (Output_segment::set_section_list_addresses): Print an error
7807 message if the address moves backward in a linker script.
7808 * script-sections.cc
7809 (Output_section_element_input::set_section_addresses): Don't
7810 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7811 (Orphan_output_section::set_section_addresses): Likewise.
7815 * layout.cc (Layout::finish_dynamic_section): Generate tags
7816 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7817 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7818 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7822 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7824 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7825 data_shdr fields of relinfo.
7826 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7827 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7828 R_386_TLS_LDO_32, adjust based on section flags.
7829 (Target_i386::Relocate::fix_up_ldo): Remove.
7833 Add support for -pie.
7834 * options.h (class General_options): Add -pie and
7836 (General_options::output_is_position_independent): Test -pie.
7837 (General_options::output_is_executable): Return true if not shared
7838 and not relocatable.
7839 (General_options::output_is_pie): Remove.
7840 * options.cc (General_options::finalize): Reject incompatible uses
7842 * gold.cc (queue_middle_tasks): A -pie link is not static.
7843 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7844 * symtab.cc (Symbol::final_value_is_known): Return false if
7845 output_is_position_independent.
7846 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7847 output_is_position_independent.
7848 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7849 output_is_position_independent.
7850 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7851 output_is_position_independent.
7852 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7854 (basic_pie_test.o, basic_pie_test): New targets.
7855 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7856 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7857 (two_file_pie_test): New target.
7858 * testsuite/Makefile.in: Rebuild.
7859 * README: Remove note saying that -pie is not supported.
7863 * options.h (class General_options): Add -init and -fini.
7864 * layout.cc (Layout::finish_dynamic_section): Emit
7865 given init and fini functions.
7869 * gc.h (gc_process_relocs): Check if icf is enabled using new
7871 * gold.cc (queue_initial_tasks): Likewise.
7872 (queue_middle_tasks): Likewise.
7873 * object.cc (do_layout): Likewise.
7874 * symtab.cc (is_section_folded): Likewise.
7875 * main.cc (main): Likewise.
7876 * reloc.cc (Read_relocs::run): Likewise.
7877 (Sized_relobj::do_scan_relocs): Likewise.
7878 * icf.cc (is_function_ctor_or_dtor): New function.
7879 (Icf::find_identical_sections): Check if function is ctor or dtor when
7881 * options.h (General_options::icf): Change option to be an enum.
7882 (Icf_status): New enum.
7883 (icf_enabled): New method.
7884 (icf_safe_folding): New method.
7885 (set_icf_status): New method.
7886 (icf_status_): New variable.
7887 * (options.cc) (General_options::finalize): Set icf_status_.
7888 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7889 icf_test and icf_keep_unique_test to use the --icf enum flag.
7890 * testsuite/icf_safe_test.sh: New file.
7891 * testsuite/icf_safe_test.cc: New file.
7895 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7896 includes to gc.h and icf.h.
7897 * arm.cc: Include gc.h.
7898 * gold.cc: Likewise.
7899 * i386.cc: Likewise.
7900 * powerpc.cc: Likewise.
7901 * sparc.cc: Likewise.
7902 * x86_64.cc: Likewise.
7903 * gc.h: Include icf.h.
7907 * plugin.cc: Include "gold.h" before other header files.
7911 * options.h (Input_file_argument::Input_file_type): New enum.
7912 (Input_file_argument::is_lib_): Replace with...
7913 (Input_file_argument::type_): New member.
7914 (Input_file_argument::Input_file_argument): Take Input_file_type
7915 'type' rather than boolean 'is_lib' as second argument.
7916 (Input_file_argument::is_lib): Use type_.
7917 (Input_file_argument::is_searched_file): New function.
7918 (Input_file_argument::may_need_search): Handle is_searched_file.
7919 * options.cc (General_options::parse_library): Support -l:filename.
7920 (General_options::parse_just_symbols): Update for Input_file_argument
7922 (Command_line::process): Likewise.
7923 * archive.cc (Archive::get_file_and_offset): Likewise.
7924 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7925 * script.cc (read_script_file, script_add_file): Likewise.
7926 * fileread.cc (Input_file::Input_file): Likewise.
7927 (Input_file::will_search_for): Handle is_searched_file.
7928 (Input_file::open): Likewise.
7929 * readsyms.cc (Read_symbols::get_name): Likewise.
7930 * testsuite/Makefile.am (searched_file_test): New test.
7931 * testsuite/Makefile.in: Regenerate.
7932 * testsuite/searched_file_test.cc: New file.
7933 * testsuite/searched_file_test_lib.cc: New file.
7938 * descriptor.cc: Include <cstdio> and "binary-io.h".
7939 (Descriptors::open): Open the files in binary mode always.
7940 * script.cc (Lex::get_token): Treat \r as whitespace.
7944 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7949 * configure.ac: Check for readv function also.
7950 * fileread.cc (readv): Define if not HAVE_READV.
7951 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7953 * config.in: Regenerate.
7954 * configure: Regenerate.
7958 * layout.cc (Layout::make_output_section): Call target hook to make
7959 ordinary output section.
7960 (Layout::finalize): Adjust parameter list of call the
7961 Target::may_relax().
7962 * layout.h (class Layout::section_list): New method.
7963 * merge.h (Output_merge_base::entsize): Change visibility to public.
7964 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7966 (Output_merge_string::do_is_string): New method.
7967 * object.cc (Sized_relobj::do_setup): renamed from
7968 Sized_relobj::set_up.
7969 * object.h (Sized_relobj::adjust_shndx,
7970 Sized_relobj::initializ_input_to_output_maps,
7971 Sized_relobj::free_input_to_output_maps): Change visibilities to
7973 (Sized_relobj::setup): Virtualize.
7974 (Sized_relobj::do_setup): New method declaration.
7975 (Sized_relobj::invalidate_section_offset,
7976 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7977 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7978 * options.cc (parse_int): New function.
7979 * options.h (parse_int): New declaration.
7980 (DEFINE_int): New macro.
7981 (stub_group_size): New option.
7982 * output.cc (Output_section::Output_section): Initialize memebers
7983 merge_section_map_, merge_section_by_properties_map_,
7984 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7985 (Output_section::add_input_section): Handled deferred code-fill
7986 generation and remove an old comment.
7987 (Output_section::add_relaxed_input_section): New method definition.
7988 (Output_section::add_merge_input_section): Use merge section by
7989 properties map to speed to search. Update merge section maps
7991 (Output_section::build_relaxation_map): New method definition.
7992 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7994 (Output_section::relax_input_section): Renamed to
7995 Output_section::convert_input_sections_to_relaxed_sections and change
7996 interface to take a vector of pointers to relaxed sections.
7997 (Output_section::find_merge_section,
7998 Output_section::find_relaxed_input_section): New method definitions.
7999 (Output_section::is_input_address_mapped,
8000 Output_section::output_offset, Output_section::output_address):
8001 Use output section data maps to speed up searching.
8002 (Output_section::find_starting_output_address): Add comments.
8003 (Output_section::do_write,
8004 Output_section::write_to_postprocessing_buffer): Do code-fill
8005 generation as appropriate.
8006 (Output_section::get_input_sections): Invalidate relaxed input section
8008 (Output_section::restore_states): Adjust type of checkpoint .
8009 Invalidate relaxed input section map.
8010 * output.h (Output_merge_base): New class declaration.
8011 (Input_section_specifier): New class defintion.
8012 (class Output_relaxed_input_section) Change base class to
8013 Output_section_data_build.
8014 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8015 base class initializer.
8016 (Output_section::add_relaxed_input_section): New method declaration.
8017 (Output_section::Input_section): Change visibility to protected.
8018 (Output_section::Input_section::relobj,
8019 Output_section::Input_section::shndx): Handle relaxed input sections.
8020 Output_section::input_sections) Change visibility to protected. Also
8021 define overload to return a non-const pointer.
8022 (Output_section::Merge_section_properties): New class defintion.
8023 (Output_section::Merge_section_by_properties_map,
8024 Output_section::Output_section_data_by_input_section_map,
8025 Output_section::Relaxation_map): New types.
8026 (Output_section::relax_input_section): Rename method to
8027 Output_section::convert_input_sections_to_relaxed_sections and change
8028 interface to take a vector of relaxed section pointers.
8029 (Output_section::find_merge_section,
8030 Output_section::find_relaxed_input_section,
8031 Output_section::build_relaxation_map,
8032 Output_section::convert_input_sections_in_list_to_relaxed_sections):
8033 New method declarations.
8034 (Output_section::merge_section_map_
8035 Output_section::merge_section_by_properties_map_,
8036 Output_section::relaxed_input_section_map_,
8037 Output_section::is_relaxed_input_section_map_valid_,
8038 Output_section::generate_code_fills_at_write_): New data members.
8039 * script-sections.cc
8040 (Output_section_element_input::set_section_addresses): Call
8041 current_data_size and addralign methods of relaxed input sections.
8042 (Orphan_output_section::set_section_addresses): Call current_data_size
8043 and addralign methods of relaxed input sections.
8044 * symtab.cc (Symbol_table::compute_final_value): Extract template
8045 from the body of Symbol_table::sized_finalize_symbol.
8046 (Symbol_table::sized_finalized_symbol): Call
8047 Symbol_table::compute_final_value.
8048 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8049 (Symbol_table::compute_final_value): New templated method declaration.
8050 * target.cc (Target::do_make_output_section): New method defintion.
8051 * target.h (Target::make_output_section): New method declaration.
8052 (Target::relax): Add more parameters for input objects, symbol table
8053 and layout. Adjust call to do_relax.
8054 (Target::do_make_output_section): New method declaration.
8055 (Target::do_relax): Add parameters for input objects, symbol table
8060 * pread.c: Include stdio.h.
8064 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8069 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8070 Change read_shndx type to unsigned int.
8071 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8073 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8074 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8075 Change read_shndx type to unsigned int.
8076 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8078 (Sized_dwarf_line_info::read_line_mappings): Likewise.
8079 * layout.cc (Layout::create_symtab_sections): Cast the result of
8080 local_symcount * symsize to off_t in the gold_assert.
8084 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8085 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8087 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8088 (Arm_relocate_functions::thm_abs5): New function.
8089 (Arm_relocate_functions::abs12): New function.
8090 (Arm_relocate_functions::abs16): New function.
8091 (Arm_relocate_functions::base_abs): New function.
8092 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8093 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
8094 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8096 (Scan::global): Likewise.
8097 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8098 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8099 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8100 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8105 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8106 (Arm_relocate_functions::movt_prel): New function.
8107 (Arm_relocate_functions::thm_movw_prel_nc): New function.
8108 (Arm_relocate_functions::thm_movt_prel): New function.
8109 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8110 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8111 (Scan::global, Relocate::relocate): Likewise.
8112 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8116 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8117 Incremental_checker.
8118 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8120 (class Incremental_inputs_header): New class.
8121 (Incremental_inputs_header_writer): Edit comment.
8122 (Incremental_inputs_entry): New class.
8123 (Incremental_inputs_entry_writer): Edit comment.
8124 (Sized_incremental_binary::do_find_incremental_inputs_section):
8125 Add *strtab_shndx parameter, fill it.
8126 (Sized_incremental_binary::do_check_inputs): New method.
8127 (Incremental_checker::can_incrementally_link_output_file): Use
8128 Sized_incremental_binary::check_inputs.
8129 (Incremental_inputs::report_command_line): Save command line in
8132 (Incremental_binary::find_incremental_inputs_section): New
8134 (Incremental_binary::do_find_incremental_inputs_section): Add
8135 strtab_shndx parameter.
8136 (Incremental_binary::do_check_inputs): New pure virtual method.
8137 (Sized_incremental_binary::do_check_inputs): Declare.
8138 (Incremental_checker::Incremental_checker): Add incremental_inputs
8139 parameter, use it to initialize incremental_inputs_.
8140 (Incremental_checker::incremental_inputs_): New field.
8141 (Incremental_checker::command_line): New method.
8142 (Incremental_checker::inputs): New method.
8143 (Incremental_checker::command_line_): New field.
8147 * incremental.cc: Include <cstdarg> and "target-select.h".
8148 (vexplain_no_incremental): New function.
8149 (explain_no_incremental): New function.
8150 (Incremental_binary::error): New method.
8151 (Sized_incremental_binary::do_find_incremental_inputs_section): New
8153 (make_sized_incremental_binary): New function.
8154 (open_incremental_binary): New function.
8155 (can_incrementally_link_file): Add checks if output is ELF and has
8157 * incremental.h: Include "elfcpp_file.h" and "output.h".
8158 (Incremental_binary): New class.
8159 (Sized_incremental_binary): New class.
8160 (open_incremental_binary): Declare.
8161 * object.cc (is_elf_object): Use
8162 elfcpp::Elf_recognizer::is_elf_file.
8163 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8164 * output.h (Output_file::filesize): New method.
8168 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8170 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8171 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8173 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8175 (Arm_relocate_functions::movw_abs_nc): New function.
8176 (Arm_relocate_functions::movt_abs): New function.
8177 (Arm_relocate_functions::thm_movw_abs_nc): New function.
8178 (Arm_relocate_functions::thm_movt_abs): New function.
8179 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8180 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8181 (Scan::global): Likewise.
8182 (Relocate::relocate): Likewise.
8183 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8187 * arm.cc (Arm_relocate_functions::got_prel) New function.
8188 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8189 (Relocate::relocate): Likewise.
8190 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8194 * options.h (class General_options): Define
8195 split_stack_adjust_size parameter.
8196 * object.h (class Object): Add uses_split_stack_ and
8197 has_no_split_stack_ fields. Add uses_split_stack and
8198 has_no_split_stack accessor functions. Declare
8199 handle_split_stack_section.
8200 (class Reloc_symbol_changes): Define.
8201 (class Sized_relobj): Define Function_offsets. Declare
8202 split_stack_adjust, split_stack_adjust_reltype, and
8204 * object.cc (Object::handle_split_stack_section): New function.
8205 (Sized_relobj::do_layout): Call handle_split_stack_section.
8206 * dynobj.cc (Sized_dynobj::do_layout): Call
8207 handle_split_stack_section.
8208 * reloc.cc (Sized_relobj::relocate_sections): Call
8209 split_stack_adjust for executable sections in split_stack
8210 objects. Pass reloc_map to relocate_section.
8211 (Sized_relobj::split_stack_adjust): New function.
8212 (Sized_relobj::split_stack_adjust_reltype): New function.
8213 (Sized_relobj::find_functions): New function.
8214 * target-reloc.h: Include "object.h".
8215 (relocate_section): Add reloc_symbol_changes parameter. Change
8217 * target.h (class Target): Add calls_non_split method. Declare
8218 do_calls_non_split virtual method. Declare match_view and
8220 * target.cc: Include "elfcpp.h".
8221 (Target::do_calls_non_split): New function.
8222 (Target::match_view): New function.
8223 (Target::set_view_to_nop): New function.
8224 * gold.cc (queue_middle_tasks): Give an error if mixing
8225 split-stack and non-split-stack objects with -r.
8226 * i386.cc (Target_i386::relocate_section): Add
8227 reloc_symbol_changes parameter.
8228 (Target_i386::do_calls_non_split): New function.
8229 * x86_64.cc (Target_x86_64::relocate_section): Add
8230 reloc_symbol_changes parameter.
8231 (Target_x86_64::do_calls_non_split): New function.
8232 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8234 * powerpc.cc (Target_powerpc::relocate_section): Add
8235 reloc_symbol_changes parameter.
8236 * sparc.cc (Target_sparc::relocate_section): Add
8237 reloc_symbol_changes parameter.
8238 * configure.ac: Call AM_CONDITIONAL for the default target.
8239 * configure: Rebuild.
8240 * testsuite/Makefile.am (TEST_AS): New variable.
8241 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8242 (check_DATA): Add split_i386 and split_x86_64 files.
8243 (SPLIT_DEFSYMS): Define.
8244 (split_i386_[1234n].o): New targets.
8245 (split_i386_[124]): New targets.
8246 (split_i386_[1234r].stdout): New targets.
8247 (split_x86_64_[1234n].o): New targets.
8248 (split_x86_64_[124]): New targets.
8249 (split_x86_64_[1234r].stdout): New targets.
8250 (MOSTLYCLEANFILES): Add new executables.
8251 * testsuite/split_i386.sh: New file.
8252 * testsuite/split_x86_64.sh: New file.
8253 * testsuite/split_i386_1.s: New file.
8254 * testsuite/split_i386_2.s: New file.
8255 * testsuite/split_i386_3.s: New file.
8256 * testsuite/split_i386_4.s: New file.
8257 * testsuite/split_i386_n.s: New file.
8258 * testsuite/split_x86_64_1.s: New file.
8259 * testsuite/split_x86_64_2.s: New file.
8260 * testsuite/split_x86_64_3.s: New file.
8261 * testsuite/split_x86_64_4.s: New file.
8262 * testsuite/split_x86_64_n.s: New file.
8263 * testsuite/testfile.cc (Target_test): Update relocation_section
8265 * testsuite/Makefile.in: Rebuild.
8269 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8270 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8271 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8272 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8273 the address on ldo_addrs_.
8274 (Target_i386::Relocate::fix_up_ldo): New function.
8278 * plugin.cc (add_input_library): New.
8279 (Plugin::load): Add add_input_library to tv.
8280 (Plugin_manager::add_input_file): Add the is_lib argument.
8281 (add_input_file): Update call to Plugin_manager::add_input_file.
8282 (add_input_library): New.
8283 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8287 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8288 symbol and call Symbol::may_need_copy_reloc to determine if
8289 a copy reloc is needed.
8290 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8291 nocopyreloc is given in command line.
8292 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8293 given in command line.
8294 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8295 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8296 of the removed Target_i386::may_need_copy_reloc.
8297 * options.h (copyreloc): New option with default value false.
8298 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8299 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8300 instead of the removed Target_powerpc::may_need_copy_reloc.
8301 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8302 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8303 instead of the removed Target_sparc::may_need_copy_reloc.
8304 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8305 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8306 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8307 instead of the removed Target_x86_64::may_need_copy_reloc.
8311 * object.h (class Object): Remove target_ field, and target,
8312 sized_target, and set_target methods.
8313 (Object::sized_target): Remove.
8314 (class Sized_relobj): Update declarations. Remove sized_target.
8315 * object.cc (Sized_relobj::setup): Remove target parameter.
8317 (Input_objects::add_object): Don't do anything with the target.
8318 (make_elf_sized_object): Add punconfigured parameter. Change all
8319 callers. Set or test parameter target.
8320 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8322 * parameters.cc (Parameters::set_target): Change parameter type to
8324 (Parameters::default_target): Remove.
8325 (set_parameters_target): Change parameter type to be non-const.
8326 (parameters_force_valid_target): New function.
8327 (parameters_clear_target): New function.
8328 * parameters.h (class Parameters): Update declarations. Remove
8329 default_target method. Add sized_target and clear_target
8330 methods. Change target_ to be non-const.
8331 (set_parameters_target): Update declaration.
8332 (parameters_force_valid_target): Declare.
8333 (parameters_clear_target): Declare.
8334 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8335 as NULL if we aren't searching.
8336 (Add_symbols::run): Don't check for compatible target.
8337 * fileread.cc (Input_file::open_binary): Call
8338 parameters_force_valid_target.
8339 * gold.cc (queue_middle_tasks): Likewise.
8340 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8341 set_target on object.
8342 * dynobj.h (class Sized_dynobj): Update declarations.
8343 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8344 make_elf_object returns NULL.
8345 (Archive::include_member): Don't check whether object target is
8347 * output.cc (Output_section::add_input_section): Get target from
8349 (Output_section::relax_input_section): Likewise.
8350 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8352 (Sized_relobj::do_scan_relocs): Likewise.
8353 (Sized_relobj::relocate_sections): Likewise.
8354 * resolve.cc (Symbol_table::resolve): Likewise.
8355 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8356 parameter. Change all callers.
8357 (Symbol_table::add_from_object): Get target from parameters.
8358 (Symbol_table::add_from_relobj): Don't check object target.
8359 (Symbol_table::add_from_dynobj): Likewise.
8360 (Symbol_table::define_special_symbol): Get target from
8362 * symtab.h (class Symbol_table): Update declaration.
8363 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8364 parameter. Change all callers. Clear parameter target.
8365 (Binary_test): Test target here.
8366 * testsuite/object_unittest.cc (gold_testsuite): Remove
8367 target_test_pointer parameter. Change all callers.
8368 (Object_test): Test target here.
8372 * testsuite/initpri1.c: Don't try to use constructor priorities if
8373 compiling with gcc before 4.3.
8377 * testsuite/retain_symbols_file_test.sh (check_present): Change
8378 output file name to retain_symbols_file_test.stdout.
8379 (check_absent): Likewise.
8383 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8384 * options.cc: Include <cerrno> and <fstream>.
8385 (General_options::finalize): Parse -retain-symbols-file tag.
8386 * options.h: New flag.
8387 (General_options): New method should_retain_symbol, new
8388 variable symbols_to_retain.
8389 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8390 should_retain_symbol map.
8391 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8392 * testsuite/Makefile.in: Regenerate.
8393 * testsuite/retain_symbols_file_test.sh: New file.
8397 * po/es.po: Updated Spanish translation.
8401 * debug.h (DEBUG_RELAXATION): New constant.
8402 (DEBUG_ALL): Add DEBUG_RELAXATION.
8403 (debug_string_to_enum): Add relaxation debug option.
8405 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8406 Layout::Relaxation_debug_check::read_sections,
8407 Layout::Relaxation_debug_check::read_sections): New method definitions.
8408 (Layout::Layout): Initialize data members
8409 record_output_section_data_from_scrips_,
8410 script_output_section_data_list_ and relaxation_debug_check_.
8411 (Layout::save_segments, Layout::restore_segments,
8412 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8413 Layout::relaxation_loop_body): New method definitions.
8414 (Layout::finalize): Support relaxation. Move section layout code to
8415 Layout::relaxation_loop_body.
8416 (Layout::set_asection_address_from_script): Move code for orphan
8417 section placement out.
8418 (Layout::place_orphan_sections_in_script): New method definition.
8419 * layout.h (Output_segment_headers, Output_file_header):
8420 New forward class declarations.
8421 (Layout::~Layout): Define.
8422 (Layout::new_output_section_data_from_script): New method definition.
8423 (Layout::place_orphan_sections_in_script): New method declaration.
8424 (Layout::Segment_states): New type declaration.
8425 (Layout::save_segments, Layout::restore_segments,
8426 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8427 Layout::relaxation_loop_body): New method declarations.
8428 (Layout::Output_section_data_list): New type declaration.
8429 (Layout::Relaxation_debug_check): New class definition.
8430 (Layout::record_output_section_data_from_script_,
8431 Layout::script_output_section_data_list_, Layout::segment_states_,
8432 Layout::relaxation_debug_check_): New data members.
8433 * output.cc: (Output_section_headers::do_size): New method definition.
8434 (Output_section_headers::Output_section_headers): Move size
8435 computation to Output_section_headers::do_size.
8436 (Output_segment_headers::do_size): New method definition.
8437 (Output_file_header::Output_file_header): Move size computation to
8438 Output_file_header::do_size and call it.
8439 (Output_file_header::do_size): New method definition.
8440 (Output_data_group::Output_data_group): Adjust call to
8441 Output_section_data.
8442 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8443 (Output_symtab_xindex::do_write): Add array bound check.
8444 (Output_section::Input_section::print_to_mapfile): Handle
8445 RELAXED_INPUT_SECTION_CODE.
8446 (Output_section::Output_section): Initialize data member checkpoint_.
8447 (Output_section::~Output_section): Delete checkpoint object pointed
8449 (Output_section::add_input_section): Always add an Input_section if
8451 (Output_section::add_merge_input_section): Add assert.
8452 (Output_section::relax_input_section): New method definition.
8453 (Output_section::set_final_data_size): Set load address to zero for
8454 an unallocated section.
8455 (Output_section::do_address_and_file_offset_have_reset_values):
8456 New method definition.
8457 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8458 Handle relaxed input section.
8459 (Output_section::sort_attached_input_sections): Checkpoint input
8460 section list lazily.
8461 (Output_section::get_input_sections): Change type of input_sections to
8462 list of Simple_input_section pointers. Checkpoint input section list
8463 lazily. Also handle relaxed input sections.
8464 (Output_section::add_input_section_for_script): Take a reference to
8465 a Simple_input_section object instead of Relobj pointer and section
8466 index as parameter. Handle relaxed input sections.
8467 (Output_section::save_states, Output_section::restore_states): New
8469 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8470 (Output_data::is_data_size_fixed): New method definition.
8471 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8473 (Output_data::address_and_file_offset_have_reset_values): New method
8475 (Output_data::do_address_and_file_offset_have_reset_values): New method
8477 (Output_data::set_data_size): Check that data size is not fixed.
8478 (Output_data::fix_data_size): New method definition.
8479 (Output_data::is_data_size_fixed_): New data member.
8480 (Output_section_headers::set_final_data_size): New method definition.
8481 (Output_section_headers::do_size): New method declaration.
8482 (Output_segment_headers::set_final_data_size): New method definition.
8483 (Output_segment_headers::do_size): New method declaration.
8484 (Output_file_header::set_final_data_size)::New method definition.
8485 (Output_file_header::do_size)::New method declaration.
8486 (Output_section_data::Output_section_data): Add new parameter
8487 is_data_size_fixed and use it to fix data size.
8488 (Output_data_const::Output_data_const): Adjust call to base class
8489 constructor and fix data size.
8490 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8491 base class constructor and fix data size.
8492 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8493 base class constructor and fix data size.
8494 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8495 class constructor and fix data size.
8496 (Output_data_group::set_final_data_size): New method definition.
8497 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8498 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8499 class constructor and fix data size.
8500 (Output_relaxed_input_section): New class definition.
8501 (Output_section::Simple_input_section): New class definition.
8502 (Output_section::get_input_sections): Adjust parameter list.
8503 (Output_section::add_input_section_for_script): Same.
8504 (Output_section::save_states, Output_section::restore_states,
8505 Output_section::do_address_and_file_offset_have_reset_values,
8506 (Output_section::Input_section::Input_section): Handle
8507 RELAXED_INPUT_SECTION_CODE. Add new overload for
8508 Output_relaxed_input_section.
8509 (Output_section::Input_section::is_input_section,
8510 Output_section::Input_section::set_output_section): Handle relaxed
8512 (Output_section::Input_section::is_relaxed_input_section,
8513 Output_section::Input_section::output_section_data,
8514 Output_section::Input_section::relaxed_input_section): New method
8516 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8518 (Output_section::Input_section::u1_): Update comments.
8519 (Output_section::Input_section::u2_): Add new union member poris.
8520 (Output_section::Checkpoint_output_section): New classs definition.
8521 (Output_section::relax_input_section): New method declaration.
8522 (Output_section::checkpoint_): New data member.
8523 (Output_segment): Update comments.
8524 (Output_segment::Output_segment): Un-privatize copy constructor.
8525 (Output_segment::operator=): Un-privatize.
8526 * script-sections.cc (Output_section_element::Input_section_list):
8527 Change element type to Output_section::Simple_input_section.
8528 (Output_section_element_dot_assignment::set_section_addresses):
8529 Register output section data for relaxation clean up.
8530 (Output_data_exression::Output_data_expression): Adjust call to base
8531 constructor to fix data size.
8532 (Output_section_element_data::set_section_addresses): Register
8533 Output_data_expression object for relaxation clean up.
8534 (struct Input_section_info): Replace Relobj pointer and section index
8535 pair with Output_section::Simple_input_section and Convert struct to a
8537 (Input_section_sorter::operator()): Adjust access to
8538 Input_section_info data member to use accessors.
8539 (Output_section_element_input::set_section_addresses): Use layout
8540 parameter. Adjust code to use Output_section::Simple_input_section
8541 and Input_secction_info classes. Register filler for relaxation
8543 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8544 and section index pair with Output_section::Simple_input_section
8545 class. Adjust code accordingly.
8546 (Phdrs_element::release_segment): New method definition.
8547 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8549 (Script_sections::release_segments): New method definition.
8550 * gold/script-sections.h (Script_sections::release_segments): New
8552 * gold/target.h (Target::may_relax, Target::relax,
8553 Target::do_may_relax, Target::do_relax): New method definitions.
8557 * arm.cc (has_signed_unsigned_overflow): New function.
8558 (Arm_relocate_functions::abs8): New function.
8559 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8560 (Target_arm::Scan::global): Likewise.
8561 (Target_arm::relocate::relocate): Likewise.
8562 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8567 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8568 * testsuite/Makefile.in: Regenerate.
8572 * po/gold.pot: Updated by the Translation project.
8576 * output.cc (Output_file::open): Add execute permission to empty file.
8577 * testsuite/Makefile.am (permission_test): New test.
8578 * testsuite/Makefile.in: Regenerate.
8582 * output.cc (Output_file::resize): Call map_no_anonymous rather
8587 * gold.cc: Include "incremental.h".
8588 (queue_initial_tasks): Call Incremental_checker methods.
8589 * incremental.cc: Include "output.h".
8590 (Incremental_checker::can_incrementally_link_output_file): New
8592 * incremental.h (Incremental_checker): New class.
8594 * output.cc (Output_file::open_for_modification): New method.
8595 (Output_file::map_anonymous): Changed return type to bool. Record
8597 (Output_file::map_no_anonymous): New method, broken out of map.
8598 (Output_file::map): Use map_no_anonymous and map_anonymous.
8599 * output.h (class Output_file): Update declarations.
8603 * options.h (Command_line::Pre_options): New class.
8604 (Command_line::pre_options): New member.
8605 * options.cc (gold::options::ready_to_register): New variable.
8606 (One_option::register_option): Do nothing if not registering options.
8607 Assert if same short option registered twice.
8608 (General_options::General_options): Turn off option registration when
8610 (Command_line::Pre_options::Pre_options): New constructor.
8614 * options.h (General_options::no_keep_memory): Remove incorrect
8619 * Makefile.am (am__skiplex, am__skipyacc): New.
8620 * Makefile.in: Regenerate.
8624 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8625 (INCLUDES): ... this.
8626 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8627 (AM_CPPFLAGS): Renamed from ...
8628 (INCLUDE): ... this.
8629 * Makefile.in, testsuite/Makefile.in: Regenerate.
8631 * Makefile.in: Regenerate.
8632 * aclocal.m4: Likewise.
8633 * config.in: Likewise.
8634 * configure: Likewise.
8635 * testsuite/Makefile.in: Likewise.
8637 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8638 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8639 * Makefile.in: Regenerate.
8640 * testsuite/Makefile.in: Regenerate.
8644 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8645 symbols in shared libraries overridden by hidden or internal symbols
8646 in the main program.
8650 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8651 checking source file names in error messages.
8655 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8656 an elcpp::Ehdr as parameter. Adjust call to set_target.
8657 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8658 an elfcpp::Ehdr as parameter.
8659 * object.cc (Object::set_target): Remove the version that looks up
8660 a target and sets it.
8661 (Sized_relobj::setup): Take a Target object instead of
8662 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8663 (make_elf_sized_object): Find target and ask target to
8665 * object.h: (Object::set_target): Remove the version that looks up
8666 a target and sets it.
8667 (Sized_relobj::setup): Take a Target object instead of
8668 an elfcpp:Ehdr as parameter.
8669 * target.cc: Include dynobj.h.
8670 (Target::do_make_elf_object_implementation): New.
8671 (Target::do_make_elf_object): New.
8672 * target.h (Target::make_elf_object): New template declaration.
8673 (Target::do_make_elf_object): New method declarations.
8674 (Target::do_make_elf_object_implementation): New template declaration.
8678 * gold.h (FUNCTION_NAME): Define.
8679 (gold_unreachable): Use FUNCTION_NAME.
8683 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8684 symbol in the --keep-unique list is not found.
8688 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8689 been maked as --keep-unique.
8690 (Icf::unfold_section): New function.
8691 * icf.h (Icf::unfold_section): New function.
8692 * options.h (General_options::keep_unique): New option.
8693 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8694 * testsuite/Makefile.in: Regenerate.
8695 * testsuite/icf_keep_unique_test.sh: New file.
8696 * testsuite/icf_keep_unique_test.cc: New file.
8701 * resolve.cc (Symbol_table::resolve): Check for references from
8702 dynamic objects to hidden and internal symbols.
8703 * testsuite/Makefile.am (hidden_test.sh): New test.
8704 * testsuite/Makefile.in: Regenerate.
8705 * testsuite/hidden_test.sh: New script.
8706 * testsuite/hidden_test_1.c: New test source.
8707 * testsuite/hidden_test_main.c: New test source.
8711 * arm.cc: Update comments.
8712 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8713 segment to locate the .ARM.exidx section if present.
8717 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8721 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8726 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8727 valid tls_segment only for non-debug-section relocations.
8728 * testsuite/Makefile.am: Add gc_tls_test.
8729 * testsuite/Makefile.in: Regenerate.
8730 * testsuite/gc_tls_test.cc: New file.
8731 * testsuite/gc_tls_test.sh: New file.
8737 * Makefile.am (CCFILES): Add icf.cc.
8739 * Makefile.in: Regenerate.
8740 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8741 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8742 section, symbol and addend information for the relocs.
8743 * gold.cc (queue_middle_tasks): Call identical code folding.
8744 * gold.h: Add defines for multimap.
8745 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8746 to the call of finalize_local_symbols.
8747 * main.cc (main): Create object of class Icf.
8748 * object.cc (Sized_relobj::do_layout): Allow this function to be
8749 called twice during icf.
8750 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8751 to sections marked as identical by icf.
8752 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8754 (Sized_relobj::do_section_entsize): New function.
8755 * object.h (Object::section_entsize): New function.
8756 (Object::do_section_entsize): New pure virtual function.
8757 (Relobj::finalize_local_symbols): Add new parameter.
8758 (Relobj::do_section_entsize): New function.
8759 * options.h (General_options::icf): New option.
8760 (General_options::icf_iterations): New option.
8761 (General_options::print_icf_sections): New option.
8762 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8763 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8764 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8766 * symtab.cc (Symbol_table::is_section_folded): New function.
8767 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8768 to sections marked as identical by icf.
8769 * symtab.h (Symbol_table::set_icf): New function.
8770 (Symbol_table::icf): New function.
8771 (Symbol_table::is_section_folded): New function.
8772 (Symbol_table::icf_): New data member.
8773 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8774 * testsuite/Makefile.am: Add commands to build icf_test.
8775 * testsuite/Makefile.in: Regenerate.
8776 * testsuite/icf_test.sh: New file.
8777 * testsuite/icf_test.cc: New file.
8781 * layout.cc (is_compressible_debug_section): Fix incorrect
8782 comment about compressed section names.
8787 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8792 * layout.h: #include <map>.
8793 (class Kept_section): Change from struct to class. Add accessors
8794 and setters. Add section size to Comdat_group mapping. Change
8795 Comdat_group to std::map. Add is_comdat_ field. Add
8796 linkonce_size field in union.
8797 (class Layout): Update declaration of find_or_add_kept_section.
8798 Don't declare find_kept_object.
8799 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8800 parameter. Add object, shndx, is_comdat, and is_group_name
8801 parameters. Change all callers. Adjust for new Kept_section.
8802 (Layout::find_kept_object): Remove.
8803 * object.cc (Sized_relobj::include_section_group): Update use of
8804 Kept_section. Rename secnum to shndx. Only record
8805 Kept_comdat_section if sections are the same size.
8806 (Sized_relobj::include_linkonce_section): Update use of
8807 Kept_section. Only record Kept_comdat_section if sections are the
8808 same size. Set size of linkonce section.
8809 (Sized_relobj::map_to_kept_section): Update call to
8810 get_kept_comdat_section.
8811 * object.h (class Sized_relobj): Rename fields in
8812 Kept_comdat_section to drop trailing underscores; change object
8813 field to Relobj*. Change Kept_comdat_section_table to store
8814 struct rather than pointer.
8815 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8816 Add kept_object and kept_shndx parameters. Change all callers.
8817 (Sized_relobj::get_kept_comdat_section): Change return type to
8818 bool. Add kept_object and kept_shndx parameters. Change all
8820 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8821 Layout::find_or_add_kept_section.
8825 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8826 Reserve space in the hash table.
8830 * fileread.cc (File_read::get_mtime): New method.
8831 * fileread.h (Timespec): New structure.
8832 (File_read::get_mtime): New method.
8833 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8834 Renamed from timestamp_nsec.
8835 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8837 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8839 (Incremental_inputs::report_archive): Save mtime; style fix.
8840 (Incremental_inputs::report_obejct): Save mtime; style fix.
8841 (Incremental_inputs::report_script): Save mtime; style fix.
8842 (Incremental_inputs::finalize_inputs): Style fix.
8843 (Incremental_inputs::finalize): Style fix.
8844 (Incremental_inputs::create_input_section_data): Store inputs
8846 * incremental.h (Incremental_inputs::report_script): Add mtime
8848 (Incremental_inputs::Input_info::Input_info): Intialize only one
8850 (Incremental_inputs::Input_info::archive): Move to nameless
8852 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8853 (Incremental_inputs::Input_info::script): Move to nameless union.
8854 (Incremental_inputs::mtime): New field.
8855 * script.cc (read_input_script): Pass file mtime to
8857 * script.h (Script_info::inputs): Style fix.
8861 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8867 * layout.cc (Layout::choose_output_section): If we find an
8868 existing section, update the flags.
8869 (Layout::create_notes): New function, broken out of
8871 (Layout::finalize): Don't create note sections.
8872 (Layout::create_note): Don't crash if linker script discards
8874 (Layout::create_gold_note): Likewise.
8875 (Layout::create_build_id): Likewise. Don't set
8876 after_input_sections on the section.
8877 (Layout::create_executable_stack_info): Remove target parameter.
8879 * layout.h (class Layout): Declare create_notes. Update
8880 declaration of create_executable_stack_info.
8881 * gold.cc (queue_middle_tasks): Call create_notes.
8882 * output.cc (Output_section::update_flags_for_input_section): Move
8883 here from output.h. If SHF_ALLOC flag is newly set, mark address
8885 * output.h (Output_data::mark_address_invalid): New function.
8886 (class Output_section): Only declare, not define,
8887 update_flags_for_input_section. Remove set_flags.
8891 * script-sections.cc (Output_section_definition::
8892 set_section_addresses): Rename shadowing local load_address to
8898 * reloc.cc (relocate_sections): Skip empty relocation sections.
8903 * layout.cc (Layout::create_note): Use choose_output_section
8904 rather than make_output_section.
8909 * options.cc (General_options::parse_V): Set printed_version_.
8910 (General_options::General_options): Initialize printed_version_.
8911 * options.h (class General_options): Add printed_version_ field.
8912 * gold.cc (queue_initial_tasks): If there are no input files,
8913 don't give a fatal error if we printed the version information.
8914 (queue_middle_tasks): If using -r with a shared object, give a
8915 fatal error rather than an ordinary error.
8920 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8921 (Layout::make_output_section): Set have_stabstr_section_ if we see
8922 a .stab*str section.
8923 (Layout::finalize): Call link_stabs_sections.
8924 (Layout::link_stabs_sections): New file.
8925 * layout.h (class Layout): Add have_stabstr_section_ field.
8926 Declare link_stabs_sections.
8930 * Makefile.am (libgold_a_LIBADD): New.
8931 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8932 * Makefile.in: Regenerate.
8933 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8934 * configure: Regenerate.
8935 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8936 * fileread.cc: Include sys/state.h
8937 * gold.h: Declare memmem and strndup if found missing.
8938 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8942 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8943 * configure: Rebuild.
8948 * object.cc (Object::section_contents): Don't try to get a view if
8949 the section has length zero.
8950 (Object::handle_gnu_warning_section): If the section is empty, use
8951 the name of the section as the warning.
8956 * stringpool.h (class Stringpool_template): Add optimize_ field.
8957 (Stringpool_template::set_optimize): New function.
8958 * stringpool.cc (Stringpool_template::Stringpool_template):
8959 Initialize optimize_ field.
8960 (Stringpool_template::set_string_offsets): Test local optimize
8961 fild rather than parameter.
8962 * layout.cc (Layout::Layout): Call set_optimize on the section
8968 * yyscript.y: Parse TARGET.
8969 * script.cc (script_set_target): New function.
8970 * script-c.h (script_set_target): Declare.
8971 * options.cc (General_options::string_to_object_format): Rename
8972 from string_to_object_format in anonymous namespace. Change
8974 * options.h (class General_options): Declare
8975 string_to_object_format.
8979 * script-sections.cc (Script_sections::create_segments): Don't put
8980 program headers in a PT_LOAD segment if -n or -N.
8985 * options.h (class General_options): Add -z lazy and -z now. Sort
8986 -z options into alphabetical order.
8987 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8991 * layout.cc (Layout::make_output_section): Call
8992 Target::new_output_section.
8993 (Layout::attach_allocated_section_to_segment): Put large section
8994 sections in a separate load segment with the large segment flag
8996 (Layout::segment_precedes): Sort large data segments after other
8998 (align_file_offset): New static function.
8999 (Layout::set_segment_offsets): Use align_file_offset.
9000 * output.h (class Output_section): Add is_small_section_ and
9001 is_large_section_ fields.
9002 (Output_section::is_small_section): New function.
9003 (Output_section::set_is_small_section): New function.
9004 (Output_section::is_large_section): New function.
9005 (Output_section::set_is_large_section): New function.
9006 (Output_section::is_large_data_section): New function.
9007 (class Output_segment): Add is_large_data_segment_ field.
9008 (Output_segment::is_large_data_segment): New function.
9009 (Output_segment::set_is_large_data_segment): New function.
9010 * output.cc (Output_section::Output_section): Initialize new
9012 (Output_segment::Output_segment): Likewise.
9013 (Output_segment::add_output_section): Add assertion that large
9014 data sections always go in large data segments. Force small data
9015 sections to the end of the list of data sections. Force small BSS
9016 sections to the start of the list of BSS sections. For large BSS
9017 sections to the end of the list of BSS sections.
9018 * symtab.h (class Symbol): Declare is_common_shndx.
9019 (Symbol::is_defined): Check Symbol::is_common_shndx.
9020 (Symbol::is_common): Likewise.
9021 (class Symbol_table): Define enum Commons_section_type. Update
9022 declarations. Add small_commons_ and large_commons_ fields.
9023 * symtab.cc (Symbol::is_common_shndx): New function.
9024 (Symbol_table::Symbol_table): Initialize new fields.
9025 (Symbol_table::add_from_object): Put small and large common
9026 symbols in the right list.
9027 (Symbol_table::sized_finalized_symbol): Check
9028 Symbol::is_common_shndx.
9029 (Symbol_table::sized_write_globals): Likewise.
9030 * common.cc (Symbol_table::do_allocate_commons): Allocate new
9031 common symbol lists. Don't call do_allocate_commons_list if the
9033 (Symbol_table::do_allocate_commons_list): Remove is_tls
9034 parameter. Add comons_section_type parameter. Change all
9035 callers. Handle small and large common symbols.
9036 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9037 Symbol::is_common_shndx.
9038 * resolve.cc (symbol_to_bits): Likewise.
9039 * target.h (Target::small_common_shndx): New function.
9040 (Target::small_common_section_flags): New function.
9041 (Target::large_common_shndx): New function.
9042 (Target::large_common_section_flags): New function.
9043 (Target::new_output_section): New function.
9044 (Target::Target_info): Add small_common_shndx, large_common_shndx,
9045 small_common_section_flags, and large_common_section_flags
9047 (Target::do_new_output_section): New virtual function.
9048 * arm.cc (Target_arm::arm_info): Initialize new fields.
9049 * i386.cc (Target_i386::i386_info): Likewise.
9050 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9052 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9053 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9054 (Target_x86_64::do_new_output_section): New function.
9055 * configure.ac: Define conditional MCMODEL_MEDIUM.
9056 * testsuite/Makefile.am (check_PROGRAMS): Add large.
9057 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9058 (large_LDFLAGS): Define.
9059 * testsuite/large.c: New file.
9060 * testsuite/testfile.cc (Target_test::test_target_info):
9061 Initialize new fields.
9062 * configure, testsuite/Makefile.in: Rebuild.
9066 * Makefile.am (CCFILES): Add target.cc.
9067 * Makefile.in: Regenerate.
9068 * i386.cc (class Target_i386): Define new virtual method to
9069 override do_is_local_label_name in parent.
9070 * object.cc (Sized_relobj::do_count_local_symbols): Discard
9071 local symbols if --discard-locals or -X is given.
9072 * options.h (class General_options): Declare new options
9073 '--discard-locals' and '-X' for discarding locals.
9074 * target.h (class Target): Define new methods is_local_label_name.
9075 Declare new virtual method do_is_local_label_name.
9076 * target.cc: New file.
9077 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9078 (check_SCRIPTS): Add discard_locals_test.sh.
9079 (check_DATA): Add discard_local_tests.syms.
9080 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9081 (discard_local_tests.syms, discard_locals_test.o): New make rules.
9082 * testsuite/Makefile.in: Regenerate.
9083 * testsuite/discard_locals_test.c: New file.
9084 * testsuite/discard_locals_test.sh: Same.
9088 * object.cc (Sized_relobj::Sized_relobj): Initialize
9089 discarded_eh_frame_shndx_ to -1U.
9090 (Sized_relobj::do_layout): Record index of a discard .eh_frame
9092 (Sized_relobj::do_count_local_symbols): Skip local symbols in
9093 a discarded .eh_frame section.
9094 (Sized_relobj::do_finalize_local_symbols): Ditto.
9095 * object.h (class Sized_relobj): Declare new member
9096 discarded_eh_frame_shndx_.
9097 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9098 (local_labels_test.o, local_labels_test): New rules.
9099 * testsuite/Makefile.in: Regenerate.
9103 * layout.cc (Layout::section_name_mapping): Add mapping for
9104 special ARM sections.
9108 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9109 (utils::has_overflow): Same.
9113 * layout.cc (Layout::section_name_mapping): New array, replacing
9114 Layout::linkonce_mapping.
9115 (Layout::section_name_mapping_count): New variable, replacing
9116 Layout::linkonce_mapping_count.
9117 (Layout::linkonce_output_name): Remove.
9118 (Layout::output_section_name): Rewrite.
9119 * layout.h (class Layout): Rename Linkonce_mapping to
9120 Section_name_mapping, linkonce_mapping to section_name_mapping,
9121 linkonce_mapping_count to section_name_mapping_count. Don't
9122 declare linkonce_output_name.
9126 * gold/arm.cc (namespace utils): New.
9127 (Target_arm::reloc_is_non_pic): Define new method.
9128 (class Arm_relocate_functions): New.
9129 (Target_arm::Relocate::relocate): Handle relocation types used by
9134 * arm.cc (Target_arm::scan::global): Use || instead of |.
9138 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
9139 issued_non_pic_error_.
9140 (class Target_arm::Scan): Declare new method check_non_pic.
9141 Define new method symbol_needs_plt_entry.
9142 Declare new data member issued_non_pic_error_.
9143 (class Target_arm::Relocate): Declare new method
9144 should_apply_static_reloc.
9145 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9146 (Target_arm::Scan::check_non_pic): Define new method.
9147 (Target_arm::Scan::local): Handle a small subset of reloc types used
9149 (Target_arm::Scan::local): Same.
9150 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9154 * incremental.cc (Incremental_inputs::report_command_line): Filter
9155 out --incremental-* options.
9159 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9161 (class Target_arm): Update comment.
9162 (Target_arm::Target_arm): Initialize new data members GOT_,
9163 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9164 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9165 and Target_arm::rel_dyn_section.
9166 Declare new_enum Target_arm::Got_type.
9167 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9169 Update commments for member do_dynsym_value.
9170 (Target_arm::got_size, Target_arm::plt_section,
9171 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9172 new methods inside class defintion.
9173 (Target_arm::got_section): Define new method.
9174 (Target_arm::rel_dyn_section): Same.
9175 (Output_data_plt_arm): New template class.
9176 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9177 (Output_data_plt_arm:do_adjust_output_section): Define new method.
9178 (Output_data_plt_arm::add_entry): Same.
9179 (Output_data_plt_arm::first_plt_entry): Define new
9180 static data member for PLT instruction template.
9181 (Output_data_plt_arm::plt_entry): Same.
9182 (Output_data_plt_arm::do_write): Define new method.
9183 (Target_arm::make_plt_entry): Same.
9184 (Target_arm::do_finalize_sections): Same.
9185 (Target_arm::do_dynsym_value): Same.
9189 * Makefile.am (TARGETSOURCES): Add arm.cc.
9190 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9191 * Makefile.in: Regenerate.
9193 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9197 * options.cc (General_options::parse_exclude_libs). Fix a comment.
9198 (General_options::check_excluded_libs): Strip off directories in
9199 archive name before matching like GNU ld does.
9200 * testsuite/Makefile.am (MOSTLYCLEANFILES,
9201 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9202 (exclude_libs_test_LDFLAGS): Add linker option
9203 -Wl,--exclude-libs,libexclude_libs_test_3
9204 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9205 an explicit archive without using -l.
9206 (alt/libexclude_libs_test_3.a): New make rule.
9207 * testsuite/Makefile.in: Regenerate.
9208 * testsuite/exclude_libs_test.c : Declare lib3_default().
9210 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9211 * exclude_libs_test_3.c: New file.
9215 * po/id.po: New Indonesian translation.
9216 * po/gold.pot: Updated template file.
9220 * testsuite/Makefile.am: Add -ffunction-sections to compile
9221 gc_comdat_test files. Add -Wl,--gc-sections to build
9223 * testsuite/Makefile.in: Regenerate.
9224 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9228 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9229 kept comdat section was garbage collected.
9230 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9231 * testsuite/Makefile.in: Regenerate.
9232 * testsuite/gc_comdat_test.sh: New file.
9233 * testsuite/gc_comdat_test_1.cc: New file.
9234 * testsuite/gc_comdat_test_2.cc: New file.
9238 * archive.cc (Archive::Archive): Move constructor from archive.h
9239 to here. Initialize no_export_.
9240 (Archive::get_elf_object_for_member): Set no_export flag of object.
9241 * archive.h (Archive::Archive): Move constructor body to
9243 (Archive::no_export): New method.
9244 (Archive::no_export_): New field.
9245 * object.h (Object::Object): Initialize no_export_ to false.
9246 (Object::no_export, Object::set_no_export): New methods.
9247 (Object::no_export_): New field.
9248 * options.cc (General_options::parse_exclude_libs): New method.
9249 (General_options::check_excluded_libs) Same.
9250 * options.h (exclude_libs): New option.
9251 (General_options::check_excluded_libs): New method declaration.
9252 (General_options::excluded_libs_): New field.
9253 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9254 default or protected visibility if an object has no-export flag set.
9255 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9256 (check_SCRIPTS): Add exclude_libs_test.sh.
9257 (check_DATA): Add exclude_libs_test.syms.
9258 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9259 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9260 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9261 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9262 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9263 libexclude_libs_test_2.a): New rules.
9264 * testsuite/Makefile.in: Regenerate.
9265 * testsuite/exclude_libs_test.c: New file.
9266 * testsuite/exclude_libs_test.sh: Ditto.
9267 * testsuite/exclude_libs_test_1.c: Ditto.
9268 * testsuite/exclude_libs_test_2.c: Ditto.
9272 * configure.ac: Check for declarations for cases where libiberty.h
9273 checks HAVE_DECL_xxx.
9274 * configure, config.in: Rebuild.
9278 * gold.h (Incremental_argument_list): Remove (invalid) forward
9280 * incremental.cc (Incremental_inputs::report_achive): New method.
9281 (Incremental_inputs::report_object): New method.
9282 (Incremental_inputs::report_script): New method.
9283 (Incremental_inputs::finalize_inputs): New method.
9284 (Incremental_inputs::finalize): Call finalize_inputs().
9285 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9286 Create inputs entries.
9287 * incremental.h (Incremental_input_type): New enum.
9288 (Incremental_inputs::Incremental_input): Initialize new fields.
9289 (Incremental_inputs::report_inputs): New method.
9290 (Incremental_inputs::report_achive): New method.
9291 (Incremental_inputs::report_object): New method.
9292 (Incremental_inputs::report_script): New method.
9293 (Incremental_inputs::finalize_inputs): New method.
9294 (Incremental_inputs::Input_info): New struct.
9295 (Incremental_inputs::Input_info_map): New typedef.
9296 (Incremental_inputs::lock_): New field.
9297 (Incremental_inputs::Inputs_): New field.
9298 (Incremental_inputs::Inputs_map): New field.
9299 * main.cc (main): Call Incremental_input::report_inputs.
9300 * options.h (Input_argument_list): Typedef moved from
9302 (Input_file_group::Files): Remove, use ::Input_argument_list.
9303 (Input_file_group::Input_argument_list): Remove, use
9304 ::Input_argument_list.
9305 * plugin.cc (Plugin_manager::add_input_file): Add error in
9307 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9309 * script.cc (read_input_script): Call
9310 Incremental_input::report_script.
9311 * script.h (Script_info): New class.
9315 * x86_64.cc (do_adjust_output_section): Set entsize to
9320 * output.cc (Output_file::close): After short writes, continue
9321 writing from the correct offset in the buffer being written.
9325 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9326 * configure: Regenerate.
9327 * config.in: Regenerate.
9328 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9329 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9333 * incremental.cc (Incremental_inputs_header_data): Renamed from
9334 Incremental_input_header_data.
9335 (Incremental_inputs_header_data::data_size): New field.
9336 (Incremental_inputs_header_data::put_input_file_count): Renamed
9337 from input_file_count.
9338 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9339 from command_line_offset.
9340 (Incremental_inputs_header_data::put_reserved): Renamed from
9342 (Incremental_inputs_entry_data): Renamed from
9343 Incremental_input_entry_data.
9344 (Incremental_inputs_entry_data::data_size): New field.
9345 (Incremental_inputs::report_command_line): New method.
9346 (Incremental_inputs::finalize): New method.
9347 (Incremental_inputs::create_incremental_inputs_data): New method.
9348 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9349 * incremental.h: New file.
9350 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9351 (Layout::finalize): Create incremental inputs section in
9353 (Layout::create_incremental_info_sections): New method.
9354 * layout.h (Layout::incremental_inputs): New method.
9355 (Layout::create_incremental_info_sections): New method.
9356 (Layout::incremental_inputs_): New field.
9357 * main.cc (main): Notify Incremental_input of the command line.
9362 * gold.h (reserve_unordered_map): Define, three versions, one for
9363 each version of Unordered_map.
9364 * layout.cc (Layout::Layout): Remove options parameter. Add
9365 number_of_input_files parameter. Don't initialize options_.
9366 Initialize number_of_input_files_ and resized_signatures_. Move
9367 sections_are_attached_.
9368 (Layout::layout_group): Reserve space for group_signatures_.
9369 (Layout::find_or_add_kept_section): Change name parameter to be a
9370 reference. Resize signatures_ map when it gets large enough.
9371 (Layout::layout_eh_frame): Use parameters->options() instead of
9373 (Layout::make_output_section): Likewise.
9374 (Layout::attach_allocated_section_to_segment): Likewise.
9375 (Layout::finalize, Layout::create_executable_stack): Likewise.
9376 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9377 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9378 * layout.h (class Layout): Update declarations. Remove options_
9379 field. Add number_of_input_files_ and resized_signatures_
9380 fields. Move sections_are_attached_ field.
9381 * main.cc (main): Pass number of input files to Layout
9382 constructor. Don't pass options.
9386 * ffsll.c (ffsll): Correct implementation.
9390 * ffsll.c: New file.
9391 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9392 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9393 * ftruncate.c (ftruncate): Declare before definition.
9394 * mremap.c (mremap): Likewise.
9395 * pread.c (pread): Likewise.
9396 * configure, Makefile.in, config.in: Rebuild.
9398 * mremap.c: New file.
9399 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9400 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9401 (mremap): Declare if HAVE_MREMAP is not defined.
9402 * configure, Makefile.in, config.in: Rebuild.
9406 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9407 position independent.
9408 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9409 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9413 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9415 (needs_dynamic_reloc): Likewise.
9419 * yyscript.y (file_cmd): Recognize EXTERN.
9420 (extern_name_list, extern_name_list_body): New nonterminals.
9421 * script.cc (script_add_extern): Define.
9422 * script-c.h (script_add_extern): Declare.
9426 * object.cc (is_elf_object): Define.
9427 * object.h (is_elf_object): Declare.
9428 * archive.cc (Archive::get_elf_object_for_member): Call
9430 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9434 * output.cc (Output_file::map_anonymous): Define.
9435 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9436 try an anonymous one. Report the size if the mmap fails.
9437 * output.h (class Output_file): Declare map_anonymous.
9441 * target-select.cc (instantiate_target): Don't acquire the lock if
9442 the instantiated_target_ field has already been set.
9446 * gold-threads.h (class Initialize_lock): Define.
9447 * gold-threads.cc (class Initialize_lock_once): Define.
9448 (initialize_lock_control): New static variable.
9449 (initialize_lock_pointer): New static variable.
9450 (initialize_lock_once): New static function.
9451 (Initialize_lock::Initialize_lock): Define.
9452 (Initialize_lock::initialize): Define.
9453 * target-select.h: Include "gold-threads.h".
9454 (class Target_selector): Add lock_ and initialize_lock_ fields.
9455 Don't define instantiate_target, just declare it.
9456 * target-select.cc (Target_selector::Target_selector): Initialize
9458 (Target_selector::instantiate_target): Define.
9459 * descriptors.h: Include "gold-threads.h".
9460 (class Descriptors): Add initialize_lock_ field.
9461 * descriptors.cc (Descriptors::Descriptors): Initialize new
9463 (Descriptors::open): Use initialize_lock_ field
9464 * errors.h (class Errors): Add initialize_lock_ field.
9465 * errors.cc (Errors::Errors): Initialize new field.
9466 (Errors::initialize_lock): Use initialize_lock_ field.
9467 * powerpc.cc (class Target_selector_powerpc): Remove
9468 instantiated_target_ field. In do_recognize call
9469 instantiate_target rather than do_instantiate_target. In
9470 do_instantiate_target just allocate a new target.
9471 * sparc.cc (class Target_selector_sparc): Likewise.
9473 * freebsd.h: New file.
9474 * i386.cc: Include "freebsd.h".
9475 (Target_i386): Derive from Target_freebsd rather than
9477 (Target_selector_i386): Derive from Target_selector_freebsd rather
9478 than Target_selector.
9479 * x86_64.cc: Include "freebsd.h".
9480 (Target_x86_64): Derive from Target_freebsd rather than
9482 (Target_selector_x86_64): Derive from Target_selector_freebsd
9483 rather than Target_selector.
9484 * target.h (class Target): Add adjust_elf_header and
9485 do_adjust_elf_header.
9486 * output.cc (Output_file_header:: do_sized_write): Call target
9487 adjust_elf_header routine.
9488 * configure.tgt: Set targ_osabi.
9489 * configure.ac: Define GOLD_DEFAULT_OSABI.
9490 * parameters.cc (Parameters::default_target): Pass
9491 GOLD_DEFAULT_OSABI to select_target.
9492 * target-select.h (class Target_selector): Make instantiate_target
9493 protected rather than private.
9494 * Makefile.am (HFILES): Add freebsd.h.
9495 * configure, Makefile.in, config.in: Rebuild.
9497 * merge.cc (do_add_input_section): Correct pend value. Change
9498 message about last entry not being null terminated from error to
9503 * incremental.cc: New file.
9504 * Makefile.am (CCFILES): Add incremental.cc.
9505 * Makefile.in: Rebuild.
9509 * layout.cc (Layout::output_section_name): Preserve names
9510 of '.note.' sections.
9514 * descriptors.cc (Descriptors::open): Check that the options are
9515 valid before using them.
9519 * script-sections.h: Include <list>.
9520 (class Script_sections): Change Sections_elements from std::vector
9521 to std::list. Typedef public Elements_iterator. Add
9522 orphan_section_placement_, data_segment_align_start_, and
9523 saw_data_segment_align_ fields. Remove data_segment_align_index_
9525 * script-sections.cc (class Orphan_section_placement): New class.
9526 (class Sections_element): Add virtual functions is_relro and
9527 orphan_section_init. Remove virtual function place_orphan_here.
9528 (class Output_section_definition): Add is_relro and
9529 orphan_section_init. Remove place_orphan_here.
9530 (class Orphan_output_section): Likewise.
9531 (Script_sections::Script_sections): Update for field changes.
9532 (Script_sections::data_segment_align): Set saw_data_segment_align_
9533 and data_segment_align_start_, not data_segment_align_index.
9534 (Script_sections::data_segment_relro_end): Check
9535 saw_data_segment_align_. Use data_segment_align_start_ rather
9536 than data_segment_align_index_.
9537 (Script_sections::place_orphan): Rewrite to use
9538 Orphan_section_placement.
9542 * archive.cc (Archive::add_symbols): Check for a version attached
9543 to the symbol name in the archive map.
9544 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9545 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9546 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9547 (ver_test_11.a): New target.
9548 * testsuite/Makefile.in: Rebuild.
9550 * configure.ac: Check for chsize and posix_fallocate. Replace
9552 * ftruncate.c: New file, from gnulib.
9553 * output.cc (posix_fallocate): Define dummy version if not
9554 HAVE_POSIX_FALLOCATE.
9555 (Output_file::map): Call posix_fallocate rather than lseek and
9557 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9558 * configure, Makefile.in, config.in: Rebuild.
9562 * layout.h (Layout::create_note): Add section_name parameter.
9563 * layout.cc (Layout::create_note): Likewise.
9564 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9568 * descriptors.cc: Include "options.h".
9569 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9570 (Descriptors::open): Always use O_CLOEXEC when opening a new
9571 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9572 then set FD_CLOEXEC.
9574 * sparc.cc (class Target_sparc): Add has_got_section.
9575 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9576 make sure we have a GOT section.
9578 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9579 (Target_sparc::Scan::local): Likewise.
9580 (Target_sparc::Scan::global): Likewise.
9581 (Target_sparc::Relocate::relocate): Likewise.
9582 (Target_sparc::Relocate::relocate_tls): Likewise.
9584 * symtab.cc (Symbol_table::define_default_version): New function,
9585 broken out of add_from_object.
9586 (Symbol_table::add_from_object): Call define_default_version.
9587 (Symbol_table::define_special_symbol): Add resolve_oldsym
9588 parameter. Change all callers. If the version for a symbol comes
9589 from a version script, resolve it with the symbol with the same
9590 name with no version. Also add the symbol without a version if
9592 (do_define_in_output_data): If resolving with oldsym, don't delete
9594 (do_define_in_output_segment): Likewise.
9595 (do_define_as_constant): Likewise.
9596 * symtab.h (class Symbol_table): Update declarations.
9600 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9601 (Read_symbols::requeue): New function.
9602 (Read_symbols::do_read_symbols): If make_elf_object fails because
9603 the target type is not configured, and the file was searched for,
9604 issue a warning and retry with the next directory.
9605 (Add_symbols::run): If the file has an incompatible format, and
9606 it was searched for, requeue the Read_symbols task. On error,
9608 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9609 dirindex parameter to constructor. Change all callers. Declare
9610 incompatible_warning and requeue.
9611 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9612 input_argument_ and input_group_ fields. Add them to
9613 constructor. Change all callers.
9614 (class Read_script): Add dirindex_ field. Add it to constructor.
9616 * archive.cc (Archive::setup): Remove input_objects parameter.
9618 (Archive::get_file_and_offset): Likewise.
9619 (Archive::read_all_symbols): Likewise.
9620 (Archive::read_symbols): Likewise.
9621 (Archive::get_elf_object_for_member): Remove input_objects
9622 parameter. Add punconfigured parameter. Change all callers.
9623 (Archive::add_symbols): Change return type to bool. Check return
9624 value of include_member.
9625 (Archive::include_all_members): Likewise.
9626 (Archive::include_member): Change return type to bool. Return
9627 false if first included object has incompatible target. Set
9628 included_member_ field.
9629 (Add_archive_symbols::run): If add_symbols returns false, requeue
9631 * archive.h (class Archive): Add included_member_ field.
9632 Initialize it in constructor. Add input_file and searched_for
9633 methods. Update declarations.
9634 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9635 input_argument_ fields. Add them to constructor. Change all
9637 * script.cc: Include "target-select.h".
9638 (class Parser_closure): Add skip_on_incompatible_target_ and
9639 found_incompatible_target_ fields. Add
9640 skip_on_incompatible_target parameter to constructor. Change all
9641 callers. Add methods skip_on_incompatible_target,
9642 clear_skip_on_incompatible_target, found_incompatible_target, and
9643 set_found_incompatible_target.
9644 (read_input_script): Add dirindex parameter. Change all callers.
9645 If parser finds an incompatible target, requeue Read_symbols
9647 (script_set_symbol): Clear skip_on_incompatible_target in
9649 (script_add_assertion, script_parse_option): Likewise.
9650 (script_start_sections, script_add_phdr): Likewise.
9651 (script_check_output_format): New function.
9652 * script.h (read_input_script): Update declaration.
9653 * script-c.h (script_check_output_format): Declare.
9654 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9655 (ignore_cmd): Remove OUTPUT_FORMAT.
9656 * fileread.cc (Input_file::Input_file): Add explicit this.
9657 (Input_file::will_search_for): New function.
9658 (Input_file::open): Add pindex parameter. Change all callers.
9659 * fileread.h (class Input_file): Add input_file_argument method.
9660 Declare will_search_for. Update declarations.
9661 * object.cc (make_elf_object): Add punconfigured parameter.
9663 * object.h (class Object): Make input_file public. Add
9664 searched_for method.
9665 (make_elf_object): Update declaration.
9666 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9668 * dirsearch.h (class Dirsearch): Update declaration.
9669 * options.h (class General_options): Add --warn-search-mismatch.
9670 * parameters.cc (Parameters::is_compatible_target): New function.
9671 * parameters.h (class Parameters): Declare is_compatible_target.
9672 * workqueue.cc (Workqueue::add_blocker): New function.
9673 * workqueue.h (class Workqueue): Declare add_blocker.
9675 * fileread.cc (Input_file::open): Remove options parameter.
9677 (Input_file::open_binary): Likewise.
9678 * script.cc (read_input_script): Likewise.
9679 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9680 options parameter from constructor. Change all callers.
9681 (class Read_script): Likewise.
9682 * fileread.h (class Input_file): Update declarations.
9683 * script.h (read_input_script): Update declaration.
9687 * po/es.po: New Spanish translation.
9691 * options.cc (parse_short_option): Keep dash_z from registering itself.
9696 * target-reloc.h (relocate_section): Pass output_section to
9698 * i386.cc (Target_i386::should_apply_static_reloc): Add
9699 output_section parameter. Change all callers.
9700 (Target_i386::Relocate::relocate): Add output_section parameter.
9701 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9702 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9703 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9704 * testsuite/two_file_shared.sh: New script.
9705 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9706 (check_DATA): Add two_file_shared.dbg.
9707 (two_file_shared.dbg): New target.
9708 * testsuite/Makefile.in: Rebuild.
9712 * configure.ac: Check for byteswap.h.
9713 * configure: Rebuild.
9714 * config.in: Rebuild.
9718 * layout.cc (Layout::find_or_add_kept_section): New function.
9719 (Layout::add_comdat): Removed.
9720 * layout.h (struct Kept_section): Move out of class Layout.
9721 Remove trailing underscores from field names. Add group_sections
9722 field. Rename group_ field to is_group. Change all uses.
9723 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9724 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9725 comdat_groups_ field.
9726 (Sized_relobj::include_section_group): Use
9727 find_or_add_kept_section and Kept_section::group_sections.
9728 (Sized_relobj::include_linkonce_section): Likewise.
9729 * object.cc (class Sized_relobj): Don't define Comdat_group or
9730 Comdat_group_table. Remove find_comdat_group and
9731 add_comdat_group. Remove comdat_groups_ field.
9732 * plugin.cc (include_comdat_group): Use
9733 Layout::find_or_add_kept_section.
9737 * README: --gc-sections and map files are now supported. Document
9738 some build requirements.
9741 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9742 relocatable link set the value of the section symbol to zero.
9743 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9744 relocatable link don't include the section address in the local
9750 * options.h (class Search_directory): Add is_system_directory.
9751 (class General_options): Declare is_in_system_directory.
9752 * options.cc (get_relative_sysroot): Make static.
9753 (get_default_sysroot): Make static.
9754 (General_optoins::is_in_system_directory): New function.
9755 * fileread.cc (Input_file::is_in_system_directory): New function.
9756 * fileread.h (class Input_file): Declare is_in_system_directory.
9757 * object.h (class Object): Add is_in_system_directory.
9758 (class Input_objects): Remove system_library_directory_ field.
9759 * object.cc (Input_objects::add_object): Don't set
9760 system_library_directory_.
9761 (input_objects::found_in_system_library_directory): Remove.
9762 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9763 parameter. Change all callers.
9764 (Symbol_table::sized_write_globals): Likewise.
9765 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9766 Call Object::is_in_system_directory.
9767 * symtab.h (class Symbol_table): Update declarations.
9770 * descriptors.h (Open_descriptor): Add is_on_stack field.
9771 * descriptors.cc (Descriptors::open): If the descriptor is on the
9772 top of the stack, remove it. Initialize is_on_stack field.
9773 (Descriptors::release): Only add pod to stack if it is not on the
9775 (Descriptors::close_some_descriptor): Clear stack_next and
9779 * output.cc (Output_section::find_starting_output_address): Rename
9780 from starting_output_address; add PADDR parameter; change return
9782 * output.h (class Output_section): Declare
9783 find_starting_output_address instead of starting_output_address.
9784 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9785 section symbol for which we can't find a merge section.
9788 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9789 hidden or internal, force the symbol to be local.
9790 * resolve.cc (Symbol::override_visibility): Define.
9791 (Symbol::override_base): Use override_visibility.
9792 (Symbol_table::resolve): Likewise.
9793 (Symbol::override_base_with_special): Likewise.
9794 (Symbol_table::override_with_special): If the visibility is hidden
9795 or internal, force the symbol to be local.
9796 * symtab.h (class Symbol): Add set_visibility and
9797 override_visibility.
9798 * testsuite/ver_test_1.sh: New file.
9799 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9800 (check_DATA): Add ver_test_1.syms.
9801 (ver_test_1.syms): New target.
9802 * testsuite/Makefile.in: Rebuild.
9806 * layout.cc (Layout::choose_output_section): Don't rename sections
9807 when using a linker script that has a SECTIONS clause.
9808 * Makefile.in: Regenerate.
9810 * testsuite/Makefile.am (script_test_5.sh): New test case.
9811 * testsuite/Makefile.in: Regenerate.
9812 * testsuite/script_test_5.cc: New file.
9813 * testsuite/script_test_5.sh: New file.
9814 * testsuite/script_test_5.t: New file.
9818 * archive.cc (Archive::include_member): Update calls to add_symbols.
9819 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9820 the Layout argument.
9821 * dynobj.h (do_add_symbols): Add the Layout argument.
9822 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9824 * object.h (Object::add_symbols): Add the Layout argument.
9825 (Object::do_add_symbols): Add the Layout argument.
9826 (Sized_relobj::do_add_symbols): Add the Layout argument.
9827 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9828 Unify the two versions.
9829 (Add_plugin_symbols): Remove.
9830 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9831 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9832 (Add_plugin_symbols): Remove.
9833 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9834 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9835 (Add_symbols::run): Make it work with Pulginobj.
9839 * object.cc (Sized_relobj::do_layout): Make info message start
9840 with lower case letter.
9844 * binary.cc: Fix file comment.
9846 * options.h (enum Incremental_disposition): Define.
9847 (class General_options): Add new options: --incremental,
9848 --incremental_changed, --incremental_unchanged,
9849 --incremental_unknown. Add incremental_disposition_ and
9850 implicit_incremental_ fields.
9851 (General_options::incremental_disposition): New function.
9852 (class Position_dependent_options): Add incremental_disposition
9854 (Position_dependent_options::copy_from_options): Set incremental
9856 * options.cc (General_options::parse_incremental_changed): New
9858 (General_options::parse_incremental_unchanged): New function.
9859 (General_options::parse_incremental_unknown): New function.
9860 (General_options::General_options): Initialize new fields
9861 incremental_disposition_ and implicit_incremental_.
9862 (General_options::finalize): Check for uasge of --incremental-*
9863 without --incremental.
9867 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9868 pointer and to report location as the file name associated with
9870 (gold_undefined_symbol_at_location): New function to replace the
9871 old gold_undefined_symbol functionality.
9872 * target-reloc.h (relocate_section): Update to use
9873 gold_undefined_symbol_at_location.
9874 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9875 Call gold_undefined_symbol function rather than gold_error.
9876 * errors.h (Errors::undefined_symbol): Take location as a
9877 string, rather than calculating it from a relocation.
9878 * errors.cc (Errors::fatal): Print "fatal error:" before the
9880 (Errors::error, Errors::error_at_location): Print "error: "
9881 before the formatted message.
9882 (Errors::undefined_symbol): Take location as a string, rather
9883 than calculating it from a relocation.
9884 (gold_undefined_symbol_at_location): New function akin to
9885 old gold_undefined_symbol, calculates location from relocation.
9886 (gold_undefined_symbol): Change to take only a Symbol pointer
9887 and to report location as the file name associated with the symbol.
9888 * testsuite/debug_msg.sh: Update for changed error messages.
9889 * testsuite/undef_symbol.sh: Likewise.
9894 * reduced_debug_output.h
9895 (Output_reduced_debug_abbrev_section::failed): Use format for
9897 (Output_reduced_debug_info_section::faild): Likewise.
9901 * script.cc (Lazy_demangler): New class.
9902 (Version_script_info::get_symbol_version_helper): Demangle a
9907 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9909 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9913 * version.cc (version_string): Bump to 1.9.
9915 * gold.h: Include <cstring> and <stdint.h>.
9916 * version.cc: Include <cstdio>.
9917 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9919 * reduced_debug_output.cc (insert_into_vector): Rename from
9920 Insert_into_vector; change all callers. Use Swap_unaligned to
9921 avoid aliasing issue; remove union since it is unnecessary.
9925 * Makefile.am (CCFILES): Add gc.cc.
9927 * Makefile.in: Regenerate.
9928 * gold.cc (Gc_runner): New class.
9929 (queue_initial_tasks): Call garbage collection related tasks
9930 when corresponding options are invoked.
9931 (queue_middle_gc_tasks): New function.
9932 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9933 processed early before laying out sections during garbage collection.
9934 * gold.h (queue_middle_gc_tasks): New function.
9935 (is_prefix_of): Move from "layout.cc".
9936 * i386.cc (Target_i386::gc_process_relocs): New function.
9937 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9938 * main.cc (main): Create object of class "Garbage_collection".
9939 * object.cc (Relobj::copy_symbols_data): New function.
9940 (Relobj::is_section_name_included): New function.
9941 (Sized_relobj::do_layout): Allow this function to be called twice
9942 during garbage collection and defer layout of section during the
9944 * object.h (Relobj::get_symbols_data): New function.
9945 (Relobj::is_section_name_included): New function.
9946 (Relobj::copy_symbols_data): New function.
9947 (Relobj::set_symbols_data): New function.
9948 (Relobj::get_relocs_data): New function.
9949 (Relobj::set_relocs_data): New function.
9950 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9951 (Relobj::gc_process_relocs): New function.
9952 (Relobj::do_gc_process_relocs): New pure virtual function.
9953 (Relobj::sd_): New data member.
9954 (Sized_relobj::is_output_section_offset_invalid): New function.
9955 (Sized_relobj::do_gc_process_relocs): New function.
9956 * options.h (General_options::gc_sections): Modify to not be a no-op.
9957 (General_options::print_gc_sections): New option.
9958 * plugin.cc (Plugin_finish::run): Remove function call to
9959 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9960 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9961 * reloc.cc (Read_relocs::run): Add task to process relocs and
9962 determine unreferenced sections when doing garbage collection.
9963 (Gc_process_relocs): New class.
9964 (Sized_relobj::do_gc_process_relocs): New function.
9965 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9966 sections that are garbage collected.
9967 * reloc.h (Gc_process_relocs): New class.
9968 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9969 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9970 symbols whose corresponding sections are garbage collected.
9971 (Symbol_table::Symbol_table): Add new parameter for the garbage
9973 (Symbol_table::gc_mark_undef_symbols): New function.
9974 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9975 (Symbol_table::gc_mark_dyn_syms): New function.
9976 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9978 (Symbol_table::add_from_object): Likewise.
9979 (Symbol_table::add_from_relobj): When building shared objects, do not
9980 treat externally visible symbols as garbage.
9981 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9982 table information for static and relocatable links.
9983 * symtab.h (Symbol_table::set_gc): New function.
9984 (Symbol_table::gc): New function.
9985 (Symbol_table::gc_mark_undef_symbols): New function.
9986 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9987 (Symbol_table::gc_mark_dyn_syms): New function.
9988 (Symbol_table::gc_): New data member.
9989 * target.h (Sized_target::gc_process_relocs): New pure virtual
9991 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9992 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9996 * options.h (General_options::gc_sections): Define as a no-op for now.
9997 (General_options::no_keep_memory): Ditto.
9998 (General_options::Bshareable): Define.
9999 * options.cc (General_options::finalize): Honor -Bshareable.
10003 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10004 read the value in the contents, since we don't use it. Use the
10005 template endianness when writing.
10006 (Relocate::relocate): Use it for R_PPC_REL16_HA.
10010 * configure.tgt (powerpc64-*): Fix targ_obj.
10014 * object.cc (Sized_relobj::write_local_symbols): Don't write out
10015 local symbols when stripping all symbols.
10019 * output.cc (Output_reloc): Add explicit instantiations.
10023 * archive.cc (Archive::get_elf_object_for_member): Remove call
10024 to File_read::claim_for_plugin.
10025 * descriptors.cc (Descriptors::open): Remove reference to
10027 (Descriptors::claim_for_plugin): Remove.
10028 * descriptors.h (Descriptors::claim_for_plugin): Remove.
10029 (Descriptors::is_claimed): Remove.
10030 (claim_descriptor_for_plugin): Remove.
10031 * fileread.cc (File_read::claim_for_plugin): Remove.
10032 * fileread.h (File_read::claim_for_plugin): Remove.
10033 (File_read::descriptor): Reopen descriptor if necessary.
10034 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
10035 (Plugin_manager::all_symbols_read): Add task parameter. Change
10037 (Plugin_manager::get_input_file): New function.
10038 (Plugin_manager::release_input_file): New function.
10039 (Pluginobj::Pluginobj): Add filesize parameter and initialize
10040 corresponding data member.
10041 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10042 and pass to base constructor. Change all callers.
10043 (get_input_file, release_input_file): New functions.
10044 (make_sized_plugin_object): Add filesize parameter. Change all callers.
10045 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10046 (Plugin_manager::all_symbols_read): Add task parameter.
10047 (Plugin_manager::get_input_file): New function.
10048 (Plugin_manager::release_input_file): New function.
10049 (Plugin_manager::task_): New data member.
10050 (Pluginobj::Pluginobj): Add filesize parameter.
10051 (Pluginobj::filename): New function.
10052 (Pluginobj::descriptor): New function.
10053 (Pluginobj::filesize): New function.
10054 (Pluginobj::filesize_): New data member.
10055 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10056 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10057 File_read::claim_for_plugin; use Object::unlock to unlock the file.
10059 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10060 with archive libraries.
10061 * testsuite/Makefile.in: Regenerate.
10062 * testsuite/plugin_test.c (struct sym_info): New type.
10063 (get_input_file, release_input_file): New static variables.
10064 (onload): Capture new transfer vector entries.
10065 (claim_file_hook): Stop reading at end of file according to filesize.
10066 Factor out parsing of readelf output into separate function.
10067 (all_symbols_read_hook): Exercise get_input_file and release_input_file
10068 APIs and get the source file name from the symbol table. Convert
10069 source file name to corresponding object file name. Print info
10070 message when adding new input files.
10071 (parse_readelf_line): New function.
10072 * testsuite/plugin_test_1.sh: Add checks for new info messages.
10073 * testsuite/plugin_test_2.sh: Likewise.
10074 * testsuite/plugin_test_3.sh: Likewise.
10075 * testsuite/plugin_test_4.sh: New test case.
10079 * version.cc (version_string): Bump to 1.8.
10083 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10084 * plugin.cc (Plugin_manager::finish): Rename as
10085 layout_deferred_objects. Move cleanup to separate function.
10086 (Plugin_manager::cleanup): New function.
10087 (Plugin_finish::run): Call layout_deferred_objects and cleanup
10089 * plugin.h (Plugin_manager::finish): Rename as
10090 layout_deferred_objects.
10091 (Plugin_manager::cleanup): New function.
10092 (Plugin_manager::cleanup_done): New field.
10096 * plugin.cc (is_visible_from_outside): New function.
10097 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10098 so we don't return "IR only" status for exported symbols or -r links.
10100 * testsuite/Makefile.am (plugin_test_3): New test case.
10101 * testsuite/Makefile.in: Regenerate.
10102 * testsuite/plugin_test_3.sh: New file.
10106 * object.cc (Sized_relobj::layout_section): New function.
10107 (Sized_relobj::do_layout): Defer layout of input sections until after
10108 plugin has provided replacement files.
10109 (Sized_relobj::do_layout_deferred_sections): New function.
10110 * object.h (Relobj::set_section_offset): Remove virtual keyword.
10111 (Relobj::layout_deferred_sections): New function.
10112 (Relobj::do_layout_deferred_sections): New function.
10113 (Sized_relobj::do_layout_deferred_sections): New function.
10114 (Sized_relobj::layout_section): New function.
10115 (Sized_relobj::Deferred_layout): New structure.
10116 (Sized_relobj::deferred_layout_): New field.
10117 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10118 Change all callers. Layout deferred sections.
10119 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
10121 (Plugin_hook::run): Move code from do_plugin_hook inline.
10122 (Plugin_hook::do_plugin_hook): Remove.
10123 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10124 (Plugin_manager::finish): Renamed, was cleanup.
10125 (Plugin_manager::should_defer_layout): New function.
10126 (Plugin_manager::add_deferred_layout_object): New function.
10127 (Plugin_manager::Deferred_layout_list): New type.
10128 (Plugin_manager::deferred_layout_objects_): New field.
10129 (Plugin_hook::do_plugin_hook): Remove.
10133 * options.h (class General_options): Add --no case for
10138 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10140 (Plugin_manager::claim_file): Create plugin object even if
10141 plugin did not call the add_symbols callback.
10142 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10143 asking for more symbols than were added.
10144 * testsuite/Makefile.am (plugin_test_1): Add test case with
10146 (empty.syms): New target.
10147 * testsuite/Makefile.in: Regenerate.
10148 * testsuite/plugin_test.c (claim_file_hook): Add new debug
10149 message. Don't call add_symbols if no globals.
10150 (all_symbols_read_hook): Don't provide replacement for empty
10155 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10156 r_type == 0 for a local symbol with r_sym == 0.
10157 (scan_relocatable_relocs): Pass r_sym to
10158 local_non_section_strategy.
10159 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10162 * configure.ac: Update test for TLS descriptors: they are
10163 supported as of glibc 2.9.
10164 * configure: Rebuild.
10169 * target-reloc.h (Default_scan_relocatable_relocs): For each
10170 function, map r_type == 0 to RELOC_DISCARD.
10174 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10175 object to override a kept COMDAT group from a plugin object.
10180 * yyscript.y (file_cmd): Handle INPUT.
10182 * testsuite/initpri1.c: Change all declarations to be full
10183 prototypes by adding void, to avoid compiler warnings.
10187 * options.cc (General_options::parse_plugin_opt): New.
10188 (General_options::add_plugin): The argument now is just the filename.
10189 (General_options::add_plugin_option): New.
10190 * options.h (plugin_opt): New.
10191 (add_plugin): Change argument name.
10192 (add_plugin_option): New.
10193 * plugin.cc (Plugin::load): Don't parse the plugin option.
10194 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10195 (Plugin::add_option): New.
10196 (Plugin::args_): Change type.
10197 (Plugin::filename_): New.
10198 (Plugin_manager::add_plugin_option): New.
10199 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10200 * testsuite/Makefile.in: Regenerate.
10204 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10205 Handle --strip-lto-sections option.
10206 * options.h (strip_lto_sections): New option.
10210 * plugin.cc (ld_plugin_message): Change format parameter to const.
10211 Fix mismatch between new[] and delete.
10215 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10220 * options.cc (General_options::parse_dynamic_list): New function.
10221 * options.h (General_options): New flags dynamic_list,
10222 dynamic_list_data, dynamic_list_cpp_new, and
10223 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10224 (General_options::in_dynamic_list): New function.
10225 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10226 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10227 (Lex::can_continue_name): Likewise.
10229 (read_script_file): New parameter script_options.
10230 (read_dynamic_list): New function.
10231 (Script_options::define_dynamic_list): New function.
10232 (dynamic_list_keyword_parsecodes): New variable.
10233 (dynamic_list_keywords): New variable.
10234 * script.h (Script_options::define_dynamic_list): New function
10236 (read_dynamic_list): New function prototype.
10237 * symtab.cc (strprefix): New macro.
10238 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10239 dynamic_list_data, dynamic_list_cpp_new, and
10240 dynamic_list_cpp_typeinfo.
10241 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10242 (dynamic_list_expr): New rule.
10243 (dynamic_list_nodes): Likewise.
10244 (dynamic_list_node): Likewise.
10245 * testsuite/Makefile.am (dynamic_list): New test.
10246 * testsuite/Makefile.in: Regenerated.
10247 * testsuite/dynamic_list.t: New file.
10248 * testsuite/dynamic_list.sh: New file.
10252 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10253 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10254 (t11_last): Likewise.
10255 * testsuite/ver_test_6.c (main): Likewise.
10259 * options.c (General_options::finalize): Add check for -static and
10261 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10266 * plugin.cc (make_sized_plugin_object): Fix conditional
10267 compilation to work when not all targets are enabled.
10271 * archive.cc (Archive::get_file_and_offset): Use filename instead
10272 of name to get library path.
10273 (Archive::include_member): Unlock external member of a thin archive.
10275 * testsuite/Makefile.am (TEST_AR): New variable.
10276 (thin_archive_test_1): New test.
10277 (thin_archive_test_2): New test.
10278 * testsuite/Makefile.in: Regenerate.
10279 * testsuite/thin_archive_main.cc: New file.
10280 * testsuite/thin_archive_test_1.cc: New file.
10281 * testsuite/thin_archive_test_2.cc: New file.
10282 * testsuite/thin_archive_test_3.cc: New file.
10283 * testsuite/thin_archive_test_4.cc: New file.
10287 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10288 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10290 (Sized_relobj::do_finalize_local_symbols): Likewise.
10291 (Sized_relobj::map_to_kept_section): Likewise.
10292 * object.h (Sized_relobj::invalid_address): New constant.
10293 (Sized_relobj::do_output_section_offset): Check for invalid_address
10295 * output.cc (Output_reloc::local_section_offset): Use constant
10296 invalid_address instead of -1U.
10297 (Output_reloc::get_address): Likewise.
10298 (Output_section::output_address): Change -1U to -1ULL.
10299 * output.h (Output_reloc::invalid_address): New constant.
10300 * reloc.cc (Sized_relobj::write_sections): Use constant
10301 invalid_address instead of -1U.
10302 (Sized_relobj::relocate_sections): Likewise.
10303 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10304 values for merge sections.
10305 * target-reloc.h (relocate_for_relocatable): Use constant
10306 invalid_address instead of -1U.
10310 Add plugin functionality for link-time optimization (LTO).
10311 * configure.ac (plugins): Add --enable-plugins option.
10312 * configure: Regenerate.
10313 * config.in: Regenerate.
10314 * Makefile.am (LIBDL): New variable.
10315 (CCFILES): Add plugin.cc.
10316 (HFILES): Add plugin.h.
10317 (ldadd_var): Add LIBDL.
10318 * Makefile.in: Regenerate.
10320 * archive.cc: Include "plugin.h".
10321 (Archive::setup): Don't preread archive symbols when using a plugin.
10322 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10323 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10325 (Archive::include_member): Add symbols from plugin objects.
10326 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10327 * descriptors.cc (Descriptors::open): Check for file descriptors
10328 abandoned by plugins.
10329 (Descriptors::claim_for_plugin): New function.
10330 * descriptors.h (Descriptors::claim_for_plugin): New function.
10331 (Open_descriptor::is_claimed): New field.
10332 (claim_descriptor_for_plugin): New function.
10333 * fileread.cc (File_read::claim_for_plugin): New function.
10334 * fileread.h (File_read::claim_for_plugin): New function.
10335 (File_read::descriptor): New function.
10336 * gold.cc: Include "plugin.h".
10337 (queue_initial_tasks): Add task to call plugin hooks for generating
10339 * main.cc: Include "plugin.h".
10340 (main): Load plugin libraries.
10341 * object.h (Pluginobj): Declare.
10342 (Object::pluginobj): New function.
10343 (Object::do_pluginobj): New function.
10344 (Object::set_target): New function.
10345 * options.cc: Include "plugin.h".
10346 (General_options::parse_plugin): New function.
10347 (General_options::General_options): Initialize plugins_ field.
10348 (General_options::add_plugin): New function.
10349 * options.h (Plugin_manager): Declare.
10350 (General_options): Add --plugin option.
10351 (General_options::has_plugins): New function.
10352 (General_options::plugins): New function.
10353 (General_options::add_plugin): New function.
10354 (General_options::plugins_): New field.
10355 * plugin.cc: New file.
10356 * plugin.h: New file.
10357 * readsyms.cc: Include "plugin.h".
10358 (Read_symbols::do_read_symbols): Check for archive before checking
10359 for ELF file. Call plugin hooks to claim files.
10360 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10361 from a real object file; force override when processing replacement
10363 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10364 (Symbol::init_base_object): Likewise.
10365 (Symbol::init_base_output_data): Likewise.
10366 (Symbol::init_base_output_segment): Likewise.
10367 (Symbol::init_base_constant): Likewise.
10368 (Symbol::init_base_undefined): Likewise.
10369 (Symbol::output_section): Assert that object is not a plugin.
10370 (Symbol_table::add_from_pluginobj): New function.
10371 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10373 (Symbol_table::sized_write_globals): Likewise.
10374 (Symbol_table::add_from_pluginobj): Instantiate template.
10375 * symtab.h (Sized_pluginobj): Declare.
10376 (Symbol::in_real_elf): New function.
10377 (Symbol::set_in_real_elf): New function.
10378 (Symbol::in_real_elf_): New field.
10379 (Symbol_table::add_from_pluginobj): New function.
10381 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10382 (LIBDL): New variable.
10383 (LDADD): Add LIBDL.
10384 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10385 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10386 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10387 (MOSTLYCLEANFILES): Likewise.
10388 * testsuite/Makefile.in: Regenerate.
10389 * testsuite/plugin_test.c: New file.
10390 * testsuite/plugin_test_1.sh: New file.
10391 * testsuite/plugin_test_2.sh: New file.
10395 * target-reloc.h (relocate_section): Check whether a symbol is
10396 defined by the ABI before reporting an undefined symbol error.
10397 * target.h (Target::is_defined_by_abi): Make parameter const.
10398 (Target::do_is_defined_by_abi): Likewise.
10399 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10400 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10401 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10402 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10403 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10404 * testsuite/Makefile.in: Rebuild.
10406 * fileread.cc (make_view): Add casts to avoid warning.
10410 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10411 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10415 * options.h (General_options::output_is_executable): New.
10416 (General_options::output_is_pie): New.
10417 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10418 for shared libraries.
10419 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10423 * options.h (origin): New -z option.
10424 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10425 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10430 * fileread.cc (File_read::make_view): Add check for attempt to map
10431 beyond end of file.
10435 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10436 explicit instantiations.
10441 * options.cc (General_options::finalize): Allow undefined symbols
10442 in shlibs if linking -shared.
10445 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10446 symbols as not needing a dynsym entry.
10450 * fileread.cc (File_read::open): Do not lock the file unless it
10451 was successfully opened.
10455 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10456 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10457 * testsuite/tls_test.cc (struct int128): 128-bit struct
10458 for testing TLS relocs with non-zero addend.
10459 (v12): New TLS variable.
10461 (t_last): Add check for v12.
10462 * testsuite/tls_test.h (t12): New function.
10463 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10467 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10468 set tls_segment_ or relro_segment_.
10469 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10471 * output.h (Output_section::clear_is_relro): New function.
10472 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10473 sections specially even when output_data_ is empty.
10474 (Output_segment::maximum_alignment): When first section is relro,
10475 only force alignment for PT_LOAD segments.
10476 * script.cc (script_data_segment_align): New function.
10477 (script_data_segment_relro_end): New function.
10478 * script-c.h (script_data_segment_align): Declare.
10479 (script_data_segment_relro_end): Declare.
10480 * script-sections.h (class Script_sections): Declare
10481 data_segment_align and data_segment_relro_end. Add fields
10482 segment_align_index_ and saw_relro_end_.
10483 * script-sections.cc (class Sections_element): Add set_is_relro
10484 virtual function. Add new bool* parameter to place_orphan_here.
10485 Add get_output_section virtual function.
10486 (class Output_section_definition): Add set_is_relro. Add new
10487 bool* parameter to place_orphan_here. Add get_output_section.
10488 Add is_relro_ field.
10489 (Output_section_definition::Output_section_definition): Initialize
10490 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10491 and is_relro_ fields.
10492 (Output_section_definition::place_orphan_here): Add is_relro
10494 (Output_section_definition::set_section_addresses): Set relro for
10496 (Output_section_definition::alternate_constraint): Likewise.
10497 (class Orphan_output_section): Add new bool* parameter to
10498 place_orphan_here. Add get_output_section.
10499 (Orphan_output_section::place_orphan_here): Add is_relro
10501 (Script_sections::Script_sections): Initialize
10502 data_segment_align_index_ and saw_relro_end_.
10503 (Script_sections::data_segment_align): New function.
10504 (Script_sections::data_segment_relro_end): New function.
10505 (Script_sections::place_orphan): Set or clear is_relro.
10506 (Script_sections::set_section_addresses): Force alignment of first
10508 * yyscript.y (exp): Call script_data_segment_align and
10509 script_data_segment_relro_end.
10510 * testsuite/relro_script_test.t: New file.
10511 * testsuite/relro_test.cc (using_script): Declare.
10512 (t1, t2): Test using_script.
10513 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10514 (relro_script_test_SOURCES): Define.
10515 (relro_script_test_DEPENDENCIES): Define.
10516 (relro_script_test_LDFLAGS): Define.
10517 (relro_script_test_LDADD): Define.
10518 (relro_script_test.so): New target.
10519 * testsuite/Makefile.in: Rebuild.
10523 * archive.cc (Archive::total_archives, Archive::total_members)
10524 (Archive::total_members_loaded): New variables.
10525 (Archive::setup): Add parameter. Add option to preread
10527 (Archive::read_armap): Add counter.
10528 (Archive::get_file_and_offset): New function.
10529 (Archive::get_elf_object_for_member): New function.
10530 (Archive::read_all_symbols): New function.
10531 (Archive::read_symbols): New function.
10532 (Archive::add_symbols): Add counters.
10533 (Archive::include_all_members): Use armap to find members if it's
10535 (Archive::include_member): Skip reading symbols if already read.
10536 Factored code into Archive::get_file_and_offset and
10537 Archive::get_elf_object_for_member. Changed call to
10538 Mapfile::report_include_archive_member.
10539 (Archive::print_stats): New function.
10540 * archive.h: Declare Object and Read_symbols_data classes.
10541 (Archive::Archive): Add initializers for new members.
10542 (Archive::setup): Add parameter.
10543 (Archive::print_stats): New function.
10544 (Archive::total_archives, Archive::total_members)
10545 (Archive::total_members_loaded): New variables.
10546 (Archive::get_file_and_offset): New function.
10547 (Archive::get_elf_object_for_member): New function.
10548 (Archive::read_all_symbols): New function.
10549 (Archive::read_symbols): New function.
10550 (Archive::Archive_member): New class.
10551 (Archive::members_): New member.
10552 (Archive::num_members_): New member.
10553 * main.cc: Include archive.h.
10554 (main): Call Archive::print_stats.
10555 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10556 archive parameter; member_name is now the fully-decorated name.
10557 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10558 * options.h: (General_options): Add --preread-archive-symbols option.
10559 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10564 * symtab.h (Symbol::use_plt_offset): New function.
10565 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10566 * powerpc.cc (Relocate::relocate): Likewise.
10567 * sparc.cc (Relocate::relocate): Likewise.
10568 * x86_64.cc (Relocate::relocate): Likewise.
10569 * testsuite/weak_plt.sh: New test.
10570 * testsuite/weak_plt_main.cc: New test.
10571 * testsuite/weak_plt_shared.cc: New test.
10572 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10573 (check_PROGRAMS): Add weak_plt.
10574 (check_DATA): Add weak_plt_shared.so.
10575 (weak_plt_main_pic.o, weak_plt): New targets.
10576 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10577 * testsuite/Makefile.in: Rebuild.
10579 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10581 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10582 * testsuite/Makefile.in: Rebuild.
10586 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10587 * Makefile.in: Regenerate.
10588 * po/POTFILES.in: Regenerate.
10592 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10593 symbols before other symbols.
10594 * testsuite/script_test_2.cc (test_addr): Declare.
10595 (test_addr_alias): Declare.
10596 (main): Check that test_addr and test_addr_alias have the right
10598 * testsuite/script_test_2.t: Define test_addr_alias and
10604 * descriptors.cc: New file.
10605 * descriptors.h: New file.
10606 * gold-threads.h (class Hold_optional_lock): New class.
10607 * fileread.cc: Include "descriptors.h".
10608 (File_read::~File_read): Release descriptor rather than closing
10610 (File_read::open) [file]: Call open_descriptor rather than open.
10611 Set is_descriptor_opened_.
10612 (File_read::open) [memory]: Assert that descriptor is not open.
10613 (File_read::reopen_descriptor): New function.
10614 (File_read::release): Release descriptor.
10615 (File_read::do_read): Make non-const. Reopen descriptor.
10616 (File_read::read): Make non-const.
10617 (File_read::make_view): Reopen descriptor.
10618 (File_read::do_readv): Likewise.
10619 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10620 Update declarations.
10621 * layout.cc: Include "descriptors.h".
10622 (Layout::create_build_id): Use open_descriptor rather than open.
10623 * output.cc: Include "descriptors.h".
10624 (Output_file::open): Use open_descriptor rather than open.
10625 * archive.cc (Archive::const_iterator): Change Archive to be
10627 (Archive::begin, Archive::end): Make non-const.
10628 (Archive::count_members): Likewise.
10629 * archive.h (class Archive): Update declarations.
10630 * object.h (Object::read): Make non-const.
10631 * Makefile.am (CCFILES): Add descriptors.cc.
10632 (HFILES): Add descriptors.h.
10633 * Makefile.in: Rebuild.
10636 * gold.h: Always include <clocale>. Add Solaris workarounds
10637 following code in binutils/sysdep.h.
10640 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10641 this->eh_frame_hdr_ is NULL before using it.
10643 * dynobj.cc (Versions::Versions): Update comment.
10645 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10646 the base version name.
10648 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10649 array size plus one.
10650 (Stringpool_template::set_string_offsets): Subtract one from key
10651 before using it as an array index.
10652 (Stringpool_template::get_offset_with_length): Likewise.
10653 (Stringpool_template::write_to_buffer): Likewise.
10654 * stringpool.h (Stringpool_template::get_offset_from_key):
10660 * object.h (Merged_symbol_value::value): Do our best to handle a
10664 * script.cc (Version_script_info::get_versions): Don't add empty
10665 version tag to return value.
10666 (Version_script_info::get_symbol_version_helper): Change return
10667 type to bool. Add pversion parameter. Change all callers.
10668 (script_register_vers_node): Don't require a non-NULL tag.
10669 * script.h (class Version_script_info): Update declarations.
10670 (Version_script_info::get_symbol_version): Change return type to
10671 bool. Add version parameter. Change all callers.
10672 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10673 handling. Handle an empty version from a version script.
10674 (Symbol_table::define_special_symbol): Likewise.
10675 * testsuite/ver_test_10.script: New file.
10676 * testsuite/ver_test_10.sh: New file.
10677 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10678 (check_DATA): Add ver_test_10.syms.
10679 (ver_test_10.syms, ver_test_10.so): New target.
10680 * testsuite/Makefile.in: Rebuild.
10684 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10685 to zero for undefined symbols from dynamic libraries.
10689 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10690 Change all callers.
10691 * symtab.h (class Symbol_table): Update declaration.
10692 * testsuite/ver_test_9.cc: New file.
10693 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10694 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10695 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10696 (ver_test_9.so, ver_test_9.o): New targets.
10697 * testsuite/Makefile.in: Rebuild.
10701 * options.h (class General_options): Define --check-sections.
10702 * layout.cc (Layout::set_segment_offsets): Handle
10705 * options.h (class General_options): Define -n/--nmagic and
10707 * options.cc (General_options::finalize): For -n/--nmagic or
10708 -N/--omagic, set -static.
10709 * layout.cc (Layout::attach_allocated_section_to_segment): If
10710 -N/--omagic, don't put read-only and read-write sections in
10711 different segments.
10712 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10713 finding a read-only segment.
10714 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10715 don't set the minimum segment alignment to the common page size,
10716 and don't set the file offset to the address modulo the page size.
10717 * script-sections.cc (Script_sections::create_segments): If
10718 -n/--omagic, don't put read-only and read-write sections in
10719 different segments.
10721 * cref.cc: New file.
10722 * cref.h: New file.
10723 * options.h (class General_options): Add --print-symbol-counts.
10724 * main.cc (main): Issue defined symbol report if requested.
10725 * archive.cc (Archive::interpret_header): Make into a const member
10727 (Archive::add_symbols): Call Input_objects::archive_start and
10729 (Archive::const_iterator): Define new class.
10730 (Archive::begin, Archive::end): New functions.
10731 (Archive::include_all_members): Rewrite to use iterator.
10732 (Archive::count_members): New function.
10733 * archive.h (class Archive): Update declarations.
10734 (Archive::filename): New function.
10735 * object.cc: Include "cref.h".
10736 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10737 (Sized_relobj::do_get_global_symbol_counts): New function.
10738 (Input_objects::add_object): Add object to cross-referencer.
10739 (Input_objects::archive_start): New function.
10740 (Input_objects::archive_stop): New function.
10741 (Input_objects::print_symbol_counts): New function.
10742 * object.h: Declare Cref and Archive.
10743 (Object::get_global_symbol_counts): New function.
10744 (Object::do_get_global_symbol_counts): New pure virtual function.
10745 (class Sized_relobj): Add defined_count_ field. Update
10747 (class Input_objects): Add cref_ field. Update constructor.
10748 Update declarations.
10749 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10751 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10753 (Sized_dynobj::do_get_global_symbol_counts): New function.
10754 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10755 defined_count_. Update declarations. Define Symbols typedef.
10756 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10757 parameter. Change all callers.
10758 (Symbol_table::add_from_dynobj): Add sympointers and defined
10759 parameters. Change all callers.
10760 * symtab.h (class Symbol_table): Update declarations.
10761 * Makefile.am (CCFILES): Add cref.cc.
10762 (HFILES): Add cref.h.
10763 * Makefile.in: Rebuild.
10767 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10768 to zero when writing undefined symbols.
10772 * output.cc (Output_section::add_input_section): Don't try to
10773 merge empty merge sections.
10777 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10778 Include symbol version in error message.
10782 * configure.ac (gold_cv_c_random_seed): New configured variable.
10783 (RANDOM_SEED_CFLAGS): New substituted variable.
10784 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10785 * configure: Rebuild.
10786 * Makefile.in: Likewise.
10787 * testsuite/Makefile.in: Likewise.
10791 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10792 where we see NAME/NULL and NAME/VERSION as separate symbols.
10793 * testsuite/ver_test_main.cc (main): Call t4.
10794 (t4, t4_2a): Define.
10795 * testsuite/ver_test_2.cc (t4_2): Define.
10796 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10797 * testsuite/ver_test_4.cc (t4_2a): Define.
10798 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10799 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10803 * dynobj.cc (Versions::add_def): If we give an error about a
10804 missing version, go ahead and create the version anyhow.
10808 Handle output sections with more than 0x7fffffff bytes.
10809 * object.h (class Relobj): Change map_to_output_ to
10810 output_sections_, and just keep a section pointer. Change all
10811 uses. Move comdat group support to Sized_relobj.
10812 (Relobj::is_section_specially_mapped): Remove.
10813 (Relobj::output_section): Remove poff parameter. Change all
10815 (Relobj::output_section_offset): New function.
10816 (Relobj::set_section_offset): Rewrite.
10817 (Relobj::map_to_output): Remove.
10818 (Relobj::output_sections): New function.
10819 (Relobj::do_output_section_offset): New pure virtual function.
10820 (Relobj::do_set_section_offset): Likewise.
10821 (class Sized_relobj): Add section_offsets_ field. Add comdat
10822 group support from Relobj. Update declarations.
10823 (Sized_relobj::get_output_section_offset): New function.
10824 (Sized_relobj::do_output_section_offset): New function.
10825 (Sized_relobj::do_set_section_offset): New function.
10826 * object.cc (Relobj::output_section_address): Remove.
10827 (Sized_relobj::Sized_relobj): Initialize new fields.
10828 (Sized_relobj::include_section_group): Cast find_kept_object to
10830 (Sized_relobj::include_linkonce_section): Likewise.
10831 (Sized_relobj::do_layout): Use separate arrays for output section
10833 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10835 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10836 output_sections and section_offsets.
10837 (Sized_relobj::write_local_symbols): Likewise.
10838 (map_to_kept_section): Compute output address directly.
10839 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10840 output_sections and section_offsets.
10841 (Sized_relobj::write_sections): Likewise.
10842 (Sized_relobj::relocate_sections): Likewise.
10843 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10844 * output.h (class Output_reloc): Update declarations. Change
10845 u2_.relobj to Sized_relobj*.
10846 (class Output_data_reloc): Change add functions to use
10848 * output.cc (Output_reloc::Output_reloc): Change relobj to
10850 (Output_reloc::local_section_offset): Change return type to
10851 Elf_Addr. Use get_output_section_offset.
10852 (Output_reloc::get_address): Likewise.
10853 (Output_section::is_input_address_mapped): Don't call
10854 is_section_specially_mapped.
10855 (Output_section::output_offset): Likewise.
10856 (Output_section::output_address): Likewise.
10857 (Output_section::starting_output_address): Likewise.
10858 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10859 parameter to Sized_relobj*.
10860 (Copy_relocs::need_copy_reloc): Likewise.
10861 (Copy_relocs::save): Likewise.
10862 * copy-relocs.h (class Copy_relocs): Update declarations.
10863 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10864 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10865 * target-reloc.h (relocate_for_relocatable): Change
10866 offset_in_output_section type to Elf_Addr. Change code that uses
10868 * layout.cc (Layout::layout): Always set *off.
10869 * mapfile.cc (Mapfile::print_input_section): Use
10870 output_section_offset.
10871 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10873 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10874 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10875 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10879 * layout.cc (Layout::include_section): Do not discard unrecognized
10880 SHT_STRTAB sections.
10884 * script.cc (Lex::can_continue_name): Make '?' allowable in
10885 version-script names.
10886 * testsuite/version_script.map: Change glob pattern to use '?'
10891 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10898 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10899 versions]: Don't try to read the value in the contents, since we
10900 don't use it. Use the template endianness when writing.
10904 * fileread.cc (File_read::make_view): Assert on zero-length view.
10905 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10906 symbol table when there are no symbols to read.
10910 * version.cc (version_string): Bump to 1.7
10914 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10915 constant 0xFFFF to type Valtype.
10916 (Powerpc_relocate_functions::rel16_ha): Likewise.
10920 * output.h (Output_section::Input_section): Initialize p2align_ to
10921 zero for Output_section_data constructors.
10922 (Output_section::Input_section::addralign): If not an input
10923 section, return the alignment of the Output_section_data.
10924 * testsuite/copy_test.cc: New file.
10925 * testsuite/copy_test_1.cc: New file.
10926 * testsuite/copy_test_2.cc: New file.
10927 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10928 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10929 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10930 (copy_test_1_pic.o, copy_test_1.so): New targets.
10931 (copy_test_2_pic.o, copy_test_2.so): New targets.
10932 * testsuite/Makefile.in: Rebuild.
10934 * script-sections.cc (Script_sections::place_orphan): Initialize
10935 local variable exact.
10939 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10944 * powerpc.cc: New file.
10945 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10946 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10947 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10948 * Makefile.in: Rebuild.
10952 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10954 (throwing, orig_terminate): New static variables.
10955 (terminate_handler): New static function.
10956 (t2): Set terminate handler.
10961 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10966 * archive.cc (Archive::include_all_members) Correct to step
10967 over symbol table and extended name table in thin archives.
10972 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10977 * reduced_debug_output.cc: New file.
10978 * reduced_debug_output.h: New file.
10979 * options.h (class General_options): Add --strip-debug-non-line.
10980 * options.cc (General_options::finalize): Add strip_debug_non_line
10981 to the strip heirarchy.
10982 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10984 * layout.cc: Include "reduced_debug_output.h".
10985 (Layout::Layout): Initialize new fields.
10986 (line_only_debug_sections): New static array.
10987 (is_lines_only_debug_sections): New static inline function.
10988 (Layout::include_section): Handle --strip-debug-non-line.
10989 (Layout::make_output_section): If --strip-debug-non-line, build
10990 new output sections for .debug_abbrev and .debug_info.
10991 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10992 gold. Warn about possible overflow.
10993 (read_signed_LEB_128): Likewise.
10994 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10995 (read_signed_LEB_128): Declare.
10996 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10997 (HFILES): Add reduced_debug_output.h.
10998 * Makefile.in: Rebuild.
11002 * mapfile.cc: New file.
11003 * mapfile.h: New file.
11004 * options.h (class General_options): Add -M/--print-map and -Map.
11005 * options.cc (General_options::finalize): Make -M equivalent to
11007 * main.cc: Include <cstdio> and "mapfile.h".
11008 (main): Open mapfile if requested.
11009 * gold.cc (class Middle_runner): Add mapfile_ field. Update
11010 constructor. Change caller.
11011 (queue_initial_tasks): Add mapfile parameter. Change caller.
11012 (queue_middle_tasks): Likewise.
11013 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11015 * archive.cc: Include "mapfile.h".
11016 (Archive::add_symbols): Add mapfile parameter. Change all
11017 callers. Pass mapfile, symbol, and reason to include_member.
11018 (Archive::include_all_members): Add mapfile parameter. Change all
11020 (Archive::include_member): Add mapfile, sym, and why parameters.
11021 Change all callers. Report inclusion to map file.
11022 * archive.h: Include "fileread.h".
11023 (class Archive): Update declarations.
11024 (Archive::file): New const method.
11025 (class Add_archive_symbols): Add mapfile_ field. Update
11026 constructor. Change all callers.
11027 * readsyms.h (class Read_symbols): Likewise.
11028 (class Finish_group): Likewise.
11029 (class Read_script): Likewise.
11030 * common.cc: Include "mapfile.h".
11031 (Symbol_table::allocate_commons): Add mapfile parameter. Change
11033 (Symbol_table::do_allocate_commons): Likewise.
11034 (Symbol_table::do_allocate_commons_list): Likewise. Report common
11035 symbol allocation to mapfile.
11036 * common.h (class Allocate_commons_task): Add mapfile_ field.
11037 Update constructor. Change all callers.
11038 * symtab.h (class Symbol_table): Update declarations.
11039 * layout.cc: Include "mapfile.h".
11040 (Layout_task_runner::run): Print information to mapfile.
11041 (Layout::create_gold_note): Change Output_data_fixed_space to
11042 Output_data_zero_fill.
11043 (Layout::create_build_id): Likewise.
11044 (Layout::print_to_mapfile): New function.
11045 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
11046 constructor. Change caller.
11047 (class Layout): Declare print_to_mapfile.
11048 * output.cc (Output_section::Input_section::print_to_mapfile): New
11050 (Output_section::add_input_section): If producing a map, always
11051 add to input_sections_ list.
11052 (Output_section::do_print_to_mapfile): New function.
11053 (Output_segment::print_sections_to_mapfile): New function.
11054 (Output_segment::print_section_list_to_mapfile): New function.
11055 * output.h: Include "mapfile.h".
11056 (Output_data::print_to_mapfile): New function.
11057 (Output_data::do_print_to_mapfile): New virtual function.
11058 (Output_segment_headers::do_print_to_mapfile): New function.
11059 (Output_file_header::do_print_to_mapfile): New function.
11060 (Output_data_const::do_print_to_mapfile): New function.
11061 (class Output_data_const_buffer): Add map_name_ field. Update
11062 constructor. Change all callers. Add do_print_to_mapfile
11064 (class Output_data_fixed_space): Likewise.
11065 (class Output_data_space): Likewise.
11066 (class Output_data_zero_fill): New class.
11067 (Output_data_strtab::do_print_to_mapfile): New function.
11068 (Output_data_reloc_base::do_print_to_mapfile): New function.
11069 (Output_relocatable_relocs::do_print_to_mapfile): New function.
11070 (Output_data_group::do_print_to_mapfile): New function.
11071 (Output_data_got::do_print_to_mapfile): New function.
11072 (Output_data_dynamic::do_print_to_mapfile): New function.
11073 (Output_symtab_xindex::do_print_to_mapfile): New function.
11074 (class Output_section): Declare do_print_to_mapflie. Declare
11075 print_to_mapfile in Input_section.
11076 (class Output_segment): Declare new functions.
11077 * object.h (Sized_relobj::symbol_count): New function.
11078 * script-sections.cc
11079 (Output_section_element_dot_assignment::set_section_addresses):
11080 Change Output_data_fixed_space to Output_data_zero_fill.
11081 (Output_data_expression::do_print_to_mapfile): New function.
11082 * script.cc (read_input_script): Add mapfile parameter. Change
11084 * script.h (read_input_script): Update declaration.
11085 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11086 (Eh_frame::do_print_to_mapfile): New function.
11087 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11088 (Output_merge_string::do_print_to_mapfile): New function.
11089 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11091 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11093 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11095 * Makefile.am (CCFILES): Add mapfile.cc.
11096 (HFILES): Add mapfile.h.
11097 * Makefile.in: Rebuild.
11101 * options.h (class General_options): Add -z relro.
11102 * layout.cc (Layout::Layout): Initialize relro_segment_.
11103 (Layout::add_output_section_data): Return the output section.
11104 (Layout::make_output_section): Rcognize relro sections and mark
11105 them appropriately.
11106 (Layout::attach_allocated_section_to_segment): Put relro sections
11107 in a PT_GNU_RELRO segment.
11108 (Layout::create_initial_dynamic_sections): Mark the .dynamic
11110 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11112 (Layout::linkonce_mapping): Map d.rel.ro.local to
11113 .data.rel.ro.local.
11114 (Layout::output_section_name): Us .data.rel.ro.local for any
11115 section which begins with that.
11116 * layout.h (class Layout): Update add_output_section_data
11117 declaration. Add relro_segment_ field.
11118 * output.cc (Output_section::Output_section): Initialize is_relro_
11119 and is_relro_local_ fields.
11120 (Output_segment::add_output_section): Group relro sections.
11121 (Output_segment::is_first_section_relro): New function.
11122 (Output_segment::maximum_alignment): If there is a relro section,
11123 align the segment to the common page size.
11124 (Output_segment::set_section_addresses): Track whether we are
11125 looking at relro sections. If the last section is a relro
11126 section, align to the common page size.
11127 (Output_segment::set_section_list_addresses): Add in_relro
11128 parameter. Change all callers. Align to the page size when
11129 moving from relro to non-relro section.
11130 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11132 * output.h (class Output_section): Add is_relro_ and
11133 is_relro_local_ fields.
11134 (Output_section::is_relro): New function.
11135 (Output_section::set_is_relro): New function.
11136 (Output_section::is_relro_local): New function.
11137 (Output_section::set_is_relro_local): New function.
11138 (class Output_segment): Update declarations.
11139 * i386.cc (Target_i386::got_section): Mark .got section as relro.
11140 * sparc.cc (Target_sparc::got_section): Likewise.
11141 * x86_64.cc (Target_x86_64::got_section): Likewise.
11142 * testsuite/relro_test_main.cc: New file.
11143 * testsuite/relro_test.cc: New file.
11144 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11145 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11146 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11147 (relro_test.so, relro_test_pic.o): New targets.
11148 * testsuite/Makefile.in: Rebuild.
11152 * output.cc (Output_segment::add_output_section): Remove front
11154 * output.h (class Output_segment): Remove
11155 add_initial_output_section and overloaded add_output_section.
11156 Update declaration of remaining add_output_section.
11157 * layout.cc (Layout::create_interp): Call add_output_section
11158 rather than add_initial_output_section.
11159 (Layout::finish_dynamic_section): Likewise.
11161 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11162 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
11163 know the dynamic type.
11164 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11165 field. Initialize it in constructor.
11166 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11167 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11168 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11171 * output.cc (Output_reloc::get_address): Change return type to
11173 * output.h (class Output_reloc): Update get_address declaration.
11174 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11175 for section addresses.
11180 * gold.cc (gold_nomem): Use return value of write.
11184 * symtab.c (Symbol::init_base_output_data): Add version
11185 parameter. Change all callers.
11186 (Symbol::init_base_output_segment): Likewise.
11187 (Symbol::init_base_constant): Likewise.
11188 (Symbol::init_base_undefined): Likewise.
11189 (Sized_symbol::init_output_data): Likewise.
11190 (Sized_symbol::init_output_segment): Likewise.
11191 (Sized_symbol::init_constant): Likewise.
11192 (Sized_symbol::init_undefined): Likewise.
11193 (Symbol_table::do_define_in_output_data): If the new symbol has a
11194 version, mark it as the default.
11195 (Symbol_table::do_define_in_output_segment): Likewise.
11196 (Symbol_table::do_define_as_constant): Likewise.
11197 * symtab.h (class Symbol): Update declarations.
11198 (class Sized_symbol): Likewise.
11199 * resolve.cc (Symbol::override_version): New function.
11200 (Symbol::override_base): Call override_version.
11201 (Symbol::override_base_with_special): Likewise.
11202 * testsuite/ver_script_8.script: New file.
11203 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11204 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11205 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11206 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11211 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11213 (class General_options): Remove existing --undefined, and add
11214 --no-undefined instead. Add new --undefined as synonym for -u.
11215 * archive.cc (Archive::add_symbols): Check whether symbol was
11217 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11218 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11219 all uses. Add IS_UNDEFINED. Update declarations to split
11220 different versions of init_base. Declare init_base_undefined.
11221 (Symbol::is_defined): Handle IS_UNDEFINED.
11222 (Symbol::is_undefined): Likewise.
11223 (Symbol::is_weak_undefined): Call is_undefined.
11224 (Symbol::is_absolute): Handle IS_CONSTANT.
11225 (class Sized_symbol): Update declarations to split different
11226 versions of init. Declare init_undefined.
11227 (class Symbol_table): Declare new functions.
11228 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11229 Change all callers.
11230 (Symbol::init_base_output_data): Likewise.
11231 (Symbol::init_base_output_segment): Likewise.
11232 (Symbol::init_base_constant): Likewise.
11233 (Symbol::init_base_undefined): New function.
11234 (Sized_symbol::init_object): Rename from init. Change all
11236 (Sized_symbol::init_output_data): Likewise.
11237 (Sized_symbol::init_output_segment): Likewise.
11238 (Sized_symbol::init_constant): Likewise.
11239 (Sized_symbol::init_undefined): New function.
11240 (Symbol_table::add_undefined_symbols_from_command_line): New
11242 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11244 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11245 (Symbol::output_section): Likewise.
11246 (Symbol::set_output_section): Likewise.
11247 (Symbol_table::sized_finalize_symbol): Likewise.
11248 (Symbol_table::sized_write_globals): Likewise.
11249 * resolve.cc (Symbol_table::should_override): Likewise.
11250 (Symbol::override_base_with_special): Likewise.
11252 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11253 symbol, change it to have default visibility.
11254 * testsuite/protected_1.cc: New file.
11255 * testsuite/protected_2.cc: New file.
11256 * testsuite/protected_3.cc: New file.
11257 * testsuite/protected_main_1.cc: New file.
11258 * testsuite/protected_main_2.cc: New file.
11259 * testsuite/protected_main_3.cc: New file.
11260 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11261 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11262 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11263 (protected_1.so): New target.
11264 (protected_1_pic.o, protected_2_pic.o): New targets.
11265 (protected_3_pic.o): New target.
11266 (check_PROGRAMS): Add protected_2.
11267 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11268 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11269 * testsuite/Makefile.in: Rebuild.
11271 * options.h (DEFINE_var): Add set_user_set_##varname__.
11272 (DEFINE_bool_alias): New macro.
11273 (class General_options): Define -Bstatic using DEFINE_bool_alias
11274 rather than DEFINE_special. Add --undefined as an alias for -z
11276 * options.cc (General_options::parse_Bstatic): Remove.
11278 * options.h (class General_options): Add --fatal-warnings.
11279 * main.cc (main): Implement --fatal-warnings.
11280 * errors.h (Errors::warning_count): New function.
11282 * options.h (class General_options): Add -Bsymbolic-functions.
11283 * symtab.h (Symbol::is_preemptible): Check for
11284 -Bsymbolic-functions.
11288 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11289 as noVARNAME rather than no-VARNAME.
11290 (class General_options): Add option -z combreloc.
11291 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11293 (Output_reloc::sort_before) [SHT_REL]: New function.
11294 (Output_reloc::sort_before) [SHT_RELA]: New function.
11295 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11296 Sort_relocs_comparison.
11297 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11298 parameter. Change all callers.
11299 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11300 sort_relocs parameter. Change all callers.
11301 * output.cc (Output_reloc::get_address): New function, broken out
11303 (Output_reloc::write_rel): Call it.
11304 (Output_reloc::compare): New function.
11305 (Output_data_reloc_base::do_write): Optionally sort relocs.
11307 * configure.ac: If targ_extra_obj is set, link it in.
11308 * configure.tgt: Initialize all variables.
11309 (x86_64*): Set targ_extra_obj and targ_extra_size.
11310 * configure: Rebuild.
11312 * object.cc (Sized_relobj::include_section_group): Adjust section
11313 indexes read from group data. Build vector to pass to
11315 * layout.cc (Layout::layout_group): Add flags and shndxes
11316 parameters. Remove contents parameter. Change caller. Update
11317 explicit instantiations.
11318 * layout.h (class Layout): Update layout_group declaration.
11319 * output.cc (Output_data_group::Output_data_group): Add flags and
11320 input_shndxes parameters. Remove contents parameter. Change
11322 (Output_data_group::do_write): Change input_sections_ to
11324 * output.h (class Output_data_group): Update constructor
11325 declaration. Rename input_sections_ to input_shndxes_.
11326 * testsuite/many_sections_test.cc: Add template.
11330 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11332 * layout.cc (Layout::include_section): Refactored check for debug
11334 (Layout::add_comdat): Add new parameters. Change type
11335 of signature parameter. Add object and shndx to signatures table.
11336 (Layout::find_kept_object): New function.
11337 * layout.h: Include <cstring>.
11338 (Layout::is_debug_info_section): New function.
11339 (Layout::add_comdat): Add new parameters.
11340 (Layout::find_kept_object): New function.
11341 (Layout::Kept_section): New struct.
11342 (Layout::Signatures): Change type of map range.
11343 * object.cc (Relobj::output_section_address): New function.
11344 (Sized_relobj::include_section_group): Add new parameters. Change
11345 calls to Layout::add_comdat. Change to build table of kept comdat
11346 groups and table mapping discarded sections to kept sections.
11347 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11348 (Sized_relobj::do_layout): Change calls to include_section_group and
11349 include_linkonce_section.
11350 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11351 value to zero when section is discarded.
11352 (Sized_relobj::map_to_kept_section): New function.
11353 * object.h (Relobj::output_section_address): New function.
11354 (Relobj::Comdat_group): New type.
11355 (Relobj::find_comdat_group): New function.
11356 (Relobj::Comdat_group_table): New type.
11357 (Relobj::Kept_comdat_section): New type.
11358 (Relobj::Kept_comdat_section_table): New type.
11359 (Relobj::add_comdat_group): New function.
11360 (Relobj::set_kept_comdat_section): New function.
11361 (Relobj::get_kept_comdat_section): New function.
11362 (Relobj::comdat_groups_): New field.
11363 (Relobj::kept_comdat_sections_): New field.
11364 (Symbol_value::input_value): Update comment.
11365 (Sized_relobj::map_to_kept_section) New function.
11366 (Sized_relobj::include_linkonce_section): Add new parameter.
11367 * target-reloc.h (Comdat_behavior): New type.
11368 (get_comdat_behavior): New function.
11369 (relocate_section): Add code to map a discarded section to the
11370 corresponding kept section when applying a relocation.
11374 * dwarf_reader.cc (next_generation_count): New static var.
11375 (Addr2line_cache_entry): New struct.
11376 (addr2line_cache): New static var.
11377 (Dwarf_line_info::one_addr2line): Added caching.
11378 (Dwarf_line_info::clear_addr2line_cache): New function.
11379 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11380 cache-size parameter.
11381 (Dwarf_line_info::one_addr2line_cache): New function.
11382 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11383 new cache-size argument to one_addr2line(), and clear cache.
11387 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11388 R_386_PC8 relocations.
11392 * object.cc (Sized_relobj::include_section_group): Check for
11393 invalid section group.
11395 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11398 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11399 than read for file header.
11400 * archive.cc (Archive::include_member): Likewise.
11404 * aclocal.m4: Regenerate.
11405 * configure: Regenerate.
11409 * version.cc (version_string): Bump to 1.6.
11411 * testsuite/Makefile.am (many_sections_r_test): New target.
11412 (many_sections_r_test_SOURCES): Remove.
11413 (many_sections_r_test_DEPENDENCIES): Remove.
11414 (many_sections_r_test_LDFLAGS): Remove.
11415 (many_sections_r_test_LDADD): Remove.
11417 * object.cc (Sized_relobj::do_add_symbols): Always pass
11418 local_symbol_count_ to add_from_relobj.
11420 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11421 every thousand variables.
11422 * testsuite/Makefile.in: Rebuild.
11424 * object.cc (Xindex::initialize_symtab_xindex): New function.
11425 (Xindex::read_symtab_xindex): New function.
11426 (Xindex::sym_xindex_to_shndx): New function.
11427 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11429 (Sized_relobj::do_initialize_xindex): New function.
11430 (Sized_relobj::do_read_symbols): Adjust section links.
11431 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11432 parameter. Change all callers.
11433 (Sized_relobj::include_section_group): Adjust section links and
11434 symbol section indexes.
11435 (Sized_relobj::do_layout): Adjust section links.
11436 (Sized_relobj::do_count_local_symbols): Adjust section links and
11437 symbol section indexes.
11438 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11439 ordinary and special symbols.
11440 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11441 dynsym_xindex parameters. Change all callers. Adjust section
11442 links. Use SHN_XINDEX when needed.
11443 (Sized_relobj::get_symbol_location_info): Adjust section links.
11444 Don't get fooled by special symbols.
11445 * object.h (class Xindex): Define.
11446 (class Object): Add xindex_ parameter. Declare virtual functoin
11447 do_initialize_xindex.
11448 (Object::adjust_sym_shndx): New function.
11449 (Object::set_xindex): New protected function.
11450 (class Symbol_value): Add is_ordinary_shndx_ field.
11451 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11452 (Symbol_value::value): Assert ordinary section.
11453 (Symbol_value::initialize_input_to_output_map): Likewise.
11454 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11455 Change all callers.
11456 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11458 (class Sized_relobj): Update declarations.
11459 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11460 parameter. Change all callers.
11461 (Sized_relobj::adjust_shndx): New function.
11462 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11464 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11465 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11466 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11467 (Sized_dynobj::read_dynsym_section): Adjust section links.
11468 (Sized_dynobj::read_dynamic): Likewise.
11469 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11471 (Sized_dynobj::do_initialize_xindex): New function.
11472 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11473 do_initialize_xindex.
11474 (Sized_dynobj::adjust_shndx): New function.
11475 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11476 dynsym_xindex_ fields.
11477 (Layout::finalize): Add a call to set_section_indexes before
11478 creating the symtab sections.
11479 (Layout::set_section_indexes): Don't do anything if the section
11480 already has a section index.
11481 (Layout::create_symtab_sections): Add shnum parameter. Change
11482 caller. Create .symtab_shndx section if needed.
11483 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11485 (Layout::allocated_output_section_count): New function.
11486 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11488 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11489 fields. Update declarations.
11490 (Layout::symtab_xindex): New function.
11491 (Layout::dynsym_xindex): New function.
11492 (class Write_symbols_task): Add layout_ field.
11493 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11495 * output.cc (Output_section_headers::Output_section_headers): Add
11496 shstrtab_section parameter. Change all callers.
11497 (Output_section_headers::do_sized_write): Store overflow values
11498 for section count and section string table section index in
11499 section header zero.
11500 (Output_file_header::do_sized_write): Check for overflow of
11501 section count and section string table section index.
11502 (Output_symtab_xindex::do_write): New function.
11503 (Output_symtab_xindex::endian_do_write): New function.
11504 * output.h (class Output_section_headers): Add shstrtab_section_.
11505 Update declarations.
11506 (class Output_symtab_xindex): Define.
11507 (Output_section::has_out_shndx): New function.
11508 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11510 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11511 Change all callers.
11512 (Sized_symbol::init): Likewise.
11513 (Symbol::output_section): Check for ordinary symbol.
11514 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11515 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11517 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11518 Change all callers. Simplify handling of symbols from sections
11519 not included in the link.
11520 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11522 (Weak_alias_sorter::operator()): Assert that symbols are
11524 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11526 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11527 parameters. Change all callers.
11528 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11529 symbol distinction. Use SHN_XINDEX when needed.
11530 (Symbol_table::write_section_symbol): Add symtab_xindex
11531 parameter. Change all callers.
11532 (Symbol_table::sized_write_section_symbol): Likewise. Use
11533 SHN_XINDEX when needed.
11534 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11536 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11537 (Symbol::is_defined): Check is_ordinary.
11538 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11539 (Symbol::is_absolute, Symbol::is_common): Likewise.
11540 (class Sized_symbol): Update declarations.
11541 (class Symbol_table): Update declarations.
11542 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11543 parameters. Change all callers.
11544 (Sized_symbol::override): Likewise.
11545 (Symbol_table::override): Likewise.
11546 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11547 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11548 is_ordinary, and orig_st_shndx parameters. Change all callers.
11549 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11550 to be in an ordinary section.
11551 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11552 object and is_ordinary parameters. Change all callers.
11553 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11554 Change all callers. Don't add undefined or non-ordinary symbols
11556 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11557 Change all callers.
11558 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11560 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11561 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11562 (Sized_relobj::relocate_sections): Likewise.
11563 * target-reloc.h (scan_relocs): Adjust section symbol index.
11564 (scan_relocatable_relocs): Likewise.
11565 * i386.cc (Scan::local): Check for ordinary symbols.
11566 * sparc.cc (Scan::local): Likewise.
11567 * x86_64.cc (Scan::local): Likewise.
11568 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11569 to symbol_section_and_value.
11570 * testsuite/many_sections_test.cc: New file.
11571 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11572 (check_PROGRAMS): Add many_sections_test.
11573 (many_sections_test_SOURCES): Define.
11574 (many_sections_test_DEPENDENCIES): Define.
11575 (many_sections_test_LDFLAGS): Define.
11576 (BUILT_SOURCES): Add many_sections_define.h.
11577 (many_sections_define.h): New target.
11578 (BUILT_SOURCES): Add many_sections_check.h.
11579 (many_sections_check.h): New target.
11580 (check_PROGRAMS): Add many_sections_r_test.
11581 (many_sections_r_test_SOURCES): Define.
11582 (many_sections_r_test_DEPENDENCIES): Define.
11583 (many_sections_r_test_LDFLAGS): Define.
11584 (many_sections_r_test_LDADD): Define.
11585 (many_sections_r_test.o): New target.
11586 * testsuite/Makefile.in: Rebuild.
11590 * errors.cc (Errors::info): New function.
11591 (gold_info): New function.
11592 * errors.h (Errors::info): New function.
11593 * gold.h (gold_info): New function.
11594 * object.cc (Input_objects::add_object): Print trace output.
11595 * options.cc (options::parse_set): New function.
11596 (General_options::parse_wrap): Deleted.
11597 (General_options::General_options): Deleted initializer.
11598 * options.h (options::String_set): New typedef.
11599 (options::parse_set): New function.
11600 (DEFINE_set): New macro.
11601 (General_options::wrap): Changed to use DEFINE_set. Changed
11602 callers of any_wrap_symbols and is_wrap_symbol.
11603 (General_options::trace, General_options::trace_symbol):
11605 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11606 (General_options::wrap_symbols_): Deleted.
11607 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11611 * options.cc (General_options::parse_V): New function.
11612 * options.h: Add entries for -V and -Qy.
11616 * common.cc (Symbol_table::allocate_commons): Remove options
11617 parameter. Change caller.
11618 (Symbol_table::do_allocate_commons): Remove options parameter.
11619 Change caller. Just call do_allocate_commons_list twice.
11620 (Symbol_table::do_allocate_commons_list): New function, broken out
11621 of do_allocate_commons.
11622 * common.h (class Allocate_commons_task): Remove options_ field.
11623 Update constructor.
11624 * symtab.cc (Symbol_table::Symbol_table): Initialize
11626 (Symbol_table::add_from_object): Put TLS common symbols on
11628 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11629 which are IN_OUTPUT_DATA.
11630 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11631 allocate_commons and do_allocate_commons declarations. Declare
11632 do_allocate_commons_list.
11633 * gold.cc (queue_middle_tasks): Update creation of
11634 Allocate_commons_task to not pass options.
11635 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11636 (TLS_TEST_C_FLAGS): New variable.
11637 (tls_test_c_pic.o): New target.
11638 (tls_test_shared.so): Link in tls_test_c_pic.o.
11639 (tls_test_c_pic_ie.o): New target.
11640 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11641 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11642 (tls_test_c.o): New target.
11643 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11644 (tls_pic_test_LDADD): Likewise.
11645 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11646 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11647 (tls_test_c_gnu2.o): New target.
11648 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11650 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11651 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11652 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11653 * testsuite/tls_test.cc: Include "config.h".
11654 (t_last): Call t11_last.
11655 * testsuite/tls_test.h (t11, t11_last): Declare.
11656 * testsuite/tls_test_c.c: New file.
11657 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11658 * configure.ac: Check for OpenMP support.
11659 * configure, config.in, Makefile.in: Rebuild.
11660 * testsuite/Makefile.in: Rebuild.
11664 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11665 (Target_i386::tls_base_symbol_defined_): New field.
11666 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11667 (Target_i386::Scan::global): Likewise.
11668 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11669 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11670 (Target_x86_64::tls_base_symbol_defined_): New field.
11671 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11672 (Target_x86_64::Scan::global): Likewise.
11676 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11677 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11678 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11679 building shared libraries.
11680 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11681 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11682 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11683 * testsuite/Makefile.in: Rebuild.
11684 * testsuite/weak_undef.h: New file.
11685 * testsuite/weak_undef_file1.cc: Add extra test cases.
11686 * testsuite/weak_undef_file2.cc: Likewise.
11687 * testsuite/weak_undef_test.cc: Likewise.
11691 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11692 Add issued_non_pic_error_ field. Declare check_non_pic.
11693 (Target_sparc::Scan::check_non_pic): New function.
11694 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11695 (Target_sparc::Scan::global): Likewise.
11697 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11698 * configure: Rebuild.
11700 * options.h (DEFINE_enable): New macro.
11701 (new_dtags): New enable option.
11702 (initfirst, interpose, loadfltr, nodefaultlib,
11703 nodelete, nodlopen, nodump): New -z options.
11704 * layout.cc (Layout:finish_dynamic_section): If new
11705 dtags enabled, emit DT_RUNPATH. Also, emit a
11706 DT_FLAGS_1 containing any specified -z flags.
11710 * copy-relocs.cc: New file.
11711 * copy-relocs.h: New file.
11712 * reloc.cc: Remove Copy_relocs code.
11713 * reloc.h: Likewise.
11714 * reloc-types.h (struct Reloc_types) [both versions]: Add
11715 get_reloc_addend_noerror.
11716 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11717 variants of add_global which take an addend which must be zero.
11718 * i386.cc: Include "copy-relocs.h".
11719 (class Target_i386): Change type of copy_relocs_ to variable,
11720 update initializer.
11721 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11722 Change all callers.
11723 (Target_i386::do_finalize_sections): Change handling of
11725 * sparc.cc: Include "copy-relocs.h".
11726 (class Target_sparc): Change type of copy_relocs_ to variable,
11727 update initializer.
11728 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11729 Change all callers.
11730 (Target_sparc::do_finalize_sections): Change handling of
11732 * x86_64.cc: Include "copy-relocs.h".
11733 (class Target_x86_64): Change type of copy_relocs_ to variable,
11734 update initializer.
11735 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11736 class. Change all callers.
11737 (Target_x86_64::do_finalize_sections): Change handling of
11739 * Makefile.am (CCFILES): Add copy-relocs.cc.
11740 (HFILES): Add copy-relocs.h.
11742 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11744 * testsuite/script_test_4.sh: Permit leading zeroes.
11748 * script-sections.cc (Script_sections::create_segments): Use
11749 header_size_adjustment even when there is enough room for the
11751 * testsuite/script_test_4.sh: New file.
11752 * testsuite/script_test_4.t: New file.
11753 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11754 (check_DATA): Add script_test_4.stdout.
11755 (MOSTLYCLEANFILES): Likewise.
11756 (script_test_4): New target.
11757 (script_test_4.stdout): New target.
11758 * testsuite/Makefile.in: Rebuild.
11760 * sparc.cc: Add definitions for Output_data_plt_sparc class
11765 * sparc.cc: New file.
11766 * Makefile.am (TARGETSOURCES): Add sparc.cc
11767 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11768 * configure.tgt: Document targ_extra_size and
11769 targ_extra_big_endian. Add entries for sparc-* and
11771 * configure.ac: Handle targ_extra_size and
11772 targ_extra_big_endian.
11773 * Makefile.in: Rebuild.
11774 * configure: Likewise.
11775 * po/POTFILES.in: Likewise.
11776 * po/gold.pot: Likewise.
11780 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11781 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11782 in the name/type/flags to section mapping. Don't call
11783 allocate_output_section.
11784 (Layout::choose_output_section): Change parameter from adjust_name
11785 to is_input_section. Don't permit input sections after sections
11786 are attached to segments. Don't call allocate_output_section.
11787 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11788 not write_enable_output_section.
11789 (Layout::make_output_section): Don't push to
11790 unattached_section_list_ nor call attach_to_segment. Call
11791 attach_section_to_segment if sections are attached.
11792 (Layout::attach_sections_to_segments): New function.
11793 (Layout::attach_section_to_segment): New function.
11794 (Layout::attach_allocated_section_to_segment): Rename from
11795 attach_to_segment. Remove flags parameter.
11796 (Layout::allocate_output_section): Remove function.
11797 (Layout::write_enable_output_section): Remove function.
11798 * layout.h (class Layout): Update for above changes. Add new
11799 field sections_are_attached_.
11800 * output.h (Output_section::update_flags_for_input_section): New
11802 * output.cc (Output_section::add_input_section): Call
11803 update_flags_for_input_section.
11804 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11808 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11809 thought unnecessary.
11810 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11814 * output.h (class Output_section_data): Remove inline definition
11816 * output.cc (Output_section_data::set_addralign): New function.
11820 Add support for TLS descriptors for i386 and x86_64.
11821 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11822 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11823 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11825 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11826 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11827 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11829 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11830 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11831 Fix problem with initial-exec relocations.
11832 (Target_i386::Relocate::relocate_tls): Likewise.
11833 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11835 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11836 support for section-plus-offset dynamic table entries.
11837 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11838 (Output_data_dynamic::Dynamic_entry): Add support for
11839 section-plus-offset dynamic table entries.
11840 (Output_data_dynamic::Classification): Likewise.
11841 (Output_data_dynamic::classification_): Renamed offset_.
11842 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11843 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11844 (Target_x86_64::make_plt_section): New function.
11845 (Target_x86_64::reserve_tlsdesc_entries): New function.
11846 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11847 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11848 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11849 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11850 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11851 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11852 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11853 add extra PLT entry for TLS descriptors.
11854 (Output_data_plt_x86_64::got_): New field.
11855 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11856 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11858 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11860 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11861 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11862 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11863 R_386_TLS_DESC_CALL relocations.
11864 (Target_x86_64::Scan::global): Likewise.
11865 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11866 for TLS descriptors.
11867 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11868 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11869 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11870 GD-to-IE relaxation.
11871 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11872 and TLS_DESCRIPTORS.
11873 * Makefile.in: Rebuild.
11874 * configure: Rebuild.
11875 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11876 (tls_test_shared2.so): New target.
11877 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11878 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11879 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11880 (tls_shared_gd_to_ie_test_LDADD): New variable.
11881 (tls_shared_gnu2_gd_to_ie_test): New target.
11882 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11884 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11885 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11886 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11887 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11888 (tls_shared_gnu2_test): New target.
11889 (tls_test_gnu2_shared.so): New target.
11890 (tls_shared_gnu2_test_SOURCES): New variable.
11891 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11892 (tls_shared_gnu2_test_LDFLAGS): New variable.
11893 (tls_shared_gnu2_test_LDADD): New variable.
11894 * testsuite/Makefile.in: Rebuild.
11895 * testsuite/Makefile.
11899 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11901 * testsuite/Makefile.in: Rebuild.
11903 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11905 * testsuite/script_test_2.cc (main): Adjust test.
11910 * options.h (General_options): Add entries for '-Y' and
11912 * options.cc (General_options:finalize): If -Y was used, add those
11913 entries to the library path instead of the default "/lib" and
11918 * testsuite/justsyms.t: Start at 0x100.
11919 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11920 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11922 * testsuite/script_test_2.cc: Adjust string and section length
11928 * script-sections.cc (Sections_element::allocate_to_segment): Add
11930 (Output_section_definition::allocate_to_segment): Likewise.
11931 (Orphan_output_section::allocate_to_segment): Likewise.
11932 (Script_sections::attach_sections_using_phdrs_clause): Don't
11933 propagate non-PT_LOAD segments to orphan sections.
11934 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11935 readelf rather than objdump.
11936 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11937 .interp section and PT_INTERP segment are the same size.
11938 * testsuite/Makefile.in: Rebuild.
11940 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11941 aliases for symbols defined in the same object.
11942 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11943 (weak_alias_test_SOURCES): New variable.
11944 (weak_alias_test_DEPENDENCIES): New variable.
11945 (weak_alias_test_LDFLAGS): New variable.
11946 (weak_alias_test_LDADD): New variable.
11947 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11948 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11949 (weak_alias_test_3.o): New target.
11950 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11951 * testsuite/weak_alias_test_main.cc: New file.
11952 * testsuite/weak_alias_test_1.cc: New file.
11953 * testsuite/weak_alias_test_2.cc: New file.
11954 * testsuite/weak_alias_test_3.cc: New file.
11958 * options.h (class General_options): Add --noinhibit-exec option.
11959 * main.cc (main): Check --noinhibit-exec.
11961 * options.h (class General_options): Define --wrap as a special
11962 option. Add wrap_symbols_ field.
11963 (General_options::any_wrap_symbols): New function.
11964 (General_options::is_wrap_symbol): New function.
11965 * options.cc (General_options::parse_wrap): New function.
11966 (General_options::General_options): Initialize wrap_symbols_.
11967 * symtab.cc (Symbol_table::wrap_symbol): New function.
11968 (Symbol_table::add_from_object): Handle --wrap.
11969 * symtab.h (class Symbol_table): Declare wrap_symbol.
11970 * target.h (Target::wrap_char): New function.
11971 (Target::Target_info): Add wrap_char field.
11972 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11973 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11974 * testsuite/testfile.cc (Target_test::test_target_info):
11977 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11980 * layout.h (class Layout): Add added_eh_frame_data_ field.
11981 * layout.cc (Layout::Layout): Initialize new field.
11982 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11983 output section until we find a section we merged successfully.
11984 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11985 that the size be non-zero.
11987 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11992 * configure.ac: Export new conditional variable HAVE_ZLIB.
11993 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11995 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11996 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12000 * version.cc (version_string): Set to "1.5".
12002 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12003 Add issued_non_pic_error_ field. Declare check_non_pic.
12004 (Target_x86_64::Scan::check_non_pic): New function.
12005 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12006 (Target_x86_64::Scan::global): Likewise.
12008 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12009 addend parameter. Change caller. Handle merge sections.
12010 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12011 Address to Addend. Don't add in the result of
12012 local_section_offset, pass down the addend and use the returned
12014 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12015 Update declarations of local_section_offset and symbol_value.
12016 * testsuite/two_file_test_1.cc (t18): New function.
12017 * testsuite/two_file_test_2.cc (f18): New function.
12018 * testsuite/two_file_test_main.cc (main): Call t18.
12019 * testsuite/two_file_test.h (t18, f18): Declare.
12021 * configure.ac: Don't test for objdump, c++filt, or readelf.
12022 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12024 (TEST_READELF): New variable.
12025 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12026 (check_PROGRAMS): Add two_file_strip_test.
12027 (two_file_strip_test): New target.
12028 (check_PROGRAMS): Add two_file_same_shared_strip_test.
12029 (two_file_same_shared_strip_test_SOURCES): New variable.
12030 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12031 (two_file_same_shared_strip_test_LDFLAGS): New variable.
12032 (two_file_same_shared_strip_test_LDADD): New variable.
12033 (two_file_shared_strip.so): New target.
12034 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12035 (ver_test_5.syms, ver_test_7.syms): Likewise.
12036 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12037 (strip_test_3.stdout): Use TEST_OBJDUMP.
12038 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12042 * symtab.h (Symbol::is_weak_undefined): New function.
12043 (Symbol::is_strong_undefined): New function.
12044 (Symbol::is_absolute): New function.
12045 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12046 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12048 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12049 (weak_undef_test): New target.
12050 * testsuite/Makefile.in: Rebuild.
12051 * testsuite/weak_undef_file1.cc: New file.
12052 * testsuite/weak_undef_file2.cc: New file.
12053 * testsuite/weak_undef_test.cc: New file.
12057 * compressed_output.h (class Output_compressed_section): Use
12059 * compressed_output.cc (zlib_compress): Use unsigned buffers,
12061 (zlib_compressed_suffix): Removed.
12062 (Output_compressed_section::set_final_data_size): Use unsigned
12064 * testsuite/Makefile.am (flagstest_compress_debug_sections):
12065 Fix linker invocation.
12066 (flagstest_o_specialfile_and_compress_debug_sections):
12068 * testsuite/Makefile.in: Regenerated.
12072 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12073 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12081 * fileread.cc (File_read::find_view): Add byteshift and vshifted
12082 parameters. Update for new key type to views_. Change all
12084 (File_read::read): Adjust for byteshift in returned view.
12085 (File_read::add_view): New function, broken out of
12086 find_and_make_view.
12087 (File_read::make_view): New function, broken out of
12088 find_and_make_view.
12089 (File_read::find_or_make_view): Add offset and aligned
12090 parameters. Rewrite accordingly. Change all callers.
12091 (File_read::get_view): Add offset and aligned parameters. Adjust
12092 for byteshift in return value.
12093 (File_read::get_lasting_view): Likewise.
12094 * fileread.h (class File_read): Update declarations.
12095 (class File_read::View): Add byteshift_ field. Add byteshift to
12096 constructor. Add byteshift method.
12097 * archive.h (Archive::clear_uncached_views): New function.
12098 (Archive::get_view): Add aligned parameter. Change all callers.
12099 * object.h (Object::get_view): Add aligned parameter. Change all
12101 (Object::get_lasting_view): Likewise.
12103 * fileread.cc (File_read::release): Don't call clear_views if
12104 there are multiple objects.
12105 * fileread.h (File_read::clear_uncached_views): New function.
12106 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12111 Add thin archive support.
12112 * archive.cc (Archive::armagt): New const.
12113 (Archive::setup): Remove task parameter and calls to unlock.
12114 (Archive::unlock_nested_archives): New function.
12115 (Archive::read_header): Add nested_off parameter. Change
12117 (Archive::interpret_header): Likewise.
12118 (Archive::include_all_members): Change to handle thin
12120 (Archive::include_member): Likewise.
12121 * archive.h (Archive::Archive): Add new parameters and
12123 (Archive::armagt): New const.
12124 (Archive::setup): Remove task parameter.
12125 (Archive::unlock_nested_archives): New function.
12126 (Archive::read_header): Add nested_off parameter.
12127 (Archive::interpret_header): Likewise.
12128 (Archive::Nested_archive_table): New typedef.
12129 (Archive::is_thin_archive_): New field.
12130 (Archive::nested_archives_): New field.
12131 (Archive::options_): New field.
12132 (Archive::dirpath_): New field.
12133 (Archive::task_): New field.
12134 * readsyms.cc (Read_symbols::do_read_symbols): Add check
12135 for thin archives. Pass additional parameters to
12136 Archive::Archive. Unlock the archive file after calling
12141 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12142 version symbol to be local.
12143 * testsuite/ver_test_4.sh: New file.
12144 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12145 (check_DATA): Add ver_test_4.syms.
12146 (ver_test_4.syms): New target.
12147 * testsuite/Makefile.in: Rebuild.
12150 (Output_section::Input_section_sort_entry::has_priority): New
12152 (Output_section::Input_section_sort_entry::match_file_name): New
12154 (Output_section::Input_section_sort_entry::match_section_name):
12156 (Output_section::Input_section_sort_entry::match_section_name_prefix):
12158 (Output_section::Input_section_sort_entry::match_section_file):
12160 (Output_section::Input_section_sort_compare::operator()): Rewrite
12161 using new Input_section_sort_entry functions. Sort crtbegin and
12162 crtend first. Sort sections with no priority before sections with
12164 * testsuite/initpri1.c (d3): Check j != 4.
12165 (cd5): New constructor/destructor function.
12166 (main): Check j != 2.
12168 * symtab.cc (Symbol_table::add_from_object): If we don't use the
12169 new symbol when resolving, don't call set_is_default.
12170 * testsuite/ver_test_7.cc: New file.
12171 * testsuite/ver_test_7.sh: New file.
12172 * testsuite/Makefile.am (ver_test_7.so): New target.
12173 (ver_test_7.o): New target.
12174 (check_SCRIPTS): Add ver_test_7.sh.
12175 (check_DATA): Add ver_test_7.syms.
12176 (ver_test_7.syms): New target.
12180 * layout.cc (Layout::layout): If we see an input section with a
12181 name that needs sorting, set the must_sort flag for the output
12183 (Layout::make_output_section): If the name of the output section
12184 indicates that it might require sorting, set the may_sort flag.
12185 * output.h (Output_section::may_sort_attached_input_sections): New
12187 (Output_section::set_may_sort_attached_input_sections): New
12189 (Output_section::must_sort_attached_input_sections): New
12191 (Output_section::set_must_sort_attached_input_sections): New
12193 (class Output_section): Declare Input_section_sort_entry. Define
12194 Input_section_sort_compare. Declare
12195 sort_attached_input_sections. Add new fields:
12196 may_sort_attached_input_sections_,
12197 must_sort_attached_input_sections_,
12198 attached_input_sections_are_sorted_.
12199 * output.cc (Output_section::Output_section): Initialize new
12201 (Output_section::add_input_section): Add an entry to
12202 input_sections_ if may_sort or must_sort are true.
12203 (Output_section::set_final_data_size): Call
12204 sort_attached_input_sections if necessary.
12205 (Output_section::Input_section_sort_entry): Define new class.
12206 (Output_section::Input_section_sort_compare::operator()): New
12208 (Output_section::sort_attached_input_sections): New function.
12209 * configure.ac: Check whether the compiler supports constructor
12210 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12211 * testsuite/initpri1.c: New file.
12212 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12213 CONSTRUCTOR_PRIORITY.
12214 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12215 (initpri1_LDFLAGS): New variable.
12216 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12220 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12221 * testsuite/common_test_1.c: New file.
12222 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12223 (common_test_1_SOURCES): New variable.
12224 (common_test_1_DEPENDENCIES): New variable.
12225 (common_test_1_LDFLAGS): New variable.
12227 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12228 and commons_ correctly when NAME/VERSION does not override
12230 * testsuite/ver_test_6.c: New file.
12231 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12232 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12233 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12237 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12238 of an undefined symbol from a version script.
12239 * testsuite/Makefile.am (ver_test_5.so): New target.
12240 (ver_test_5.o): New target.
12241 (check_SCRIPTS): Add ver_test_5.sh.
12242 (check_DATA): Add ver_test_5.syms.
12243 (ver_test_5.syms): New target.
12244 * testsuite/ver_test_5.cc: New file.
12245 * testsuite/ver_test_5.script: New file.
12246 * testsuite/ver_test_5.sh: New file.
12247 * Makefile.in, testsuite/Makefile.in: Rebuild.
12250 Fix problems building gold with gcc 4.3.0.
12251 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12252 (gold_error_at_location, gold_warning_at_location): Use it.
12253 * configure.ac: Check whether we can compile and use a template
12254 function with a printf attribute.
12255 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12256 when jumping over bytes.
12257 * object.cc: Instantiate Object::read_section_data.
12258 * debug.h: Include <cstring>
12259 * dwarf_reader.cc: Include <algorithm>
12260 * main.cc: Include <cstring>.
12261 * options.cc: Include <cstring>.
12262 * output.cc: Include <cstring>.
12263 * script.cc: Include <cstring>.
12264 * script.h: Include <string>.
12265 * symtab.cc: Include <cstring> and <algorithm>.
12266 * target-select.cc: Include <cstring>.
12267 * version.cc: Include <string>.
12268 * testsuite/testmain.cc: Include <cstdlib>.
12269 * configure, config.in: Rebuild.
12273 * options.cc: Include "../bfd/bfdver.h".
12274 (options::help): Print bug reporting address.
12276 * version.cc (print_version): Adjust output for current value of
12277 BFD_VERSION_STRING.
12281 * options.cc (options::help): Print list of supported targets.
12282 * target-select.h: Include <vector>.
12283 (class Target_selector): Make machine_, size_, and is_big_endian_
12284 fields const. Add bfd_name_ and instantiated_target_ fields.
12285 (Target_selector::Target_selector): Add bfd_name parameter.
12286 (Target_selector::recognize): Make non-virtual, call
12288 (Target_selector::recognize_by_name): Make non-virtual, call
12289 do_recognize_by_name.
12290 (Target_selector::supported_names): New function.
12291 (Target_selector::bfd_name): New function.
12292 (Target_selector::do_instantiate_target): New pure virtual
12294 (Target_selector::do_recognize): New virtual function.
12295 (Target_selector::do_recognize_by_name): New virtual function.
12296 (Target_selector::instantiate_target): New private function.
12297 (supported_target_names): Declare.
12298 * target-select.cc (Target_selector::Target_selector): Update for
12299 new parameter and fields.
12300 (select_target_by_name): Check that the name matches before
12301 calling recognize_by_name.
12302 (supported_target_names): New function.
12303 * i386.cc (class Target_selector_i386): Update Target_selector
12304 constructor call. Remove recognize and recognize_by_name. Add
12305 do_instantiate_target.
12306 * x86_64.cc (class Target_selector_x86_64): Likewise.
12307 * testsuite/testfile.cc (class Target_selector_test): Update for
12308 changes to Target_selector.
12310 * README: Rewrite, with some notes on unsupported features.
12314 * i386.cc (Target_i386::Got_type): New enum declaration.
12315 (Target_i386::Scan::local): Updated callers of Output_data_got
12317 (Target_i386::Scan::global): Likewise.
12318 (Target_i386::Relocate::relocate): Likewise.
12319 (Target_i386::Relocate::relocate_tls): Likewise.
12320 * object.h (Got_offset_list): New class.
12321 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12322 (Sized_relobj::local_got_offset): Likewise.
12323 (Sized_relobj::set_local_got_offset): Likewise.
12324 (Sized_relobj::local_has_tls_got_offset): Removed.
12325 (Sized_relobj::local_tls_got_offset): Removed.
12326 (Sized_relobj::set_local_tls_got_offset): Removed.
12327 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12328 * output.cc (Output_data_got::add_global): Added got_type parameter.
12329 (Output_data_got::add_global_with_rel): Likewise.
12330 (Output_data_got::add_global_with_rela): Likewise.
12331 (Output_data_got::add_global_pair_with_rel): New function.
12332 (Output_data_got::add_global_pair_with_rela): New function.
12333 (Output_data_got::add_local): Added got_type parameter.
12334 (Output_data_got::add_local_with_rel): Likewise.
12335 (Output_data_got::add_local_with_rela): Likewise.
12336 (Output_data_got::add_local_pair_with_rel): New function.
12337 (Output_data_got::add_local_pair_with_rela): New function.
12338 (Output_data_got::add_global_tls): Removed.
12339 (Output_data_got::add_global_tls_with_rel): Removed.
12340 (Output_data_got::add_global_tls_with_rela): Removed.
12341 (Output_data_got::add_local_tls): Removed.
12342 (Output_data_got::add_local_tls_with_rel): Removed.
12343 (Output_data_got::add_local_tls_with_rela): Removed.
12344 * output.h (Output_data_got::add_global): Added got_type parameter.
12345 (Output_data_got::add_global_with_rel): Likewise.
12346 (Output_data_got::add_global_with_rela): Likewise.
12347 (Output_data_got::add_global_pair_with_rel): New function.
12348 (Output_data_got::add_global_pair_with_rela): New function.
12349 (Output_data_got::add_local): Added got_type parameter.
12350 (Output_data_got::add_local_with_rel): Likewise.
12351 (Output_data_got::add_local_with_rela): Likewise.
12352 (Output_data_got::add_local_pair_with_rel): New function.
12353 (Output_data_got::add_local_pair_with_rela): New function.
12354 (Output_data_got::add_global_tls): Removed.
12355 (Output_data_got::add_global_tls_with_rel): Removed.
12356 (Output_data_got::add_global_tls_with_rela): Removed.
12357 (Output_data_got::add_local_tls): Removed.
12358 (Output_data_got::add_local_tls_with_rel): Removed.
12359 (Output_data_got::add_local_tls_with_rela): Removed.
12360 * resolve.cc (Symbol::override_base_with_special): Removed
12361 reference to has_got_offset_ field.
12362 * symtab.cc (Symbol::init_fields): Replaced initialization
12363 of got_offset_ with got_offsets_. Removed initialization
12365 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12366 (Symbol::got_offset): Likewise.
12367 (Symbol::set_got_offset): Likewise.
12368 (Symbol::has_tls_got_offset): Removed.
12369 (Symbol::tls_got_offset): Removed.
12370 (Symbol::set_tls_got_offset): Removed.
12371 (Symbol::got_offset_): Removed.
12372 (Symbol::tls_mod_got_offset_): Removed.
12373 (Symbol::tls_pair_got_offset_): Removed.
12374 (Symbol::got_offsets_): New field.
12375 (Symbol::has_got_offset): Removed.
12376 (Symbol::has_tls_mod_got_offset): Removed.
12377 (Symbol::has_tls_pair_got_offset): Removed.
12378 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12379 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12381 (Target_x86_64::Scan::global): Likewise.
12382 (Target_x86_64::Relocate::relocate): Likewise.
12383 (Target_x86_64::Relocate::relocate_tls): Likewise.
12387 * yyscript.y: Fix spelling error in comment.
12391 * options.h (class General_options): Define build_id option.
12392 * layout.h (class Layout): Declare write_build_id, create_note,
12393 create_build_id. Add build_id_note_ member.
12394 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12395 "libiberty.h", "md5.h", "sha1.h".
12396 (Layout::Layout): Initialize eh_frame_data_,
12397 eh_frame_hdr_section_, and build_id_note_.
12398 (Layout::finalize): Call create_build_id.
12399 (Layout::create_note): New function, broken out of
12400 Layout::create_gold_note.
12401 (Layout::create_gold_note): Call create_note.
12402 (Layout::create_build_id): New function.
12403 (Layout::write_build_id): New function.
12404 (Close_task_runner::run): Call write_build_id.
12406 * x86_64.cc: Correct license to GPLv3.
12410 * options.cc: Include "demangle.h".
12411 (parse_optional_string): New function.
12412 (parse_long_option): Handle takes_optional_argument.
12413 (parse_short_option): Update dash_z initializer. Handle
12414 takes_optional_argument.
12415 (General_options::General_options): Initialize do_demangle_.
12416 (General_options::finalize): Set do_demangle_. Handle demangling
12418 * options.h (parse_optional_string): Declare.
12419 (struct One_option): Add optional_arg field. Update constructor.
12420 Update call constructor calls. Add takes_optional_argument
12422 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12423 (DEFINE_optional_string): Define.
12424 (General_options::demangle): Change from DEFINE_bool to
12425 DEFINE_optional_string.
12426 (General_options::no_demangle): New function.
12427 (General_options::do_demangle): New function.
12428 (General_options::set_do_demangle): New function.
12429 (General_options::execstack_status_): Move definition to end of
12431 (General_options::static_): Likewise.
12432 (General_options::do_demangle_): New field.
12433 * object.cc (big_endian>::get_symbol_location_info): Call
12434 Options::do_demangle, not Options::demangle.
12435 * symtab.cc (demangle): Likewise.
12439 * gold.h: Include <cstddef> and <sys/types.h>
12440 * options.h: Include <cstring>.
12444 * Added source code to GNU binutils.