3 * options.h (--fix-cortex-a53-843419): Rename option.
4 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
6 (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
11 * output.cc (Output_section::is_input_address_mapped): Assume a missing
13 * testsuite/Makefile.am: Add the eh_test test.
14 * testsuite/Makefile.in: Regenerate.
15 * testsuite/eh_test_a.cc: New test.
16 * testsuite/eh_test_b.cc: New test.
19 * options.h (--weak-unresolved-symbols): New option.
20 * symtab.cc (Symbol_table::sized_write_globals): Change symbol
21 binding to weak with new option.
22 * symtab.h (is_weak_undefined): Check for new option.
23 (is_strong_undefined): Check for new option.
24 * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
25 * testsuite/Makefile.in: Regenerate.
26 * testsuite/weak_unresolved_symbols_test.cc: New file.
30 * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
35 * gc.cc (Garbage_collection::do_transitive_closure): Use back and
37 * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
38 * object.cc (Sized_relobj_file::do_layout): Use push_back.
39 * powerpc.cc (process_gc_mark): Use push_back.
40 (Target_powerpc::do_gc_mark_symbol): Use push_back.
41 * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
45 * aarch64.cc (AArch64_insn_utilities): New utility class.
46 (AArch64_relobj::Mapping_symbol_position): New struct.
47 (AArch64_relobj::Mapping_symbol_info): New typedef.
48 (AArch64_relobj::do_count_local_symbols): New function overriding
49 parent's implementation.
50 (AArch64_relobj::mapping_symbol_info_): New member
51 (AArch64_relobj::scan_erratum_843419): New method.
52 (Target_aarch64::scan_erratum_843419_span): New method.
53 (Target_aarch64::is_erratum_843419_sequence): New method.
54 * options.h (fix_cortex_a53): New option.
58 * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
60 * testsuite/Makefile.am (tls_pie_test.sh): New test.
61 * testsuite/Makefile.in: Regenerate.
62 * testsuite/tls_pie_test.sh: New.
66 * debug.h (DEBUG_LOCATION): New.
67 (DEBUG_ALL): Include DEBUG_LOCATION.
68 (debug_string_to_enum): Add DEBUG_LOCATION.
69 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
70 output to print correct context.
71 (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
72 up to 4 more locations at the beginning of the function.
73 * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
74 result before sorting list of line numbers.
75 * testsuite/debug_msg.sh: Allow range of line numbers for
76 canonical results on optimized code.
80 Add AArch32 support for gold linker.
82 * arm.cc: Add V8 arch combine table.
86 * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
90 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
91 to find by using the return value of insert.
95 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
101 * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
102 (Target_x86_64::Scan::local): Don't create GOT entry, when we
103 can convert mov to lea.
104 (Target_x86_64::Scan::global): Ditto.
105 (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
106 %reg to lea foo(%rip), %reg if possible.
107 * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
108 * testsuite/x86_64_mov_to_lea1.s: New.
109 * testsuite/x86_64_mov_to_lea2.s: Ditto.
110 * testsuite/x86_64_mov_to_lea3.s: Ditto.
111 * testsuite/x86_64_mov_to_lea4.s: Ditto.
112 * testsuite/x86_64_mov_to_lea.sh: Ditto.
116 * configure: Regenerated.
121 * i386.cc (Target_i386::can_convert_mov_to_lea): New.
122 (Target_i386::Scan::local): Don't create GOT entry, when we
123 can convert GOT to GOTOFF.
124 (Target_i386::Scan::global): Ditto.
125 (Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
126 lea foo@GOTOFF(%reg), %reg if possible.
127 * testsuite/Makefile.am (i386_mov_to_lea): New test.
128 * testsuite/i386_mov_to_lea1.s: New.
129 * testsuite/i386_mov_to_lea2.s: Ditto.
130 * testsuite/i386_mov_to_lea3.s: Ditto.
131 * testsuite/i386_mov_to_lea4.s: Ditto.
132 * testsuite/i386_mov_to_lea5.s: Ditto.
133 * testsuite/i386_mov_to_lea.sh: Ditto.
137 * Makefile.am (ZLIB): New.
139 (AM_CFLAGS): Add $(ZLIBINC).
140 (AM_CXXFLAGS): Likewise.
141 (ldadd_varldadd_var): Add $(ZLIB).
142 (incremental_dump_LDADD): Likewise.
143 (dwp_LDADD): Likewise.
144 * compressed_output.cc: Don't check HAVE_ZLIB_H to include
146 (zlib_compress): Don't check HAVE_ZLIB_H.
147 (zlib_decompress): Likewise.
148 * options.h (compress_debug_sections): Likewise.
149 * configure.ac (AM_CONDITIONAL): Removed.
150 * testsuite/Makefile.am (ZLIB): New.
151 (LDADD): Add $(ZLIB).
152 Don't check HAVE_ZLIB.
153 * Makefile.in: Regenerated.
154 * config.in: Likewise.
155 * configure: Likewise.
156 * testsuite/Makefile.in: Likewise.
160 * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
161 TLSLD_ADD_DTPREL_LO12_NC.
162 * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
163 _TLS_MODULE_BASE_ point to the start of tls segment.
164 (Target_aarch64::optimize_tls_reloc): Add cases for
165 R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
166 R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
167 (Target_aarch64::Scan::local): Likewise.
168 (Target_aarch64::Scan::global): Likewise.
169 (Target_aarch64::Relocate::relocate): Likewise.
170 (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
171 subtracting tls segment size from symbol value for TLSLD_*_DTPREL
176 * merge.cc (Object_merge_map::add_mapping): call
177 Object_merge_map::Input_merge_map::add_mapping.
178 (Object_merge_map::Input_merge_map::add_mapping): New.
179 (Output_merge_data::do_add_input_section): Call
180 get_or_make_input_merge_map before a loop.
181 (Output_merge_string<Char_type>::finalize_merged_data): Call
182 get_or_make_input_merge_map before a loop.
183 * merge.h (Object_merge_map): Make Input_merge_map public.
184 * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
185 (Relobj::get_or_create_merge_map): New.
186 * object.h (Relobj::get_or_create_merge_map): New.
191 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
192 relocation errors for branches to strong undefined symbols.
196 * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
197 (Object_merge_map::is_merge_section_for): Remove.
198 (Object_merge_map::find_merge_section): New.
199 * merge.h (Object_merge_map::is_merge_section_for): Remove.
200 (Object_merge_map::find_merge_section): New.
201 (Object_merge_map::get_input_merge_map): Add a const version.
202 * object.cc (Relobj::is_merge_section_for): Remove.
203 (Relobj::find_merge_section): New.
204 * object.h (Relobj::is_merge_section_for): Remove.
205 (Relobj::find_merge_section): New.
207 (Output_section::Input_section::is_merge_section_for): Remove.
208 (Output_section::add_merge_input_section): Don't call
209 add_merge_input_section.
210 (Output_section::find_merge_section): Return const. Use
211 object->find_merge_section.
212 (Output_section::build_lookup_maps): Don't build a map for
214 (Output_section::is_input_address_mapped): Return false if
215 section is not found.
216 (Output_section::find_starting_output_address): Use
217 find_merge_section instead of is_merge_section_for.
218 (Output_section::add_script_input_section): Don't build a map for
220 * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
221 (Output_section_lookup_maps::find_merge_section): Remove.
222 (Output_section_lookup_maps::add_merge_input_section) Remove.
223 (Output_section::find_merge_section): Return const.
228 * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
229 non-SIB form of lea, with nop after the call.
234 * output.cc (Output_segment::is_first_section_relro): Don't ignore
236 (Output_segment::set_section_addresses): Don't align size of relro
242 * stringpool.cc (Stringpool_template): Don't optimize if section
243 alignment is greater than sizeof(char).
248 * script-c.h (script_include_directive): Add first_token parameter.
249 * script.cc (script_include_directive): Add first_token parameter, and
250 pass it to read_script_file.
251 * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
252 (PARSING_MEMORY_DEF): New tokens.
253 (top): Add new productions for INCLUDE files.
254 (file_cmd): Replace file_or_sections_cmd with copy of its productions.
255 Pass PARSING_LINKER_SCRIPT to script_include_directive.
256 (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
257 (section_cmd): Pass PARSING_SECTION_CMDS.
258 (file_or_sections_cmd): Remove.
259 (memory_def): Pass PARSING_MEMORY_DEF.
260 * testsuite/Makefile.am (memory_test_2): New test.
261 * testsuite/Makefile.in: Regenerate.
262 * testsuite/memory_test_inc.t: New script file.
263 * testsuite/memory_test_inc_1.t.src: New script file.
264 * testsuite/memory_test_inc_2.t.src: New script file.
265 * testsuite/memory_test_inc_3.t.src: New script file.
269 * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
270 (Sized_relobj_dwo::setup): Build compressed section map.
271 (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
272 * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
274 * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
275 compressed_sections_ field.
276 (build_compressed_section_map): Take Object instead of
277 Sized_relobj_file parameter; add decompress_if_needed parameter.
278 (Sized_relobj_file::do_find_special_sections): Store compressed
279 section map in parent Object.
280 (Sized_relobj_file::do_decompressed_section_contents): Move
281 implementation to Object::decompressed_section_contents.
282 (Sized_relobj_file::do_discard_decompressed_sections): Move
283 implementation to Object::discard_decompressed_sections.
284 * object.h (build_compressed_section_map): Declare.
285 (Object::Object): Add compressed_sections_ field.
286 (Object::section_is_compressed): Move implementation here.
287 (Object::decompressed_section_contents): De-virtualize.
288 (Object::discard_decompressed_sections): De-virtualize.
289 (Object::do_section_is_compressed): Delete.
290 (Object::do_decompressed_section_contents): Delete.
291 (Object::set_compressed_sections): New method.
292 (Object::compressed_sections): New method.
293 (Object::compressed_sections_): New data member.
294 (Compressed_section_info, Compressed_section_map): Move to top of file.
295 (Sized_relobj_file::do_section_is_compressed): Delete.
296 (Sized_relobj_file::do_decompressed_section_contents): Delete.
297 (Sized_relobj_file::do_discard_decompressed_sections): Delete.
298 (Sized_relobj_file::compressed_sections_): Move to Object class.
303 * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
308 * options.cc (General_options::finalize): Don't allow -z relro
309 with incremental linking.
310 * testsuite/Makefile.am (incremental_test): Add -z norelro.
311 (incremental_test_2): Likewise.
312 (incremental_test_3): Likewise.
313 (incremental_test_4): Likewise.
314 (incremental_test_5): Likewise.
315 (incremental_test_6): Likewise.
316 (incremental_copy_test): Likewise.
317 (incremental_common_test_1): Likewise.
318 (incremental_comdat_test_1): Likewise.
319 * testsuite/Makefile.in: Regenerate.
324 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
325 return enum indicating whether .eh_frame section is empty, optimizable,
326 unrecognized, or an end marker. Adjust explicit instantiations.
327 * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
328 (Eh_frame::add_ehframe_input_section): Change return type.
329 * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
330 * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
331 to the .eh_frame output section until we see the end marker.
332 (Layout::finalize_eh_frame_section): New.
333 * layout.h: (Layout::finalize_eh_frame_section): New.
337 * output.cc (Relobj::initialize_input_to_output_map<size>):
338 Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
342 * parameters.cc (Parameters::set_target_once): Call
343 Target::select_as_default_target just once from here...
344 (set_parameters_target): ...instead of from here.
348 * ehframe.cc (Cie::set_output_offset): Pass in and use a
349 Output_section_data instead of a Merge_map.
350 (Eh_frame::Eh_frame): Don't initialize merge_map_.
351 (Eh_frame::read_cie): Use add_merge_mapping instead of
352 Merge_map::add_mapping.
353 (Eh_frame::read_fde): Ditto.
354 (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
355 (Eh_frame::do_output_offset): Use merge_output_offset istead of
356 merge_map_->get_output_offset.
357 (Eh_frame::do_is_merge_section_for): Delete.
358 * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
359 instead of a Merge_map.
360 (Cie::set_output_offset): Pass in a Output_section_data instead of a
362 (Eh_frame::do_is_merge_section_for): Delete.
363 (Eh_frame::merge_map_): Delete.
364 * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
365 and use a Output_section_data instead of a Merge_map.
366 (Object_merge_map::add_mapping): Ditto.
367 (Object_merge_map::get_output_offset): Remove the merge_map argument.
368 (Object_merge_map::is_merge_section_for): Pass in and use a
369 Output_section_data instead of a Merge_map.
371 (Output_merge_base::do_output_offset): Use merge_output_offset instead
372 of merge_map_.get_output_offset.
373 (Output_merge_base::do_is_merge_section_for): Delete.
374 (Output_merge_data::do_add_input_section): Use
375 object->add_merge_mapping instead of add_mapping.
376 (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
377 * merge.h (Merge_map): Delete forward declaration.
378 (Object_merge_map::add_mapping): Pass in and use a Output_section_data
379 instead of a Merge_map.
380 (Object_merge_map::get_output_offset): Remove the merge_map argument.
381 (Object_merge_map::is_merge_section_for): Pass in and use a
382 Output_section_data instead of a Merge_map.
383 (Input_merge_map::Object_merge_map::merge_map): Replace with
385 (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
386 Output_section_data instead of a Merge_map.
388 (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
389 (Output_merge_base::do_is_merge_section_for): Delete.
390 (Output_merge_base::add_mapping): Delete.
391 (Output_merge_base::merge_map_): Delete.
392 * object.cc (Relobj::initialize_input_to_output_map): New.
393 (Relobj::initialize_input_to_output_map): New.
394 (Relobj::merge_output_offset): New.
395 (Relobj::is_merge_section_for): New.
396 (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
398 * object.h (Relobj::merge_map): Delete.
399 (initialize_input_to_output_map): New.
400 (set_merge_map): Delete.
401 (add_merge_mapping): New.
402 (merge_output_offset): New.
403 (is_merge_section_for): New.
404 * output.cc (Output_section::Input_section::is_merge_section_for):
405 Use object->is_merge_section_for.
406 * output.h (Output_section_data::is_merge_section_for): Delete.
407 (Output_section_data::do_is_merge_section_for): Delete.
408 * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
409 Use object->initialize_input_to_output_map.
410 (Merged_symbol_value<size>::value_from_output_section): Use
411 object->merge_output_offset.
416 * output.cc (Output_section::add_merge_input_section): Do not
417 attempt to merge sections with an entsize of 0.
421 * attributes.h (class Output_attributes_section_data ): Add
422 do_print_to_mapfile function.
427 * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
428 complain if value is not a multiple of four.
429 (Target_powerpc::Relocate::relocate): Correct handling of
430 R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
434 * configure.ac (default_size): Set to 32 for x32.
435 * configure: Regenerated.
440 * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
445 * gc.h (Garbage_collection::add_reference): Don't use find.
449 * object.cc (write_local_symbols): avoid std::vector copy.
453 * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
457 * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
458 DW_LANG_Fortran03 and DW_LANG_Fortran08.
464 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
465 DF_SYMBOLIC if --dynamic-list option is used.
466 * options.cc (General_options::finalize): --dynamic-list is not
467 mutually exclusive with -Bsymbolic.
468 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
469 listed in --dynamic-list.
470 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
471 -Bsymbolic-functions.
472 * testsuite/Makefile.in: Regenerate.
477 * incremental.cc: Remove redundant include of "output.h".
481 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
482 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
484 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
485 TLSLE_MOVW_* relocations.
486 (Target_aarch64::Scan::global): Likewise.
487 (Target_aarch64::Relocate::relocate): Likewise.
488 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
489 for new TLSLE_MOVW_* relocations.
494 * arm.cc (Target_arm::make_plt_section): Create an ARM
495 state mapping symbol at the start of the PLT.
499 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
500 Replace two_file_shared_2.so with two_file_shared_1.so.
501 * testsuite/Makefile.in: Regenerated.
505 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
506 plugin_test_thin.a and defsym_test.
507 * testsuite/Makefile.in: Regenerate.
511 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
516 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
517 forwarding symbols when computing symbol resolution info for plugins.
518 * plugin.h (Plugin_manager::symtab): New method.
519 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
525 * archive.cc (Thin_archive_object_unlocker): New class.
526 (Archive::include_member): Unlock external members of thin archives.
527 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
528 (plugin_test_2): Likewise.
529 (plugin_test_3): Likewise.
530 (plugin_test_4): Likewise.
531 (plugin_test_5): Likewise.
532 (plugin_test_6): Likewise.
533 (plugin_test_7): Likewise.
534 (plugin_test_8): Likewise.
535 (plugin_test_9): Likewise.
536 (plugin_test_10): Likewise.
537 (plugin_test_11): New test case.
538 * testsuite/Makefile.in: Regenerate.
539 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
540 file to decide whether to claim file.
541 (all_symbols_read_hook): Likewise.
542 * testsuite/plugin_test_1.sh: Adjust expected output.
543 * testsuite/plugin_test_2.sh: Likewise.
544 * testsuite/plugin_test_3.sh: Likewise.
545 * testsuite/plugin_test_6.sh: Likewise.
546 * testsuite/plugin_test_tls.sh: Likewise.
547 * testsuite/plugin_test_11.sh: New testcase.
551 * descriptors.cc (Descriptors::open): Set artificially-low limit for
552 file descriptors when debugging enabled. Add debug output.
553 (Descriptors::release): Add debug output.
554 (Descriptors::close_some_descriptor): Likewise.
555 (Descriptors::close_all): Likewise.
556 * fileread.cc (File_read::lock): Likewise.
557 (File_read::unlock): Likewise.
561 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
562 executable output file.
566 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
567 (Target_arm::do_plt_address_for_global): New method.
568 (Target_arm::do_plt_address_for_local): New method.
569 (Target_arm::rel_irelative_section): New method.
570 (Target_arm::make_data_plt): Add more parameters for plt ctor.
571 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
572 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
573 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
574 (Target_arm::Scan::check_non_pic): Add ifunc support.
575 (Target_arm::Scan::local): Add ifunc support.
576 (Target_arm::Scan::global): Add ifunc support.
577 (Target_arm::make_plt_section): New method.
578 (Target_arm::make_plt_entry): Change to call to make_plt_section.
579 (Target_arm::make_local_ifunc_plt_entry): New method.
580 (Target_arm::got_irelative_): New member.
581 (Target_arm::rel_irelative_): New member.
582 (Target_arm::got_section): Add creation for got_irelative_.
583 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
584 (Target_arm::Relocate::relocate): Properly set local ifunc address.
585 (Target_arm::do_dynsym_value): Properly set global ifunc address.
586 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
587 (Output_data_plt_arm::IRelative_data): New type.
588 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
589 (Output_data_plt_arm::add_entry): Add more parameters.
590 (Output_data_plt_arm::add_relocation): New method.
591 (Output_data_plt_arm::add_local_ifunc_entry): New method.
592 (Output_data_plt_arm::rel_irelative): New method.
593 (Output_data_plt_arm::entry_count): Modified.
594 (Output_data_plt_arm::address_for_global): New method.
595 (Output_data_plt_arm::address_for_local): New method.
597 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
598 (Output_data_plt_arm::insert_irelative_data): New method.
599 (Output_data_plt_arm::irelative_rel_): New member.
600 (Output_data_plt_arm::got_): New member.
601 (Output_data_plt_arm::got_irelative_): New member.
602 (Output_data_plt_arm::irelative_count_): New member.
603 (Output_data_plt_arm::IRelative_data_vec): New typedef.
604 (Output_data_plt_arm::irelative_data_vec_): New member.
605 (Output_data_plt_arm::do_write): Write out irelative entries.
606 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
607 more parameters to ctor.
608 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
609 more parameters to ctor.
610 * output.h (Output_data_reloc::add_local_relative): New method.
611 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
615 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
616 and GOT_TLSGD to LE optimization.
620 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
621 for undef TLS symbols.
622 (Target_x86_64::Relocate::relocate_tls): Likewise.
623 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
627 * output.cc (Output_segment::set_section_addresses): Fix calculation
628 of size of relro segment.
632 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
633 condition for need of ifunc plt entry.
634 (Target_powerpc::Scan::global <got relocs>): Likewise.
638 * mips.cc (reloc_high): Add r_sym.
639 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
640 reloc_high constructor.
641 (Mips_relocate_functions::relgot16_local): Likewise.
642 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
643 r_type to decide whether LO16 matches HI16.
644 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
645 rello16 and relgot16_local.
649 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
650 unless alignment is larger than page size.
656 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
657 (DEFAULT_TARGET_X32): Set for x32.
658 * x86_64.cc (cmp_insn_32): New.
659 (lea_r10_insn_32): Likewise.
660 (lea_r11_insn_32): Likewise.
661 (cmp_insn_64): Likewise.
662 (lea_r10_insn_64): Likewise.
663 (lea_r11_insn_64): Likewise.
664 (Target_x86_64<size>::do_calls_non_split): Handle x32.
665 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
666 (check_DATA): Add split_x32 files.
667 (split_x32_[1234n].o): New targets.
668 (split_x32_[124]): New targets.
669 (split_x32_[1234r].stdout): New targets.
670 * testsuite/split_x32.sh: New file.
671 * testsuite/split_x32_1.s: Likewise.
672 * testsuite/split_x32_2.s: Likewise.
673 * testsuite/split_x32_3.s: Likewise.
674 * testsuite/split_x32_4.s: Likewise.
675 * testsuite/split_x32_n.s: Likewise.
676 * configure: Regenerated.
677 * testsuite/Makefile.in: Likewise.
682 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
687 * version.cc (print_version): Just print current year.
688 * dwp.cc (print_version): Likewise.
692 Update year range in copyright notice of all files.
696 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
698 (Target_arm::merge_object_attributes, ): Likewise.
702 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
703 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
704 AEABI_VFP_args_vfp to check that.
705 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
706 value and replace hardcoded values by enum values.
710 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
715 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
716 to "return i * i * 3;".
720 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
721 (Mapfile::print_output_data): Use current_data_size() to avoid
722 assert for sections requiring postprocessing; if address is not valid,
724 (Mapfile::print_output_section): Use current_data_size(); print note
725 that addresses and sizes are before compression.
729 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
730 Cast current_group_size to unsigned long when reporting error.
734 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
735 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
736 Update error message.
737 (Target_aarch64::do_relax): Use absolute value of option
738 stub_group_size. Replace local variable with class member
743 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
744 addend of PLTREL24 reloc when not generating a plt stub. Make
745 max_branch_offset an "Address".
746 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
747 (Target_powerpc::Relocate::relocate): Likewise.
752 * symtab.cc (Symbol::set_undefined): Remove assertion.
753 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
754 on symbols defined in discarded sections, instead return false.
755 Rearrange params, update all callers.
756 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
757 branches to syms in discarded sections.
758 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
759 undefined and flag as discarded.
760 (Target_powerpc::Relocate::relocate): Localize variable.
765 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
766 * testsuite/Makefile.in: Regenerated.
771 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
772 when adding dynamic relocations against section symbols.
776 * layout.cc (Layout::finish_dynamic_section): When '-z global'
777 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
778 * options.h (General_options): New -z option (global).
783 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
785 (Layout::create_executable_stack_info): Warn when -z noexecstack is
786 given but some inputs require executable stack.
790 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
791 .debug_str_offsets; strip .debug_gnu_pubnames and
793 (lines_only_debug_sections): Strip all four new sections.
797 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
798 register to be x0 when to relax TLSDESC_LD64_LO12.
802 * powerpc.cc (struct Stub_table_owner): New.
803 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
804 unsigned int vector. Update all references.
805 (powerpc_relobj::set_stub_table): Take an unsigned int param
806 rather than a Stub_table. Update callers.
807 (Powerpc_relobj::clear_stub_table): New function.
808 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
809 stub_group_size_ vars.
810 (Target_powerpc::new_stub_table): Delete.
811 (max_branch_delta): New function, extracted from..
812 (Target_powerpc::Relocate::relocate): ..here..
813 (Target_powerpc::Branch_info::make_stub): ..and here. Return
814 status on whether stub created successfully.
815 (Stub_control::Stub_control): Add "no_size_errors" param. Move
817 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
818 reduce on relax failure.
819 (Target_powerpc::group_sections): Add "no_size_errors" param.
820 Use stub_group_size_. Set up group info in a temp vector,
821 before building Stub_table vector. Account for input sections
822 possibly already converted to relaxed sections.
823 (Stub_table::init): Delete. Merge into..
824 (Stub_table::Stub_table): ..here.
825 (Stub_table::can_reach_stub): New function.
826 (Stub_table::add_plt_call_entry): Add "from" parameter and
827 return true iff stub could be reached.
828 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
830 (Stub_table::clear_stubs): Add "all" param.
834 * powerpc.cc (Stub_control::set_output_and_owner): New function.
835 (Target_powerpc::group_sections): Use it.
839 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
840 (Binary_to_elf::write_symbol): Add st_size parameter.
841 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
846 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
847 (Sized_relobj_file::do_layout): Handle deferred sections properly
848 during GC pass 1. Don't add reloc sections to deferred list twice.
849 * object.h (Sized_relobj_file::is_deferred_layout): New function.
850 (Sized_relobj_file::is_deferred_layout_): New data member.
855 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
856 Check PC-relative offset overflow in PLT entry.
860 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
865 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
866 from --stub-group-size parameter divided by 1024.
867 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
868 template parameter. Update all uses.
869 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
870 has_stub_value. Set for long branches. Don't report overflow for
871 branch to undefined weak symbols. Print info message on
872 overflowing branch to stub.
876 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
880 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
881 entry for R_X86_64_GOTPLT64.
882 (Target_x86_64<size>::Relocate::relocate): Update comments for
887 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
888 * plugin.h: add lock definition
893 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
894 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
895 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
897 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
899 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
900 (Target_aarch64::tls_ld_to_le): New method.
901 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
903 (Output_data_plt_aarch64::irelative_rel_): New data member.
904 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
905 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
906 (Output_data_plt_aarch64::add_relocation): New method.
907 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
908 offset. Add got_irelative size to got size.
909 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
910 type string with the new typename.
911 (AArch64_relocate_functions::update_adr): Replace parameter x with
913 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
914 (AArch64_relocate_functions::reloc_common): New method.
915 (AArch64_relocate_funcsions::rela_general): Extract common part out
916 into reloc_common method.
917 (AArch64_relocate_functions::rela_general): Likewise.
918 (AArch64_relocate_functions::pcrela_general): Likewise.
919 (AArch64_relocate_functions::adr): New method.
920 (AArch64_relocate_functions::adrp): Calculate immed before calling
922 (AArch64_relocate_functions::adrp): Likewise.
923 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
924 comparing x to 0. Calculate immed from ~x when x < 0.
925 (Target_aarch64::optimize_tls_reloc): Add new cases for
926 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
927 TLSLD_MOVW_DTPREL_G0_NC.
928 (Target_aarch64::possible_function_pointer_reloc): Implement this
930 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
932 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
933 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
934 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
935 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
936 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
937 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
938 (Target_aarch64::make_plt_entry): Call add_entry with two more
940 (Target_aarch64::make_local_ifunc_plt_entry): New method.
941 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
942 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
943 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
944 (Target_aarch64::Relocate::relocate_tls): Add cases for
945 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
946 TLSLD_MOVW_DTPREL_G0_NC.
947 * testsuite/icf_safe_so_test.cc: Correct test comment.
948 * testsuite/icf_safe_test.sh: Add AArch64 arch.
952 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
957 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
961 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
962 Add "typename" keyword.
967 Patch for gold aarch64 backend to support relaxation.
968 * aarch64-reloc.def: Change format.
969 * aarch64.cc (class Reloc_stub): New class.
970 (class Stub_table): New class.
971 (class AArch64_relobj): New class.
972 (class AArch64_input_section): New class.
973 (class AArch64_output_section): New class.
974 (Target_aarch64::new_stub_table): New method.
975 (Target_aarch64::new_aarch64_input_section): New method.
976 (Target_aarch64::find_aarch64_input_section): New method.
977 (Target_aarch64::scan_section_for_stubs): New method.
978 (Target_aarch64::scan_reloc_section_for_stubs): New method.
979 (Target_aarch64::relocate_stub): New method.
980 (Target_aarch64::current_target): New method.
981 (Target_aarch64::do_make_elf_object): New method.
982 (Target_aarch64::do_may_relax): New method.
983 (Target_aarch64::do_relax): New method.
984 (Target_aarch64::group_sections): New method.
985 (Target_aarch64::scan_reloc_for_stub): New method.
986 (Target_aarch64::do_make_output_section): New method.
987 (Target_aarch64::stub_tables_): New data member.
988 (Target_aarch64::aarch64_input_section_map_): New data member.
989 (AArch64_relocate_functions::maybe_apply_stub): New method.
994 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
999 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1000 hash table before sysv-style hash table.
1004 * options.h (--pic-executable): Add negative to alias to -no-pie.
1009 * object.cc (Sized_relobj_file): Compute value of section symbols
1010 for TLS sections the same as TLS symbols.
1015 * resolve.cc (Symbol_table::resolve): Override common placeholder
1016 symbols, but adjust sizes.
1017 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1018 symbols to common lists.
1022 * po/POTFILES.in: Regenerate.
1028 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1029 on input_sections_blocker.
1030 * layout.cc (Write_sections_task::locks): Unblock
1031 input_sections_blocker_.
1032 * layout.h (Write_sections_task::Write_sections_task): Add
1033 input_sections_blocker.
1034 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1036 * testsuite/Makefile.in: Regenerate.
1040 * testsuite/Makefile.am (plugin_test_10): New test.
1041 * testsuite/Makefile.in: Regenerate
1042 * testsuite/plugin_common_test_2.c (c1): Align to 8.
1043 * testsuite/plugin_test_10.sh: New file.
1047 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1048 * resolve.cc (Symbol_table::resolve): Don't override common symbols
1049 during the replacement phase.
1054 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1055 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1056 * aarch64.cc (Target_aarch64): Add data members
1057 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1058 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1060 (Target_aarch64::do_reloc_symbol_index): New method.
1061 (Target_aarch64::do_reloc_addend): New method.
1062 (Target_aarch64::add_tlsdesc_info): New method.
1063 (Target_aarch64::do_dynsym_value): New method.
1064 (Target_aarch64::do_make_data_plt): Add new parameters: got,
1065 got_irelative. Pass them to Output_data_plt_aarch64_standard.
1066 (Target_aarch64::make_data_plt): Add new parameters: got,
1067 got_irelative. Pass them to do_make_data_plt.
1068 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1069 (Target_aarch64::Relocate:tls_gd_to_le): New method.
1070 (Target_aarch64::Relocate:tls_ie_to_le): New method.
1071 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1072 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1073 (Target_aarch64::got_tlsdesc_section): New method.
1074 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1075 (Target_aarch64::define_tls_base_symbol): New method.
1076 (Target_aarch64::reserve_tlsdesc_entries): New method.
1077 (Target_aarch64::got_mod_index_entry): New method.
1078 (Target_aarch64::rela_tlsdesc_section): New method.
1079 (Target_aarch64::rela_irelative_section): New method.
1080 (Target_aarch64::Tlsdesc_info): New struct.
1081 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1082 relocations and tlsdesc relocations.
1083 (Target_aarch64::optimize_tls_reloc): Implement method.
1084 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1085 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1087 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1088 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1089 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1090 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1091 (Output_data_plt_aarch64::rela_tlsdesc): New method.
1092 (Output_data_plt_aarch64::rela_irelative): New method.
1093 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1094 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1095 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1096 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1097 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1098 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1099 (Output_data_plt_aarch64_standard): New member variables:
1100 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1101 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1102 New parameter: got, got_irelative.
1103 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1104 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1105 (Output_data_plt_aarch64::do_write): Replace got_address with
1106 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1107 (AArch64_relocate_functions::update_movnz): New method.
1108 (AArch64_relocate_functions): Correct format.
1109 (AArch64_relocate_functions::movnz): New method.
1110 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1111 before the switch. Add new cases to switch.
1112 Check ie_to_le relaxation on tlsie relocations. Add code handling
1113 tlsgd tlsdesc cases.
1114 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1115 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1116 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1117 Call reloc_name_in_error_message to print unsupported reloc.
1118 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1120 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1121 relocs. Fill in some more dynamic tags.
1122 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1123 Skip call tls_get_addr when tlsgd is relaxed.
1124 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1125 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1126 tlsdesc->ie relaxation.
1130 * mips.cc (Target_mips_nacl): New class.
1131 (Target_selector_mips_nacl): New class.
1132 (target_selector_mips32): Rename from target_selector_mips32be and use
1133 Target_selector_mips_nacl instead of Target_selector_mips.
1134 (target_selector_mips32el): Rename from target_selector_mips32 and use
1135 Target_selector_mips_nacl instead of Target_selector_mips.
1136 (target_selector_mips64): Rename from target_selector_mips64be and use
1137 Target_selector_mips_nacl instead of Target_selector_mips.
1138 (target_selector_mips64el): Rename from target_selector_mips64 and use
1139 Target_selector_mips_nacl instead of Target_selector_mips.
1140 (Target_mips::mips_info): Add const attribute.
1144 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1145 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1146 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1147 (Sized_incr_dynobj::do_section_name): Likewise.
1148 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1149 (Sized_incr_dynobj::do_section_name): Likewise.
1150 * object.h (Object::section_name): Likewise.
1151 (Object::do_section_name): Likewise.
1152 (Sized_relobj_file::do_section_name): Likewise.
1153 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1154 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1159 * ehframe.cc (Fde::write): Add output_offset parameter.
1160 (Cie::write): Likewise.
1161 (Eh_frame::set_final_data_size): Account for offset within output
1163 (Eh_frame::do_sized_write): Likewise.
1164 * ehframe.h (Fde::write): Add output_offset parameter.
1165 (Cie::write): Likewise.
1166 * output.cc (Output_section::Input_section_sort_entry): Remove
1167 section_has_name_; add output_section_name parameter. Use
1168 output section name for non-input sections.
1169 (Output_section::Input_section_sort_entry::section_has_name): Remove.
1170 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1171 (Output_section::Input_section_sort_compare): Remove logic for
1172 sections without names.
1173 (Output_section::Input_section_sort_init_fini_compare): Likewise.
1174 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1176 (Output_section::Input_section_sort_section_name_compare): Likewise.
1181 * aarch64-reloc-property.cc
1182 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1183 reference reloc property in the table.
1184 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1186 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1187 2 new overloaded methods.
1188 (Output_data_got_aarch64::do_write): Add code to write out
1190 (class Output_data_got_aarch64::Static_reloc): New class to wrap
1192 (Output_data_got_aarch64::static_relocs): New vector to
1194 (Target_aarch64::TCB_SIZE): New const static memeber.
1195 (Target_aarch64::tcb_size): New method.
1196 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1197 (Target_aarch64::Relocate::relocate_tls): New method.
1198 (Target_aarch64::Scan::local): Add code handling new reloc types.
1199 (Target_aarch64::Scan::global): Add code handling new reloc types.
1203 * options.h (-no-pie): Add option.
1208 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1209 (DEFFILES): add aarch64-reloc.def.
1210 (TARGETSOURCES): Add aarch64-reloc-property.cc.
1211 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1212 * Makefile.in: Regenerate.
1213 * aarch64-reloc-property.cc: New file.
1214 * aarch64-reloc-property.h: New file.
1215 * aarch64-reloc.def: New file.
1216 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1217 with tab to make the format consistent.
1218 (Output_data_got_aarch64::symbol_table_): New method.
1219 (Target_aarch64::do_plt_address_for_global): New method.
1220 (Target_aarch64::do_plt_address_for_local): New method.
1221 (Target_aarch64::do_select_as_default_target): New method.
1222 (Target_aarch64::do_make_data_plt): New method.
1223 (Target_aarch64::make_data_plt): New method.
1224 (Output_data_plt_aarch64::has_irelative_section): New method.
1225 (Output_data_plt_aarch64::address_for_global): New method.
1226 (Output_data_plt_aarch64::address_for_local): New method.
1227 (Output_data_plt_aarch64::irelative_rel_): New parameter.
1228 (Output_data_plt_aarch64::add_entry): Implement contents.
1229 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1230 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1231 the got_pov entry to plt0.
1232 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1234 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1235 (AArch64_howto): New struct.
1236 (aarch64_howto[]): New static const array.
1237 (AArch64_relocate_functions): New class.
1238 (Target_aarch64::Scan::get_reference_flags): Remove method.
1239 (Target_aarch64::Scan::local): Implement to support a few relocations.
1240 (Target_aarch64::Scan::global): Implement to support a few relocations.
1241 (Target_aarch64::make_plt_section): Implement contents.
1242 (Target_aarch64::make_plt_entry): Implement contents.
1243 (Target_aarch64::do_finalize_sections): Implement contents.
1244 (Target_aarch64::Relocate::relocate): Implement a few relocations.
1245 (Target_aarch64::relocate_section): Implement contents.
1249 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1254 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1258 * object.cc (Relobj::is_section_name_included): Add
1259 ".rodata.nptl_version" to not garbage collect this section.
1263 * expression.cc (struct Expression::Expression_eval_info): Add
1264 new fields type_pointer, vis_pointer, and nonvis_pointer.
1265 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1266 nonvis_pointer parameters. Adjust all calls.
1267 (Symbol_expression::value): Update type, visibility, and nonvis bits
1269 * script.cc (Symbol_assignment::sized_finalize): Update type,
1270 visibility, and remaining st_other bits for new symbol.
1271 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1272 vis_pointer, and nonvis_pointer parameters.
1273 * symtab.h (Symbol::set_type): New method.
1275 * testsuite/Makefile.am (defsym_test): New test.
1276 * testsuite/Makefile.in: Regenerate.
1277 * testsuite/defsym_test.c: New file.
1278 * testsuite/defsym_test.sh: New file.
1283 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1284 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1285 (Sized_dynobj::base_read_symbols): ...new method.
1286 * object.h (Sized_relobj_file::base_read_symbols): New method.
1287 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1288 (Sized_relobj_file::base_read_symbols): ...new method.
1289 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1290 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1291 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1295 * po/POTFILES.in: Regenerate.
1299 * aarch64.cc: New file
1300 * Makefile.am (TARGETSOURCES): Add aarch64.cc
1301 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1302 * Makefile.in: Regenerate.
1303 * configure.tgt: Add entries for aarch64*.
1304 * configure.ac: Likewise.
1305 * configure: Likewise.
1309 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1313 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1315 (Dwo_file::sized_read_unit_index): Likewise.
1319 * mips.cc: New file.
1320 * Makefile.am (TARGETSOURCES): Add mips.cc
1321 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1322 * configure.tgt: Add entries for mips*.
1323 * configure.ac: Likewise.
1324 * Makefile.in: Regenerate.
1325 * configure: Likewise.
1329 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1330 unit_length is within section bounds.
1335 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1340 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1344 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1345 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1346 (Dwarf_pubnames_table::read_header): Likewise.
1347 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1348 .debug_gnu_pubtypes.
1352 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1353 * Makefile.in, configure: Regenerate.
1357 * powerpc.cc (addis_12_2): Define.
1358 (Stub_table::do_write): Support fusion on ELFv2 stubs.
1362 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1367 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1368 Only ignore relocs on ELFv1.
1369 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1373 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1374 * testsuite/Makefile.in: Regenerate.
1375 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1380 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1381 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
1385 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1386 Compare FDE contents with DW_CFA_nop rather than 0.
1390 * symtab.h (may_need_copy_reloc): Remove check for position independent
1392 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1393 position independence before pc absolute may_need_copy_reloc call.
1394 Add check for executable output befor pc relative may_need_copy_reloc
1400 * powerpc.cc: Add check for no position independence before
1401 may_need_copy_reloc calls.
1402 * testsuite/pie_copyrelocs_test.cc: New file.
1403 * testsuite/pie_copyrelocs_shared_test.cc: New file.
1404 * Makefile.am (pie_copyrelocs_test): New test.
1405 * Makefile.in: Regenerate.
1409 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1414 * i386.cc (Output_data_got_plt_i386): New class.
1415 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1416 parameter. Change all callers.
1417 (Output_data_plt_i386::layout_): Remove.
1418 (Output_data_plt_i386::got_plt_): Change type.
1419 (Target_i386::got_plt_): Change type. Change all references.
1420 (Target_i386::got_section): Create instance of new class.
1421 (Output_data_got_plt_i386::do_write): New function.
1422 * x86_64.cc (Output_data_got_plt_x86_64): New class.
1423 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1424 parameter. Change all callers.
1425 (Output_data_plt_x86_64::layout_): Remove.
1426 (Output_data_plt_x86_64::got_plt_): Change type.
1427 (Target_x86_64::got_plt_): Change type. Change all references.
1428 (Target_x86_64::got_section): Create instance of new class.
1429 (Output_data_got_plt_x86_64::do_write): New function.
1430 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1431 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1436 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1437 if we have pubnames/pubtypes.
1441 * defstd.cc (in_segment): Define __ehdr_start here...
1442 * layout.cc (Layout::finalize): ...Instead of here. Set the
1443 output segment when known.
1444 * resolve.cc (Symbol::override_base_with_special): Remember
1445 the original binding.
1446 * symtab.cc (Symbol::set_output_segment): New function.
1447 (Symbol::set_undefined): New function.
1448 * symtab.h (Symbol::is_weak_undefined): Check original undef
1450 (Symbol::is_strong_undefined): New function.
1451 (Symbol::set_output_segment): New function.
1452 (Symbol::set_undefined): New function.
1453 * target-reloc.h (is_strong_undefined): Remove.
1454 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1455 Check for hidden undefs.
1456 (relocate_section): Call Symbol::is_strong_undefined.
1458 * testsuite/Makefile.am (ehdr_start_test_1)
1459 (ehdr_start_test_2, ehdr_start_test_3)
1460 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1461 * testsuite/Makefile.in: Regenerate.
1462 * testsuite/ehdr_start_def.cc: New source file.
1463 * testsuite/ehdr_start_test.cc: New source file.
1464 * testsuite/ehdr_start_test.t: New linker script.
1465 * testsuite/ehdr_start_test_4.sh: New shell script.
1470 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1474 * layout.cc (Layout::include_section): Allow a target to decide
1475 whether to include a section.
1476 * target.h (Target::should_include_section): New function.
1477 (Target::do_should_include_section): New function.
1481 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1483 (Copy_relocs::emit): ... here.
1484 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1485 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1486 (Copy_reloc_entry::entries_): Change from private to protected.
1490 * icf.cc (get_section_contents): Replace copies of reloc
1491 vectors with const references.
1495 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1496 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1497 * configure: Regenerate.
1498 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1499 -fno-use-linker-plugin.
1500 (LINK1, CXXLINK1): Add it to the link command.
1501 * testsuite/Makefile.in: Regenerate.
1505 * Makefile.in: Regenerate.
1509 * symtab.h (Symbol::set_nonvis): New function.
1513 * symtab.cc (Sized_symbol<32>::init_output_data):
1514 Instantiate the template.
1515 (Sized_symbol<64>::init_output_data): Likewise.
1519 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1520 adjust dynamic symbol value.
1521 * target.h (Target::adjust_dyn_symbol): New function.
1522 (Target::do_adjust_dyn_symbol): New function.
1526 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1527 Get the value of DYNAMIC_CUSTOM dynamic entry.
1528 * output.h (Output_data_dynamic::add_custom): New function.
1529 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1531 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1532 * target.h (Target::dynamic_tag_custom_value): New function.
1533 (Target::do_dynamic_tag_custom_value): New function.
1537 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1539 * target.h (Target::has_custom_set_dynsym_indexes): New function.
1540 (Target::do_has_custom_set_dynsym_indexes): New function.
1541 (Target::set_dynsym_indexes): New function.
1542 (Target::do_set_dynsym_indexes): New function.
1546 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1547 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1548 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1549 (Powerpc_relocate_functions::has_overflow_bitfield,
1550 overflowed): Use the above.
1551 (Target_powerpc::Relocate::relocate): Correct overflow checking
1552 for a number of relocations. Modify overflow test for 16-bit
1553 fields in instructions to signed/unsigned according to whether
1554 the field takes a signed or unsigned value.
1558 Update copyright years.
1562 * powerpc.cc (Target_powerpc::Scan::local, global): Support
1563 R_PPC64_ADDR64_LOCAL.
1564 (Target_powerpc::Relocate::relocate): Likewise.
1568 * dwp.cc (print_version): Update copyright year to current.
1572 * po/gold.pot: Regenerate.
1576 Fix problem where -u is ignored when a weak undef is seen.
1578 * archive.cc (Library_base::should_include_member): Reorder
1579 code to check for -u option if a weak undef has already been seen.
1580 * testsuite/Makefile.am (weak_undef_test_2): New test case.
1581 * testsuite/Makefile.in: Regenerate.
1582 * testsuite/weak_undef_file3.cc: New file.
1583 * testsuite/weak_undef_file4.cc: New file.
1584 * testsuite/weak_undef_test_2.cc: New file.
1588 Fix issues with gold undefined symbol diagnostics.
1591 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1593 * target-reloc.h (is_strong_undefined): New function.
1594 (relocate_section): Move undef vtable symbol check from here.
1595 Check for is_strong_undefined.
1599 Fix problems with the --dynamic-list option.
1602 * options.cc (General_options::parse_dynamic_list):
1603 Set have_dynamic_list_.
1604 (General_options::General_options): Initialize have_dynamic_list_.
1605 (General_options::finalize): Turn off -Bsymbolic and
1606 -Bsymbolic-functions if --dynamic-list provided.
1607 * options.h (General_options::have_dynamic_list): New function.
1608 (General_options::have_dynamic_list_): New data member.
1609 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1613 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1614 in --dynamic-list, mark it.
1616 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1617 (dynamic_list_2): New test case.
1618 * testsuite/Makefile.in: Regenerate.
1619 * testsuite/dynamic_list_2.cc: New file.
1620 * testsuite/dynamic_list_2.t: New file.
1621 * testsuite/dynamic_list_lib1.cc: New file.
1622 * testsuite/dynamic_list_lib2.cc: New file.
1623 * testsuite/gc_dynamic_list_test.c: New file.
1624 * testsuite/gc_dynamic_list_test.sh: New file.
1625 * testsuite/gc_dynamic_list_test.t: New file.
1629 Add .gdb_index version 7 support.
1631 * gold/dwarf_reader.cc: include <utility> (for make_pair).
1632 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1634 (Dwarf_ranges_table::read_ranges_table): Likewise.
1635 (Dwarf_pubnames_table::read_section): Check for GNU-style
1636 sections, and for compressed debug sections.
1637 (Dwarf_pubnames_table::read_header): Compute end address of table.
1638 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
1639 for end of list by offset, not by offset == 0.
1640 (Dwarf_info_reader::do_read_string_table): Check for compressed
1642 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1643 Initialize new data members.
1644 (Dwarf_pubnames_table::next_name): return flag_byte.
1645 (Dwarf_pubnames_table::end_of_table_): New data member.
1646 (Dwarf_pubnames_table::is_gnu_style_): New data member.
1647 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1648 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1649 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1650 read skeleton type unit DIEs.
1651 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1652 (Gdb_index::do_write): Write flag_byte.
1653 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1654 (Gdb_index::Cu_vector): Store flags along with cu indexes.
1655 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1656 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1660 * version.cc (print_version): Update copyright year to 2014.
1664 * stringpool.cc (Stringpool_template::reserve): Add
1665 HAVE_UNORDERED_MAP case.
1666 * stringpool.cc (Stringpool_template::print_stats): Likewise.
1670 * configure.ac: Check for <unordered_set> and <unordered_map>.
1671 * config.in: Regenerate.
1672 * configure: Regenerate.
1673 * system.h: Use <unordered_set> and <unordered_map> if available.
1677 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1678 with $(INSTALL_PROGRAM_ENV).
1679 * Makefile.in: Regenerate.
1683 * configure.ac: Add check for which library is needed for
1685 * configure: Regenerate.
1689 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1691 * testsuite/Makefile.in: Regenerate.
1695 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1696 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1697 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1698 (Target_x86_64<size>::Scan::local): Likewise.
1699 (Target_x86_64<size>::Scan::global): Likewise.
1700 (Target_x86_64<size>::Relocate::relocate): Likewise.
1701 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1703 (Target_x86_64<size>::Scan::check_non_pic(): Handle
1706 * testsuite/Makefile.am (check_PROGRAMS): Add
1707 exception_x86_64_bnd_test.
1708 (exception_x86_64_bnd_test_SOURCES): New macro.
1709 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1710 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1711 (exception_x86_64_bnd_test_LDADD): Likewise.
1712 (exception_x86_64_bnd_1.o): New rule.
1713 (exception_x86_64_bnd_2.o): Likewise.
1714 * testsuite/Makefile.in: Regenerated.
1718 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1720 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1721 Only call ppc64_local_entry_offset for 64-bit. Restrict
1722 symval_for_branch lookup to ELFv1.
1723 (Stub_table::add_plt_call_entry): Use unsigned int off.
1724 (Output_data_glink::Address, invalid_address): New.
1725 (Output_data_glink::add_eh_frame): Move out of line. Add
1727 (Output_data_glink::add_global_entry, find_global_entry,
1728 global_entry_address): New functions.
1729 (Output_data_glink::global_entry_stubs_, end_branch_table_,
1730 ge_size): New variables.
1731 (Output_data_glink::set_final_data_size): Add global entry
1733 (Output_data_glink::do_write): Write global entry stubs.
1734 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1735 parameter. Return true for ELFv2. Adjust callers.
1736 (Target_powerpc::Scan::local, global): Restrict opd lookup to
1737 ELFv1. Similarly for ifunc and dynamic relocation processing
1738 specific to ELFv1. Recognize that symbols are defined on
1739 their plt entries for ELFv2.
1740 (Target_powerpc::symval_for_branch): Assert if called for
1742 (Target_powerpc::Relocate::relocate): Use global entry plt
1743 stub for symbol value if such exists on ELFv2.
1744 (Target_powerpc::Relocate::relocate): Don't call
1745 symval_for_branch when ELFv2. Do adjust for local entry
1747 (Target_powerpc::do_dynsym_value): Set symbols to global entry
1749 (Target_powerpc::do_plt_address_for_global): Similarly.
1753 Revert patch -- this did not fix the problem, and there is
1759 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1760 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1761 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1762 updating fde_offsets_.
1763 (Eh_frame_hdr::lock_): New data member.
1767 * dwp.cc (Dwo_file_entry): New type.
1768 (File_list): Use Dwo_file_entry.
1769 (Dwo_file::verify): New function.
1770 (Dwo_file::verify_dwo_list): New function.
1771 (Dwo_file::sized_verify_dwo_list): New function.
1772 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1774 (Dwp_options): New enum type.
1775 (dwp_options): Add --verify-only.
1778 * dwp.h (gold_info): Add declaration.
1783 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1784 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1785 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1786 updating fde_offsets_.
1787 (Eh_frame_hdr::lock_): New data member.
1792 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1793 before reloc sections.
1797 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1798 (Symbol::needs_dynamic_reloc): Test new flag.
1799 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1800 (Target_powerpc::Scan::get_reference_flags): Add target param.
1801 Return FUNC_DESC_ABI for 64-bit ELFv1.
1802 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1804 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1805 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1809 Restore support for dwp v2 DWARF package file format.
1811 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1812 tu_length parameter. Adjust all callers.
1813 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1814 * dwp.cc: Include dwarf.h.
1815 (Section_bounds): New struct type.
1816 (Unit_set): New struct type.
1817 (Dwo_file::Dwo_file): Initialize new data member.
1818 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1819 Combine and rename to...
1820 (Dwo_file::read_unit_index): ...this.
1821 (Dwo_file::sized_read_compunit_index)
1822 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1823 (Dwo_file::sized_read_unit_index): ...this.
1824 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1825 parameters; add section_id parameter.
1826 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1827 (Dwo_file::add_unit_set): ...this.
1828 (Dwo_file::shndx_map_): Remove.
1829 (Dwo_file::sect_offsets_): New data member.
1830 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1831 (Dwp_output_file::add_section): Rename to...
1832 (Dwp_output_file::add_contribution): ...this.
1833 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1834 (Dwp_output_file::add_tu_set): Likewise.
1835 (Dwp_output_file::Contribution): New type.
1836 (Dwp_output_file::Section::contributions): New data member.
1837 (Dwp_output_file::Cu_or_tu_set): Remove.
1838 (Dwp_output_file::Section::Section): New ctor.
1839 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1840 (Dwp_output_file::Dwp_index::Section_table): New type.
1841 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1842 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1844 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1845 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1846 (Dwp_output_file::Dwp_index::section_table): New member function.
1847 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1848 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1849 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1850 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1851 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1852 (Dwp_output_file::Dwp_index::section_table_): New data member.
1853 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1854 (Dwp_output_file::add_output_section): New member function.
1855 (Dwp_output_file::write_new_section): New member function.
1856 (Dwp_output_file::write_contributions): New member function.
1857 (Dwp_output_file::section_id_map_): New data member.
1858 (class Dwo_id_info_reader): Remove.
1859 (class Unit_reader): New class.
1860 (get_dwarf_section_name): New function.
1861 (Dwo_file::read_executable): Adjust initializations of class data.
1862 (Dwo_file::read): Add support for v2 package file format.
1863 (Dwo_file::read_unit_index): Likewise.
1864 (Dwo_file::sized_read_unit_index): Likewise.
1865 (Dwo_file::copy_section): Likewise.
1866 (Dwo_file::add_unit_set): Likewise.
1867 (Dwp_output_file::add_output_section): Likewise.
1868 (Dwp_output_file::add_contribution): Likewise.
1869 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1871 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1873 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1875 (Dwp_output_file::initialize): Remove unused function.
1876 (Dwp_output_file::finalize): Add support for v2 package file format.
1877 (Dwp_output_file::write_index): Likewise.
1878 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1883 * configure.ac: Fix check for -fmerge-constants.
1884 * configure.ac: Regenerate.
1888 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1889 Correct 9-byte nop sequence to match what the assembler generates.
1893 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1894 ppc64_local_entry_offset, ppc64_local_entry_offset,
1895 do_read_symbols): New functions.
1896 (Powerpc_relobj::e_flags_, st_other_): New vars.
1897 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1898 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1899 (Powerpc_relobj::e_flags_): New var.
1900 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1901 and adjust for ELFv2.
1902 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1903 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1904 (Powerpc_dynobj::do_find_special_sections): Likewise.
1905 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1906 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1907 to ELFv2 local entry.
1908 (Target_powerpc::do_relax): No thread safe barriers needed for
1910 (Output_data_plt_powerpc::initial_plt_entry_size_,
1911 plt_entry_size): Delete. Replace all uses with
1912 first_plt_entry_offset() and plt_entry_size().
1913 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1914 reserved_size parm. Update callers.
1915 (Output_data_plt_powerpc::entry_count): Update.
1916 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1917 and use Target_powerpc::first_plt_entry_offset().
1918 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1919 rename to plt_entry_size.
1920 (Output_data_plt_powerpc::add_ifunc_entry,
1921 add_local_ifunc_entry): Adjust reloc for ELFv2.
1922 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1923 (glink_eh_frame_fde_64v2): New.
1924 (Stub_table::plt_call_size): Support ELFv2 sizing.
1925 (Output_data_glink::add_eh_frame): Use the new FDE.
1926 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1927 (Stub_table::do_write): Write ELFv2 stubs and glink.
1928 (Target_powerpc::Relocate::relocate): Replaces nop after call
1929 with ld 2,24(1) and adjust local offset destination for ELFv2.
1933 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1934 (Target_powerpc::Scan::global, local): Likewise.
1935 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
1936 on all ppc64 @h and @ha relocs.
1940 * output.h (Output_data_got::add_constant): Tidy.
1941 (Output_data_got::add_constant_pair): New function.
1942 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1943 methods used so as to first call reserve_ent().
1947 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1948 add_got_entry and add_got_entry_pair.
1950 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1951 (HAVE_PUBNAMES): Likewise.
1952 * configure: Regenerate.
1954 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1955 * testsuite/Makefile.in: Regenerate.
1957 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1958 Remove const from declaration.
1959 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1960 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1961 * output.h (Output_file_header): Remove const from member target_
1962 and corresponding constructor argument.
1963 * output.cc (Output_file_header::Output_file_header): Update prototype.
1964 (Output_file_header::do_sized_write): Use this->target_ in place
1965 of parameters()->target().
1967 * testsuite/undef_symbol.cc (Foo::get_a): New method.
1969 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1970 * configure: Regenerate.
1971 * Makefile.in: Regenerate.
1972 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1973 * testsuite/merge_string_literals_2.c: Likewise.
1974 * testsuite/Makefile.am
1975 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1976 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1977 literal -fmerge-constants.
1978 * testsuite/Makefile.in: Regenerate.
1980 * i386.cc (Target_i386): Remove unused member dynbss_.
1981 * arm.cc (Target_arm): Likewise.
1982 * powerpc.cc (Target_powerpc): Likewise.
1983 * sparc.cc (Target_sparc): Likewise.
1984 * tilegx.cc (Target_tilegx): Likewise.
1985 * x86_64.cc (Target_x86_64): Likewise.
1986 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1987 type_signature_, type_offset_.
1988 * plugin.h (Plugin_hook): Remove unused member layout_.
1989 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1991 (Read_member): Remove unused members input_objects_, symtab_,
1993 (Check_library): Remove unused member symtab_.
1994 * archive.h (Lib_group): Remove unused member lib_.
1995 * archive.cc (Lib_group::Lib_group): Update initializer.
1996 * incremental.h (Incremental_binary): Remove unused member target_.
1997 (Incremental_script_entry): Removed unused member script_.
1998 * layout.h (Write_symbols_task): Remove unused member input_objects_.
1999 * icf.h (Icf): Remove unused member num_tracked_relocs.
2001 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2002 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2004 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2006 * archive.h: Use struct rather than class for forward declaration
2007 of Read_symbols_data.
2012 * testsuite/Makefile.am (icf_test): Fix dependencies.
2013 (icf_safe_test): Likewise.
2014 (icf_safe_so_test): Likewise.
2015 (large_symbol_alignment): Add empty _LDADD rule.
2016 * testsuite/Makefile.in: Regenerate.
2021 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2022 relocation for R_X86_64_32 on x32.
2026 * output.cc (Output_segment::set_section_addresses): Take new
2027 Target* argument. If target->isolate_execinstr() and the segment
2028 is executable and starts at a target->abi_pagesize() boundary,
2029 pad its end out to a target->abi_pagesize() boundary with code fill.
2030 * output.h (Output_segment::set_section_addresses): Update decl.
2031 * layout.h (Layout::check_output_data_for_reset_values): Take new
2032 argument RELAX_OUTPUTS.
2033 (Layout): New member relax_output_list_.
2034 (Layout::add_relax_output): New method.
2035 * layout.cc (Layout::Layout): Update constructor.
2036 (Layout::reset_relax_output): New method.
2037 (Layout::clean_up_after_relaxation): Call it.
2038 (Layout::prepare_for_relaxation): Update caller.
2039 (Layout::set_segment_offsets): Update callers of set_section_addresses.
2040 Call reset_relax_output before re-processing segments for
2041 isolate_execinstr case.
2042 (Layout::write_data): Handle relax_output_list_.
2043 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2044 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
2049 * object.h: Fix typos.
2053 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2054 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2058 Revert support for v2 DWP files:
2062 Add dwp support for v2 DWARF package file format.
2063 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2064 tu_length parameter. Adjust all callers.
2065 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2066 * dwp.cc: Include dwarf.h.
2067 (Section_bounds): New struct type.
2068 (Unit_set): New struct type.
2069 (Dwo_file::Dwo_file): Initialize new data member.
2070 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2071 Combine and rename to...
2072 (Dwo_file::read_unit_index): ...this.
2073 (Dwo_file::sized_read_compunit_index)
2074 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2075 (Dwo_file::sized_read_unit_index): ...this.
2076 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2077 parameters; add section_id parameter.
2078 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2079 (Dwo_file::add_unit_set): ...this.
2080 (Dwo_file::shndx_map_): Remove.
2081 (Dwo_file::sect_offsets_): New data member.
2082 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2083 (Dwp_output_file::add_section): Rename to...
2084 (Dwp_output_file::add_contribution): ...this.
2085 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2086 (Dwp_output_file::add_tu_set): Likewise.
2087 (Dwp_output_file::Contribution): New type.
2088 (Dwp_output_file::Section::contributions): New data member.
2089 (Dwp_output_file::Cu_or_tu_set): Remove.
2090 (Dwp_output_file::Section::Section): New ctor.
2091 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2092 (Dwp_output_file::Dwp_index::Section_table): New type.
2093 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2094 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2096 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2097 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2098 (Dwp_output_file::Dwp_index::section_table): New member function.
2099 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2100 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2101 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2102 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2103 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2104 (Dwp_output_file::Dwp_index::section_table_): New data member.
2105 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2106 (Dwp_output_file::add_output_section): New member function.
2107 (Dwp_output_file::write_new_section): New member function.
2108 (Dwp_output_file::write_contributions): New member function.
2109 (Dwp_output_file::section_id_map_): New data member.
2110 (class Dwo_id_info_reader): Remove.
2111 (class Unit_reader): New class.
2112 (get_dwarf_section_name): New function.
2113 (Dwo_file::read_executable): Adjust initializations of class data.
2114 (Dwo_file::read): Add support for v2 package file format.
2115 (Dwo_file::read_unit_index): Likewise.
2116 (Dwo_file::sized_read_unit_index): Likewise.
2117 (Dwo_file::copy_section): Likewise.
2118 (Dwo_file::add_unit_set): Likewise.
2119 (Dwp_output_file::add_output_section): Likewise.
2120 (Dwp_output_file::add_contribution): Likewise.
2121 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2123 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2125 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2127 (Dwp_output_file::initialize): Remove unused function.
2128 (Dwp_output_file::finalize): Add support for v2 package file format.
2129 (Dwp_output_file::write_index): Likewise.
2130 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2135 * object.cc (Sized_relobj::do_output_section_address): New function.
2136 (Sized_relobj): Instantiate explicitly.
2137 * object.h (Object::output_section_address): New function.
2138 (Object::do_output_section_address): New function.
2139 (Sized_relobj::do_output_section_address): New function.
2140 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2145 * parameters.cc (Parameters::entry): Return target-specific entry
2147 * target.h (Target::entry_symbol_name): New function.
2148 (Target_info::entry_symbol_name): New data member.
2150 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2151 * i386.cc (Target_i386::i386_info): Likewise.
2152 (Target_i386_nacl::i386_nacl_info): Likewise.
2153 * sparc.cc (Target_sparc::sparc_info): Likewise.
2154 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2155 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2156 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2157 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2161 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2162 Convert parameter shndx to local variable. Add parameters symtab
2163 and symtab_size. Scan over section names. Find relocation
2164 section corresponding to current section. Create and initialize
2165 reloc_mapper_ and reloc_type_.
2166 (Dwarf_pubnames_table::read_header): Add assertion. Change
2167 unit_length to off_t. Initialize member unit_length_. Fill in field
2169 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2170 Initialize new fields unit_length_ and cu_offset_.
2171 (Dwarf_pubnames_table::read_section): Update prototype.
2172 (Dwarf_pubnames_table::cu_offset): New member function.
2173 (Dwarf_pubnames_table::subsection_size): Likewise.
2174 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2176 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2177 member functions public.
2178 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2179 Update comment. Rework logic. Move repeated parts to...
2180 (Gdb_index_info_reader::read_pubtable): ...here. New function.
2181 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2182 pubtypes_table_, and stmt_list_offset.
2183 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2184 Gdb_index::find_pubtype_offset,
2185 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2186 (Gdb_index::pubnames_read): Update prototype and rework logic.
2187 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2189 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2190 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2191 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2192 Gdb_index::map_pubtable_to_dies):
2194 (Gdb_index::pubnames_read): Update declaration.
2195 (Gdb_index::Pubname_offset_map): New type.
2196 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2197 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2198 Gdb_index::stmt_list_offset): Declare.
2199 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2200 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2201 Gdb_index::pubtypes_offset_): Remove.
2205 * options.h (General_options): Add -Trodata-segment option.
2206 * parameters.cc (Parameters::check_rodata_segment): New function.
2207 (Parameters::set_target_once): Call it.
2208 * parameters.h (Parameters): Declare it (private member function).
2209 * layout.cc (load_seg_unusable_for_headers): New function, broken
2210 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
2211 then validate rodata segment rather than text segment.
2212 (relaxation_loop_body): Call that.
2213 (is_text_segment): New function. Don't admit a non-executable
2214 segment if TARGET->isolate_execinstr().
2215 (set_segment_offsets): Call it. Honor -Trodata-segment option.
2220 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2221 * nacl.h (Sniff_file::View::View): Request aligned view.
2225 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2226 correct BRLT entry size.
2230 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2235 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2237 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2238 (Dwarf_ranges_table::lookup_reloc): New function.
2239 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2241 (Dwarf_ranges_table::lookup_reloc): New function.
2242 (Dwarf_ranges_table::reloc_type_): New data member.
2247 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2249 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2250 (Target_powerpc::do_relax): Call the above.
2254 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2255 on garbage collected .opd section.
2259 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2261 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2262 (Target_powerpc::do_function_location): Likewise for loc->shndx.
2266 * resolve.cc (Symbol::override_base): Don't override st_type
2267 from plugin placeholder symbols.
2268 (Symbol_table::resolve): Likewise.
2269 (Symbol_table::should_override): Don't complain about TLS mismatch
2270 if the TO symbol is a plugin placeholder.
2271 * testsuite/Makefile.am (plugin_test_tls): New test.
2272 * testsuite/Makefile.in: Regenerate.
2273 * testsuite/plugin_test_tls.sh: New test script.
2274 * testsuite/two_file_test_2_tls.cc: New test source.
2275 * testsuite/two_file_test_tls.cc: New test source.
2279 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2280 the maximum segment alignment is larger than the page size.
2281 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2282 correctly aligns the symbols with large alignemnt.
2283 * testsuite/Makefile.in: Regenerate.
2284 * testsuite/large_symbol_alignment.cc: New file.
2289 * options.h (sort_section): New option.
2290 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2291 Rename from Input_section_sort_section_name_special_ordering_compare.
2292 (Input_section_sort_section_name_compare): New struct.
2293 * output.cc (Output_section::Input_section_sort_section_name_compare::
2294 operator()): New function.
2295 (Output_section::sort_attached_input_sections): Use new sort function
2296 for .text if --sort-section=name is specified.
2297 * layout.cc (Layout::make_output_section):
2298 Add sorting by name when --sort-section=name is specified.
2299 * testsuite/Makefile.am (text_section_grouping): Test option
2300 --sort-section=name.
2301 * testsuite/Makefile.in: Regenerate.
2302 * testsuite/section_sorting_name.cc: New file.
2303 * testsuite/section_sorting_name.sh: New file.
2307 * symtab.h (Symbol::is_cxx_vtable): New function.
2308 * target-reloc.h (relocate_section): Check for vtable symbol.
2309 * testsuite/Makefile.am (missing_key_func.sh): New test case.
2310 * testsuite/Makefile.in: Regenerate.
2311 * testsuite/missing_key_func.cc: New test source.
2312 * testsuite/missing_key_func.sh: New test script.
2316 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2317 type of enclosing symbol.
2318 (Relocate_info::location): Check symbol type when describing symbol.
2319 * object.h (Symbol_location_info): Remove unused line_number;
2320 add enclosing_symbol_type.
2321 * testsuite/debug_msg.sh: Adjust expected output.
2325 * configure.ac: Export DEFAULT_TARGET.
2326 * configure: Regenerate.
2327 * Makefile.in: Regenerate.
2328 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2329 * testsuite/Makefile.in: Regenerate.
2330 * testsuite/debug_msg.sh: Delete duplicate tests.
2331 Don't check undef_int error message match for powerpc where the
2332 source file and line number aren't available.
2336 * options.h (General_options): Add --rosegment-gap option.
2337 * options.cc (finalize): --rosegment-gap implies --rosegment.
2338 * layout.cc (set_segment_offsets): Let user option override
2339 target->rosegment_gap().
2343 * options.h (General_options): Remove leading space from help
2344 messages for -nostdlib and --rosegment.
2349 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2353 * merge.cc (Output_merge_string::do_add_input_section): Correct
2354 scan for number of strings. Rename vars to avoid shadowing.
2355 Include missing terminator in input_size_.
2359 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2360 Restore empty string handling.
2364 * stringpool.cc (Stringpool_template::new_key_offset): Fix
2365 uninitialized warning.
2369 * output.cc (Output_section::add_merge_input_section): Allow
2370 to merge sections if the alignment is more than character size.
2371 * merge.h (Output_merge_string::Output_merge_string): Remove
2373 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2374 only not-null strings. Check the alignment of strings.
2376 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2377 alignment as the argument.
2378 (Stringpool_template<Stringpool_char>::addralign_): New class member.
2379 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2380 Align non-zero length strings according to the addralign_.
2381 (Stringpool_template<Stringpool_char>::set_string_offsets):
2382 Updating offsets according to the given alignment.
2383 * testsuite/Makefile.am (text_section_grouping): Test if string
2384 literals are getting merged.
2385 * testsuite/Makefile.in: Regenerate.
2386 * testsuite/merge_string_literals_1.c: New file.
2387 * testsuite/merge_string_literals_2.c: Ditto.
2388 * testsuite/merge_string_literals.sh: Ditto.
2392 * target-reloc.h (relocate_section): If the reloc offset is out of
2393 range, pass VIEW as NULL to relocate.relocate.
2394 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2395 * i386.cc (Target_i386::Relocate::relocate): Likewise.
2396 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2397 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2398 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2399 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2403 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2404 * layout.cc (Hash_task): New class.
2405 (Layout::queue_build_id_tasks): New function.
2406 (Layout::write_build_id): Handle single-thread portion of build ID
2407 computation. (In some cases, all of it is single-threaded.) Replace
2408 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2409 functionality in fewer lines of code.
2410 * layout.h (Layout::queue_build_id_tasks): New function declaration.
2411 * options.h (General_options): make "--build-id" default to tree
2412 rather than sha1. Add two new options related to --build-id=tree:
2413 --build-id-chunk-size-for-treehash and
2414 --build-id-min-file-size-for-treehash.
2415 * Makefile.am: add testing of --build-id=tree and related new options
2416 (these tests will be invoked by "make check").
2417 * Makefile.in: Regenerate.
2421 * configure.tgt: Add powerpcle and powerpc64le.
2426 * layout.cc (Layout::segment_precedes): Allow more than one
2427 segment with the same type and flags.
2431 * layout.cc (Layout::set_relocatable_section_offsets): Don't
2432 allocate space in file for BSS sections.
2436 * script-sections.cc (Orphan_output_section): Reset address
2437 to zero after each orphaned section for relocatable links.
2441 * symtab.cc (Symbol_table::sized_write_globals): Subtract
2442 section starting address for relocatable link.
2443 * testsuite/Makefile.am (script_test_11): New test.
2444 * testsuite/Makefile.in: Regenerate.
2445 * testsuite/script_test_11.c: New source file.
2446 * testsuite/script_test_11.t: New linker script.
2450 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2451 owner when sections are not adjacent and exceed group size.
2452 (Target_powerpc::group_sections): Handle corner case.
2453 (Target_powerpc::Branch_info::make_stub): Handle case where
2454 stub table doesn't exist due to branches in non-exec sections.
2455 (Target_powerpc::Relocate::relocate): Likewise.
2460 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2461 .branch_lt to match bfd ld. Adjust comments throughout file.
2466 * object.cc (do_layout_deferred_sections): Handle .eh_frame
2467 sections before checking whether they are included in the link.
2471 * archive.cc (Archive::get_elf_object_for_member): Create the elf
2472 object before calling the plugin claim_file handler. Pass the elf
2473 object of the archive to the plugin. Delete the elf object if the
2474 plugin claims the file.
2478 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2479 segment when omagic.
2483 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2485 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2486 uninitialized" warning.
2490 * symtab.h (Symbol::clear_version): New function.
2491 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2492 is_needed by weak references. Clear version for symbols defined
2493 in as-needed objects that are not needed.
2497 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2498 static and public. Add report_err param. Return false for data refs.
2499 (Target_powerpc::rela_dyn_section): New overloaded function.
2500 (Target_powerpc::plt_, iplt_): Elucidate.
2501 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2502 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2503 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2504 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2505 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2506 push_branch and make_plt_entry for ifunc syms when
2507 reloc_needs_plt_for_ifunc.
2508 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2509 for ifunc unless reloc_needs_plt_for_ifunc.
2513 * gc.h (gc_process_relocs): Don't look through function descriptors.
2514 * icf.cc (get_section_contents): Do so here instead.
2518 * powerpc.cc (is_branch_reloc): Forward declare.
2519 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2520 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2521 false for 64-bit, true for 32-bit non-branch relocs.
2522 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2523 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2525 (icf_safe_test): Generate linker map file as well as nm output.
2526 (icf_safe_so_test): Likewise.
2527 * testsuite/Makefile.in: Regenerate.
2528 * testsuite/icf_test.sh: Parse linker map file to determine
2530 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
2531 * testsuite/icf_safe_so_test.sh: Likewise.
2532 (X86_32_or_ARM_specific_safe_fold): Merge into..
2533 (arch_specific_safe_fold): ..this.
2534 (X86_64_specific_safe_fold): Delete unused function.
2538 * gc.h (gc_process_relocs): Look through function descriptors
2539 to determine shndx, symvalue and addend used by ICF. Tidy
2540 variable duplication.
2544 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2545 * layout.cc (Layout_task_runner::run): ..to here.
2546 * symtab.h (struct Symbol_location): Extract from..
2547 (class Symbol_table): ..here.
2548 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2549 * target.h (class Target): Add function_location and
2550 do_function_location functions.
2551 (class Sized_target): Add do_function_location.
2552 * object.h (class Sized_relobj_file): Move find_shdr..
2553 (class Object): ..to here.
2554 * object.cc: Likewise. Update to suit. Instantiate.
2555 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2556 * powerpc.cc (class Powerpc_dynobj): New.
2557 (Target_powerpc::do_function_location): New function.
2558 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2559 (Powerpc_dynobj::do_read_symbols): New function.
2560 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2564 * options.cc (General_options::string_to_object_format): Accept
2569 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2570 pointer to Post_fde.
2571 (struct Post_fde): Move definition to here..
2572 * ehframe.cc (struct Post_fde): ..from here.
2573 (Cie::write): Don't alloc Post_fde.
2574 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
2578 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2579 relocation referencing .LC0.
2580 * testsuite/discard_locals_test.sh: Remove FIXMEs.
2584 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2585 always_inline. Add assembly for powerpc to avoid GOT.
2589 * testsuite/script_test_10.sh: Don't test .bss section
2594 * powerpc.cc (class Powerpc_relobj): Move some member functions.
2595 (Target_powerpc::symval_for_branch): Add symtab param. Update
2596 all callers. Handle folded sections.
2597 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2599 (Global_symbol_visitor_opd::operator()): Likewise.
2603 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2604 * testsuite/Makefile.in: Regenerate.
2608 Add dwp support for v2 DWARF package file format.
2609 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2610 tu_length parameter. Adjust all callers.
2611 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2612 * dwp.cc: Include dwarf.h.
2613 (Section_bounds): New struct type.
2614 (Unit_set): New struct type.
2615 (Dwo_file::Dwo_file): Initialize new data member.
2616 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2617 Combine and rename to...
2618 (Dwo_file::read_unit_index): ...this.
2619 (Dwo_file::sized_read_compunit_index)
2620 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2621 (Dwo_file::sized_read_unit_index): ...this.
2622 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2623 parameters; add section_id parameter.
2624 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2625 (Dwo_file::add_unit_set): ...this.
2626 (Dwo_file::shndx_map_): Remove.
2627 (Dwo_file::sect_offsets_): New data member.
2628 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2629 (Dwp_output_file::add_section): Rename to...
2630 (Dwp_output_file::add_contribution): ...this.
2631 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2632 (Dwp_output_file::add_tu_set): Likewise.
2633 (Dwp_output_file::Contribution): New type.
2634 (Dwp_output_file::Section::contributions): New data member.
2635 (Dwp_output_file::Cu_or_tu_set): Remove.
2636 (Dwp_output_file::Section::Section): New ctor.
2637 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2638 (Dwp_output_file::Dwp_index::Section_table): New type.
2639 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2640 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2642 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2643 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2644 (Dwp_output_file::Dwp_index::section_table): New member function.
2645 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2646 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2647 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2648 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2649 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2650 (Dwp_output_file::Dwp_index::section_table_): New data member.
2651 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2652 (Dwp_output_file::add_output_section): New member function.
2653 (Dwp_output_file::write_new_section): New member function.
2654 (Dwp_output_file::write_contributions): New member function.
2655 (Dwp_output_file::section_id_map_): New data member.
2656 (class Dwo_id_info_reader): Remove.
2657 (class Unit_reader): New class.
2658 (get_dwarf_section_name): New function.
2659 (Dwo_file::read_executable): Adjust initializations of class data.
2660 (Dwo_file::read): Add support for v2 package file format.
2661 (Dwo_file::read_unit_index): Likewise.
2662 (Dwo_file::sized_read_unit_index): Likewise.
2663 (Dwo_file::copy_section): Likewise.
2664 (Dwo_file::add_unit_set): Likewise.
2665 (Dwp_output_file::add_output_section): Likewise.
2666 (Dwp_output_file::add_contribution): Likewise.
2667 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2669 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2671 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2673 (Dwp_output_file::initialize): Remove unused function.
2674 (Dwp_output_file::finalize): Add support for v2 package file format.
2675 (Dwp_output_file::write_index): Likewise.
2676 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2681 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2682 function into class definition in header file.
2683 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2684 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2686 (Dwarf_info_reader::check_buffer): Move here from .cc file.
2690 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2691 * target.cc (Target::do_plt_fde_location): New function.
2692 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2693 accessor function, and constructor param.
2694 (struct Post_fde, Post_fdes): Declare.
2695 (Cie::write): Add post_fdes param.
2696 * ehframe.cc (Fde::write): Use plt_fde_location.
2697 (struct Post_fde): Define.
2698 (Cie::write): Stash FDEs added post merge mapping.
2699 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2700 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
2701 (Eh_frame::do_sized_write): Arrange to write post map FDES after
2703 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2704 (Target_powerpc::has_glink): New function.
2705 (Target_powerpc::do_relax): Add eh_frame info for stubs.
2706 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2707 glink_eh_frame_fde_32, default_fde): New data.
2708 (Stub_table::eh_frame_added_): New var.
2709 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2711 (Stub_table::add_eh_frame): New function.
2712 (Output_data_glink::add_eh_frame): New function.
2713 (Target_powerpc::make_glink_section): Call add_eh_frame.
2717 * options.h (DEFINE_uint64_alias): Define.
2718 (class General_options): Add -Ttext-segment as an alias for
2723 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2724 (Stub_table::do_write): ..here, two places.
2725 (Stub_table::plt_call_size): Use it here too.
2729 * descriptors.cc (Descriptors::close_all): New function.
2730 * descriptors.h (class Descriptors): Declare close_all.
2731 (close_all_descriptors): New inline function.
2732 * plugin.cc: Include "descriptors.h".
2733 (Plugin_manager::cleanup): Call close_all_descriptors.
2737 * README: Update coding style link.
2741 * dwp.cc (File_list): New typedef.
2742 (Dwo_name_info_reader): New class.
2743 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2744 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2745 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2746 (Dwo_file::read_executable): New function.
2747 (Dwo_file::read): Move common setup code to ...
2748 (Dwo_file::make_object): ... here.
2749 (dwp_options): Add --exec/-e.
2755 * layout.cc (Layout::layout): Check for option text_reorder.
2756 (Layout::make_output_section): Ditto.
2757 * options.h (text_reorder): New option.
2758 * output.cc (Input_section_sort_compare): Remove special ordering
2761 Input_section_sort_section_name_special_ordering_compare::
2762 operator()): New function.
2763 (Output_section::sort_attached_input_sections): Use new sort function
2765 * output.h (Input_section_sort_section_name_special_ordering_compare):
2767 * testsuite/Makefile.am (text_section_grouping): Test option
2769 * testsuite/Makefile.in: Regenerate.
2770 * testsuite/text_section_grouping.sh: Check order of functions without
2771 default text reordering.
2775 * options.h (General_options): Change default to true for new_dtags.
2779 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2780 when enable_new_dtags is false. Only add DT_RUNPATH when
2781 enable_new_dtags is true.
2785 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2786 used in declaration and definition consistent.
2787 (Target_powerpc::symval_for_branch): Ditto.
2791 * testsuite/plugin_final_layout.cc: Fix comment.
2795 * layout.cc (Layout::layout): Do not do default sorting for
2796 text sections when section ordering is specified.
2797 (make_output_section): Ditto.
2798 * testsuite/plugin_final_layout.cc: Name the function sections
2799 to catch reordering issues.
2803 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2808 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2809 * testsuite/Makefile.in: Regenerate.
2813 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2814 * testsuite/Makefile.in: Regenerate.
2819 Fix mingw gold build with plugins enabled
2820 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2821 * configure.ac: Export DLOPEN_LIBS and add headers check.
2822 * plugin.cc: Handle non-dlfcn case.
2823 * Makefile.in: Regenerate.
2824 * config.in: Regenerate.
2825 * configure: Regenerate.
2826 * testsuite/Makefile.in: Regenerate.
2830 * output.h (sort_attached_input_sections): Change to be public.
2831 * script-sections.cc
2832 (Output_section_definition::set_section_addresses): Sort
2833 attached input sections according to section order before linker
2834 script assigns section addresses.
2835 (Orphan_output_section::set_section_addresses): Sort
2836 attached input sections according to section order before linker
2837 script assigns section addresses.
2838 * Makefile.am (final_layout.sh): Use a simple linker script to
2839 check if section ordering still works.
2840 * Makefile.in: Regenerate.
2844 * arm.cc (Target_arm::attributes_accept_div): New function.
2845 (Target_arm::attributes_forbid_div): New function.
2846 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2847 attribute using the same new functions as what bfd/elf32_arm.c
2853 * output.cc (Output_section::add_input_section): For incremental
2854 updates, don't track input sections that are allocated from patch
2861 * configure.ac (--enable-ld): Removed.
2862 (install_as_default): Set to yes only for --enable-gold=default
2864 * configure: Regenerated.
2868 * options.h (General_options): Add -fuse-ld= for GCC linker
2869 option compatibility.
2873 * configure.ac: Fix typo restoring CXXFLAGS.
2874 * configure: Regenerate.
2878 * testsuite/Makefile.am (CXXLINK_S): New macro.
2879 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2880 * testsuite/Makefile.in: Regenerate.
2884 * version.cc (print_version): Update copyright year to 2013.
2888 * layout.cc (Layout::special_ordering_of_input_section): New
2890 (Layout::layout): If input section requires special ordering, must
2891 sort input sections.
2892 (Layout::make_output_section): May sort .text input sections.
2893 (Layout::is_section_name_prefix_grouped): Remove.
2894 * layout.h (class Layout): Declare
2895 special_ordering_of_input_section. Don't declare
2896 is_section_name_prefix_grouped.
2897 * output.cc (Output_section::add_input_section): Revert last
2899 (Output_section::Input_section_sort::match_file_name): Don't crash
2900 if called on output section data.
2901 (Output_section::Input_section_sort_compare): Sort based on
2903 (Output_section::Input_section_sort_section_order_index_compare):
2905 (Output_section::sort_attached_input_sections): Likewise.
2909 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2910 * layout.h (Layout::is_section_name_prefix_grouped): New function.
2911 * output.cc (Output_section::add_input_section): Check if section
2912 name contains special prefix. Keep input sections to sort such
2914 (Output_section::Input_section_sort_section_order_index_compare
2915 ::operator()): Group sections according to prefixes.
2916 (Output_section::sort_attached_input_sections): Add condition to
2917 Input_section_entry constructor call.
2918 * testsuite/Makefile.am (text_section_grouping): New test.
2919 * testsuite/Makefile.in: Regenerate.
2920 * testsuite/text_section_grouping.cc: New file.
2921 * testsuite/text_section_grouping.sh: New file.
2925 * Makefile.am: Add copyright notice.
2928 * configure.ac: Likewise.
2929 * ftruncate.c: Likewise.
2930 * Makefile.in: Regenerate.
2934 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2935 --no-as-needed flag.
2936 (exception_separate_shared_12_test): Likewise.
2937 (incremental_copy_test): Likewise.
2938 * testsuite/Makefile.in: Regenerate.
2942 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2943 (Dwp_output_file::Dwp_index::enter_set): Add assert.
2947 * powerpc.cc (class Track_tls): New.
2948 (class Relocate, class Scan): Inherit Track_tls.
2949 (Target_powerpc::Scan::local, global): Track tls optimization
2950 and avoid creating plt entry for __tls_get_addr if all uses
2952 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2956 * options.h (General_options): Add --toc-sort/--no-toc-sort.
2957 Replace no_toc_optimize with toc_optimize.
2958 * output.h (Output_section::input_sections): Provide non-const variant.
2959 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2960 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2962 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2963 (class Sort_toc_sections): New.
2964 (Target_powerpc::do_finalize_sections): Sort toc sections.
2965 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2969 * testsuite/binary_unittest.cc (read_all): New function.
2970 (Sized_binary_test): Use it instead of ::read.
2971 * fileread.cc (do_read): Don't assume pread always reads the whole
2972 amount in a single call.
2976 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2977 Set EM_PPC64 or EM_PPC here.
2978 (Target_selector_powerpc::do_recognize): Delete.
2982 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2984 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2988 * testsuite/binary_unittest.cc (Sized_binary_test):
2989 Use open_descriptor rather than ::open.
2993 * powerpc.cc (Stub_table::do_write): Delete redundant Address
2994 typedef and invalid_address constant.
2995 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2996 instantiate constants.
3000 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3001 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3002 * aclocal.m4: Regenerate.
3003 * configure: Regenerate.
3004 * Makefile.in: Regenerate.
3005 * testsuite/Makefile.in: Regenerate.
3009 * options.h (General_options): Add no_toc_optimize.
3010 * powerpc.cc (ok_lo_toc_insn): New function.
3011 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3015 * options.h (General_options): Add plt_align, plt_static_chain,
3016 plt_thread_safe. Update stub_group_size help text.
3017 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3018 for new plt_thread_safe_ var.
3019 (use_plt_offset): Correct comments.
3020 (Target_powerpc::do_relax): Look for thread creation symbols to
3021 determine default plt_thread_safe value. Clear plt call stubs
3022 as well as branch stubs each iteration.
3023 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3025 (l, hi, ha, write_insn): Move earlier.
3026 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3027 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3029 (Stub_table::update_size): Adjust.
3030 (Stub_table::prev_size, set_prev_size): Delete.
3031 (Stub_table::stub_align): Let --plt-align affect result.
3032 (Stub_table::plt_call_size): Calculate sizes for various stubs.
3033 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3034 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3035 (Stub_table::do_write): Support more stub variants.
3039 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3040 (Target_powerpc::do_define_standard_symbols): New function.
3044 * output.h: Formatting, whitespace.
3048 * layout.h (Layout::get_executable_sections): Declare.
3049 * layout.cc (Layout::get_executable_sections): New function.
3050 * arm.cc (Target_arm::group_sections): Use it.
3051 (Arm_output_section::group_sections): Delete now redundant test.
3052 * output.cc (Output_reloc::Output_reloc): Add is_relative.
3053 param to handle relative relocs.
3054 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3055 (Output_data_reloc::add_absolute): Adjust.
3056 (Output_data_reloc::add_relative): New function.
3057 (Output_data::reset_data_size): New function.
3058 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3059 (Output_section::set_addralign): New function.
3060 (Output_section::checkpoint_set_addralign): New function.
3061 (Output_section::clear_section_offsets_need_adjustment): New function.
3062 (Output_section::input_sections): Make public.
3063 * powerpc.cc (class Output_data_brlt_powerpc): New.
3064 (class Stub_table, class Stub_control): New.
3065 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3066 stub_table_, set_stub_table, stub_table): New vectors and accessor
3068 (Target_powerpc::do_may_relax, do_relax, push_branch,
3069 new_stub_table, stub_tables, brlt_section, group_sections,
3070 add_branch_lookup_table, find_branch_lookup_table,
3071 write_branch_lookup_table, make_brlt_section): New functions.
3072 (Target_powerpc::struct Sort_sections, class Branch_info): New.
3073 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3074 branch_info_): New vars.
3075 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3076 make call stubs here.
3077 (Output_data_glink): Remove all call stub handling from this class.
3078 (Target_powerpc::Scan::local, global): Save interesting branch
3079 relocs and relocs for ifunc. Adjust calls to plt entry functions.
3080 (Target_powerpc::do_finalize_sections): Only make reg save/restore
3081 functions on final link.
3082 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3083 Handle long branch destinations too.
3084 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3085 do_plt_address_for_local): Adjust lookup of plt call stubs.
3089 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3090 relocs against protected symbols when building 32-bit shared libs.
3094 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3095 param. Call got_section() to make .got. Update all callers
3096 and their callers and so on.
3100 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3101 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3102 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3103 value if it already exists.
3108 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3112 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3113 than bfc instruction for data sandboxing.
3117 * po/POTFILES.in: Regenerate.
3121 * configure.ac: Apply 2012-09-10 change to config.in here.
3122 * configure: Regenerate.
3126 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3127 (struct Opd_ent): Use "Address" rather than "Offset".
3128 (Output_data_got_powerpc::got_base_offset): Return Valtype.
3129 (Target_powerpc::got_section): Make public.
3130 (Target_powerpc::scan_relocs): Move code setting symbols..
3131 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3132 Create _SDA_BASE_ only when referenced.
3136 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3141 * target.h (Sized_target::relocate_relocs): Use Elf_Off
3142 for offset_in_output_section parameter.
3143 (Sized_target::relocate_special_relocatable): Likewise.
3144 * arm.cc (Target_arm::relocate_relocs): Likewise.
3145 (Target_arm::relocate_special_relocatable): Likewise.
3146 * i386.cc (Target_i386::relocate_relocs): Likewise.
3147 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3148 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3149 * target-reloc.h (relocate_relocs): Likewise.
3150 * testsuite/testfile.cc (Target_test): Likewise.
3151 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3152 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3154 * system.h: Move inclusion of <clocale> to after <libintl.h> in
3155 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3157 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3158 parameter, which is unused in the [!F_SETFD] case.
3160 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3161 SYMNDX to off_t before comparing it to this->data_size().
3162 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3163 * incremental.cc (Output_section_incremental_inputs::do_write):
3164 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3166 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3170 * gold.cc (Target_arm::do_adjust_elf_header): Add the
3171 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3176 * dwp.cc (usage): Add file and exit status parameters;
3177 add --help and --version options.
3178 (print_version): New function.
3179 (main): Add --help and --version options.
3183 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3184 final_layout_sequence.txt.
3185 * testsuite/Makefile.in: Regenerated.
3189 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3190 COMPILE generated by automake.
3192 (CXXCOMPILE1): Likewise.
3193 (CXXLINK1): Likewise.
3194 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3196 (CXXCOMPILE): Likewise.
3197 (CXXLINK): Likewise.
3198 * testsuite/Makefile.in: Regenerated.
3202 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3203 on bad fwrite return.
3207 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3212 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3213 * testsuite/Makefile.in: Regenerate.
3214 * testsuite/dwp_test.h: New source file.
3215 * testsuite/dwp_test_1.cc: New source file.
3216 * testsuite/dwp_test_1.s: New source file.
3217 * testsuite/dwp_test_1.sh: New source file.
3218 * testsuite/dwp_test_1b.cc: New source file.
3219 * testsuite/dwp_test_1b.s: New source file.
3220 * testsuite/dwp_test_2.cc: New source file.
3221 * testsuite/dwp_test_2.s: New source file.
3222 * testsuite/dwp_test_2.sh: New source file.
3223 * testsuite/dwp_test_main.cc: New source file.
3224 * testsuite/dwp_test_main.s: New source file.
3228 * dwp.h: New header file.
3229 * dwp.cc: New source file.
3230 * gold.h: Move shared declarations to system.h.
3231 * system.h: New header file.
3232 * Makefile.am: Add dwp.
3233 * Makefile.in: Regenerate.
3237 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3238 Dwarf_info_reader::read_from_pointer.
3239 (Dwarf_pubnames_table::read_header): Likewise.
3240 (Dwarf_pubnames_table::next_name): Likewise.
3241 (Dwarf_die::read_attributes): Likewise.
3242 (Dwarf_die::skip_attributes): Likewise.
3243 (Dwarf_info_reader::read_from_pointer): New function template.
3244 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3245 (Dwarf_pubnames_table): Likewise.
3246 (Dwarf_info_reader::read_from_pointer): New function template.
3247 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3248 Dwarf_pubnames_table ctor.
3252 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3254 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3256 (Dwarf_info_reader::set_abbrev_shndx): New method.
3257 (Dwarf_info_reader::abbrev_shndx_): New data member.
3261 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3262 from object, not parameters.
3263 (Dwarf_info_reader::parse): Likewise.
3264 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3265 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3266 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3271 * fileread.cc (Input_file::Input_file): New constructor.
3272 * fileread.h (class Input_file): Add new constructor.
3277 * object.cc (Relobj::is_section_name_included): Also match
3278 .sdata personality section.
3282 * target-reloc.h (class Default_comdat_behavior): New, package up..
3283 (get_comdat_behaviour): ..this.
3284 (relocate_section): Add Relocate_comdat_behavior template arg,
3285 adjust code to suit.
3286 * arm.cc (Target_arm::relocate_section): Adjust to suit.
3287 (Target_arm::scan_reloc_section): Likewise.
3288 * i386.cc (Target_i386::relocate_section): Likewise.
3289 * sparc.cc (Target_sparc::relocate_section): Likewise.
3290 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3291 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3292 * powerpc.cc (class Relocate_comdat_behavior): New.
3293 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
3294 gold::relocate_section with new template arg.
3298 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3299 dynamic relocs for GOT_TPREL got entries, without symbol if
3301 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3302 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3303 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3308 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3312 * layout.cc (Layout::include_section): Keep sections marked
3313 SHF_EXCLUDE when doing relocatable links.
3317 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3318 (Target_powerpc::do_finalize_sections): Call it.
3319 (Output_data_save_res): New class and supporting functions.
3320 (Target_powerpc::symval_for_branch): Only look up .opd entry for
3321 normal symbols defined in object files.
3325 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3326 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
3327 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3328 section if scan_opd_relocs not yet called.
3329 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3333 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3334 add_local_ifunc_entry): Revert last change.
3335 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3339 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3340 do_plt_address_for_global): New functions.
3341 (Output_data_got_powerpc::do_write): Don't segfault when linking
3343 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3344 add_local_ifunc_entry): Return true on adding entry..
3345 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3346 glink->add_entry call. Remove unused symtab param. Adjust calls.
3347 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3348 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
3349 set up symbols here.
3350 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3351 syms here. Do so even when no .iplt. Don't segfault when linking
3353 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
3354 new variants without reloc param.
3355 (Glink_sym_ent::Glink_sym_ent): Likewise.
3356 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3357 reloc when refs will resolve to plt call stub.
3358 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
3359 R_PPC_PLTREL24 to resolve locally.
3360 (Target_powerpc::Scan::global): Correct ifunc handling.
3361 (Target_powerpc::Relocate::relocate): Correct local sym glink
3362 lookup. Don't destroy "value" when we have a plt call stub,
3363 and when checking plt call validity.
3364 (Target_powerpc::do_dynsym_value): Simplify.
3368 * i386.cc (Output_data_plt_i386::address_for_global,
3369 address_for_local): Add plt offset to returned value. Adjust uses.
3370 * sparc.cc (Output_data_plt_sparc::address_for_global,
3371 address_for_local): Likewise.
3372 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3373 address_for_local): Likewise.
3374 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3375 address_for_local): Likewise.
3376 * target.h (Target::plt_address_for_global, plt_address_for_local):
3378 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3379 (Output_data_got::Got_entry::write): Nor here.
3380 * output.h: Comment fix.
3384 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3385 global_offset_table_ value for larget got.
3386 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3390 * powerpc.cc (Target_powerpc::iplt_): New output section.
3391 (Target_powerpc::iplt_section, make_iplt_section,
3392 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3393 (Target_powerpc::make_plt_entry): Handle ifunc syms.
3394 Target_powerpc::plt_entry_count): Count iplt entries too.
3395 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3396 reloc section in constructor. New params.
3397 (Target_powerpc::make_plt_section): Create reloc section here instead.
3398 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3400 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3401 (Output_data_glink::add_entry, find_entry): New functions to
3402 deal with local syms.
3403 (Glink_sym_ent): Add support for local syms.
3404 (Output_data_glink::do_write): Handle ifunc plt entries.
3405 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3406 (Target_powerpc::Scan::local, global): Handle ifunc syms.
3407 (Target_powerpc::Relocate::relocate): Likewise.
3408 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3412 * object.h (Sized_relobj_file::adjust_local_symbol,
3413 do_adjust_local_symbol): New functions.
3414 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3415 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3416 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3417 and irregular opd entry spacing.
3418 (Powerpc_relobj::do_read_relocs): Add opd size checks.
3419 (Global_symbol_visitor_opd): New functor.
3420 (Target_powerpc::do_finalize_sections): Omit global symbols defined
3421 on deleted opd entries.
3425 * tilegx.cc: New file.
3426 * Makefile.am (TARGETSOURCES): Add tilegx.cc
3427 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3428 * configure.tgt: Add entries for tilegx*.
3429 * configure.ac: Likewise.
3430 * Makefile.in: Rebuild.
3431 * configure: Likewise.
3432 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3437 * target-reloc.h (scan_relocs): Call scan.local for relocs
3438 against symbols in discarded sections. Pass is_discarded
3440 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3441 Add is_discarded param.
3442 * powerpc (Target_powerpc::Scan::local): Likewise. Use
3443 is_discarded to flag opd entry as discarded. Don't emit dyn
3444 relocs on such entries.
3445 (Target_powerpc::Scan::global): Similarly detect and handle
3447 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3448 opd_ent_. Update all uses.
3449 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3450 (Target_powerpc::relocate_section): Zero out discarded opd
3456 * output.cc: Rename Output_data_got template parameter from size
3457 to got_size for all functions. Compile all variants of
3459 (Output_data_got::Got_entry::write): Correct use of size for
3460 symbol value. Use local_is_tls rather than casting to
3462 * object.h (class Object): Add local_is_tls and do_local_is_tls.
3463 (class Sized_relobj_file): Add do_local_is_tls.
3464 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3469 * layout.cc (Layout::set_segment_offsets): When using
3470 common-page-size alignment, ensure we are on a new max-page-size
3472 * output.cc (Output_segment::set_section_addresses): Use
3473 abi_pagesize, not common_pagesize for relro boundary.
3474 (Output_segment::set_offset): Likewise.
3478 * output.h (Output_data_got::add_global_tls, add_local_tls,
3479 add_local_tls_pair): New functions.
3480 (Output_data_got::add_local_pair_with_rel): Remove second
3481 reloc param. Expand comment.
3482 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3483 use_plt_or_tls_offset_, similarly for constructor param.
3484 (Output_data_got::Got_entry::write): Add got_index param.
3485 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3486 add_local_tls_pair): New functions.
3487 (Output_data_got::Got_entry::write): Handle tls symbols
3488 with use_plt_or_tls_offset_ set specially.
3489 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3490 (Output_data_got::do_write): Replace iterator with index, pass
3491 index to entry write function.
3492 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3493 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3494 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3496 * i386.cc (Target_i386::Scan::local): Likewise.
3497 * sparc.cc (Target_sparc::Scan::local): Likewise.
3498 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3499 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3500 do_tls_offset_for_global): New functions.
3501 (Target_powerpc::Scan::local): Correct TLS relocations and got
3503 (Target_powerpc::Scan::global): Don't emit unnecessary
3504 dynamic relocations on TLS GOT entries.
3508 * config.in: Disable sanity check for kfreebsd.
3512 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3513 (Gdb_index::pubtypes_read): New parameter.
3514 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3516 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3521 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3522 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3523 * gc.h (gc_process_relocs): Call target gc_add_reference.
3524 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3525 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3526 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3528 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3529 to cater for when we don't need code offset. Update use.
3530 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3531 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3532 set_opd_valid): New functions.
3533 (Target_powerpc::do_gc_add_reference): New function.
3534 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3536 (Target_powerpc::do_gc_mark_symbol): New function.
3540 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3541 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3542 (Dwarf_die::skip_attributes): Likewise.
3543 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3544 * testsuite/gdb_index_test.cc (inline_func_1): New function.
3546 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3550 * testsuite/script_test_3.t: Add .got.plt output section
3552 * testsuite/script_test_4.t: Likewise.
3556 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3557 update all uses and lose "enum" when using type.
3561 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3562 * configure: Regenerate.
3563 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3564 (plugin_final_layout.stdout): Likewise.
3565 (memory_test): Set page sizes to 0x1000.
3566 * testsuite/Makefile.in: Regenerate.
3567 * testsuite/discard_locals_test.sh: Add FIXME comment.
3568 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3569 * testsuite/pr14265.t: Add .got output section statement.
3570 * testsuite/script_test_2.t: Likewise.
3571 * testsuite/script_test_3.t: Likewise.
3572 * testsuite/script_test_4.t: Likewise.
3573 * testsuite/script_test_5.t: Likewise.
3574 * testsuite/script_test_6.t: Likewise.
3575 * testsuite/script_test_7.t: Likewise.
3576 * testsuite/script_test_9.t: Likewise.
3580 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3581 (Powerpc_relocate_functions::Status): New typedef.
3582 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3583 (Target_powerpc::Scan::local): Handle REL64.
3584 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3585 for REL32 and REL64.
3586 (Target_powerpc::symval_for_branch): New function, extracted from..
3587 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
3588 checks. Report overflow errors.
3592 * object.h (Sized_relobj_file::emit_relocs): Delete.
3593 (Sized_relobj_file::emit_relocs_reltype): Delete.
3594 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3595 relocate_relocs for --emit-relocs.
3596 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3597 * output.h: Update comment.
3598 (Output_segment::first_section): New function.
3599 (Output_segment::first_section_load_address): Use first_section.
3600 * output.cc (Output_segment::first_section): New function extracted..
3601 (Output_segment::first_section_load_address): ..from here. Delete.
3602 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3603 * target.h (Sized_target::relocate_for_relocatable): Likewise.
3604 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3605 adjust call to target.h function.
3606 * i386.cc (Target_i386): Likewise.
3607 * sparc.cc (Target_sparc): Likewise.
3608 * x86_64.cc (Target_x86_64): Likewise.
3609 * powerpc.cc (Target_powerpc): Likewise.
3610 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
3611 first tls section has section symbol for optimised local dynamic
3613 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3614 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3616 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3617 Rename to relocate_relocs. Update error message.
3621 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3626 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3627 (Powerpc_relobj::toc_base_offset): New stub function.
3628 (Target_powerpc): Add tp_offset, dtp_offset. Rename
3629 got_mod_index_offset to tlsld_got_offset. Update all refs.
3630 (Target_powerpc::Relocate::enum skip_tls): New.
3631 (Target_powerpc::call_tls_get_addr_): New var.
3632 (Target_powerpc::is_branch_reloc): Move to file scope.
3633 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3634 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3636 (Target_powerpc::enum Got_type): Delete old values, add new ones.
3637 (powerpc_info): Correct common_pagesize for ppc64.
3638 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3639 (Powerpc_relocate_functions): Add overflow check enums and functions.
3640 Add non-shift version of rela, rela_ua. Delete all rel public
3641 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
3642 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3643 addr16_ha3, addr14 functions.
3644 (Output_data_got_powerpc::add_constant_pair): New function.
3645 (Output_data_got_powerpc::got_base_offset): Likewise.
3646 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3647 (instruction constants): Sort, add some more.
3648 (Output_data_glink::do_write): Add and use Address typedef. Use
3649 object->toc_base_offset() stub for 64-bit.
3650 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3651 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3652 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3653 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
3654 Always treat .opd relocs as against locally defined symbol.
3655 Correct condition for RELATIVE relocs.
3656 (Target_powerpc::do_finalize_sections): Test for NULL sections.
3657 (Target_powerpc::Relocate::relocate): Use plt call stub as value
3658 for 32-bit syms with a plt entry. Correct ppc64 toc base
3659 calculations. Handle TLS relocs, and more. Add overflow
3660 checking and adjust for Powerpc_relocate_functions changes.
3661 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3662 Reinstate --emit-relocs code with FIXME.
3666 * layout.cc (Layout::set_segment_offsets): Set p_align to
3667 abi_pagesize, not common_pagesize.
3668 (Layout::relaxation_loop_body): Similarly use abi_pagesize
3669 to determine whether file header can go in segment.
3673 * output.h (Output_reloc::Output_reloc <output section>): Add
3674 is_relative param. Adjust calls.
3675 (Output_reloc::add_output_section_relative): New functions.
3676 * output.cc (Output_reloc::Output_reloc <output section>): Handle
3678 (Output_reloc::symbol_value): Handle SECTION_CODE.
3682 * gold.cc (queue_middle_tasks): Call layout again when unique
3683 segments for sections is desired.
3684 * layout.cc (Layout::Layout): Initialize new members.
3685 (Layout::get_output_section_flags): New function.
3686 (Layout::choose_output_section): Call get_output_section_flags.
3687 (Layout::layout): Make output section for mapping to a unique segment.
3688 (Layout::insert_section_segment_map): New function.
3689 (Layout::attach_allocated_section_to_segment): Make unique segment for
3690 output sections marked so.
3691 (Layout::segment_precedes): Check for unique segments when sorting.
3692 * layout.h (Layout::Unique_segment_info): New struct.
3693 (Layout::Section_segment_map): New typedef.
3694 (Layout::insert_section_segment_map): New function.
3695 (Layout::get_output_section_flags): New function.
3696 (Layout::is_unique_segment_for_sections_specified): New function.
3697 (Layout::set_unique_segment_for_sections_specified): New function.
3698 (Layout::unique_segment_for_sections_specified_): New member.
3699 (Layout::section_segment_map_): New member.
3700 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3701 Rename is_gc_pass_one to is_pass_one.
3702 Rename is_gc_pass_two to is_pass_two.
3703 Rename is_gc_or_icf to is_two_pass.
3704 Check for which pass based on whether symbols data is present.
3705 Make it two pass when unique segments for sections is desired.
3706 * output.cc (Output_section::Output_section): Initialize new
3708 * output.h (Output_section::is_unique_segment): New function.
3709 (Output_section::set_is_unique_segment): New function.
3710 (Output_section::is_unique_segment_): New member.
3711 (Output_section::extra_segment_flags): New function.
3712 (Output_section::set_extra_segment_flags): New function.
3713 (Output_section::extra_segment_flags_): New member.
3714 (Output_section::segment_alignment): New function.
3715 (Output_section::set_segment_alignment): New function.
3716 (Output_section::segment_alignment_): New member.
3717 (Output_segment::Output_segment): Initialize is_unique_segment_.
3718 (Output_segment::is_unique_segment): New function.
3719 (Output_segment::set_is_unique_segment): New function.
3720 (Output_segment::is_unique_segment_): New member.
3721 * plugin.cc (allow_unique_segment_for_sections): New function.
3722 (unique_segment_for_sections): New function.
3723 (Plugin::load): Add new functions to transfer vector.
3724 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3725 * Makefile.in: Regenerate.
3726 * testsuite/plugin_final_layout.sh: Check if unique segment
3727 functionality works.
3728 * testsuite/plugin_section_order.c (onload): Check if new interfaces
3730 (allow_unique_segment_for_sections): New global.
3731 (unique_segment_for_sections): New global.
3732 (claim_file_hook): Call allow_unique_segment_for_sections.
3733 (all_symbols_read_hook): Call unique_segment_for_sections.
3737 * layout.cc (Layout::include_section): Don't assert on GROUP
3738 sections with --emit-relocs.
3742 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3743 if --export-dynamic-symbol names an undef symbol.
3747 * powerpc.cc: Formatting and white space.
3748 (Powerpc_relobj): Rename got2_section_ to special_.
3749 Add opd_ent_shndx_ and opd_ent_off_ vectors.
3750 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3751 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3752 (Target_powerpc): Add Address typedef and invalid_address. Use
3754 (Target_powerpc::is_branch_reloc): New function.
3755 (Powerpc_relocate_functions): Add Address typedef, use throughout.
3756 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3757 for dst_mask, value and addend.
3758 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3759 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3760 (Output_data_glink::do_write): Correct toc base. Don't try to use
3761 uint16_t for 24-bit offset. Use get_output_section_offset and
3763 (Target_powerpc::Scan::local): Handle more relocs.
3764 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3765 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3766 Plug in toc restoring insn after plt calls. Translate branches
3767 to function descriptor symbols to corresponding entry point.
3768 (Target_powerpc::relocate_for_relocatable): Check return from
3769 get_output_section_offset.
3770 * symtab.h: Comment typo.
3774 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3775 unsupported_relocal_local to call unsupported_reloc_global.
3780 * script-sections.cc (Sections_element::output_section_name): Add
3781 keep return parameter.
3782 (Output_section_element::match_name): Add keep return parameter.
3783 Return the value of the keep_ member.
3784 * script-sections.h (class Output_section): Update
3785 output_section_name prototype.
3786 * layout.cc (Layout::keep_input_section): New public member
3788 (Layout::choose_output_section): Pass keep parameter to
3789 output_section_name.
3790 * layout.h (class Layout): Add keep_input_section.
3791 * object.cc (Sized_relobj_file::do_layout): Check for kept input
3793 * testsuite/Makefile.am: Add a test.
3794 * testsuite/Makefile.in: Regenerate.
3795 * testsuite/pr14265.c: Source file for the test.
3796 * testsuite/pr14265.t: Linker script for the test.
3797 * testsuite/pr14265.sh: Shell script for the test.
3801 * target.h (Target::output_section_name): New function.
3802 (Target::do_output_section_name): New function.
3803 * layout.cc (Layout::choose_output_section): Call the above.
3804 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3808 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3809 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3810 for replace_constant call.
3811 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3812 (Output_data_glink::do_print_to_mapfile): New function.
3813 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3814 (Target_powerpc::Relocate::relocate): Likewise.
3818 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3819 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3820 (Output_data_glink::add_entry,find_entry): Remove shndx param.
3821 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
3822 all references to shndx_. Handle special case for R_PPC_PLTREL24
3824 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3825 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3826 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3828 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3829 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3833 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
3834 (glink insn constants): Use uint32_t.
3835 (Output_data_glink::add_entry): Use insert, not [] operator.
3839 * object.h (Sized_relobj_file::find_shdr): New function.
3840 (Sized_relobj_file::find_special_sections): New function.
3841 * object.cc (Sized_relobj_file::find_shdr): New function.
3842 (Sized_relobj_file::find_eh_frame): Use find_shdr.
3843 (Sized_relobj_file::find_special_sections): New function, split out..
3844 (Sized_relobj_file::do_read_symbols): ..from here.
3845 * output.h (Output_data_got::replace_constant): New function.
3846 (Output_data_got::num_entries): New function.
3847 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3848 (Output_data_got::got_offset): Protected rather than private.
3849 (Output_data_got::replace_got_entry): New function.
3850 * output.cc (Output_data_got::replace_got_entry): New function.
3851 * powerpc.cc (class Powerpc_relobj): New.
3852 (class Powerpc_relocate_functions): Delete all psymval variants or
3853 convert to value,addend type. Delete pcrela, pcrela_unaligned.
3854 Implement _ha functions using corresponding _hi function.
3855 (Powerpc_relobj::find_special_sections): New function.
3856 (Target_powerpc::do_make_elf_object): New function.
3857 (class Output_data_got_powerpc): New.
3858 (class Output_data_glink): New.
3859 (class Powerpc_scan_relocatable_reloc): New.
3860 Many more changes througout file.
3864 * po/vi.po: Updated Vietnamese translation.
3868 * layout.cc (Layout::add_target_dynamic_tags): If
3869 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3874 * po/gold.pot: Updated template.
3875 * po/es.po: Updated Spanish translation.
3880 * configure.ac: Add check for -gpubnames support.
3881 * configure: Regenerate.
3882 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3883 support; force -gno-pubnames.
3884 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3886 (gdb_index_test_4): New test.
3887 * testsuite/Makefile.in: Regenerate.
3888 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3889 * testsuite/gdb_index_test_2.sh: Likewise.
3890 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3891 * testsuite/gdb_index_test_4.sh: New script.
3892 * testsuite/gdb_index_test_comm.sh: New script with common code;
3893 don't look for space after colon.
3897 * gold.cc (queue_middle_tasks): Update function order only after
3898 deferred objects due to plugins are processed.
3902 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3903 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3904 (Target_arm::scan_reloc_for_stub): Likewise.
3905 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3906 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3907 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3908 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3909 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3915 * configure.ac: Test whether std::tr1::hash<off_t> works.
3916 * gold.h: Add a specialization for std::tr1::hash<off_t> if
3918 * output.h (class Output_fill): Add virtual destructor.
3919 * configure, config.in: Rebuild.
3923 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3927 * plugin.cc (Plugin::load): Handle position independent executables.
3931 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3933 (lines_only_debug_sections): Likewise.
3934 (gdb_fast_lookup_sections): New static array.
3935 (is_gdb_debug_section): Rename formal parameter.
3936 (is_lines_only_debug_section): Likewise.
3937 (is_gdb_fast_lookup_section): New function.
3938 (Layout::include_section): Check for ".zdebug_" prefix; pass
3939 section name suffix to is_gdb_debug_section, et al.; check for
3940 fast-lookup sections when building .gdb_index.
3941 * options.h (--strip-debug-gdb): Update GDB version number.
3945 * configure.ac: Add check for fallocate.
3946 * configure: Regenerate.
3947 * config.in: Regenerate.
3949 * options.h (class General_options): Add --mmap-output-file and
3950 --posix-fallocate options.
3951 * output.cc: (posix_fallocate): Remove; replace with...
3952 (gold_fallocate): New function.
3953 (Output_file::map_no_anonymous): Call gold_fallocate.
3954 (Output_file::map): Check --mmap-output-file option.
3958 * gold.h (textdomain): Add do {} to empty while(0).
3959 (bindtextdomain): Likewise.
3963 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3968 * symtab.cc (Symbol_table::define_special_symbol):
3969 Initialize *poldsym to prevent uninitialized variable errors.
3973 * layout.cc (Layout::section_name_mapping): Add rules to handle
3974 exact match on .data.rel.ro.local or .data.rel.ro.
3975 (Layout::output_section_name): Check for exact matches.
3979 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3984 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3985 object before exporting symbol.
3989 * testsuite/tls_test.cc: Include "config.h" first.
3990 * testsuite/tls_test_c.c: Likewise.
3996 * configure.in: Add check that sysdep.h has been included before
3997 any system header files.
3998 * configure: Regenerate.
3999 * config.in: Regenerate.
4003 * layout.cc (Layout::make_output_section): Mark .tdata section
4005 * testsuite/relro_test.cc: Add a TLS variable.
4010 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4011 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4016 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4017 (lines_only_debug_sections): Likewise.
4021 * nacl.cc: New file.
4023 * Makefile.am (CCFILES, HFILES): Add them.
4024 * Makefile.in: Regenerate.
4025 * i386.cc (Output_data_plt_i386_nacl): New class.
4026 (Output_data_plt_i386_nacl_exec): New class.
4027 (Output_data_plt_i386_nacl_dyn): New class.
4028 (Target_i386_nacl): New class.
4029 (Target_selector_i386_nacl): New class.
4030 (target_selector_i386): Use it instead of Target_selector_i386.
4031 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4032 (Target_x86_64_nacl): New class.
4033 (Target_selector_x86_64_nacl): New class.
4034 (target_selector_x86_64, target_selector_x32): Use it instead of
4035 Target_selector_x86_64.
4036 * arm.cc (Output_data_plt_arm_nacl): New class.
4037 (Target_arm_nacl): New class.
4038 (Target_selector_arm_nacl): New class.
4039 (target_selector_arm, target_selector_armbe): Use it instead of
4040 Target_selector_arm.
4042 * target-select.cc (select_target): Take new Input_file* and off_t
4043 arguments, pass them on to recognize method of selector.
4044 * object.cc (make_elf_sized_object): Update caller.
4045 * parameters.cc (parameters_force_valid_target): Likewise.
4046 * incremental.cc (make_sized_incremental_binary): Likewise.
4047 * target-select.h: Update decl.
4048 (Target_selector::recognize): Take new Input_file* argument,
4049 pass it on to do_recognize.
4050 (Target_selector::do_recognize): Take new Input_file* argument.
4051 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4052 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4053 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4054 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4056 * target.h (Target::Target_info): New members isolate_execinstr
4058 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4059 * arm.cc (Target_arm::arm_info): Update initializer.
4060 * i386.cc (Target_i386::i386_info): Likewise.
4061 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4062 * sparc.cc (Target_sparc::sparc_info): Likewise.
4063 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4064 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4065 * layout.cc (Layout::attach_allocated_section_to_segment):
4066 Take new const Target* argument. If target->isolate_execinstr(), act
4068 (Layout::find_first_load_seg): Take new const Target* argument;
4069 if target->isolate_execinstr(), reject PF_X segments.
4070 (Layout::relaxation_loop_body): Update caller.
4071 (Layout::set_segment_offsets): If target->isolate_execinstr(),
4072 reset file offset to zero when we hit LOAD_SEG, and then do a second
4073 loop over the segments before LOAD_SEG to reassign offsets after
4074 addresses have been determined. Handle target->rosegment_gap().
4075 (Layout::attach_section_to_segment): Take new const Target* argument;
4076 pass it to attach_allocated_section_to_segment.
4077 (Layout::make_output_section): Update caller.
4078 (Layout::attach_sections_to_segments): Take new const Target* argument;
4079 pass it to attach_section_to_segment.
4080 * gold.cc (queue_middle_tasks): Update caller.
4081 * layout.h (Layout): Update method decls with new arguments.
4083 * arm.cc (Target_arm::Target_arm): Take optional argument for the
4084 Target_info pointer to use.
4085 (Target_arm::do_make_data_plt): New virtual method.
4086 (Target_arm::make_data_plt): New method that calls it.
4087 (Target_arm::make_plt_entry): Use it.
4088 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4089 for the section alignment.
4090 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4092 (Output_data_plt_arm::first_plt_entry_offset): Call it.
4093 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4095 (Output_data_plt_arm::get_plt_entry_size): Call it.
4096 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4097 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4098 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4100 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4101 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4102 method instead of sizeof(plt_entry).
4103 (Output_data_plt_arm::add_entry): Likewise.
4104 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4105 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4107 (Target_arm::plt_entry_size): Likewise.
4108 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4110 (Output_data_plt_arm_standard): ... here, new class.
4111 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4112 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4113 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4115 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4116 Take additional argument for the PLT entry size.
4117 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4118 Use get_plt_entry_size method rather than plt_entry_size variable.
4119 (Output_data_plt_x86_64::reserve_slot): Likewise.
4120 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4121 (Output_data_plt_x86_64::add_entry): Likewise.
4122 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4123 (Output_data_plt_x86_64::address_for_global): Likewise.
4124 (Output_data_plt_x86_64::address_for_local): Likewise.
4125 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4126 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4127 Make method non-static.
4128 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4130 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4131 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4132 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4133 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4135 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4136 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4138 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4139 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4141 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4142 (Output_data_plt_x86_64::plt_entry_size)
4143 (Output_data_plt_x86_64::first_plt_entry)
4144 (Output_data_plt_x86_64::plt_entry)
4145 (Output_data_plt_x86_64::tlsdesc_plt_entry)
4146 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4147 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4148 (Output_data_plt_x86_64_standard): ... here, new class.
4149 (Target_x86_64::Target_x86_64): Take optional argument for the
4150 Target_info pointer to use.
4151 (Target_x86_64::do_make_data_plt): New virtual method.
4152 (Target_x86_64::make_data_plt): New method to call it.
4153 (Target_x86_64::init_got_plt_for_update): Use that.
4154 Call this->plt_->add_eh_frame method here.
4155 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4156 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4157 rather than static method.
4158 (Target_x86_64::plt_entry_size): Likewise.
4159 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4160 rather than plt_entry_size variable. Move guts of PLT filling to...
4161 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4162 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4163 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4165 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4166 additional argument for the section alignment.
4167 Don't do add_eh_frame_for_plt here.
4168 (Output_data_plt_i386::first_plt_entry_offset): Make the method
4169 non-static. Use get_plt_entry_size method rather than plt_entry_size
4171 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4173 (Output_data_plt_i386::get_plt_entry_size): Call it.
4174 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4175 (Output_data_plt_i386::add_eh_frame): New method to call it.
4176 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4178 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4179 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4181 (Output_data_plt_i386::fill_plt_entry): New method to call it.
4182 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4183 method instead of plt_entry_size.
4184 (Output_data_plt_i386::plt_entry_size)
4185 (Output_data_plt_i386::plt_eh_frame_fde_size)
4186 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4187 (Output_data_plt_i386_standard): ... here, new class.
4188 (Output_data_plt_i386_exec): New class.
4189 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4190 (Output_data_plt_i386_exec::first_plt_entry): ... here.
4191 (Output_data_plt_i386::exec_plt_entry): Move to ...
4192 (Output_data_plt_i386_exec::plt_entry): ... here.
4193 (Output_data_plt_i386_dyn): New class.
4194 (Output_data_plt_i386::first_plt_entry): Move to ...
4195 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4196 (Output_data_plt_i386::dyn_plt_entry): Move to ...
4197 (Output_data_plt_i386_dyn::plt_entry): ... here.
4198 (Target_i386::Target_i386): Take optional argument for the Target_info
4200 (Target_i386::do_make_data_plt): New virtual method.
4201 (Target_i386::make_data_plt): New method to call it.
4202 (Target_i386::make_plt_section): Use that.
4203 Call this->plt_->add_eh_frame method here.
4204 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4205 rather than plt_entry_size variable.
4206 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4207 (Output_data_plt_i386::address_for_local): Likewise.
4208 (Output_data_plt_i386::do_write): Likewise.
4209 Move guts of PLT filling to...
4210 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4211 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4212 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4213 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4217 * dwarf_reader.cc (Dwarf_die::read_attributes)
4218 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4219 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4220 * reduced_debug_output.cc
4221 (Output_reduced_debug_info_section::get_die_end): Remove
4222 DW_FORM_GNU_ref_index. Add default case.
4226 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4227 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4228 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4229 DW_AT_high_pc as offset from DW_AT_low_pc.
4231 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4232 * testsuite/Makefile.in: Regenerate.
4233 * testsuite/gdb_index_test_3.c: New test source file.
4234 * testsuite/gdb_index_test_3.sh: New test source file.
4238 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4240 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4241 as a class, not a struct.
4242 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4243 (Target_arm::apply_cortex_a8_workaround): Likewise.
4244 * gc.h: Declare Reloc_types as a struct, not a class.
4245 * object.h: Declare Symbols_data as a struct.
4246 * reloc.h: Declare Read_relocs_data as a struct.
4247 * target.h: Declare Relocate_info as a struct.
4251 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4252 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4257 * incremental-dump.cc (find_input_containing_global): Replace
4258 magic number with symbolic constant.
4259 (dump_incremental_inputs): Update version number.
4260 * incremental.cc (Output_section_incremental_inputs): Update version
4261 number; import symbolic constants from Incremental_inputs_reader.
4262 (Incremental_inputs::create_data_sections): Align relocations
4263 section correctly for 64-bit targets.
4264 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4265 constants; add padding.
4266 (Output_section_incremental_inputs::write_header): Add assert for
4268 (Output_section_incremental_inputs::write_input_files): Add assert
4269 for input_entry_size.
4270 (Output_section_incremental_inputs::write_info_blocks): Add padding;
4271 add assert for object_info_size, input_section_entry_size,
4272 global_sym_entry_size.
4273 * incremental.h (Incremental_inputs_reader): Add symbolic constants
4274 for data structure sizes; use them.
4275 (Incremental_input_entry_reader): Import symbolic constants from
4276 Incremental_inputs_reader; use them.
4280 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4282 (Target_sparc::Target_sparc): Initialize new fields.
4283 (Target_sparc::do_make_elf_object): New function.
4284 (Target_sparc::do_adjust_elf_header): New function.
4288 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4289 CU range table of gdb index.
4293 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4298 * sparc.cc (Target_sparc::got_address): New function.
4299 (Sparc_relocate_functions::gdop_hix22): New function.
4300 (Sparc_relocate_functions::gdop_lox10): New function.
4301 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4303 (Target_sparc::Scan::local): Likewise if the global symbol is not
4304 preemptible and is not IFUNC.
4305 (Target_sparc::Relocate::relocate): Perform GOTDATA code
4306 transformations for local and non-preemptible non-IFUNC global
4309 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4310 writing out 64-bit part of ranges.
4312 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4313 -fpic and -fpie respectively.
4314 * Makefile.in: Regenerate.
4316 * sparc.cc (class Target_sparc): Add rela_ifunc_.
4317 (Target_sparc::Target_sparc): Initialize new field.
4318 (Target_sparc::do_plt_section_for_global): New function.
4319 (Target_sparc::do_plt_section_for_local): New function.
4320 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4321 (Target_sparc::make_plt_section): New function, broken out of
4322 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
4323 (Target_sparc::make_plt_entry): Call make_plt_section.
4324 (Target_sparc::make_local_ifunc_plt_entry): New function.
4325 (Target_sparc::rela_ifunc_section): New function.
4326 (Target_sparc::plt_section): Remove const.
4327 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
4328 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4329 and ifunc_count_ fields.
4330 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4331 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4332 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4333 (Output_data_plt_sparc::rela_ifunc): New function.
4334 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4335 (Output_data_plt_sparc::has_ifunc_section): New function.
4336 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4337 (Output_data_plt_sparc::address_for_global): New function.
4338 (Output_data_plt_sparc::address_for_local): New function.
4339 (Output_data_plt_sparc::plt_index_to_offset): New function.
4340 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4342 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4344 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4345 R_SPARC_JMP_IREL to switch.
4346 (Target_sparc::Scan::check_non_pic): Likewise.
4347 (Target_sparc::Scan::local): Handle IFUNC symbols.
4348 (Target_sparc::Scan::local): Likewise.
4349 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4350 and plt_address_for_local.
4351 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4352 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4354 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4355 (class Output_data_reloc): Adjust calls to Output_reloc_type.
4356 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4357 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4359 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4360 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4362 * sparc.cc (Target_sparc::Scan::global): Likewise.
4363 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4367 * archive.cc (Library_base::should_include_member): Check for
4368 --export-dynamic-symbol.
4369 * options.h (class General_options): Add --export-dynamic-symbol.
4370 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4371 --export-dynamic-symbol.
4372 (Symbol_table::gc_mark_undef_symbols): Likewise.
4373 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4377 * sparc.cc (Reloc::wdisp10): New relocation method.
4378 (Reloc::h34): Likewise.
4379 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4380 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4382 (Target_sparc::Scan::local): Likewise.
4383 (Target_sparc::Scan::global): Likewise.
4384 (Target_sparc::Relocate::relocate): Likewise.
4388 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4393 * timer.cc: #include <unistd.h>.
4397 * configure.in (AC_CHECK_HEADERS): Add locale.h.
4398 * config.in: Regenerate.
4399 * configure: Regenerate.
4403 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4404 (AM_LC_MESSAGES): Add.
4405 * aclocal.m4: Regenerate.
4406 * config.in: Regenerate.
4407 * configure: Regenerate.
4411 * Makefile.am: Add gdb-index.cc, gdb-index.h.
4412 * Makefile.in: Regenerate.
4413 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4414 (Sized_elf_reloc_mapper::symbol_section): New function.
4415 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4416 (make_elf_reloc_mapper): New function.
4417 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4418 (Dwarf_abbrev_table::do_read_abbrevs): New function.
4419 (Dwarf_abbrev_table::do_get_abbrev): New function.
4420 (Dwarf_ranges_table::read_ranges_table): New function.
4421 (Dwarf_ranges_table::read_range_list): New function.
4422 (Dwarf_pubnames_table::read_section): New function.
4423 (Dwarf_pubnames_table::read_header): New function.
4424 (Dwarf_pubnames_table::next_name): New function.
4425 (Dwarf_die::Dwarf_die): New function.
4426 (Dwarf_die::read_attributes): New function.
4427 (Dwarf_die::skip_attributes): New function.
4428 (Dwarf_die::set_name): New function.
4429 (Dwarf_die::set_linkage_name): New function.
4430 (Dwarf_die::attribute): New function.
4431 (Dwarf_die::string_attribute): New function.
4432 (Dwarf_die::int_attribute): New function.
4433 (Dwarf_die::uint_attribute): New function.
4434 (Dwarf_die::ref_attribute): New function.
4435 (Dwarf_die::child_offset): New function.
4436 (Dwarf_die::sibling_offset): New function.
4437 (Dwarf_info_reader::check_buffer): New function.
4438 (Dwarf_info_reader::parse): New function.
4439 (Dwarf_info_reader::do_parse): New function.
4440 (Dwarf_info_reader::do_read_string_table): New function.
4441 (Dwarf_info_reader::lookup_reloc): New function.
4442 (Dwarf_info_reader::get_string): New function.
4443 (Dwarf_info_reader::visit_compilation_unit): New function.
4444 (Dwarf_info_reader::visit_type_unit): New function.
4445 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4446 Sized_elf_reloc_mapper.
4447 (Sized_dwarf_line_info::symbol_section): Remove function.
4448 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4449 (Sized_dwarf_line_info::read_line_mappings): Remove object
4450 parameter, adjust callers.
4451 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4452 * dwarf_reader.h: Include <sys/types.h>.
4453 (class Track_relocs): Remove forward declaration.
4454 (class Elf_reloc_mapper): New class.
4455 (class Sized_elf_reloc_mapper): New class.
4456 (class Dwarf_abbrev_table): New class.
4457 (class Dwarf_range_list): New class.
4458 (class Dwarf_ranges_table): New class.
4459 (class Dwarf_pubnames_table): New class.
4460 (class Dwarf_die): New class.
4461 (class Dwarf_info_reader): New class.
4462 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4463 (Sized_dwarf_line_info::symbol_section): Remove member function.
4464 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4466 * gdb-index.cc: New source file.
4467 * gdb-index.h: New source file.
4468 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4469 and .debug_types sections, call Layout::add_to_gdb_index.
4470 (Sized_relobj_incr::do_section_name): Implement.
4471 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4472 return type; Implement.
4473 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4475 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4476 parameter list and return type.
4477 (Sized_incr_dynobj::do_section_contents): Likewise.
4478 * layout.cc: Include gdb-index.h.
4479 (Layout::Layout): Initialize gdb_index_data_.
4480 (Layout::init_fixed_output_section): Check for .gdb_index section.
4481 (Layout::add_to_gdb_index): New function. Instantiate.
4482 * layout.h: Add forward declaration for class Gdb_index.
4483 (Layout::add_to_gdb_index): New member function.
4484 (Layout::gdb_index_data_): New data member.
4485 * main.cc: Include gdb-index.h.
4486 (main): Print statistics for gdb index.
4487 * object.cc (Object::section_contents): Move code into
4488 do_section_contents.
4489 (need_decompressed_section): Check for sections needed when building
4491 (build_compressed_section_map): Likewise.
4492 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4494 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4495 sections; call Layout::add_to_gdb_index.
4496 (Sized_relobj_file::do_decompressed_section_contents): Call
4497 do_section_contents directly.
4498 * object.h (Object::do_section_contents): Adjust parameter list and
4500 (Object::do_decompressed_section_contents): Call do_section_contents
4502 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4504 * options.h (class General_options): Add --gdb-index option.
4505 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4506 list and return type.
4507 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4508 * reloc.h (Track_relocs::checkpoint): New function.
4509 (Track_relocs::reset): New function.
4511 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4513 * testsuite/Makefile.in: Regenerate.
4514 * testsuite/gdb_index_test.cc: New test source file.
4515 * testsuite/gdb_index_test_1.sh: New test source file.
4516 * testsuite/gdb_index_test_2.sh: New test source file.
4520 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4521 (Target_arm::do_finalize_sections): Remove code which defines
4522 __exidx_start and __exidx_end. Make symbol table parameter
4523 anonymous as it is not used.
4524 * gold.cc (queue_middle_tasks): Call target hook to define any
4525 target-specific symbols.
4526 * target.h (Target::define_standard_symbols): New method.
4527 (Target::do_define_standard_symbols): Same.
4528 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4529 * testsuite/Makefile.in: Regenerate.
4530 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4532 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4533 relocations are generated for __exidx_start and __exidx_end.
4537 * testsuite/Makefile.am: Disable test initpri3b.
4538 * testsuite/Makefile.in: Regenerate.
4542 * arm.cc (Target_arm::got_section): Make .got section read-only
4548 * layout.cc (Layout::make_output_section): Correctly mark
4549 SHT_INIT_ARRAY, et. al., as relro.
4553 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4554 dynamic relocations for protected symbols in shared objects.
4558 * resolve.cc (Symbol_table::resolve): When merging common symbols,
4559 keep the larger alignment.
4563 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4564 handling of DW_LNE_define_file.
4568 * reduced_debug_output.cc
4569 (Output_reduced_debug_info_section::get_die_end): Add new FORM
4574 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4578 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4579 Call Object::decompressed_section_contents.
4580 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4582 (Sized_dwarf_line_info::buffer_start_): New data member.
4583 * merge.cc (Output_merge_data::do_add_input_section): Call
4584 Object::decompressed_section_contents.
4585 (Output_merge_string::do_add_input_section): Likewise.
4586 * object.cc (need_decompressed_section): New function.
4587 (build_compressed_section_map): Decompress sections needed later.
4588 (Sized_relobj_file::do_decompressed_section_contents): New function.
4589 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4590 * object.h (Object::decompressed_section_contents): New function.
4591 (Object::discard_decompressed_sections): New function.
4592 (Object::do_decompressed_section_contents): New function.
4593 (Object::do_discard_decompressed_sections): New function.
4594 (Compressed_section_info): New type.
4595 (Compressed_section_map): Include decompressed section contents.
4596 (Sized_relobj_file::do_decompressed_section_contents): New function.
4597 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4601 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4602 * testsuite/Makefile.in: Regenerate.
4606 * options.cc (General_options::finalize): Disallow -pie and -static.
4610 * arm.cc (Arm_relocate_functions::abs8,
4611 Arm_relocate_functions::abs16): Use
4612 Bits::has_signed_unsigned_overflow32.
4613 (Arm_relocate_functions::thm_abs8): Correct range of
4615 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4620 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4621 position independent outputs, not just shared objects.
4625 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4626 * configure: Regenerated.
4630 * reloc.h (Bits): New class with static functions, copied from
4631 namespace utils in arm.cc.
4632 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
4637 * incremental.cc (write_info_blocks): Correct relocation offset.
4641 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4642 (Relocate::tls_gd_to_le): Likewise.
4646 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4650 * configure.ac: Check if -mcmodel=medium works.
4651 * configure: Regenerated.
4655 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4657 (read_unsigned_LEB_128_x): ... this new function.
4658 (read_signed_LEB_128): Replaced with inline definition and ...
4659 (read_signed_LEB_128_x): ... this new function.
4660 * int_encoding.h (read_unsigned_LEB_128_x): New function.
4661 (read_unsigned_LEB_128): Add inline definition.
4662 (read_signed_LEB_128_x): New function.
4663 (read_signed_LEB_128): Add inline definition.
4664 * testsuite/Makefile.am (leb128_unittest): New unit test.
4665 * testsuite/Makefile.in: Regenerate.
4666 * testsuite/leb128_unittest.cc: New unit test.
4671 * i386.cc (Target_i386::do_code_fill): When using a jmp
4672 instruction, pad with nop instructions.
4673 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4677 * x86_64.cc (gc_process_relocs): Add typename on types used in
4679 (scan_relocs): Likewise.
4680 (relocate_section): Likewise.
4681 (apply_relocation): Likewise.
4685 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4686 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4691 * x86_64.cc: Initial support for x32.
4695 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4696 Use abstract base class for GOT.
4697 * gold/output.h (class Output_data_got_base): New abstract base class.
4698 (class Output_data_got): Derive from new base class, adjust ctors.
4699 (Output_data_got::reserve_slot): Make virtual; rename to
4700 do_reserve_slot; Adjust callers.
4701 * gold/target.h (Sized_target::init_got_plt_for_update): Return
4702 pointer to abstract base class.
4703 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4707 * object.h (Relobj::local_symbol_value): New function.
4708 (Relobj::local_plt_offset): New function.
4709 (Relobj::local_has_got_offset): New function.
4710 (Relobj::local_got_offset): New function.
4711 (Relobj::set_local_got_offset): New function.
4712 (Relobj::do_local_symbol_value): New pure virtual function.
4713 (Relobj::do_local_plt_offset): Likewise.
4714 (Relobj::do_local_has_got_offset): Likewise.
4715 (Relobj::do_local_got_offset): Likewise.
4716 (Relobj::do_set_local_got_offset): Likewise.
4717 (Sized_relobj::do_local_has_got_offset): Rename from
4718 local_has_got_offset.
4719 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4720 (Sized_relobj::do_set_local_got_offset): Rename from
4721 set_local_got_offset.
4722 (Sized_relobj_file::do_local_plt_offset): Rename from
4724 (Sized_relobj_file::do_local_symbol_value): New function.
4725 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4727 * output.cc (Output_data_got::Got_entry::write): Change object to
4728 Relobj. Use local_symbol_value.
4729 (Output_data_got::add_global_with_rel): Change rel_dyn to
4730 Output_data_reloc_generic*. Use add_global_generic.
4731 (Output_data_got::add_global_with_rela): Remove. Change all
4732 callers to use add_global_with_rel.
4733 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4734 Output_data_reloc_generic*. Use add_global_generic.
4735 (Output_data_got::add_global_pair_with_rela): Remove. Change all
4736 callers to use add_global_pair_with_rel.
4737 (Output_data_got::add_local): Change object to Relobj*.
4738 (Output_data_got::add_local_plt): Likewise.
4739 (Output_data_got::add_local_with_rel): Change object to Relobj*,
4740 change rel_dyn to Output_data_reloc_generic*. Use
4742 (Output_data_got::add_local_with_rela): Remove. Change all
4743 callers to use all_local_with_rel.
4744 (Output_data_got::add_local_pair_with_rel): Change object to
4745 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
4746 add_output_section_generic.
4747 (Output_data_got::add_local_pair_with_rela): Remove. Change all
4748 callers to use add_local_pair_with_rel.
4749 (Output_data_got::reserve_local): Change object to Relobj*.
4750 * output.h: (class Output_data_reloc_generic): Add pure virtual
4751 declarations for add_global_generic, add_local_generic,
4752 add_output_section_generic.
4753 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4754 functions for Output_data_reloc_generic. Update declarations for
4755 changes listed in output.cc.
4756 (class Output_data_got): Change template parameter to got_size.
4757 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
4758 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4760 (Sized_relobj_incr::do_local_plt_offset): New function.
4761 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4766 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4767 * resolve.cc (Symbol_table::resolve): Likewise.
4768 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4770 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4774 * output.h (Output_data_reloc_generic::add): Only call
4775 add_dynamic_reloc if this is a dynamic reloc section.
4780 * target-reloc.h (apply_relocation): Replace <64, false> with
4785 * po/it.po: New Italian translation.
4789 * script.cc (script_include_directive): Implement.
4790 (read_script_file): New local variables name and search_path. Update
4791 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4792 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4793 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4797 * yyscript.y (section_cmd): Add support for INCLUDE directive.
4798 (file_or_sections_cmd): Likewise.
4802 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4803 if --just-symbols is given.
4808 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4809 when processing data relocs.
4810 * reloc.h (Relocate_functions::rel_unaligned): New method.
4811 (Relocate_functions::pcrel_unaligned): Ditto.
4812 (Relocate_functions::rel32_unaligned): Ditto.
4813 (Relocate_functions::pcrel32_unaligned): Ditto.
4818 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4819 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4820 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4821 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4822 (Relocate_functions::rel_unaligned): New.
4823 (Relocate_functions::rel32_unaligned): New.
4824 * target-reloc.h (relocate_for_relocatable): Add code to handle
4825 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4826 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4827 arm_unaligned_reloc_r): New targets.
4828 * testsuite/Makefile.in: Regenerate.
4829 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4834 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
4836 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4837 * options.cc (General_options::finalize): Use library search path
4838 from configure script if specified. If not native and no sysroot,
4839 only search TOOLLIBDIR.
4840 * options.h (Search_directory::Search_directory): Change name to
4842 (General_options::add_to_library_path_with_sysroot): Change arg to
4844 * configure, Makefile.in, config.in: Rebuild.
4848 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4849 we are working around the ARM1176 Erratum.
4850 * options.h (General_options::fix_arm1176): Add option.
4851 * testsuite/Makefile.am: Add testcases, and keep current ones
4853 * testsuite/Makefile.in: Regenerate.
4854 * testsuite/arm_fix_1176.s: New file.
4855 * testsuite/arm_fix_1176.sh: Likewise.
4859 * arm.cc (Target_arm::Target_arm): Remove initialisation of
4861 (Target_arm::may_use_blx): Remove method.
4862 (Target_arm::set_may_use_blx): Likewise.
4863 (Target_arm::may_use_v4t_interworking): New method.
4864 (Target_arm::may_use_v5t_interworking): Likewise.
4865 (Target_arm::may_use_blx_): Remove member variable.
4866 (Arm_relocate_functions::arm_branch_common): Check for v5T
4868 (Arm_relocate_functions::thumb_branch_common): Likewise.
4869 (Reloc_stub::stub_type_for_reloc): Likewise.
4870 (Target_arm::do_finalize_sections): Correct interworking checks.
4871 * testsuite/Makefile.am: Add new tests.
4872 * testsuite/Makefile.in: Regenerate.
4873 * testsuite/arm_farcall_arm_arm.s: New test.
4874 * testsuite/arm_farcall_arm_arm.sh: Likewise.
4875 * testsuite/arm_farcall_arm_thumb.s: Likewise.
4876 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4877 * testsuite/arm_farcall_thumb_arm.s: Likewise.
4878 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4879 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4880 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4885 * expression.cc (Expression::eval_with_dot): Add
4886 is_section_dot_assignment parameter.
4887 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
4888 absolute and assigning to dot within a section.
4889 * script-sections.cc
4890 (Output_section_element_assignment::set_section_addresses): Pass
4891 dot_section to set_if_absolute.
4892 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4893 as is_section_dot_assignment flag to eval_with_dot.
4894 (Output_section_element_dot_assignment::set_section_addresses):
4896 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4897 parameter. Also set value if relative to dot_section; set the
4898 symbol's output_section.
4899 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4900 parameter. Adjust all callers.
4901 (Expression::eval_maybe_dot): Likewise.
4902 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4904 * testsuite/script_test_2.t: Test assignment of an absolute value
4905 to dot within an output section element.
4909 * options.h (class General_options): Add --[no-]gnu-unique options.
4910 * symtab.cc (Symbol_table::sized_write_globals): Convert
4911 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4916 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4917 unnecessary assertion.
4918 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4922 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4924 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4926 Change to just keep the section associated with symbol.
4927 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4928 they are externally visible and --export-dynamic is turned on.
4929 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4934 * script-sections.cc
4935 (Output_section_element_dot_assignment::needs_output_section): New
4941 * layout.cc (Layout::segment_precedes): Don't assert failure if a
4942 --section-start option was seen.
4943 * options.h (General_options::any_section_start): New function.
4948 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4949 member to track relocation locations that have moved during TLS
4950 reloc optimizations.
4951 (Target_sparc::Relocate::Relocate): Initialize to NULL.
4952 (Target_sparc::Relocate::relocate): Adjust view down by 4
4953 bytes if it matches reloc_adjust_addr_.
4954 (Target_sparc::Relocate::relocate_tls): Always move the
4955 __tls_get_addr call delay slot instruction forward 4 bytes when
4956 performing relaxation.
4960 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4961 (Output_file::map_no_anonymous): Check for non-zero
4962 return code from posix_fallocate.
4967 * plugin.cc (is_visible_from_outside): Check for symbols
4968 referenced from dynamic objects.
4969 * resolve.cc (Symbol_table::resolve): Don't count references
4970 from dynamic objects as references from real ELF files.
4971 * testsuite/plugin_test_2.sh: Adjust expected result.
4975 * gold.cc: Include timer.h.
4976 (queue_middle_tasks): Stamp time.
4977 (queue_final_tasks): Likewise.
4978 * main.cc (main): Store timer in parameters. Print timers
4980 * parameters.cc (Parameters::Parameters): Initialize timer_.
4981 (Parameters::set_timer): New function.
4982 (set_parameters_timer): New function.
4983 * parameters.h (Parameters::set_timer): New function.
4984 (Parameters::timer): New function.
4985 (Parameters::timer_): New data member.
4986 (set_parameters_timer): New function.
4987 * timer.cc (Timer::stamp): New function.
4988 (Timer::get_pass_time): New function.
4989 * timer.h (Timer::stamp): New function.
4990 (Timer::get_pass_time): New function.
4991 (Timer::pass_times_): New data member.
4995 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4996 task for members of lib groups.
5001 * fileread.cc (File_read::find_view): Add assert.
5002 (File_read::make_view): Move bounds check (replace with assert)...
5003 (File_read::find_or_make_view): ... to here.
5007 * output.cc (Output_file::open_base_file): Handle case where
5008 ::read returns less than requested size.
5012 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5013 Initialize defined_count_.
5014 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5015 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5016 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5017 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5018 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5019 * incremental.h (Sized_relobj_incr::defined_count_): New data
5021 (Sized_incr_dynobj::defined_count_): New data member.
5022 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5023 Return zeroes instead of internal error.
5028 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5029 (Output_reloc::symbol_value): Return PLT offset if flag is set.
5030 * output.h (class Output_reloc): Add use_plt_offset flag.
5031 (Output_reloc::type_): Adjust size of bit field.
5032 (Output_reloc::use_plt_offset_): New bit field.
5033 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5034 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5035 flag. Adjust all callers.
5036 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5037 creating RELATIVE relocations.
5041 * po/es.po: Updated Spanish translation.
5042 * po/fi.po: Updated Finnish translation.
5046 * options.cc (parse_uint): Fix dereference of RETVAL.
5050 * layout.h (section_order_map_): New member.
5051 (get_section_order_map): New member function.
5052 * output.cc (Output_section::add_input_section): Check for patterns
5053 only when --section-ordering-file is specified.
5054 * gold.cc (queue_middle_tasks): Delay updating order of sections till
5055 output_sections have been formed.
5056 * layout.cc (Layout_Layout): Initialize section_order_map_.
5057 * plugin.cc (update_section_order): Store order in order_map. Do not
5059 * testsuite/Makefile.am: Add test case for plugin_final_layout.
5060 * testsuite/Makefile.in: Regenerate.
5061 * testsuite/plugin_section_order.c: New file.
5062 * testsuite/plugin_final_layout.cc: New file.
5063 * testsuite/plugin_final_layout.sh: New file.
5067 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5069 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5070 symbols during incremental update.
5071 (Symbol_table::add_from_dynobj): Likewise.
5076 * symtab.cc (Symbol_table::define_special_symbol): Always
5077 canonicalize version string.
5081 * gold.cc (queue_initial_tasks): Move option checks ...
5082 * options.cc (General_options::finalize): ... to here. Disable
5083 some options; make others fatal.
5088 * plugin.cc (get_symbols_v2): New function.
5089 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5090 (is_referenced_from_outside): New function.
5091 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5092 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5093 (get_symbols): Pass version parameter.
5094 (get_symbols_v2): New function.
5095 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5097 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5098 (onload): Add LDPT_GET_SYMBOLS_V2.
5099 (all_symbols_read_hook): Use get_symbols_v2; check for
5100 LDPR_PREVAILING_DEF_IRONLY_EXP.
5101 * testsuite/plugin_test_3.sh: Update expected results.
5105 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5106 configuration options.
5107 * configure: Regenerate.
5108 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5109 * Makefile.in: Regenerate.
5110 * testsuite/Makefile.in: Regenerate.
5114 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5118 * incremental.cc (can_incremental_update): Fix typo in comment.
5119 * incremental.h (can_incremental_update): Likewise.
5123 * incremental.cc (can_incremental_update): New function.
5124 * incremental.h (can_incremental_update): New function.
5125 * layout.cc (Layout::init_fixed_output_section): Call it.
5126 (Layout::make_output_section): Don't allow patch space in .eh_frame.
5127 * object.cc (Sized_relobj_file::do_layout): Call
5128 can_incremental_update.
5132 * configure.ac: Check for glibc support for gnu_indirect_function
5133 support with static linking, setting automake conditional
5135 * Makefile.in: Regenerate.
5136 * configure: Regenerate.
5138 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5139 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5141 * testsuite/Makefile.in: Regenerate.
5145 * incremental.cc (Sized_relobj_incr::do_layout): Call
5146 report_comdat_group for kept comdat sections.
5147 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5148 * testsuite/Makefile.in: Regenerate.
5149 * testsuite/incr_comdat_test_1.cc: New source file.
5150 * testsuite/incr_comdat_test_2_v1.cc: New source file.
5151 * testsuite/incr_comdat_test_2_v2.cc: New source file.
5152 * testsuite/incr_comdat_test_2_v3.cc: New source file.
5156 * object.cc (Sized_relobj_file::do_layout): Remove unused local
5157 variable external_symbols_offset.
5161 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5162 triggered if object has no symbols.
5166 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5167 (Output_fill_debug_line::do_write): Likewise.
5171 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5172 casts to match formatting specs.
5173 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5177 * layout.cc (Free_list::allocate): Provide guarantee of minimum
5178 remaining hole size when allocating.
5179 (Layout::make_output_section): Set fill methods for debug sections.
5180 * layout.h (Free_list::Free_list_node): Move from private to
5182 (Free_list::set_min_hole_size): New function.
5183 (Free_list::begin, Free_list::end): New functions.
5184 (Free_list::min_hole_): New data member.
5185 * output.cc: Include dwarf.h.
5186 (Output_fill_debug_info::do_minimum_hole_size): New function.
5187 (Output_fill_debug_info::do_write): New function.
5188 (Output_fill_debug_line::do_minimum_hole_size): New function.
5189 (Output_fill_debug_line::do_write): New function.
5190 (Output_section::Output_section): Initialize new data member.
5191 (Output_section::set_final_data_size): Ensure patch space is larger
5192 than minimum hole size.
5193 (Output_section::do_write): Fill holes in debug sections.
5194 * output.h (Output_fill): New class.
5195 (Output_fill_debug_info): New class.
5196 (Output_fill_debug_line): New class.
5197 (Output_section::set_free_space_fill): New function.
5198 (Output_section::free_space_fill_): New data member.
5199 * testsuite/Makefile.am (incremental_test_3): Add
5200 --incremental-patch option.
5201 (incremental_test_4): Likewise.
5202 (incremental_test_5): Likewise.
5203 (incremental_test_6): Likewise.
5204 (incremental_copy_test): Likewise.
5205 (incremental_common_test_1): Likewise.
5206 * testsuite/Makefile.in: Regenerate.
5210 * po/es.po: Updated Spanish translation.
5214 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5215 * gold/testsuite/Makefile.in: Regenerate.
5216 * gold/testsuite/justsyms_exec.c: New source file.
5217 * gold/testsuite/justsyms_lib.c: New source file.
5221 * layout.cc (Layout::set_segment_offsets): Don't realign text
5222 segment if -Ttext was specified.
5223 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5225 * object.h (Sized_relobj_file::e_type): New function.
5226 (Sized_relobj_file::e_type_): New data member.
5227 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5228 base address for ET_EXEC files.
5229 * target.cc (Target::do_make_elf_object_implementation): Allow
5230 ET_EXEC files with --just-symbols option.
5234 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5235 Add thread_number parameter.
5236 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5237 * workqueue-threads.cc
5238 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5239 current thread if its thread number is greater than desired thread
5241 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5242 Add thread_number parameter.
5243 (Workqueue::should_cancel_thread): Likewise.
5244 (Workqueue::find_runnable_or_wait): Pass thread_number to
5245 should_cancel_thread.
5246 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5251 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5252 only after checking if it cannot be forced local.
5253 * symtab.h (is_externally_visible): Check if the symbol is not forced
5258 * options.h (class General_options): Add --print-output-format.
5259 Move -EL next to -EB, for better --help output.
5260 * target-select.cc: Include <cstdio>, "options.h", and
5262 (Target_selector::do_target_bfd_name): New function.
5263 (print_output_format): New function.
5264 * target-select.h (class Target_selector): Update declarations.
5265 (Target_selector::target_bfd_name): New function.
5266 (print_output_format): Declare.
5267 * main.cc: Include "target-select.h".
5268 (main): Handle --print-output-format.
5269 * gold.cc: Include "target-select.h".
5270 (queue_initial_tasks): Handle --print-output-format when there are
5272 * parameters.cc (parameters_force_valid_target): Give a better
5273 error message if -EB/-EL does not match target.
5274 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5279 * i386.cc (class Output_data_plt_i386): Add layout_ field.
5280 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5281 (Output_data_plt_i386::do_write): Write address of .dynamic
5282 section to first entry in .got.plt section.
5283 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5284 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5286 (Output_data_plt_x86_64::do_write): Write address of .dynamic
5287 section to first entry in .got.plt section.
5288 * layout.h (Layout::dynamic_section): New function.
5292 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5294 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5295 input_section_position_, and input_section_glob_.
5296 (read_layout_from_file): Call function section_ordering_specified.
5297 * layout.h (is_section_ordering_specified): New function.
5298 (section_ordering_specified): New function.
5299 (section_ordering_specified_): New boolean member.
5300 * main.cc(main): Call load_plugins after layout object is defined.
5301 * output.cc (Output_section::add_input_section): Use
5302 function section_ordering_specified to check if section ordering is
5304 * output.cc (Output_section::add_relaxed_input_section): Use
5305 function section_ordering_specified to check if section ordering is
5307 (Output_section::update_section_layout): New function.
5308 (Output_section::sort_attached_input_sections): Check if input section
5310 * output.h (Output_section::update_section_layout): New function.
5311 * plugin.cc (get_section_count): New function.
5312 (get_section_type): New function.
5313 (get_section_name): New function.
5314 (get_section_contents): New function.
5315 (update_section_order): New function.
5316 (allow_section_ordering): New function.
5317 (Plugin::load): Add the new interfaces to the transfer vector.
5318 (Plugin_manager::load_plugins): New parameter.
5319 (Plugin_manager::all_symbols_read): New parameter.
5320 (Plugin_manager::claim_file): New parameter. Save the elf object for
5322 (Plugin_manager::get_elf_object): New function.
5323 (Plugin_manager::get_view): Change to directly use the bool to check
5324 if get_view is called from claim_file_hook.
5325 * plugin.h (input_objects): New function
5326 (Plugin__manager::load_plugins): New parameter.
5327 (Plugin_manager::claim_file): New parameter.
5328 (Plugin_manager::get_elf_object): New function.
5329 (Plugin_manager::in_claim_file_handler): New function.
5330 (Plugin_manager::in_claim_file_handler_): New member.
5331 (layout): New function.
5332 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5333 handler with an extra parameter. Make the elf object before calling
5335 * testsuite/plugin_test.c (get_section_count): New function pointer.
5336 (get_section_type): New function pointer.
5337 (get_section_name): New function pointer.
5338 (get_section_contents): New function pointer.
5339 (update_section_order): New function pointer.
5340 (allow_section_ordering): New function pointer.
5341 (onload): Check if the new interfaces exist.
5345 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5347 * x86_64.cc (Target_x86_64::got_section): Likewise.
5348 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5349 (relro_now_test_SOURCES): New variable.
5350 (relro_now_test_DEPENDENCIES): New variable.
5351 (relro_now_test_LDFLAGS): New variable.
5352 (relro_now_test_LDADD): New variable.
5353 (relro_now_test.so): New target.
5354 * testsuite/Makefile.in: Rebuild.
5359 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5360 GLOB_DAT relocation rather than a RELATIVE relocation for a
5361 protected symbol when creating a shared library.
5362 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5363 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5364 * testsuite/protected_main_1.cc (main): Test that protected
5365 function has same address.
5370 * options.h (class General_options): Add -Bgroup.
5371 * options.cc (General_options::finalize): If -Bgroup is set,
5372 default to --unresolved-symbols=report-all.
5373 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5374 * target-reloc.h (issue_undefined_symbol_error): Handle
5375 --unresolved-symbols=report-all.
5380 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5381 if linker script discards key sections.
5382 (Layout::create_dynamic_symtab): Likewise.
5383 (Layout::assign_local_dynsym_offsets): Likewise.
5384 (Layout::sized_create_version_sections): Likewise.
5385 (Layout::create_interp): Likewise.
5386 (Layout::finish_dynamic_section): Likewise.
5387 (Layout::set_dynamic_symbol_size): Likewise.
5392 * options.h (class General_options): Add --unresolved-symbols.
5393 * target-reloc.h (issue_undefined_symbol_error): Check
5394 --unresolved-symbols. Add comments.
5398 * testsuite/odr_violation2.cc (Ordering::operator()): Make
5399 expression more complex.
5404 * target-reloc.h (issue_undefined_symbol_error): New inline
5405 function, broken out of relocate_section.
5406 (relocate_section): Call issue_undefined_symbol_error.
5407 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5408 there is no TLS segment if we are about to issue an undefined
5410 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5415 * resolve.cc (Symbol_table::should_override): Add fromtype
5416 parameter. Change all callers. Give error when linking together
5417 TLS and non-TLS symbol.
5418 (Symbol_table::should_override_with_special): Add fromtype
5419 parameter. Change all callers.
5420 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5421 there is no TLS segment if we have reported some errors.
5422 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5427 * target.h (Target::plt_address_for_global): New function.
5428 (Target::plt_address_for_local): New function.
5429 (Target::plt_section_for_global): Remove.
5430 (Target::plt_section_for_local): Remove.
5431 (Target::do_plt_address_for_global): New virtual function.
5432 (Target::do_plt_address_for_local): New virtual function.
5433 (Target::do_plt_section_for_global): Remove.
5434 (Target::do_plt_section_for_local): Remove.
5435 (Target::register_global_plt_entry): Add Symbol_table and Layout
5437 * output.cc (Output_data_got::Got_entry::write): Use
5438 plt_address_for_global and plt_address_for_local.
5439 * layout.cc (Layout::add_target_dynamic_tags): Use size and
5440 address of output section.
5441 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5442 got_irelative_, and irelative_count_ fields. Update
5444 (Output_data_plt_i386::has_irelative_section): New function.
5445 (Output_data_plt_i386::entry_count): Add irelative_count_.
5446 (Output_data_plt_i386::set_final_data_size): Likewise.
5447 (class Target_i386): Add got_irelative_ and rel_irelative_
5448 fields. Update declarations.
5449 (Target_i386::Target_i386): Initialize new fields.
5450 (Target_i386::do_plt_address_for_global): New function replacing
5451 do_plt_section_for_global.
5452 (Target_i386::do_plt_address_for_local): New function replacing
5453 do_plt_section_for_local.
5454 (Target_i386::got_section): Create got_irelative_.
5455 (Target_i386::rel_irelative_section): New function.
5456 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5457 fields. Don't define __rel_iplt_{start,end}.
5458 (Output_data_plt_i386::add_entry): Add symtab and layout
5459 parameters. Change all callers. Use different PLT and GOT for
5461 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5462 layout parameters. Change all callers. Use different PLT and
5464 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5465 (Output_data_plt_i386::rel_irelative): New function.
5466 (Output_data_plt_i386::address_for_global): New function.
5467 (Output_data_plt_i386::address_for_local): New function.
5468 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
5469 IRELATIVE GOT when changing IFUNC GOT entries.
5470 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5472 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5473 if we didn't create an IRELATIVE GOT.
5474 (Target_i386::Relocate::relocate): Use plt_address_for_global and
5475 plt_address_for_local.
5476 (Target_i386::do_dynsym_value): Use plt_address_for_global.
5477 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5478 got_irelative_, and irelative_count_ fields. Update
5480 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5481 Initialize new fields. Remove symtab parameter. Change all
5483 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5485 (Output_data_plt_x86_64::has_irelative_section): New function.
5486 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5487 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5488 fields. Update declarations.
5489 (Target_x86_64::Target_x86_64): Initialize new fields.
5490 (Target_x86_64::do_plt_address_for_global): New function replacing
5491 do_plt_section_for_global.
5492 (Target_x86_64::do_plt_address_for_local): New function replacing
5493 do_plt_section_for_local.
5494 (Target_x86_64::got_section): Create got_irelative_.
5495 (Target_x86_64::rela_irelative_section): New function.
5496 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5497 all callers. Don't create __rel_iplt_{start,end}.
5498 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5499 parameters. Change all callers. Use different PLT and GOT for
5501 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5502 layout parameters. Change all callers. Use different PLT and
5504 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5505 parameters. Change all callers. Use different PLT and GOT for
5507 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5508 (Output_data_plt_x86_64::rela_irelative): New function.
5509 (Output_data_plt_x86_64::address_for_global): New function.
5510 (Output_data_plt_x86_64::address_for_local): New function.
5511 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5512 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5513 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5514 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5516 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5518 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5519 symbols if we didn't create an IRELATIVE GOT.
5520 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5521 plt_address_for_local.
5522 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5523 * testsuite/ifuncvar1.c: New test file.
5524 * testsuite/ifuncvar2.c: New test file.
5525 * testsuite/ifuncvar3.c: New test file.
5526 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5527 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5528 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5529 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5530 * testsuite/Makefile.in: Rebuild.
5534 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5535 (two_file_test_1_ndebug.o): Likewise.
5536 (two_file_test_1b_ndebug.o): Likewise.
5537 (two_file_test_2_ndebug.o): Likewise.
5538 (two_file_test_main_ndebug.o): Likewise.
5539 (incremental_test_2): Link with no-debug versions.
5543 * gold/incremental.cc
5544 (Output_section_incremental_inputs::write_info_blocks): Check for
5545 hidden and internal symbols.
5549 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5550 Check disposition for startup file.
5551 (Incremental_inputs::report_command_line): Ignore
5552 --incremental-startup-unchanged option.
5553 * options.cc (General_options::parse_incremental_startup_unchanged):
5555 (General_options::General_options): Initialize new data member.
5556 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5557 (General_options): Add --incremental-startup-unchanged option.
5558 (General_options::incremental_startup_disposition): New function.
5559 (General_options::incremental_startup_disposition_): New data member.
5563 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5564 input file index to Script_info ctor.
5565 (Sized_incremental_binary::do_file_has_changed): Find the
5566 command-line argument for files named in scripts.
5567 * incremental.h (Script_info::Script_info): New ctor
5568 with input file index.
5569 (Script_info::input_file_index): New function.
5570 (Script_info::input_file_index_): New data member.
5571 (Incremental_binary::get_library): Add const.
5572 (Incremental_binary::get_script_info): Add const.
5573 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5574 * testsuite/Makefile.am (incremental_test_5): New test case.
5575 (incremental_test_6): New test case.
5576 * testsuite/Makefile.in: Regenerate.
5580 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5581 debug output when command lines differ.
5585 * incremental.cc (Incremental_inputs::report_command_line): Ignore
5586 --incremental-patch option.
5587 * layout.cc (Free_list::allocate): Extend allocation beyond original
5589 (Layout::make_output_section): Mark sections that should get
5591 * options.cc (parse_percent): New function.
5592 * options.h (parse_percent): New function.
5593 (DEFINE_percent): New macro.
5594 (General_options): Add --incremental-patch option.
5595 * output.cc (Output_section::Output_section): Initialize new data
5597 (Output_section::add_input_section): Print section name when out
5599 (Output_section::add_output_section_data): Likewise.
5600 (Output_section::set_final_data_size): Add patch space when
5601 doing --incremental-full.
5602 (Output_section::do_reset_address_and_file_offset): Remove patch
5604 (Output_segment::set_section_list_addresses): Print debug output
5605 only if --incremental-update.
5606 * output.h (Output_section::set_is_patch_space_allowed): New function.
5607 (Output_section::is_patch_space_allowed_): New data member.
5608 (Output_section::patch_space_): New data member.
5609 * parameters.cc (Parameters::incremental_full): New function.
5610 * parameters.h (Parameters::incremental_full): New function
5611 * testsuite/Makefile.am (incremental_test_2): Add test for
5612 --incremental-patch option.
5613 * testsuite/Makefile.in: Regenerate.
5614 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5615 (t18): Remove function body.
5620 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5621 Arm_Address type for relocation result.
5622 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
5624 (Arm_relocate_functions::abs32): Use unaligned access.
5625 (Arm_relocate_functions::rel32): Ditto.
5626 (Arm_relocate_functions::prel31): Ditto.
5627 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5628 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5629 static data relocations.
5630 * testsuite/Makefile.in: Regnerate.
5631 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5636 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5637 symbols if necessary.
5638 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5643 * resolve.cc (Symbol::override_base_with_special): Simply override
5644 version with special symbol version, ignoring previous version.
5648 * object.cc (Sized_relobj_file::include_section_group): Add
5649 information to comment about signature location.
5654 * options.h (class General_options): Add -f and -F.
5655 * options.cc (General_options::finalize): Fatal error if -f/-F
5656 are used without -shared.
5657 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5661 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5667 * resolve.cc (Symbol::override_base_with_special): Don't override
5668 the version if the overriding symbol has a different name.
5669 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
5670 all callers. If we give an error about an undefined version,
5671 define the base version if necessary.
5672 * dynobj.h (class Versions): Update declaration.
5673 * testsuite/weak_alias_test_5.cc: New file.
5674 * testsuite/weak_alias_test.script: New file.
5675 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5676 and versioned_alias have the right value, and call t2.
5677 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5678 weak_alias_test_5.so.
5679 (weak_alias_test_LDADD): Likewise.
5680 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5681 * testsuite/Makefile.in: Rebuild.
5686 * options.h (class General_options): Support -z notext.
5687 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5689 (two_file_shared_nonpic.so): Likewise.
5690 (two_file_shared_mixed.so): Likewise.
5691 (two_file_shared_mixed_1.so): Likewise.
5692 (weak_undef_lib_nonpic.so): Likewise.
5693 (alt/weak_undef_lib_nonpic.so): Likewise.
5694 (tls_test_shared_nonpic.so): Likewise.
5695 * testsuite/Makefile.in: Rebuild.
5700 * configure.ac: Test whether static linking works, setting
5701 the automake conditional HAVE_STATIC.
5702 * testsuite/Makefile.am: Disable tests using -static if
5703 HAVE_STATIC is not true.
5704 * configure, testsuite/Makefile.in: Rebuild.
5709 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5710 Assert if we see DW_EH_PE_indirect.
5711 * target.h (Target::ehframe_datarel_base): New function.
5712 (Target::do_ehframe_datarel_base): New target function.
5713 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5714 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5720 * options.h (class General_options): Add
5721 --ld-generated-unwind-info.
5722 * ehframe.cc (Fde::write): Add address parameter. Change all
5723 callers. If associated with PLT, fill in address and size.
5724 (Cie::set_output_offset): Only add merge mapping if there is an
5726 (Cie::write): Add address parameter. Change all callers.
5727 (Eh_frame::add_ehframe_for_plt): New function.
5728 * ehframe.h (class Fde): Update declarations. Move shndx_ and
5729 input_offset_ fields into union u_, with new plt field.
5730 (Fde::Fde): Adjust for new union field.
5731 (Fde::Fde) [Output_data version]: New constructor.
5732 (Fde::add_mapping): Only add merge mapping if there is an object.
5733 (class Cie): Update declarations.
5734 (class Eh_frame): Declare add_ehframe_for_plt.
5735 * layout.cc (Layout::layout_eh_frame): Break out code into
5736 make_eh_frame_section, and call it.
5737 (Layout::make_eh_frame_section): New function.
5738 (Layout::add_eh_frame_for_plt): New function.
5739 * layout.h (class Layout): Update declarations.
5740 * merge.cc (Merge_map::add_mapping): Add assertion.
5741 * i386.cc: Include "dwarf.h".
5742 (class Output_data_plt_i386): Make first_plt_entry,
5743 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
5744 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5745 and plt_eh_frame_fde.
5746 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5747 boundary. Call add_eh_frame_for_plt if appropriate.
5748 * x86_64.cc: Include "dwarf.h".
5749 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
5750 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
5751 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5752 and plt_eh_frame_fde.
5753 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5759 * object.cc (Sized_relobj_file::layout_section): Change shdr
5760 parameter to be const.
5761 (Sized_relobj_file::layout_eh_frame_section): New function, broken
5763 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5764 appropriate. Call layout_eh_frame_section.
5765 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5767 * object.h (class Sized_relobj_file): Update declarations.
5772 * script.cc (Token::integer_value): Accept trailing M/m/K/k
5774 (Lex::gather_token): Accept trailing M/m/K/k for integers.
5779 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5781 * layout.cc (Layout::layout_eh_frame): Likewise.
5786 * layout.cc (Layout::symtab_section_shndx): New function.
5787 * layout.h (class Layout): Declare symtab_section_shndx.
5788 * output.cc (Output_section::write_header): Call it.
5793 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5794 symbols which are not used in a relocation.
5799 * layout.cc (Layout::segment_precedes): Don't crash if a linker
5800 script create indistinguishable segments.
5801 (Layout::set_segment_offsets): Use stable_sort when sorting
5802 segments. Pass this to Compare_segments constructor.
5803 * layout.h (class Layout): Make segment_precedes non-static.
5804 (class Compare_segments): Change from struct to class. Add
5805 layout_ field. Add constructor.
5806 * script-sections.cc
5807 (Script_sections::attach_sections_using_phdrs_clause): Rename
5808 local orphan to is_orphan. Don't report failure to put empty
5809 section in segment. On attachment failure, report name of
5810 section, and attach to first PT_LOAD segment.
5815 * target-select.cc (Target_selector::Target_selector): Add
5816 emulation parameter. Change all callers.
5817 (select_target_by_bfd_name): Rename from select_target_by_name.
5819 (select_target_by_emulation): New function.
5820 (supported_emulation_names): New function.
5821 * target-select.h (class Target_selector): Add emulation_ field.
5822 Update declarations.
5823 (Target_selector::recognize_by_bfd_name): Rename from
5824 recognize_by_name. Change all callers.
5825 (Target_selector::supported_bfd_names): Rename from
5826 supported_names. Change all callers.
5827 (Target_selector::recognize_by_emulation): New function.
5828 (Target_selector::supported_emulations): New function.
5829 (Target_selector::emulation): New function.
5830 (Target_selector::do_recognize_by_bfd_name): Rename from
5831 do_recognize_by_name. Change all callers.
5832 (Target_selector::do_supported_bfd_names): Rename from
5833 do_supported_names. Change all callers.
5834 (Target_selector::do_recognize_by_emulation): New function.
5835 (Target_selector::do_supported_emulations): New function.
5836 (select_target_by_bfd_name): Change name in declaration.
5837 (select_target_by_emulation): Declare.
5838 (supported_emulation_names): Declare.
5839 * parameters.cc (parameters_force_valid_target): Try to find
5840 target based on emulation from -m option.
5841 * options.h (class General_options): Change doc string for -m.
5842 * options.cc (help): Print emulations.
5843 (General_options::parse_V): Likewise.
5844 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5845 Add emulation parameter. Change all callers.
5849 * target.h (class Target): Add osabi_ field.
5850 (Target::osabi): New function.
5851 (Target::set_osabi): New function.
5852 (Target::Target): Initialize osabi_.
5853 (Target::do_adjust_elf_header): Make pure virtual.
5854 (Sized_target::do_adjust_elf_header): Declare.
5855 * target.cc (Sized_target::do_adjust_elf_header): New function.
5856 (class Sized_target): Instantiate all versions.
5857 * freebsd.h (class Target_freebsd): Remove.
5858 (Target_selector_freebsd::do_recognize): Call set_osabi on
5860 (Target_selector_freebsd::do_recognize_by_name): Likewise.
5861 (Target_selector_freebsd::set_osabi): Remove.
5862 * i386.cc (class Target_i386): Inherit from Sized_target rather
5863 than Target_freebsd.
5864 * x86_64.cc (class Target_x86_64): Likewise.
5868 * target.h (Target::can_check_for_function_pointers): Rewrite.
5870 (Target::can_icf_inline_merge_sections): Likewise.
5871 (Target::section_may_have_icf_unsafe_poineters): Likewise.
5872 (Target::Target_info): Add can_icf_inline_merge_sections field.
5873 (Target::do_can_check_for_function_pointers): New virtual
5875 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5876 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5877 from can_check_for_function_pointers, move in file.
5878 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5879 section_may_have_icf_unsafe_poineters, move in file.
5880 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5881 * i386.cc (Target_i386::do_can_check_for_function_pointers):
5882 Rename from can_check_for_function_pointers, move in file.
5883 (Target_i386::can_icf_inline_merge_sections): Remove.
5884 (Target_i386::i386_info): Initialize
5885 can_icf_inline_merge_sections.
5886 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5887 Initialize can_icf_inline_merge_sections.
5888 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5889 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5890 Rename from can_check_for_function_pointers, move in file.
5891 (Target_x86_64::can_icf_inline_merge_sections): Remove.
5892 (Target_x86_64::x86_64_info): Initialize
5893 can_icf_inline_merge_sections.
5894 * testsuite/testfile.cc (Target_test::test_target_info):
5896 * icf.cc (get_section_contents): Correct formatting.
5900 * symtab.cc (Symbol::versioned_name): New function.
5901 (Symbol_table::add_to_final_symtab): Use versioned_name when
5903 (Symbol_table::sized_write_symbol): Likewise.
5904 * symtab.h (class Symbol): Declare versioned_name.
5905 * stringpool.h (class Stringpool_template): Add variant of add
5906 which takes a std::basic_string.
5907 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5908 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5909 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5910 (ver_test_12.o): New target.
5911 * testsuite/Makefile.in: Rebuild.
5915 * arm.cc (Arm_relocate_functions::thm_jump8,
5916 Arm_relocate_functions::thm_jump11): Use a wider signed
5917 type to compute offset.
5918 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5920 * testsuite/Makefile.in: Regenerate.
5921 * testsuite/arm_branch_in_range.sh: Check test results of
5922 arm_thm_jump11 and arm_thm_jump8.
5923 * testsuite/arm_thm_jump11.s: New test source file.
5924 * testsuite/arm_thm_jump11.t: New linker script.
5925 * testsuite/arm_thm_jump8.s: New test source file.
5926 * testsuite/arm_thm_jump8.t: New linker script.
5930 * layout.cc: Include "object.h".
5931 (ctors_sections_in_init_array): New static variable.
5932 (Layout::is_ctors_in_init_array): New function.
5933 (Layout::layout): Add entry to ctors_sections_in_init_array if
5935 * layout.h (class Layout): Declare is_ctors_in_init_array.
5936 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5937 is_ctors_reverse_view is set.
5938 (Sized_relobj_file::write_sections): Add layout parameter. Change
5939 all callers. Set is_ctors_reverse_view field of View_size.
5940 (Sized_relobj_file::reverse_words): New function.
5941 * object.h (Sized_relobj_file::View_size): Add
5942 is_ctors_reverse_view field.
5943 (class Sized_relobj_file): Update declarations.
5944 * testsuite/initpri3.c: New test.
5945 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5947 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5948 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5949 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5950 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5951 * testsuite/Makefile.in: Rebuild.
5955 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5956 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5957 (debug_msg_cdebug.err): New targets.
5958 * testsuite/Makefile.in: Regenerate.
5959 * testsuite/debug_msg.sh: Check output of link with compressed debug.
5960 Fix checks for link with shared library.
5964 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5965 skip empty text sections.
5966 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5971 * options.h (class General_options): Add --ctors-in-init-array.
5972 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5973 friends as SHT_PROGBITS for merging sections.
5974 (Layout::layout): Remove special handling of .init_array and
5975 friends. Don't sort if doing relocatable link. Sort for .ctors
5976 and .dtors if ctors_in_init_array.
5977 (Layout::make_output_section): Force correct section types for
5978 .init_array and friends. Don't sort if doing relocatable link,
5979 Don't sort .ctors and .dtors if ctors_in_init_array.
5980 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5981 (Layout::output_section_name): Add relobj parameter. Change all
5982 callers. Handle .ctors. and .dtors. in code rather than table.
5983 Handle .ctors and .dtors if ctors_in_init_array.
5984 (Layout::match_file_name): New function, moved from output.cc.
5985 * layout.h (class Layout): Update declarations.
5986 * output.cc: Include "layout.h".
5987 (Input_section_sort_entry::get_priority): New function.
5988 (Input_section_sort_entry::match_file_name): Just call
5989 Layout::match_file_name.
5990 (Output_section::Input_section_sort_init_fini_compare::operator()):
5991 Handle .ctors and .dtors. Sort by explicit priority rather than
5993 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5994 * testsuite/initpri2.c: New test.
5995 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5996 (check_PROGRAMS): Add initpri2.
5997 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5998 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5999 * configure, testsuite/Makefile.in: Rebuild.
6004 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6005 .interp section to a PT_INTERP segment even if we have seen a
6006 --dynamic-linker option. Don't do it if we have seen a PHDRS
6007 clause in a linker script.
6008 (Layout::finalize): Don't create a .interp section if we've
6009 already create a PT_INTERP segment.
6010 (Layout::create_interp): Always call choose_output_section (revert
6011 patch of 2011-06-17). Don't create PT_INTERP segment.
6012 * script-sections.cc
6013 (Script_sections::create_note_and_tls_segments): Add a .interp
6014 section to a PT_INTERP segment even if we have seen a
6015 --dynamic-linker option.
6019 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6020 merely because a non-PT_LOAD segment has a dynamic reloc.
6024 * layout.cc (Layout::finish_dynamic_section): Don't create
6025 DT_FLAGS entry if not needed.
6030 * layout.cc (Layout::layout_eh_frame): Correct handling of
6031 writable .eh_frame section.
6036 * resolve.cc (Symbol_table::resolve): Don't give an error if a
6037 symbol is redefined with the exact same object and value.
6042 * layout.h (class Layout): Add interp_segment_ field.
6043 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6044 (Layout::attach_allocated_section_to_segment): If making shared
6045 library, put .interp section in PT_INTERP segment.
6046 (Layout::finalize): Also call create_interp if -dynamic-linker
6048 (Layout::create_interp): Assert that there is no PT_INTERP
6049 segment. If not using a SECTIONS clause, use make_output_section.
6050 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6051 * script-sections.cc
6052 (Script_sections::create_note_and_tls_segments): If making shared
6053 library, put .interp section in PT_INTERP segment.
6057 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6058 when making a shared library.
6062 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6063 parameter. Change all callers. Don't issue warning about PC32
6064 against locally defined symbol.
6068 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6069 occurs in same object.
6073 * po/POTFILES.in: Regenerate.
6077 * script-sections.cc
6078 (Orphan_output_section::set_section_addresses): For a relocatable
6079 link set address to 0.
6084 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6085 used with --compress-debug-sections.
6086 * gold/object.cc (Sized_relobj_file::do_layout): Report
6087 uncompressed size of compressed input sections.
6092 * testsuite/two_file_test_2_v1.cc: Change initialization of
6093 v2 to keep it in .data.
6097 * common.cc (Symbol_table::do_allocate_commons_list): Call
6099 * errors.cc (Errors::fatal): Adjust call to gold_exit.
6100 (Errors::fallback): New function.
6101 (gold_fallback): New function.
6102 * errors.h (Errors::fallback): New function.
6103 * gold.cc (gold_exit): Change status parameter to enum; adjust
6105 (queue_initial_tasks): Call gold_fallback.
6106 * gold.h: Include cstdlib.
6107 (Exit_status): New enum type.
6108 (gold_exit): Change status parameter to enum.
6109 (gold_fallback): New function.
6110 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6111 (Layout::create_symtab_sections): Likewise.
6112 (Layout::create_shdrs): Likewise.
6113 * main.cc (main): Adjust call to gold_exit.
6114 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6115 (Output_data_got::add_got_entry_pair): Likewise.
6116 (Output_section::add_input_section): Likewise.
6117 (Output_section::add_output_section_data): Likewise.
6118 (Output_segment::set_section_list_addresses): Likewise.
6119 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6123 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6124 for incremental links.
6125 * output.cc (Output_segment::set_section_list_addresses): Remove
6126 FIXME and test for TLS or BSS.
6130 * testsuite/Makefile.am: Add incremental_copy_test,
6131 incremental_common_test_1.
6132 * testsuite/Makefile.in: Regenerate.
6133 * testsuite/common_test_1_v1.c: New source file.
6134 * testsuite/common_test_1_v2.c: New source file.
6135 * testsuite/copy_test_v1.cc: New source file.
6139 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6140 update, allocate common from bss section's free list.
6141 * incremental-dump.cc (dump_incremental_inputs): Print flag for
6142 linker-defined symbols.
6143 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6144 Skip GOT and PLT entries that are no longer referenced.
6145 (Output_section_incremental_inputs::write_info_blocks): Mark
6146 linker-defined symbols.
6147 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6148 * output.cc (Output_section::allocate): New function.
6149 * output.h (Output_section::allocate): New function.
6150 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6151 linker-defined symbols.
6152 (Symbol::override_base_with_special): Copy is_predefined_ flag.
6153 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6154 (Symbol::init_base_output_data): Likewise.
6155 (Symbol::init_base_output_segment): Likewise.
6156 (Symbol::init_base_constant): Likewise.
6157 (Sized_symbol::init_output_data): Likewise.
6158 (Sized_symbol::init_output_segment): Likewise.
6159 (Sized_symbol::init_constant): Likewise.
6160 (Symbol_table::do_define_in_output_data): Likewise.
6161 (Symbol_table::do_define_in_output_segment): Likewise.
6162 (Symbol_table::do_define_as_constant): Likewise.
6163 * symtab.h (Symbol::is_predefined): New function.
6164 (Symbol::init_base_output_data): Add is_predefined parameter.
6165 (Symbol::init_base_output_segment): Likewise.
6166 (Symbol::init_base_constant): Likewise.
6167 (Symbol::is_predefined_): New data member.
6168 (Sized_symbol::init_output_data): Add is_predefined parameter.
6169 (Sized_symbol::init_output_segment): Likewise.
6170 (Sized_symbol::init_constant): Likewise.
6171 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6175 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6176 instead of emit_copy_reloc.
6177 (Copy_relocs::emit_copy_reloc): Refactor.
6178 (Copy_relocs::make_copy_reloc): New function.
6179 (Copy_relocs::add_copy_reloc): Remove.
6180 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6182 (Copy_relocs::make_copy_reloc): New function.
6183 (Copy_relocs::add_copy_reloc): Remove.
6184 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6185 unchanged input files.
6186 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6187 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6188 Reserve BSS space for COPY relocations.
6189 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6190 (Output_section_incremental_inputs::write_info_blocks): Record
6191 whether a symbol is copied from a shared object.
6192 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6193 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6194 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6195 (Incremental_input_entry_reader::get_output_symbol_index): Add
6197 (Incremental_binary::emit_copy_relocs): New function.
6198 (Incremental_binary::do_emit_copy_relocs): New function.
6199 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6201 (Sized_incremental_binary::add_copy_reloc): New function.
6202 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6203 (Sized_incremental_binary::Copy_reloc): New struct.
6204 (Sized_incremental_binary::Copy_relocs): New typedef.
6205 (Sized_incremental_binary::copy_relocs_): New data member.
6206 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6207 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6208 * target.h (Sized_target::emit_copy_reloc): New function.
6209 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6214 * gold/archive.cc (Archive::Archive): Initialize new data member.
6215 (Archive::include_all_members): Return if archive has already been
6217 * gold/archive.h (Archive::include_all_members_): New data member.
6221 * dynobj.h: Fix spelling mistake in comment.
6222 * output.cc: Likewise.
6228 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6229 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6230 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
6231 redundant arm_exidx_test.so.
6232 * testsuite/Makefile.in: Regenerate.
6233 (check_SCRIPTS): Add pr12826.sh
6234 (check_DATA): Add pr12826.stdout
6235 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6236 * testsuite/pr12826.sh: New file.
6237 * testsuite/pr12826_1.s: Ditto.
6238 * testsuite/pr12826_1.s: Ditto.
6242 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6248 * testsuite/Makefile.am: Use different file name for two_file_test
6249 temporary file for each incremental test.
6250 * testsuite/Makefile.in: Rebuild.
6254 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6255 binary input file is empty.
6259 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6260 (ver_test_9.so): Likewise.
6261 * testsuite/Makefile.in: Rebuild.
6265 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6266 * incremental.cc (Incremental_inputs::report_input_section): Fix
6267 comment, indentation.
6268 (Incremental_inputs::report_comdat_group): New function.
6269 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6270 of data for incremental input file entry.
6271 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6272 group count, COMDAT group signatures.
6273 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6274 an unchanged input file.
6275 * incremental.h (Incremental_object_entry::Incremental_object_entry):
6276 Initialize new data member.
6277 (Incremental_object_entry::add_comdat_group): New function.
6278 (Incremental_object_entry::get_comdat_group_count): New function.
6279 (Incremental_object_entry::get_comdat_signature_key): New function.
6280 (Incremental_object_entry::groups_): New data member.
6281 (Incremental_inputs::report_comdat_group): New function.
6282 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6283 data for incremental input file entry.
6284 (Incremental_input_entry_reader::get_comdat_group_count): New function.
6285 (Incremental_input_entry_reader::get_input_section): Adjust size of
6286 data for incremental input file entry.
6287 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6288 (Incremental_input_entry_reader::get_comdat_group_signature): New
6290 * object.cc (Sized_relobj::include_section_group): Report kept
6291 COMDAT groups for incremental links.
6295 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6296 with name parameter. Add found_name parameter.
6297 * fileread.cc (Input_file::find_file): Adjust code accordingly.
6298 * dirsearch.h (class Dirsearch): Update declaration.
6302 * archive.cc (Library_base::should_include_member): Pull in object
6303 from archive if it defines the entry symbol.
6304 * parameters.cc (Parameters::entry): New function.
6305 * parameters.h (class Parameters): Declare entry.
6306 * output.h (class Output_file_header): Remove entry_ field.
6307 * output.cc (Output_file_header::Output_file_header): Remove entry
6308 parameter. Change all callers.
6309 (Output_file_header::entry): Use parameters->entry.
6310 * gold.cc (queue_middle_tasks): Likewise.
6311 * plugin.cc (Plugin_hook::run): Likewise.
6315 * gold.cc (queue_initial_tasks): Pass incremental base filename
6316 to Output_file::open_base_file; don't print error message.
6317 * incremental-dump.cc (main): Adjust call to
6318 Output_file::open_for_modification.
6319 * incremental-dump.cc (main): Likewise.
6320 * incremental.cc (Incremental_inputs::report_command_line):
6321 Ignore --incremental-base option when comparing command lines.
6322 Ignore parameter when given as separate argument.
6323 * options.h (class General_options): Add --incremental-base.
6324 * output.cc (Output_file::Output_file):
6325 (Output_file::open_base_file): Add base_name and writable parameters;
6326 read base file into new file; print error message here.
6327 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6329 * output.h (Output_file::open_for_modification): Rename to...
6330 (Output_file::open_base_file): ...this; add base_name and
6331 writable parameters; adjust all callers.
6332 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6334 * testsuite/Makefile.am (incremental_test_4): Test
6336 * testsuite/Makefile.in: Regenerate.
6340 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6342 * testsuite/Makefile.in: Regenerate.
6343 * testsuite/two_file_test_1_v1.cc: New test source file.
6344 * testsuite/two_file_test_1b_v1.cc: New test source file.
6345 * testsuite/two_file_test_2_v1.cc: New test source file.
6349 * dynobj.h (Dynobj::do_dynobj): New function.
6350 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6351 flag and soname for shared objects.
6352 * incremental.cc (Incremental_inputs::report_object): Make
6353 either Incremental_object_entry or Incremental_dynobj_entry; add
6354 soname to string table.
6355 (Incremental_inputs::report_input_section): Add assertion.
6356 (Output_section_incremental_inputs::set_final_data_size): Adjust
6357 type of input file entry for shared libraries; adjust size of
6358 shared library info entry.
6359 (Output_section_incremental_inputs::write_input_files): Write
6360 as_needed flag for shared libraries.
6361 (Output_section_incremental_inputs::write_info_blocks): Adjust type
6362 of input file entry for shared libraries; write soname.
6363 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6364 soname from incremental info.
6365 * incremental.h (enum Incremental_input_flags): Add
6366 INCREMENTAL_INPUT_AS_NEEDED.
6367 (Incremental_input_entry::Incremental_input_entry): Initialize new
6369 (Incremental_input_entry::set_as_needed): New function.
6370 (Incremental_input_entry::as_needed): New function.
6371 (Incremental_input_entry::do_dynobj_entry): New function.
6372 (Incremental_input_entry::as_needed_): New data member.
6373 (Incremental_object_entry::Incremental_object_entry): Don't check
6375 (Incremental_object_entry::do_type): Likewise.
6376 (class Incremental_dynobj_entry): New class.
6377 (Incremental_input_entry_reader::as_needed): New function.
6378 (Incremental_input_entry_reader::get_soname): New function.
6379 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6380 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6381 size of shared library info entry.
6382 * layout.cc (Layout::finish_dynamic_section): Don't test for
6383 incremental link when adding DT_NEEDED entries.
6384 * object.h (Object::Object): Initialize new data member.
6385 (Object::dynobj): New function.
6386 (Object::set_as_needed): New function.
6387 (Object::as_needed): New function.
6388 (Object::do_dynobj): New function.
6389 (Object::as_needed_): New data member.
6393 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6394 info; adjust display of GOT entries.
6395 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6396 vector of input objects; remove file_status_.
6397 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6398 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6399 got_plt reader; call target hooks to reserve GOT entries.
6400 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6401 of input file info header and GOT info entry.
6402 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6404 (Got_plt_view_info::got_descriptor): Remove.
6405 (Got_plt_view_info::sym_index): New data member.
6406 (Got_plt_view_info::input_index): New data member.
6407 (Local_got_offset_visitor::visit): Write input file index.
6408 (Global_got_offset_visitor::visit): Write 0 for input file index.
6409 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6410 with sym_index and input_index.
6411 (Output_section_incremental_inputs::write_got_plt): Adjust size of
6412 incremental info GOT entry; replace got_descriptor with input_index.
6413 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6414 map from input file index to object.
6415 (Sized_relobj_incr::do_layout): Replace direct data member reference
6416 with accessor function.
6417 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6418 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6419 Adjust size of input file info header.
6420 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6421 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6422 (Incremental_input_entry_reader::get_input_section): Adjust size of
6423 input file info header.
6424 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6425 of incremental info GOT entry.
6426 (Incremental_got_plt_reader::get_got_desc): Remove.
6427 (Incremental_got_plt_reader::get_got_symndx): New function.
6428 (Incremental_got_plt_reader::get_got_input_index): New function.
6429 (Sized_incremental_binary::Sized_incremental_binary): Remove
6430 file_status_; add input_objects_.
6431 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6432 (Sized_incremental_binary::set_file_is_unchanged): Remove.
6433 (Sized_incremental_binary::file_is_unchanged): Remove.
6434 (Sized_incremental_binary::set_input_object): New function.
6435 (Sized_incremental_binary::input_object): New function.
6436 (Sized_incremental_binary::file_status_): Remove.
6437 (Sized_incremental_binary::input_objects_): New data member.
6438 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6440 (Sized_relobj_incr::invalid_address): Move to base class.
6441 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6443 (Sized_relobj_incr::do_output_section_offset): Likewise.
6444 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6445 (Sized_relobj_incr::section_offsets_): Likewise.
6446 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6448 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6449 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6450 with accessor function.
6451 (Sized_relobj_file::do_layout): Likewise.
6452 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6453 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6454 (Sized_relobj_file::compute_final_local_value): Replace refs to
6455 section_offsets_ with accessor function.
6456 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6457 * object.h (Relobj::Relobj): Initialize new data members.
6458 (Relobj::add_dyn_reloc): New function.
6459 (Relobj::first_dyn_reloc): New function.
6460 (Relobj::dyn_reloc_count): New function.
6461 (Relobj::first_dyn_reloc_): New data member.
6462 (Relobj::dyn_reloc_count_): New data member.
6463 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6465 (Sized_relobj::Address): New typedef.
6466 (Sized_relobj::invalid_address): Move here from child class.
6467 (Sized_relobj::Sized_relobj): Initialize new data members.
6468 (Sized_relobj::sized_relobj): New function.
6469 (Sized_relobj::is_output_section_offset_invalid): Move here from
6471 (Sized_relobj::get_output_section_offset): Likewise.
6472 (Sized_relobj::local_has_got_offset): Likewise.
6473 (Sized_relobj::local_got_offset): Likewise.
6474 (Sized_relobj::set_local_got_offset): Likewise.
6475 (Sized_relobj::do_for_all_local_got_entries): Likewise.
6476 (Sized_relobj::clear_got_offsets): New function.
6477 (Sized_relobj::section_offsets): Move here from child class.
6478 (Sized_relobj::do_output_section_offset): Likewise.
6479 (Sized_relobj::do_set_section_offset): Likewise.
6480 (Sized_relobj::Local_got_offsets): Likewise.
6481 (Sized_relobj::local_got_offsets_): Likewise.
6482 (Sized_relobj::section_offsets_): Likewise.
6483 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6485 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6487 (Sized_relobj_file::sized_relobj): New function
6488 (Sized_relobj_file::local_has_got_offset): Move to base class.
6489 (Sized_relobj_file::local_got_offset): Likewise.
6490 (Sized_relobj_file::set_local_got_offset): Likewise.
6491 (Sized_relobj_file::get_output_section_offset): Likewise.
6492 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6493 (Sized_relobj_file::do_output_section_offset): Likewise.
6494 (Sized_relobj_file::do_set_section_offset): Likewise.
6495 (Sized_relobj_file::Local_got_offsets): Likewise.
6496 (Sized_relobj_file::local_got_offsets_): Likewise.
6497 (Sized_relobj_file::section_offsets_): Likewise.
6498 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6500 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6501 (Output_reloc::get_symbol_index): Likewise.
6502 (Output_reloc::local_section_offset): Likewise.
6503 (Output_reloc::get_address): Likewise.
6504 (Output_reloc::symbol_value): Likewise.
6505 (Output_data_got::reserve_slot): Move to class definition.
6506 (Output_data_got::reserve_local): New function.
6507 (Output_data_got::reserve_slot_for_global): Remove.
6508 (Output_data_got::reserve_global): New function.
6509 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6510 (all constructors, two instantiations).
6511 (Output_reloc::get_relobj): New function (two instantiations).
6512 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6513 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6514 (Output_data_reloc::add_global): Adjust type of relobj.
6515 (Output_data_reloc::add_global_relative): Likewise.
6516 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6517 (Output_data_reloc::add_local): Likewise.
6518 (Output_data_reloc::add_local_relative): Likewise.
6519 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6520 (Output_data_reloc::add_local_section): Likewise.
6521 (Output_data_reloc::add_output_section): Likewise.
6522 (Output_data_reloc::add_absolute): Likewise.
6523 (Output_data_reloc::add_target_specific): Likewise.
6524 (Output_data_got::reserve_slot): Move definition here.
6525 (Output_data_got::reserve_local): New function.
6526 (Output_data_got::reserve_global): New function.
6527 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6528 section_offsets_ with accessor function.
6529 (Sized_relobj_file::write_sections): Likewise.
6530 (Sized_relobj_file::do_relocate_sections): Likewise.
6531 * target.h (Sized_target::reserve_local_got_entry): New function.
6532 (Sized_target::reserve_global_got_entry): New function.
6533 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6534 (Target_x86_64::reserve_global_got_entry): New function.
6535 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6539 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6540 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6541 bit when checking got_type.
6542 * incremental.cc (Sized_incremental_binary::setup_readers):
6543 Store symbol table and string table locations; initialize bit vector
6544 of file status flags.
6545 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6547 (Sized_incremental_binary::do_process_got_plt): New function.
6548 (Sized_incremental_binary::get_symtab_view): Use stored locations.
6549 (Output_section_incremental_inputs::set_final_data_size): Record
6550 file index for each input file.
6551 (Output_section_incremental_inputs::write_got_plt): Store file index
6552 instead of input entry offset for each GOT entry.
6554 (Incremental_input_entry::Incremental_input_entry): Initialize new
6556 (Incremental_input_entry::set_offset): Store file index.
6557 (Incremental_input_entry::get_file_index): New function.
6558 (Incremental_input_entry::file_index_): New data member.
6559 (Incremental_binary::process_got_plt): New function.
6560 (Incremental_binary::do_process_got_plt): New function.
6561 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6563 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6564 (Sized_incremental_binary::set_file_is_unchanged): New function.
6565 (Sized_incremental_binary::file_is_unchanged): New function.
6566 (Sized_incremental_binary::do_process_got_plt): New function.
6567 (Sized_incremental_binary::file_status_): New data member.
6568 (Sized_incremental_binary::main_symtab_loc_): New data member.
6569 (Sized_incremental_binary::main_strtab_loc_): New data member.
6570 * output.cc (Output_data_got::Got_entry::write): Add case
6572 (Output_data_got::add_global): Call add_got_entry.
6573 (Output_data_got::add_global_plt): Likewise.
6574 (Output_data_got::add_global_with_rel): Likewise.
6575 (Output_data_got::add_global_with_rela): Likewise.
6576 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6577 (Output_data_got::add_global_pair_with_rela): Likewise.
6578 (Output_data_got::add_local): Call add_got_entry.
6579 (Output_data_got::add_local_plt): Likewise.
6580 (Output_data_got::add_local_with_rel): Likewise.
6581 (Output_data_got::add_local_with_rela): Likewise.
6582 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6583 (Output_data_got::add_local_pair_with_rela): Likewise.
6584 (Output_data_got::reserve_slot): New function.
6585 (Output_data_got::reserve_slot_for_global): New function.
6586 (Output_data_got::add_got_entry): New function.
6587 (Output_data_got::add_got_entry_pair): New function.
6588 (Output_section::add_output_section_data): Edit FIXME.
6590 (Output_section_data_build::Output_section_data_build): New
6591 constructor with size parameter.
6592 (Output_data_space::Output_data_space): Likewise.
6593 (Output_data_got::Output_data_got): Initialize new data member; new
6594 constructor with size parameter.
6595 (Output_data_got::add_constant): Call add_got_entry.
6596 (Output_data_got::reserve_slot): New function.
6597 (Output_data_got::reserve_slot_for_global): New function.
6598 (class Output_data_got::Got_entry): Add RESERVED_CODE.
6599 (Output_data_got::add_got_entry): New function.
6600 (Output_data_got::add_got_entry_pair): New function.
6601 (Output_data_got::free_list_): New data member.
6602 * target.h (Sized_target::init_got_plt_for_update): New function.
6603 (Sized_target::register_global_plt_entry): New function.
6604 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6605 Initialize new data member; call init; add constructor with PLT count.
6606 (Output_data_plt_x86_64::init): New function.
6607 (Output_data_plt_x86_64::add_relocation): New function.
6608 (Output_data_plt_x86_64::reserve_slot): New function.
6609 (Output_data_plt_x86_64::free_list_): New data member.
6610 (Target_x86_64::init_got_plt_for_update): New function.
6611 (Target_x86_64::register_global_plt_entry): New function.
6612 (Output_data_plt_x86_64::add_entry): Allocate from free list for
6613 incremental updates.
6614 (Output_data_plt_x86_64::add_relocation): New function.
6615 * testsuite/object_unittest.cc (Object_test): Set default options.
6619 * options.h (class General_options): Make -i a synonym for -r.
6623 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6627 * object.cc (Sized_relobj::do_count_local_symbols): Check for
6632 * layout.cc (Layout::layout): If the output section flags change,
6633 update the ordering.
6637 * incremental-dump.cc (dump_incremental_inputs): Print local
6638 symbol info for each input file.
6640 (Output_section_incremental_inputs::set_final_data_size): Add local
6641 symbol info to input file entries in incremental info.
6642 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6643 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6644 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6645 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6647 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6648 (Sized_incr_relobj::do_relocate): Write the local symbols.
6649 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6650 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6651 Adjust size of input file header.
6652 (Incremental_inputs_reader::get_local_symbol_offset): New function.
6653 (Incremental_inputs_reader::get_local_symbol_count): New function.
6654 (Incremental_inputs_reader::get_input_section): Adjust size of input
6656 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6657 (Sized_incr_relobj::This): New typedef.
6658 (Sized_incr_relobj::sym_size): New const data member.
6659 (Sized_incr_relobj::Local_symbol): New struct.
6660 (Sized_incr_relobj::do_output_local_symbol_count): New function.
6661 (Sized_incr_relobj::do_local_symbol_offset): New function.
6662 (Sized_incr_relobj::local_symbol_count_): New data member.
6663 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6664 (Sized_incr_relobj::local_symbol_index_): New data member.
6665 (Sized_incr_relobj::local_symbol_offset_): New data member.
6666 (Sized_incr_relobj::local_dynsym_offset_): New data member.
6667 (Sized_incr_relobj::local_symbols_): New data member.
6668 * object.h (Relobj::output_local_symbol_count): New function.
6669 (Relobj::local_symbol_offset): New function.
6670 (Relobj::do_output_local_symbol_count): New function.
6671 (Relobj::do_local_symbol_offset): New function.
6672 (Sized_relobj::do_output_local_symbol_count): New function.
6673 (Sized_relobj::do_local_symbol_offset): New function.
6677 * descriptors.cc (set_close_on_exec): New function.
6678 (Descriptors::open): Use set_close_on_exec.
6679 * output.cc (S_ISLNK): Define if not defined.
6683 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6685 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6686 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6687 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6689 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6690 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6691 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6693 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6695 (Incremental_binary::apply_incremental_relocs): New function.
6696 (Incremental_binary::do_apply_incremental_relocs): New function.
6697 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6699 (Sized_incremental_binary::add_global_symbol): New function.
6700 (Sized_incremental_binary::global_symbol): New function.
6701 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6702 (Sized_incremental_binary::symbol_map_): New data member.
6703 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6704 * target.h (Sized_target::apply_relocation): New function.
6705 * target-reloc.h (apply_relocation): New function.
6706 * x86_64.cc (Target_x86_64::apply_relocation): New function.
6710 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6711 flag of a SHT_ARM_EXIDX section.
6712 * testsuite/Makefile.am (arm_exidx_test): New test rules.
6713 * testsuite/Makefile.in: Regenerate.
6714 * testsuite/arm_exidx_test.s: New file.
6715 * testsuite/arm_exidx_test.sh: Same.
6720 * archive.h (Incremental_archive_entry::Archive_member):
6721 Initialize arg_serial_ (second constructor).
6725 * object.cc (Relocate_info::location): Simplify location string.
6726 * errors.cc (Errors::error_at_location): Don't print program
6728 (Errors::warning_at_location): Likewise.
6729 (Errors::undefined_symbol): Likewise.
6730 * testsuite/debug_msg.sh: Update accordingly.
6734 * gold/layout.cc (Layout::symtab_section_offset): New function.
6735 * gold/layout.h (Layout::symtab_section_offset): New function.
6736 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6740 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
6741 with MREMAP_MAYMOVE.
6742 * output.h (class Output_file): Add map_is_allocated_ field.
6743 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
6744 not available, provide stubs. If mremap is not available, #define
6746 (MREMAP_MAYMOVE): Define if not defined.
6747 (Output_file::Output_file): Initialize map_is_allocated_.
6748 (Output_file::resize): Check map_is_allocated_.
6749 (Output_file::map_anonymous): If mmap fails, use malloc.
6750 (Output_file::unmap): Don't do anything for an anonymous map.
6751 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
6752 is not available, provide stubs.
6753 (File_read::View::~View): Use free rather than delete[].
6754 (File_read::make_view): Use malloc rather than new[]. If mmap
6756 (File_read::find_or_make_view): Use malloc rather than new[].
6757 * gold.h: Remove HAVE_REMAP code.
6758 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
6759 exists. Rename mremap to gold_mremap. If mmap is not available
6761 * configure, config.in: Rebuild.
6765 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6766 initialize local variable v.
6770 * archive.cc (Archive::include_member): Adjust call to
6772 (Add_archive_symbols::run): Track argument serial numbers.
6773 (Lib_group::include_member): Likewise.
6774 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6775 * archive.h (Incremental_archive_entry::Archive_member):
6776 Initialize arg_serial_.
6777 (Archive_member::arg_serial_): New data member.
6778 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6779 (Sized_dynobj::do_add_symbols): Track symbols when doing an
6781 (Sized_dynobj::do_for_all_local_got_entries): New function.
6782 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6784 * fileread.cc (get_mtime): New function.
6785 * fileread.h (get_mtime): New function.
6786 * gold.cc (queue_initial_tasks): Check for incremental update.
6787 (process_incremental_input): New function.
6788 (queue_middle_tasks): Don't force valid target for incremental
6790 * incremental-dump.cc (find_input_containing_global): Adjust
6791 size of symbol info entry.
6792 (dump_incremental_inputs): Dump argument serial number and
6793 in_system_directory flag; bias shndx by 1; print symbol names
6794 when dumping per-file symbol lists; use new symbol info readers.
6796 (Output_section_incremental_inputs:update_data_size): New function.
6797 (Sized_incremental_binary::setup_readers): Setup input readers
6798 for each input file; build maps for files added from libraries
6800 (Sized_incremental_binary::check_input_args): New function.
6801 (Sized_incremental_binary::do_check_inputs): Build map of argument
6802 serial numbers to input arguments.
6803 (Sized_incremental_binary::do_file_has_changed): Rename
6804 do_file_is_unchanged to this; compare file modification times.
6805 (Sized_incremental_binary::do_init_layout): New function.
6806 (Sized_incremental_binary::do_reserve_layout): New function.
6807 (Sized_incremental_binary::do_get_input_reader): Remove.
6808 (Sized_incremental_binary::get_symtab_view): New function.
6809 (Incremental_checker::can_incrementally_link_output_file): Remove.
6810 (Incremental_inputs::report_command_line): Exclude --debug options.
6811 (Incremental_inputs::report_archive_begin): Add parameter; track
6812 argument serial numbers; don't put input file entry for archive
6813 before archive members.
6814 (Incremental_inputs::report_archive_end): Put input file entry
6815 for archive after archive members.
6816 (Incremental_inputs::report_object): Add parameter; track argument
6817 serial numbers and in_system_directory flag.
6818 (Incremental_inputs::report_script): Add parameter; track argument
6820 (Output_section_incremental_inputs::set_final_data_size): Adjust
6821 size of symbol info entry; check for forwarding symbols.
6822 (Output_section_incremental_inputs::write_input_files): Write
6823 in_system_directory flag and argument serial number.
6824 (Output_section_incremental_inputs::write_info_blocks): Map section
6825 indices between incremental info and original input file; store
6826 input section index for each symbol.
6827 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6828 change operator() to visit().
6829 (class Global_got_offset_visitor): Likewise.
6830 (class Global_symbol_visitor_got_plt):
6831 (Output_section_incremental_inputs::write_got_plt): Use new visitor
6833 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6834 (Sized_incr_relobj::do_read_symbols): New function.
6835 (Sized_incr_relobj::do_layout): New function.
6836 (Sized_incr_relobj::do_layout_deferred_sections): New function.
6837 (Sized_incr_relobj::do_add_symbols): New function.
6838 (Sized_incr_relobj::do_should_include_member): New function.
6839 (Sized_incr_relobj::do_for_all_global_symbols): New function.
6840 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6841 (Sized_incr_relobj::do_section_size): New function.
6842 (Sized_incr_relobj::do_section_name): New function.
6843 (Sized_incr_relobj::do_section_contents): New function.
6844 (Sized_incr_relobj::do_section_flags): New function.
6845 (Sized_incr_relobj::do_section_entsize): New function.
6846 (Sized_incr_relobj::do_section_address): New function.
6847 (Sized_incr_relobj::do_section_type): New function.
6848 (Sized_incr_relobj::do_section_link): New function.
6849 (Sized_incr_relobj::do_section_info): New function.
6850 (Sized_incr_relobj::do_section_addralign): New function.
6851 (Sized_incr_relobj::do_initialize_xindex): New function.
6852 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6853 (Sized_incr_relobj::do_read_relocs): New function.
6854 (Sized_incr_relobj::do_gc_process_relocs): New function.
6855 (Sized_incr_relobj::do_scan_relocs): New function.
6856 (Sized_incr_relobj::do_count_local_symbols): New function.
6857 (Sized_incr_relobj::do_finalize_local_symbols): New function.
6858 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6859 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6860 (Sized_incr_relobj::do_relocate): New function.
6861 (Sized_incr_relobj::do_set_section_offset): New function.
6862 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6863 (Sized_incr_dynobj::do_read_symbols): New function.
6864 (Sized_incr_dynobj::do_layout): New function.
6865 (Sized_incr_dynobj::do_add_symbols): New function.
6866 (Sized_incr_dynobj::do_should_include_member): New function.
6867 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6868 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6869 (Sized_incr_dynobj::do_section_size): New function.
6870 (Sized_incr_dynobj::do_section_name): New function.
6871 (Sized_incr_dynobj::do_section_contents): New function.
6872 (Sized_incr_dynobj::do_section_flags): New function.
6873 (Sized_incr_dynobj::do_section_entsize): New function.
6874 (Sized_incr_dynobj::do_section_address): New function.
6875 (Sized_incr_dynobj::do_section_type): New function.
6876 (Sized_incr_dynobj::do_section_link): New function.
6877 (Sized_incr_dynobj::do_section_info): New function.
6878 (Sized_incr_dynobj::do_section_addralign): New function.
6879 (Sized_incr_dynobj::do_initialize_xindex): New function.
6880 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6881 (make_sized_incremental_object): New function.
6882 (Incremental_library::copy_unused_symbols): New function.
6883 (Incremental_library::do_for_all_unused_symbols): New function.
6884 * incremental.h (enum Incremental_input_flags): New type.
6885 (class Incremental_checker): Remove.
6886 (Incremental_input_entry::Incremental_input_entry): Add argument
6888 (Incremental_input_entry::arg_serial): New function.
6889 (Incremental_input_entry::set_is_in_system_directory): New function.
6890 (Incremental_input_entry::is_in_system_directory): New function.
6891 (Incremental_input_entry::arg_serial_): New data member.
6892 (Incremental_input_entry::is_in_system_directory_): New data member.
6893 (class Script_info): Move here from script.h.
6894 (Script_info::Script_info): Add filename parameter.
6895 (Script_info::filename): New function.
6896 (Script_info::filename_): New data member.
6897 (Incremental_script_entry::Incremental_script_entry): Add argument
6899 (Incremental_object_entry::Incremental_object_entry): Likewise.
6900 (Incremental_object_entry::add_input_section): Build list of input
6901 sections with map to original shndx.
6902 (Incremental_object_entry::get_input_section_index): New function.
6903 (Incremental_object_entry::shndx_): New data member.
6904 (Incremental_object_entry::name_key_): Rename; adjust all refs.
6905 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6906 (Incremental_archive_entry::Incremental_archive_entry): Add argument
6908 (Incremental_inputs::report_archive_begin): Likewise.
6909 (Incremental_inputs::report_object): Likewise.
6910 (Incremental_inputs::report_script): Likewise.
6911 (class Incremental_global_symbol_reader): New class.
6912 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6913 and store flags and input file type.
6914 (Incremental_input_entry_reader::arg_serial): New function.
6915 (Incremental_input_entry_reader::type): Extract type from flags.
6916 (Incremental_input_entry_reader::is_in_system_directory): New function.
6917 (Incremental_input_entry_reader::get_input_section_count): Call
6918 accessor function for type.
6919 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6920 function for type; adjust size of global symbol entry.
6921 (Incremental_input_entry_reader::get_global_symbol_count): Call
6922 accessor function for type.
6923 (Incremental_input_entry_reader::get_object_count): Likewise.
6924 (Incremental_input_entry_reader::get_object_offset): Likewise.
6925 (Incremental_input_entry_reader::get_member_count): Likewise.
6926 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6927 (Incremental_input_entry_reader::get_member_offset): Likewise.
6928 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6929 (Incremental_input_entry_reader::Global_symbol_info): Remove.
6930 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6931 (Incremental_input_entry_reader::get_global_symbol_reader): New
6933 (Incremental_input_entry_reader::get_output_symbol_index): New
6935 (Incremental_input_entry_reader::type_): Remove.
6936 (Incremental_input_entry_reader::flags_): New data member.
6937 (Incremental_inputs_reader::input_file_offset): New function.
6938 (Incremental_inputs_reader::input_file_index): New function.
6939 (Incremental_inputs_reader::input_file): Call input_file_offset.
6940 (Incremental_inputs_reader::input_file_at_offset): New function.
6941 (Incremental_relocs_reader::get_r_type): Reformat.
6942 (Incremental_relocs_reader::get_r_shndx): Reformat.
6943 (Incremental_relocs_reader::get_r_offset): Reformat.
6944 (Incremental_relocs_reader::data): New function.
6945 (Incremental_binary::Incremental_binary): Initialize new data members.
6946 (Incremental_binary::check_inputs): Add cmdline parameter.
6947 (Incremental_binary::file_is_unchanged): Remove.
6948 (Input_reader::arg_serial): New function.
6949 (Input_reader::get_unused_symbol_count): New function.
6950 (Input_reader::get_unused_symbol): New function.
6951 (Input_reader::do_arg_serial): New function.
6952 (Input_reader::do_get_unused_symbol_count): New function.
6953 (Input_reader::do_get_unused_symbol): New function.
6954 (Incremental_binary::input_file_count): New function.
6955 (Incremental_binary::get_input_reader): Change signature to use
6956 index instead of filename.
6957 (Incremental_binary::file_has_changed): New function.
6958 (Incremental_binary::get_input_argument): New function.
6959 (Incremental_binary::get_library): New function.
6960 (Incremental_binary::get_script_info): New function.
6961 (Incremental_binary::init_layout): New function.
6962 (Incremental_binary::reserve_layout): New function.
6963 (Incremental_binary::output_file): New function.
6964 (Incremental_binary::do_check_inputs): New function.
6965 (Incremental_binary::do_file_is_unchanged): Remove.
6966 (Incremental_binary::do_file_has_changed): New function.
6967 (Incremental_binary::do_init_layout): New function.
6968 (Incremental_binary::do_reserve_layout): New function.
6969 (Incremental_binary::do_input_file_count): New function.
6970 (Incremental_binary::do_get_input_reader): Change signature.
6971 (Incremental_binary::input_args_map_): New data member.
6972 (Incremental_binary::library_map_): New data member.
6973 (Incremental_binary::script_map_): New data member.
6974 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6976 (Sized_incremental_binary::output_section): New function.
6977 (Sized_incremental_binary::inputs_reader): Add const.
6978 (Sized_incremental_binary::symtab_reader): Add const.
6979 (Sized_incremental_binary::relocs_reader): Add const.
6980 (Sized_incremental_binary::got_plt_reader): Add const.
6981 (Sized_incremental_binary::get_symtab_view): New function.
6982 (Sized_incremental_binary::Inputs_reader): New typedef.
6983 (Sized_incremental_binary::Input_entry_reader): New typedef.
6984 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6985 (Sized_incremental_binary::do_file_is_unchanged): Remove.
6986 (Sized_incremental_binary::do_file_has_changed): New function.
6987 (Sized_incremental_binary::do_init_layout): New function.
6988 (Sized_incremental_binary::do_reserve_layout): New function.
6989 (Sized_input_reader::Inputs_reader): Remove.
6990 (Sized_input_reader::Input_entry_reader): Remove.
6991 (Sized_input_reader::do_arg_serial): New function.
6992 (Sized_input_reader::do_get_unused_symbol_count): New function.
6993 (Sized_input_reader::do_get_unused_symbol): New function.
6994 (Sized_incremental_binary::do_input_file_count): New function.
6995 (Sized_incremental_binary::do_get_input_reader): Change signature;
6996 use index instead of filename.
6997 (Sized_incremental_binary::section_map_): New data member.
6998 (Sized_incremental_binary::input_entry_readers_): New data member.
6999 (class Sized_incr_relobj): New class.
7000 (class Sized_incr_dynobj): New class.
7001 (make_sized_incremental_object): New function.
7002 (class Incremental_library): New class.
7003 * layout.cc (Free_list::num_lists): New static data member.
7004 (Free_list::num_nodes): New static data member.
7005 (Free_list::num_removes): New static data member.
7006 (Free_list::num_remove_visits): New static data member.
7007 (Free_list::num_allocates): New static data member.
7008 (Free_list::num_allocate_visits): New static data member.
7009 (Free_list::init): New function.
7010 (Free_list::remove): New function.
7011 (Free_list::allocate): New function.
7012 (Free_list::dump): New function.
7013 (Free_list::print_stats): New function.
7014 (Layout_task_runner::run): Resize output file for incremental updates.
7015 (Layout::Layout): Initialize new data members.
7016 (Layout::set_incremental_base): New function.
7017 (Layout::init_fixed_output_section): New function.
7018 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7019 incremental updates.
7020 (Layout::create_gold_note): Do not create gold note section for
7021 incremental updates.
7022 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7023 for incremental updates.
7024 (Layout::set_section_offsets): For incremental updates, allocate space
7026 (Layout::create_symtab_sections): Layout with offsets relative to
7027 start of section; for incremental updates, allocate space from free
7029 (Layout::create_shdrs): For incremental updates, allocate space from
7031 (Layout::finish_dynamic_section): For incremental updates, do not
7032 check --as-needed (fixed in subsequent patch).
7033 * layout.h (class Free_list): New class.
7034 (Layout::set_incremental_base): New function.
7035 (Layout::incremental_base): New function.
7036 (Layout::init_fixed_output_section): New function.
7037 (Layout::allocate): New function.
7038 (Layout::incremental_base_): New data member.
7039 (Layout::free_list_): New data member.
7040 * main.cc (main): Print Free_list statistics.
7041 * object.cc (Relobj::finalize_incremental_relocs): Add
7042 clear_counts parameter; clear counts only when clear_counts is set.
7043 (Sized_relobj::Sized_relobj): Initialize new base class.
7044 (Sized_relobj::do_layout): Don't report special sections.
7045 (Sized_relobj::do_for_all_local_got_entries): New function.
7046 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7047 symtab_off to all symbol table offsets.
7048 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7049 * object.h (class Got_offset_list): Move to top of file.
7050 (Object::Object): Allow case where input_file == NULL.
7051 (Object::~Object): Likewise.
7052 (Object::input_file): Assert that input_file != NULL.
7053 (Object::lock): Allow case where input_file == NULL.
7054 (Object::unlock): Likewise.
7055 (Object::is_locked): Likewise.
7056 (Object::token): Likewise.
7057 (Object::release): Likewise.
7058 (Object::is_incremental): New function.
7059 (Object::get_mtime): New function.
7060 (Object::for_all_local_got_entries): New function.
7061 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7062 (Object::set_is_in_system_directory): New function.
7063 (Object::is_in_system_directory): New function.
7064 (Object::do_is_incremental): New function.
7065 (Object::do_get_mtime): New function.
7066 (Object::do_for_all_local_got_entries): New function.
7067 (Object::is_in_system_directory_): New data member.
7068 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7069 (class Sized_relobj_base): New class.
7070 (class Sized_relobj): Derive from Sized_relobj_base.
7071 (class Sized_relobj::Symbols): Redeclare from base class.
7072 (class Sized_relobj::local_got_offset_list): Remove.
7073 (class Sized_relobj::Output_sections): Redeclare from base class.
7074 (class Sized_relobj::do_for_all_local_got_entries): New function.
7075 (class Sized_relobj::write_local_symbols): Add offset parameter.
7076 (class Sized_relobj::local_symbol_offset_): Update comment.
7077 (class Sized_relobj::local_dynsym_offset_): Update comment.
7078 * options.cc (Input_arguments::add_file): Remove const.
7079 * options.h (Input_file_argument::Input_file_argument):
7080 Initialize arg_serial_ (all constructors).
7081 (Input_file_argument::set_arg_serial): New function.
7082 (Input_file_argument::arg_serial): New function.
7083 (Input_file_argument::arg_serial_): New data member.
7084 (Input_arguments::Input_arguments): Initialize file_count_.
7085 (Input_arguments::add_file): Remove const.
7086 (Input_arguments::number_of_input_files): New function.
7087 (Input_arguments::file_count_): New data member.
7088 (Command_line::number_of_input_files): Call
7089 Input_arguments::number_of_input_files.
7090 * output.cc (Output_segment_headers::Output_segment_headers):
7092 (Output_section::Input_section::current_data_size): New function.
7093 (Output_section::Output_section): Initialize new data members.
7094 (Output_section::add_input_section): Don't do merge sections for
7095 an incremental link; allocate space from free list for an
7097 (Output_section::add_output_section_data): Allocate space from
7098 free list for an incremental update.
7099 (Output_section::update_data_size): New function.
7100 (Output_section::set_fixed_layout): New function.
7101 (Output_section::reserve): New function.
7102 (Output_segment::set_section_addresses): Remove const.
7103 (Output_segment::set_section_list_addresses): Remove const; allocate
7104 space from free list for an incremental update.
7105 (Output_segment::set_offset): Adjust size of RELRO segment for an
7107 * output.h (Output_data::current_data_size): Move here from
7109 (Output_data::pre_finalize_data_size): New function.
7110 (Output_data::update_data_size): New function.
7111 (Output_section_headers::update_data_size): new function.
7112 (Output_section_data_build::current_data_size): Move to Output_data.
7113 (Output_data_strtab::update_data_size): New function.
7114 (Output_section::current_data_size): Move to Output_data.
7115 (Output_section::set_fixed_layout): New function.
7116 (Output_section::has_fixed_layout): New function.
7117 (Output_section::reserve): New function.
7118 (Output_section::update_data_size): New function.
7119 (Output_section::has_fixed_layout_): New data member.
7120 (Output_section::free_list_): New data member.
7121 (Output_segment::set_section_addresses): Remove const.
7122 (Output_segment::set_section_list_addresses): Remove const.
7123 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7125 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7127 * readsyms.cc (Read_symbols::do_read_symbols): Add library
7128 parameter when calling Add_symbols constructor; store argument
7129 serial number for members of a lib group.
7130 (Add_symbols::locks): Allow case where token == NULL.
7131 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7132 (Read_member::~Read_member): New function.
7133 (Read_member::is_runnable): New function.
7134 (Read_member::locks): New function.
7135 (Read_member::run): New function.
7136 (Check_script::~Check_script): New function.
7137 (Check_script::is_runnable): New function.
7138 (Check_script::locks): New function.
7139 (Check_script::run): New function.
7140 (Check_library::~Check_library): New function.
7141 (Check_library::is_runnable): New function.
7142 (Check_library::locks): New function.
7143 (Check_library::run): New function.
7144 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7145 (Add_symbols::library_): New data member.
7146 (class Read_member): New class.
7147 (class Check_script): New class.
7148 (class Check_library): New class.
7149 * reloc.cc (Read_relocs::is_runnable): Allow case where
7151 (Read_relocs::locks): Likewise.
7152 (Scan_relocs::locks): Likewise.
7153 (Relocate_task::locks): Likewise.
7154 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7156 (Sized_relobj::incremental_relocs_scan): Fix comment.
7157 (Sized_relobj::do_relocate): Pass output file offset to
7158 write_local_symbols.
7159 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7160 from class declaration.
7161 * script.cc (read_input_script): Allocate Script_info; pass
7162 argument serial number to report_script.
7163 * script.h (class Script_info): Move to incremental.h.
7164 * symtab.cc (Symbol_table::add_from_incrobj): New function.
7165 * symtab.h (Symbol_table::add_from_incrobj): New function.
7166 (Symbol_table::set_file_offset): New function.
7170 * incremental-dump.cc (dump_incremental_inputs): Change signature
7171 to take a Sized_incremental_binary; change caller. Use readers
7172 in Sized_incremental_binary.
7174 (Sized_incremental_binary::find_incremental_inputs_sections):
7175 Rename do_find_incremental_inputs_sections to this.
7176 (Sized_incremental_binary::setup_readers): New function.
7177 (Sized_incremental_binary::do_check_inputs): Check
7178 has_incremental_info_ flag; move setup code to setup_readers;
7180 (Sized_incremental_binary::do_file_is_unchanged): New function.
7181 (Sized_incremental_binary::do_get_input_reader): New function.
7182 * incremental.h (class Incremental_binary): Move to end of file.
7183 (Incremental_binary::file_is_unchanged): New function.
7184 (Incremental_binary::do_file_is_unchanged): New function.
7185 (Incremental_binary::Input_reader): New class.
7186 (Incremental_binary::get_input_reader): New function.
7187 (class Sized_incremental_binary): Move to end of file.
7188 (Sized_incremental_binary::Sized_incremental_binary): Setup the
7189 input section reader classes.
7190 (Sized_incremental_binary::has_incremental_info): New function.
7191 (Sized_incremental_binary::inputs_reader): New function.
7192 (Sized_incremental_binary::symtab_reader): New function.
7193 (Sized_incremental_binary::relocs_reader): New function.
7194 (Sized_incremental_binary::got_plt_reader): New function.
7195 (Sized_incremental_binary::do_file_is_unchanged): New function.
7196 (Sized_incremental_binary::Sized_input_reader): New class.
7197 (Sized_incremental_binary::get_input_reader): New function.
7198 (Sized_incremental_binary::find_incremental_inputs_sections):
7199 Rename do_find_incremental_inputs_sections to this.
7200 (Sized_incremental_binary::setup_readers): New function.
7201 (Sized_incremental_binary::has_incremental_info_): New data member.
7202 (Sized_incremental_binary::inputs_reader_): New data member.
7203 (Sized_incremental_binary::symtab_reader_): New data member.
7204 (Sized_incremental_binary::relocs_reader_): New data member.
7205 (Sized_incremental_binary::got_plt_reader_): New data member.
7206 (Sized_incremental_binary::current_input_file_): New data member.
7211 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7216 * archive.cc (Archive::include_member): Adjust call to report_object.
7217 (Add_archive_symbols::run): Add script_info to call to
7218 report_archive_begin.
7219 (Lib_group::include_member): Adjust call to report_object.
7220 (Add_lib_group_symbols::run): Adjust call to report_object.
7221 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7222 blocks. Add object count for script input files.
7223 * incremental.cc (Incremental_inputs::report_archive_begin): Add
7224 script_info parameter; change all callers.
7225 (Incremental_inputs::report_object): Add script_info parameter;
7227 (Incremental_inputs::report_script): Store backpointer to
7228 incremental info entry.
7229 (Output_section_incremental_inputs::set_final_data_size): Record
7230 additional information for scripts.
7231 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7232 * incremental.h (Incremental_script_entry::add_object): New function.
7233 (Incremental_script_entry::get_object_count): New function.
7234 (Incremental_script_entry::get_object): New function.
7235 (Incremental_script_entry::objects_): New data member; adjust
7237 (Incremental_inputs::report_archive_begin): Add script_info parameter.
7238 (Incremental_inputs::report_object): Add script_info parameter.
7239 (Incremental_inputs_reader::get_object_count): New function.
7240 (Incremental_inputs_reader::get_object_offset): New function.
7241 * options.cc (Input_arguments::add_file): Return reference to
7243 * options.h (Input_argument::set_script_info): New function.
7244 (Input_argument::script_info): New function.
7245 (Input_argument::script_info_): New data member; adjust all
7247 (Input_file_group::add_file): Return reference to new input argument.
7248 (Input_file_lib::add_file): Likewise.
7249 (Input_arguments::add_file): Likewise.
7250 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7251 * script.cc (Parser_closure::Parser_closure): Add script_info
7252 parameter; adjust all callers.
7253 (Parser_closure::script_info): New function.
7254 (Parser_closure::script_info_): New data member.
7255 (read_input_script): Report scripts earlier to incremental info.
7256 (script_add_file): Set script_info in Input_argument.
7257 (script_add_library): Likewise.
7258 * script.h (Script_options::Script_info): Rewrite class.
7262 * archive.cc (Library_base::should_include_member): Move
7263 method here from class Archive.
7264 (Archive::Archive): Initialize base class.
7265 (Archive::should_include_member): Move to base class.
7266 (Archive::do_for_all_unused_symbols): New function.
7267 (Add_archive_symbols::run): Remove redundant access to
7269 (Lib_group::Lib_group): Initialize base class.
7270 (Lib_group::do_filename): New function.
7271 (Lib_group::include_member): Pass pointer to Lib_group to
7273 (Lib_group::do_for_all_unused_symbols): New function.
7274 (Add_lib_group_symbols::run): Report archive information for
7276 * archive.h (class Library_base): New base class.
7277 (class Archive): Derive from Library_base.
7278 (Archive::filename): Move to base class.
7279 (Archive::set_incremental_info): Likewise.
7280 (Archive::incremental_info): Likewise.
7281 (Archive::Should_include): Likewise.
7282 (Archive::should_include_member): Likewise.
7283 (Archive::Armap_entry): Remove.
7284 (Archive::Unused_symbol_iterator): Remove.
7285 (Archive::unused_symbols_begin): Remove.
7286 (Archive::unused_symbols_end): Remove.
7287 (Archive::do_filename): New function.
7288 (Archive::do_get_mtime): New function.
7289 (Archive::do_for_all_unused_symbols): New function.
7290 (Archive::task_): Move to base class.
7291 (Archive::incremental_info_): Likewise.
7292 (class Lib_group): Derive from Library_base.
7293 (Lib_group::do_filename): New function.
7294 (Lib_group::do_get_mtime): New function.
7295 (Lib_group::do_for_all_unused_symbols): New function.
7296 (Lib_group::task_): Move to base class.
7297 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7299 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7301 * incremental.cc (Incremental_inputs::report_archive_begin):
7302 Use Library_base; call library's get_mtime; add incremental inputs
7303 entry before members.
7304 (class Unused_symbol_visitor): New class.
7305 (Incremental_inputs::report_archive_end): Use Library_base; use
7306 visitor class to record unused symbols; don't add incremental inputs
7307 entry after members.
7308 (Incremental_inputs::report_object): Use Library_base.
7310 (Incremental_archive_entry::Incremental_archive_entry): Remove
7311 unused Archive parameter.
7312 (Incremental_inputs::report_archive_begin): Use Library_base.
7313 (Incremental_inputs::report_archive_end): Likewise.
7314 (Incremental_inputs::report_object): Likewise.
7315 * object.cc (Sized_relobj::do_for_all_global_symbols): New
7317 * object.h (Object::for_all_global_symbols): New function.
7318 (Object::do_for_all_global_symbols): New function.
7319 (Sized_relobj::do_for_all_global_symbols): New function.
7320 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
7322 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
7327 * archive.cc (Archive::interpret_header): Return -1 if something
7328 goes wrong. Change callers accordingly.
7332 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7333 * testsuite/Makefile.in: Regenerate.
7337 * plugin.cc (get_view): New.
7338 (Plugin::load): Pass get_view to the plugin.
7339 (Plugin_manager::get_view): New.
7343 * testsuite/final_layout.sh: Rewrite to not use dc.
7344 * testsuite/relro_test.sh: Fail if dc is not present.
7348 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7350 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7351 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7353 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7354 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7358 * script-sections.cc (Sort_output_sections::script_compare):
7359 Rename from is_before, change return type.
7360 (Sort_output_sections::operator()): Adjust accordingly.
7365 * testsuite/odr_violation2.cc: Add comment to make all error line
7366 numbers double digits.
7367 * testsuite/debug_msg.sh: Adjust expected errors.
7371 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7372 but mark earlier ones as non-canonical
7373 (offset_to_iterator): Update search target and example
7374 (do_addr2line): Return extra lines in a vector*
7375 (format_file_lineno): Extract from do_addr2line
7376 (one_addr2line): Add vector* out-param
7377 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7378 when a lineno entry appeared last for its instruction
7379 (Dwarf_line_info): Add vector* out-param
7380 * object.cc (Relocate_info): Pass NULL for the vector* out-param
7381 * symtab.cc (Odr_violation_compare): Include the lineno in the
7383 (linenos_from_loc): New. Combine the canonical line for an
7384 address with its other lines.
7385 (True_if_intersect): New. Helper functor to make
7386 std::set_intersection a query.
7387 (detect_odr_violations): Compare sets of lines instead of just
7388 one line for each function. This became less deterministic, but
7389 has fewer false positives.
7390 * symtab.h: Declarations.
7391 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7392 mix an optimized and non-optimized object in the same binary
7393 (odr_violation2.so): Same.
7394 * testsuite/Makefile.in: Regenerate from Makefile.am.
7395 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7396 * testsuite/debug_msg.sh: Update line numbers and add
7398 * testsuite/odr_violation1.cc: Use OdrDerived, in a
7399 non-optimized context.
7400 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7401 isn't inlined, and use OdrDerived in an optimized context.
7402 * testsuite/odr_header1.h: Defines OdrDerived, where
7403 optimization will change the
7404 first-instruction-in-the-destructor's file and line number.
7405 * testsuite/odr_header2.h: Defines OdrBase.
7409 * fileread.cc (File_read::clear_views): Don't delete the whole
7415 * fileread.cc: #include <climits>.
7416 (GOLD_IOV_MAX): Define.
7417 (File_read::read_multiple): Limit number of entries by iov_max.
7418 * fileread.h (class File_read): Always set max_readv_entries to
7424 * options.h (class General_options): Add -dy and -dn.
7428 * testsuite/script_test_9.t: Add TLS segment.
7432 * configure.ac: Add check for gnu_indirect_function support in
7433 the toolchain building binutils.
7434 * configure: Rebuild.
7438 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7439 plugin only symbols.
7440 (Symbol_table::sized_finalize_symbol) Mark symbol only present
7441 in plugin files as not needed in the symbol table.
7445 * output.cc (Output_section::add_input_section): Delay fill
7446 generation for section ordering.
7451 * object.h (class Sized_relobj): Remove clear_local_symbols.
7452 * reloc.cc (Sized_relobj::do_relocate): Don't call
7453 clear_local_symbols.
7457 * plugin.cc (is_visible_from_outside): Return true for symbols
7462 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7467 * icf.h (is_section_foldable_candidate): Change type of parameter
7469 * icf.cc (Icf::find_identical_sections): Change type of local variable
7470 section_name to be std::string.
7471 (is_function_ctor_or_dtor): Change type of parameter to std::string.
7475 * script.cc (script_add_extern): Rewrite to use
7476 add_symbol_reference.
7480 * icf.cc (get_section_contents): Always lock section's object.
7484 * options.h (class General_options): Accept
7485 --no-detect-odr-violations.
7489 * version.cc (version_string): Bump to 1.11.
7493 * plugin.cc (class Plugin_rescan): Define new class.
7494 (Plugin_manager::claim_file): Set any_claimed_.
7495 (Plugin_manager::save_archive): New function.
7496 (Plugin_manager::save_input_group): New function.
7497 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7499 (Plugin_manager::new_undefined_symbol): New function.
7500 (Plugin_manager::rescan): New function.
7501 (Plugin_manager::rescannable_defines): New function.
7502 (Plugin_manager::add_input_file): Set any_added_.
7503 * plugin.h (class Plugin_manager): define new fields rescannable_,
7504 undefined_symbols_, any_claimed_, and any_added_. Declare
7505 Plugin_rescan as friend. Declare new functions.
7506 (Plugin_manager::Rescannable): Define type.
7507 (Plugin_manager::Rescannable_list): Define type.
7508 (Plugin_manager::Undefined_symbol_list): Define type.
7509 (Plugin_manager::Plugin_manager): Initialize new fields.
7510 * archive.cc (Archive::defines_symbol): New function.
7511 (Add_archive_symbols::run): Pass archive to plugins if any.
7512 * archive.h (class Archive): Declare defines_symbol.
7513 * readsyms.cc (Input_group::~Input_group): New function.
7514 (Finish_group::run): Pass input_group to plugins if any.
7515 * readsyms.h (class Input_group): Declare destructor.
7516 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7521 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7523 (Layout::set_segment_offsets): Reset increase_relro before calling
7524 set_section_addresses a second time.
7528 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7529 sections before NOBITS sections.
7533 * version.cc (print_version): Update copyright to 2011.
7537 * output.h (Output_data_reloc::add_output_section): Pass OD instead
7538 of OS to this->add. Add OD parameter to second form of the function.
7542 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7543 second of two consecutive entries with same offset.
7547 * testsuite/Makefile.am (ifuncmain2static_LDADD)
7548 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7549 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7550 to avoid unneeded links against $(LDADD).
7551 * testsuite/Makefile.in: Regenerate.
7556 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7557 for R_X86_64_32 and R_X86_64_PC32.
7558 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7559 ver_matching_def_pic.o.
7560 (ver_matching_def_pic.o): New target.
7564 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7565 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7566 Move definition before File_read::View member definitions.
7567 (File_read::View::~View): Initialize and hold lock before
7568 updating current_mapped_bytes.
7572 * dwarf_reader.cc: Remove outdated comment.
7573 * gold-threads.cc: Fix typo in error message.
7574 * archive.cc: Fix typos in comments.
7575 * archive.h: Likewise.
7576 * arm-reloc-property.cc: Likewise.
7577 * arm-reloc-property.h: Likewise.
7578 * arm-reloc.def: Likewise.
7580 * attributes.h: Likewise.
7581 * cref.cc: Likewise.
7582 * ehframe.cc: Likewise.
7583 * fileread.h: Likewise.
7585 * i386.cc: Likewise.
7587 * incremental.h: Likewise.
7588 * int_encoding.cc: Likewise.
7589 * layout.h: Likewise.
7590 * main.cc: Likewise.
7591 * merge.h: Likewise.
7592 * object.cc: Likewise.
7593 * object.h: Likewise.
7594 * options.cc: Likewise.
7595 * readsyms.cc: Likewise.
7596 * reduced_debug_output.cc: Likewise.
7597 * reloc.cc: Likewise.
7598 * script-sections.cc: Likewise.
7599 * sparc.cc: Likewise.
7600 * symtab.h: Likewise.
7601 * target-reloc.h: Likewise.
7602 * target.cc: Likewise.
7603 * target.h: Likewise.
7604 * timer.cc: Likewise.
7605 * timer.h: Likewise.
7606 * x86_64.cc: Likewise.
7610 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7612 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7613 parameter; change all callers.
7614 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7615 * options.h (warn_execstack): New option.
7619 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7620 like function call relocations.
7624 * archive.cc (Archive::get_elf_object_for_member): Permit
7625 punconfigured to be NULL.
7626 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7627 (Archive::include_member): Pass NULL to get_elf_object_for_member
7628 if we searched for the archive and this is the first included
7633 * dwarf_reader.h (class Sized_dwarf_line_info): Add
7634 track_relocs_type_ field.
7635 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7636 Set track_relocs_type_.
7637 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7638 contents when using RELA relocs.
7639 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7641 * reloc.cc (Track_relocs::next_addend): New function.
7642 * reloc.h (class Track_relocs): Declare next_addend.
7646 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7651 * README: Update compilers known to work and fail.
7655 * configure.in: For --enable-gold, handle value `default' instead of
7656 `both*'. Always install ld as ld.bfd, install as ld if gold is
7658 * configure: Regenerate.
7662 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7663 and right_alignment to be zero. Store result alignment only if it is
7664 greater than existing alignment.
7669 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7670 Check for ".zdebug_line".
7675 * output.h (Output_segment::set_section_addresses): Pass increase_relro
7676 by reference; adjust all callers.
7677 * output.cc (Output_segment::set_section_addresses): Adjust references
7678 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7680 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7681 end at page boundary.
7686 * layout.cc (Layout::choose_output_section): Transform names of
7687 compressed sections even when using a script with a SECTIONS clause.
7688 (Layout::output_section_name): Remove code to transform
7689 compressed debug section names.
7690 * output.cc (Output_section::add_input_section): Use uncompressed
7691 section size when tracking input sections.
7695 * symtab.h (Symbol::NON_PIC_REF): Remove.
7696 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7697 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
7698 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7699 (Symbol::use_plt_offset): Take a flags argument and pass it
7700 directly to needs_dynamic_reloc. Restrict check for undefined
7701 weak symbols to function calls.
7702 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7703 (Target_arm::Scan::global): Use it.
7704 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7705 (Target_arm::Relocate::relocate): Likewise.
7706 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7707 parameter with an r_type parameter. Use get_reference_flags
7709 (Target_arm::Relocate::relocate): Update accordingly.
7710 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7711 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7712 (Target_i386::Scan::global): Likewise.
7713 (Target_i386::Relocate::relocate): Likewise.
7714 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7715 parameter with an r_type parameter. Use get_reference_flags
7717 (Target_i386::Relocate::relocate): Update accordingly.
7718 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7719 (Target_powerpc::Scan::global): Use it.
7720 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7721 (Target_powerpc::Relocate::relocate): Likewise.
7722 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7723 (Target_sparc::Scan::global): Use it.
7724 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7725 (Target_sparc::Relocate::relocate): Likewise.
7726 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7727 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7728 (Target_x86_64::Scan::global): Likewise.
7729 (Target_x86_64::Relocate::relocate): Likewise.
7734 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7735 (Arm_exidx_merge_section::section_contents_): New data member.
7736 (Arm_input_section::Arm_input_section): Initialize original_contents_.
7737 (Arm_input_section::~Arm_input_section): De-allocate memory.
7738 (Arm_input_section::original_contents_): New data member.
7739 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7740 in parameters instead of calling Object::section_contents without
7742 (Arm_output_section::group_section): New parameter TASK. Pass it
7743 to callees that need locking objects.
7744 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
7745 to lock EXIDX input sections. Fix a formatting issue. Call
7746 Arm_exidx_merged_section::build_contents to create merged section
7748 (Arm_output_section::create_stub_group): New parameter TASK. Use it
7749 to lock object of stub table owner.
7750 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7751 TEXT_SIZE to initialize data member TEXT_SIZE_.
7752 (Arm_exidx_input_section::addralign): Fix typo in comment.
7753 (Arm_exidx_input_section::text_size): New method.
7754 (Target_arm::do_relax): New parameter TASK. Pass it to callees
7755 that require locking objects. Lock objects before scanning for stubs
7756 and updating local symbols.
7757 (Arm_input_section<big_endian>::init): Copy contents of original
7759 (Arm_input_section<big_endian>::do_write): Use saved contents of
7760 original input section instead of calling Object::section_contents
7762 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7763 size without calling Object::section_size().
7764 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7765 for size. Allocate a buffer for merged EXIDX entries.
7766 (Arm_exidx_merged_section::build_contents): New method.
7767 (Arm_exidx_merged_section::do_write): Move merge section contents
7768 building code to Arm_exidx_merged_section::build_contetns. Write
7769 out contetns in buffer instead of building it on the fly.
7770 (Arm_relobj::make_exidx_input_section): Also pass text section size
7771 to Arm_exidx_input_section constructor.
7772 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
7773 (Arm_dynobj::do_read_symbols): Fix memory leak.
7774 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7775 * target.h: (class Task): Add forward declaration.
7776 (Target::relax): Add new parameter TASK and pass it to
7778 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
7783 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7784 object when reading from the file.
7785 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7787 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7788 when reading section contents.
7789 (get_section_contents): Likewise.
7790 (icf::find_identical_sections): Likewise.
7791 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7792 object when reading from the file.
7793 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7794 the object when doing deferred section layout.
7799 * script.h (class Symbol_assignment: name): New member. Returns
7800 the name of the symbol.
7801 * scrfipt.cc (Script_options::is_pending_assignment): New member.
7802 Returns true if the given symbol name is on the list of
7803 assignments wating to be processed.
7804 * archive.cc (should_incldue_member): If the symbol is undefined,
7805 check to see if it is on the list of symbols pending assignment.
7809 * script-sections.cc (Script_sections::find_memory_region): Check
7810 for a NULL output section pointer.
7814 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7815 Output_section::add_relaxed_input_section.
7816 * output.cc (Output_section::add_relaxed_input_section): Add new
7817 arguments LAYOUT and NAME. Set section order index.
7818 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7819 Copy section order index.
7820 * output.h (Output_section::add_relaxed_input_section): Add new
7821 arguments LAYOUT and NAME.
7825 * testsuite/Makefile.am: Move gcctestdir/ld rule to
7826 NATIVE_OR_CROSS_LINKER.
7827 * testsuite/Makefile.in: Regenerate.
7831 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7832 without SHF_LINK_ORDER flags.
7833 * layout.cc (Layout::choose_output_section): Do not filter
7834 SHF_LINK_ORDER flag in a relocatable link.
7838 * output.h (Output_segment::set_section_addresses): Change function
7839 signature. Update all callers.
7840 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7842 (Output_segment::set_section_addresses): Align after last TLS
7843 section. Add padding before last relro section instead of after.
7847 * gold/arm.cc (Target_arm::got_section): Use correct order and set
7848 GOT output section to be writable.
7852 * debug.h (DEBUG_INCREMENTAL): New flag.
7853 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7854 * gold.cc (queue_initial_tasks): Check parameters for incremental link
7856 * incremental.cc (report_command_line): Ignore all forms of
7858 * layout.cc (Layout::Layout): Check parameters for incremental link
7860 * options.cc (General_options::parse_incremental): New function.
7861 (General_options::parse_no_incremental): New function.
7862 (General_options::parse_incremental_full): New function.
7863 (General_options::parse_incremental_update): New function.
7864 (General_options::incremental_mode_): New data member.
7865 (General_options::finalize): Check incremental_mode_.
7866 * options.h (General_options): Update help text for --incremental.
7867 Add --no-incremental, --incremental-full, --incremental-update.
7868 (General_options::Incremental_mode): New enum type.
7869 (General_options::incremental_mode): New function.
7870 (General_options::incremental_mode_): New data member.
7871 * parameters.cc (Parameters::incremental_mode_): New data member.
7872 (Parameters::set_options): Set incremental_mode_.
7873 (Parameters::set_incremental_full): New function.
7874 (Parameters::incremental): New function.
7875 (Parameters::incremental_update): New function.
7876 (set_parameters_incremental_full): New function.
7877 * parameters.h (Parameters::set_incremental_full): New function.
7878 (Parameters::incremental): New function.
7879 (Parameters::incremental_update): New function.
7880 (Parameters::incremental_mode_): New data member.
7881 (set_parameters_incremental_full): New function.
7882 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7883 incremental link mode.
7884 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7885 (Sized_relobj::do_relocate_sections): Likewise.
7886 * testsuite/Makefile.am (incremental_test): Use --incremental-full
7888 * testsuite/Makefile.in: Regenerate.
7889 * testsuite/incremental_test.sh: Filter all forms of --incremental.
7893 * script-sections.h (class Script_sections): Make
7894 Sections_elements typedef public.
7895 * script-sections.cc (class Sort_output_sections): Add elements_
7896 field. Add constructor which sets it; change all callers.
7897 (Sort_output_sections::is_before): New function.
7898 (Sort_output_sections::operator()): Call is_before.
7899 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7901 * testsuite/script_test_10.sh: New test. Test script section
7903 * testsuite/script_test_10.t: Likewise.
7904 * testsuite/script_test_10.s: Likewise.
7905 * testsuite/Makefile.am: Wrap the cross linker tests and the
7906 common tests into NATIVE_OR_CROSS_LINKER.
7907 (check_SCRIPTS): Add script_test_10.sh.
7908 (check_DATA): Add script_test_10.stdout.
7909 (script_test_10.o, script_test_10): New targets.
7910 (script_test_10.stdout): New target.
7911 * configure, testsuite/Makefile.in: Regenerate.
7915 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7916 error for the deprecated relocations.
7917 (Target_arm::Scan::global): Likewise.
7918 (Target_arm::Relocate::relocate): Likewise.
7922 * fileread.cc (Input_file::find_file): Initialize *found_name
7923 and *namep when using the fallback search for case 4.
7927 * options.h (class General_options): Redefine -z lazy as an alias for
7928 the negation of -z now.
7932 * resolve.cc (symbol_to_bits): Report the value of the unsupported
7937 * script-sections.cc(class Memory_region): Remove
7938 current_lma_offset_ field. Rename current_vma_offset_ to
7939 current_offset_. Add last_section_ field.
7940 (Memory_region::get_current_vma_address): Rename to
7941 get_current_address.
7942 (Memory_region::get_current_lma_address): Delete.
7943 (Memory_region::increment_vma_offset): Rename to
7945 (Memory_region::increment_lma_offset): Delete.
7946 (Memory_region::attributes_compatible): New method. Returns
7947 true if the provided section is compatible with the region.
7948 (Memory_region::get_last_section): New method. Returns the last
7949 section to use the region.
7950 (Memory_region::set_last_section): New method. Stores the last
7951 section to use the region.
7952 (Script_sections::block_in_region): New method. Returns true if
7953 a block of memory is contained within a region.
7954 (Script_sections::find_memory_region): New method. Locates a
7955 memory region to be used to set a VMA or LMA address.
7956 (Output_section_definition::set_section_addresses): Add code to
7957 check for addresses set by memory regions.
7958 (Output_segment::set_section_addresses): Remove memory region
7960 (Script_sections::create_segment): Add a warning if a header
7961 segment is created outside of any region.
7962 * script-sections.h (class Script_sections): Add prototypes for
7963 find_memory_region and block_in_region methods.
7964 * testsuite/memory_test.s: Use .long instead of .word.
7965 * testsuite/memory_test.t: Add some more output sections.
7966 * testsuite/memory_test.sh: Update expected output.
7970 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7971 defintion to symtab.h
7972 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7973 declaration to defintion.
7977 * expression.cc (eval): Replace dummy argument with NULL.
7978 (eval_maybe_dot): Check for a NULL result section pointer.
7979 (Symbol_expression::value): Likewise.
7980 (Dot_expression::value): Likewise.
7981 (BINARY_EXPRESSION): Likewise.
7982 (Max_expression::value): Likewise.
7983 (Min_expression::value): Likewise.
7984 (Absolute_expression::value): Likewise.
7985 (Addr_expression::value_from_output_section): Likewise.
7986 (Loaddddr_expression::value_from_output_section): Likewise.
7987 (Segment_start_expression::value): Likewise.
7988 * script-sections.cc
7989 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7991 (Sections_elememt_dot_assignment::set_section_addresses):
7993 (Output_data_expression::do_write_to_buffer): Likewise.
7994 (Output_section_definition::finalize_symbols): Likewise.
7995 (Output_section_definition::set_section_addresses): Likewise.
7999 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8003 * target.h (Target::can_icf_inline_merge_sections): New virtual
8005 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8007 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8009 * icf.cc (get_section_contents): Inline merge sections only when
8014 * configure: Regenerate.
8018 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8019 * testsuite/Makefile.am (memory_test.o): New target.
8020 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8022 * testsuite/Makefile.in: Rebuild.
8026 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8027 defintion if relocation uses GOT entries of the symbol.
8028 * testsuite/icf_safe_test.sh: Fix test.
8029 * testsuite/icf_safe_so_test.sh: Fix test.
8033 * script_sections.cc (class Memory_region): Remove "NULL" from
8034 vector initializations.
8038 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8039 Resolve forwarding symbols.
8043 * gold/testsuite/script_test_3.t: Add ARM special sections.
8044 * gold/testsuite/script_test_4.t: Same.
8045 * gold/testsuite/script_test_5.t: Same.
8046 * gold/testsuite/script_test_6.t: Same.
8047 * gold/testsuite/script_test_7.t: Same.
8048 * gold/testsuite/script_test_7.t: Same.
8049 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8053 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8054 (Target_x86_64::Relocate::relocate_tls): Replace check for
8055 saw_tls_block_reloc_ with test for executable section.
8059 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8060 position-independent executables to shared libraries need dynamic
8062 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8063 position-independent executables.
8064 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8065 * testsuite/Makefile.in: Regenerate.
8070 * testsuite/memory_test.t: Discard any sections that are not
8076 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8077 "This::" to work around a bug in gcc 4.2.
8079 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8083 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8084 sections with different PF_X flags in the same segment.
8085 (Layout::find_first_load_seg): Search all segments to find the first
8087 * options.h (rosegment): New.
8091 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8095 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8096 (Arm_relobj::do_relocate_sections): Add new parameter for output
8097 file to match the parent.
8098 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8099 of local symbols instead of input values. Update code to track
8100 changes in gold::relocate_section.
8101 * object.cc (Sized_relobj::compute_final_local_value): New methods.
8102 (Sized_relobj::compute_final_local_value_internal): New methods.
8103 (Sized_relobj::do_finalize_local_symbols): Move code from loop
8104 body into private version of Sized_relobj::compute_final_local_value.
8105 Call the inline method.
8106 * object.h (Symbol_value::Symbol_value): Define destructor. Free
8107 merged symbol value if there is one.
8108 (Symbol_value::has_output_value): New method defintiion.
8109 (Sized_relobj::Compute_final_local_value_status): New enum type.
8110 (Sized_relobj::compute_final_local_value): New methods.
8111 (Sized_relobj::compute_final_local_value_internal): New methods.
8112 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8113 and arm_cortex_a8.sh.
8114 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8115 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8117 * Makefile.in: Regenerate.
8118 * testsuite/arm_bl_out_of_range.s: Update test.
8119 * testsuite/thumb_bl_out_of_range.s: Ditto.
8120 * testsuite/thumb_blx_out_of_range.s: Ditto.
8121 * testsuite/arm_branch_out_of_range.sh: New file.
8122 * testsuite/arm_cortex_a8.sh: Ditto.
8123 * testsuite/arm_cortex_a8_b.s: Ditto.
8124 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8125 * testsuite/arm_cortex_a8_b_local.s: Ditto.
8126 * testsuite/arm_cortex_a8_bl.s: Ditto.
8127 * testsuite/arm_cortex_a8_blx.s: Ditto.
8128 * testsuite/arm_cortex_a8_local.s: Ditto.
8129 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8130 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8134 * Makefile.am (memory_test.stdout): Run readelf with -W.
8135 * Makefile.in: Regenerate.
8136 * testsuite/memory_test.sh: Make the regexps accept both 32 and
8141 * script-sections.cc (Script_sections::add_memory_region): Convert
8142 field precision to int.
8143 * script.cc (script_set_section_region, script_set_section_region):
8144 Convert field precision to int.
8148 * arm.cc (do_finalize_sections): Create the __exidx_start and
8149 __exdix_end symbols even when the section is missing.
8153 * README: Remove claim that MEMORY is not supported.
8154 * expression.cc (script_exp_function_origin)
8155 (script_exp_function_length): Move from here to ...
8156 * script.cc: ... here.
8157 (script_set_section_region, script_add_memory)
8158 (script_parse_memory_attr, script_include_directive): New
8160 * script-sections.cc
8161 (class Memory_region): New class.
8162 (class Output_section_definition): Add set_memory_region,
8163 set_section_vma, set_section_lma and get_section_name methods.
8164 (class Script_Sections): Add add_memory_region,
8165 find_memory_region, find_memory_region_origin,
8166 find_memory_region_length and set_memory_region methods.
8167 Have set_section_addresses method walk the list of set memory
8169 Extend the print methos to display memory regions.
8170 * script-sections.h: Add prototypes for new methods.
8171 Add enum for MEMORY region attributes.
8172 * yyscript.y: Add support for parsing MEMORY regions.
8173 * script-c.h: Add prototypes for new functions.
8174 * testsuite/Makefile.am: Add test of MEMORY region functionality.
8175 * testsuite/Makefile.in: Regenerate.
8176 * testsuite/memory_test.sh: New script.
8177 * testsuite/memory_test.s: New assembler source file.
8178 * testsuite/memory_test.t: New linker script.
8182 * gold/resolve.cc (Symbol_table::should_override): Let a weak
8183 reference override an existing dynamic weak reference.
8184 * testsuite/Makefile.am: Add new test dyn_weak_ref.
8185 * testsuite/Makefile.in: Regenerate.
8186 * testsuite/dyn_weak_ref.sh: New file.
8187 * testsuite/dyn_weak_ref_1.c: Ditto.
8188 * testsuite/dyn_weak_ref_2.c: Ditto.
8192 * incremental.h (class Incremental_input_entry): Add virtual
8197 * testsuite/start_lib_test_3.c: Mark t3 as used.
8201 * options.cc (version_script): Fix small typo in previous
8206 * archive.cc: Formatting fixes: Remove whitespace between
8207 typename and following asterisk. Remove whitespace between
8208 function name and opening parenthesis.
8209 * archive.h: Likewise.
8211 * attributes.cc: Likewise.
8212 * attributes.h: Likewise.
8213 * common.cc: Likewise.
8214 * copy-relocs.cc: Likewise.
8215 * dirsearch.h: Likewise.
8216 * dynobj.cc: Likewise.
8217 * ehframe.cc: Likewise.
8218 * ehframe.h: Likewise.
8219 * expression.cc: Likewise.
8220 * fileread.cc: Likewise.
8221 * fileread.h: Likewise.
8223 * gold-threads.cc: Likewise.
8224 * gold.cc: Likewise.
8225 * i386.cc: Likewise.
8227 * incremental-dump.cc: Likewise.
8228 * incremental.cc: Likewise.
8229 * layout.cc: Likewise.
8230 * layout.h: Likewise.
8231 * main.cc: Likewise.
8232 * merge.cc: Likewise.
8233 * merge.h: Likewise.
8234 * object.cc: Likewise.
8235 * object.h: Likewise.
8236 * options.cc: Likewise.
8237 * options.h: Likewise.
8238 * output.cc: Likewise.
8239 * output.h: Likewise.
8240 * plugin.cc: Likewise.
8241 * plugin.h: Likewise.
8242 * powerpc.cc: Likewise.
8243 * reloc.cc: Likewise.
8244 * script-c.h: Likewise.
8245 * script-sections.cc: Likewise.
8246 * script.cc: Likewise.
8247 * stringpool.cc: Likewise.
8248 * symtab.cc: Likewise.
8249 * symtab.h: Likewise.
8250 * target.cc: Likewise.
8251 * timer.cc: Likewise.
8252 * timer.h: Likewise.
8253 * version.cc: Likewise.
8254 * x86_64.cc: Likewise.
8259 * layout.cc (segment_precedes): Sort segments by their physical
8260 addresses, if they have been set.
8264 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8266 (Lib_group::include_member): Unlock object after deleting its
8268 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8274 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8275 constructor, and set_blocker.
8276 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8278 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8279 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8280 * testsuite/Makefile.am (start_lib_test): New test case.
8281 * testsuite/Makefile.in: Regenerate.
8282 * testsuite/start_lib_test_main.c: New file.
8283 * testsuite/start_lib_test_1.c: New file.
8284 * testsuite/start_lib_test_2.c: New file.
8285 * testsuite/start_lib_test_3.c: New file.
8289 * Makefile.in: Rebuild with automake 1.11.1.
8290 * aclocal.m4: Likewise.
8291 * testsuite/Makefile.in: Likewise.
8296 * i386.cc (class Output_data_plt_i386): Update declarations.
8297 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
8298 local_ifuncs_ fields.
8299 (Target_i386::do_plt_section_for_global): New function.
8300 (Target_i386::do_plt_section_for_local): New function.
8301 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8302 parameter; change all callers. Initialize global_ifuncs_ and
8303 local_ifuncs_. If doing a static link define __rel_iplt_start and
8305 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8306 (Output_data_plt_i386::add_local_ifunc_entry): New function.
8307 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8309 (Target_i386::make_plt_section): New function, broken out of
8310 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
8311 (Target_i386::make_plt_entry): Call make_plt_section.
8312 (Target_i386::make_local_ifunc_plt_entry): New function.
8313 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8314 (Target_i386::Scan::local): Handle IFUNC symbols. Add
8315 R_386_IRELATIVE to switch.
8316 (Target_i386::Scan::global): Likewise.
8317 (Target_i386::Relocate::relocate): Likewise.
8318 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8320 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8321 (Target_x86_64::do_plt_section_for_global): New function.
8322 (Target_x86_64::do_plt_section_for_local): New function.
8323 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8324 parameter; change all callers. If doing a static link define
8325 __rela_iplt_start and __rela_iplt_end.
8326 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8327 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8328 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8330 (Target_x86_64::make_local_ifunc_plt_entry): New function.
8331 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8333 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8334 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
8335 R_X86_64_IRELATIVE to switch.
8336 (Target_x86_64::Scan::global): Likewise.
8337 (Target_x86_64::Relocate::relocate): Likewise.
8338 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8340 * target.h (class Target): Add plt_section_for_global and
8341 plt_section_for_local functions. Add do_plt_section_for_global
8342 and do_plt_section_for_local virtual functions.
8343 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
8344 clarifying comments.
8345 (Symbol::use_plt_offset): Handle IFUNC symbol.
8346 * object.cc (Sized_relobj::Sized_relobj): Initialize
8348 (Sized_relobj::local_has_plt_offset): New function.
8349 (Sized_relobj::local_plt_offset): New function.
8350 (Sized_relobj::set_local_plt_offset): New function.
8351 (Sized_relobj::do_count): Handle IFUNC symbol.
8352 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
8353 a bit away from input_shndx_ field. Add set_is_func_symbol and
8354 is_ifunc_symbol functions.
8355 (class Sized_relobj): Update declarations. Remove Tls_got_entry
8356 and Local_tls_got_offsets. Define Local_plt_offsets. Add
8357 local_plt_offsets_ field.
8358 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8359 * output.h (class Output_section_data): Add non-const
8360 output_section function.
8361 (class Output_data_got): Update declarations.
8362 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8363 Add use_plt_offset parameter to global and local constructors.
8364 Change all callers. Change local_sym_index_ field to 31 bits.
8365 Change GSYM_CODE and CONSTANT_CODE accordingly.
8366 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8367 doing a static link don't set sh_link field.
8368 (Output_data_got::Got_entry::write): Use PLT offset if
8370 (Output_data_got::add_global_plt): New function.
8371 (Output_data_got::add_local_plt): New function.
8372 * target-reloc.h (relocate_section): Handle IFUNC symbol.
8373 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8374 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8375 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8376 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8378 * testsuite/ifunc-sel.h: New file.
8379 * testsuite/ifuncmain1.c: New file.
8380 * testsuite/ifuncmain1vis.c: New file.
8381 * testsuite/ifuncmod1.c: New file.
8382 * testsuite/ifuncdep2.c: New file.
8383 * testsuite/ifuncmain2.c: New file.
8384 * testsuite/ifuncmain3.c: New file.
8385 * testsuite/ifuncmod3.c: New file.
8386 * testsuite/ifuncmain4.c: New file.
8387 * testsuite/ifuncmain5.c: New file.
8388 * testsuite/ifuncmod5.c: New file.
8389 * testsuite/ifuncmain6pie.c: New file.
8390 * testsuite/ifuncmod6.c: New file.
8391 * testsuite/ifuncmain7.c: New file.
8392 * configure, testsuite/Makefile.in: Rebuild.
8397 (Output_section_incremental_inputs::write_input_files): Add cast
8398 to avoid signed/unsigned comparison warning.
8399 (Output_section_incremental_inputs::write_info_blocks): Likewise.
8403 * common.cc (Sort_commons::operator()): Remove unnecessary code.
8407 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8412 * resolve.cc (Symbol_table::should_override): When a weak dynamic
8413 defintion overrides non-weak undef, remember that the original undef
8415 * symtab.cc (Symbol_table::sized_write_global): For undef without
8416 an original weak binding, set binding to global in output.
8417 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8418 * testsuite/Makefile.in: Regenerate.
8419 * testsuite/strong_ref_weak_def.sh: New file.
8420 * testsuite/strong_ref_weak_def_1.c: Ditto.
8421 * testsuite/strong_ref_weak_def_2.c: Ditto.
8425 * testsuite/incremental_test.sh: Rewrite.
8426 * testsuite/incremental_test_1.c: Rewrite.
8427 * testsuite/incremental_test_2.c: Rewrite.
8431 * arm.cc (Target_arm::got_size): Add const.
8432 (Target_arm::got_entry_count): New function.
8433 (Target_arm::plt_entry_count): New function.
8434 (Target_arm::first_plt_entry_offset): New function.
8435 (Target_arm::plt_entry_size): New function.
8436 (Output_data_plt_arm::entry_count): New function.
8437 (Output_data_plt_arm::first_plt_entry_offset): New function.
8438 (Output_data_plt_arm::get_plt_entry_size): New function.
8439 * i386.cc (Target_i386::got_size): Add const.
8440 (Target_i386::got_entry_count): New function.
8441 (Target_i386::plt_entry_count): New function.
8442 (Target_i386::first_plt_entry_offset): New function.
8443 (Target_i386::plt_entry_size): New function.
8444 (Output_data_plt_i386::entry_count): New function.
8445 (Output_data_plt_i386::first_plt_entry_offset): New function.
8446 (Output_data_plt_i386::get_plt_entry_size): New function.
8447 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8448 find_incremental_inputs_sections. Dump incremental_got_plt section.
8449 * incremental.cc: Include target.h.
8450 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8451 parameter. Adjust all callers. Find incremental_got_plt section.
8452 (Incremental_inputs::create_data_sections): Create incremental_got_plt
8454 (Output_section_incremental_inputs::set_final_data_size): Calculate
8455 size of incremental_got_plt section.
8456 (Output_section_incremental_inputs::do_write): Write the
8457 incremental_got_plt section.
8458 (Got_plt_view_info): New struct.
8459 (Local_got_offset_visitor): New class.
8460 (Global_got_offset_visitor): New class.
8461 (Global_symbol_visitor_got_plt): New class.
8462 (Output_section_incremental_inputs::write_got_plt): New function.
8463 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8464 Add parameter. Adjust all callers.
8465 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8466 (Incremental_inputs::got_plt_section): New function.
8467 (Incremental_inputs::got_plt_section_): New data member.
8468 (Incremental_got_plt_reader): New class.
8469 * layout.cc (Layout::create_incremental_info_sections): Add the
8470 incremental_got_plt section.
8471 * object.h (Got_offset_list::get_list): New function.
8472 (Got offset_list::for_all_got_offsets): New function.
8473 (Sized_relobj::local_got_offset_list): New function.
8474 * powerpc.cc (Target_powerpc::got_size): Add const.
8475 (Target_powerpc::got_entry_count): New function.
8476 (Target_powerpc::plt_entry_count): New function.
8477 (Target_powerpc::first_plt_entry_offset): New function.
8478 (Target_powerpc::plt_entry_size): New function.
8479 (Output_data_plt_powerpc::entry_count): New function.
8480 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8481 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8482 * sparc.cc (Target_sparc::got_size): Add const.
8483 (Target_sparc::got_entry_count): New function.
8484 (Target_sparc::plt_entry_count): New function.
8485 (Target_sparc::first_plt_entry_offset): New function.
8486 (Target_sparc::plt_entry_size): New function.
8487 (Output_data_plt_sparc::entry_count): New function.
8488 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8489 (Output_data_plt_sparc::get_plt_entry_size): New function.
8490 * symtab.h (Symbol::got_offset_list): New function.
8491 (Symbol_table::for_all_symbols): New function.
8492 * target.h (Sized_target::got_entry_count): New function.
8493 (Sized_target::plt_entry_count): New function.
8494 (Sized_target::plt_entry_size): New function.
8495 * x86_64.cc (Target_x86_64::got_size): Add const.
8496 (Target_x86_64::got_entry_count): New function.
8497 (Target_x86_64::plt_entry_count): New function.
8498 (Target_x86_64::first_plt_entry_offset): New function.
8499 (Target_x86_64::plt_entry_size): New function.
8500 (Output_data_plt_x86_64::entry_count): New function.
8501 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8502 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8506 * archive.cc: Include incremental.h.
8507 (Archive::Archive): Initialize incremental_info_.
8508 (Archive::include_member): Record archive members in incremental info.
8509 (Add_archive_symbols::run): Record begin and end of an archive in
8511 (Lib_group::include_member): Record objects in incremental info.
8512 * archive.h (Incremental_archive_entry): Forward declaration.
8513 (Archive::set_incremental_info): New member function.
8514 (Archive::incremental_info): New member function.
8515 (Archive::Unused_symbol_iterator): New class.
8516 (Archive::unused_symbols_begin): New member function.
8517 (Archive::unused_symbols_end): New member function.
8518 (Archive::incremental_info_): New data member.
8519 * incremental-dump.cc (find_input_containing_global): New function.
8520 (dump_incremental_inputs): Dump new incremental info sections.
8521 * incremental.cc: Include symtab.h.
8522 (Output_section_incremental_inputs): New class.
8523 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8524 new incremental info sections.
8525 (Sized_incremental_binary::do_check_inputs): Likewise.
8526 (Incremental_inputs::report_archive): Remove.
8527 (Incremental_inputs::report_archive_begin): New function.
8528 (Incremental_inputs::report_archive_end): New function.
8529 (Incremental_inputs::report_object): New function.
8530 (Incremental_inputs::finalize_inputs): Remove.
8531 (Incremental_inputs::report_input_section): New function.
8532 (Incremental_inputs::report_script): Rewrite.
8533 (Incremental_inputs::finalize): Do nothing but finalize string table.
8534 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8535 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8536 (Incremental_inputs::create_data_sections): New function.
8537 (Incremental_inputs::relocs_entsize): New function.
8538 (Output_section_incremental_inputs::set_final_data_size): New function.
8539 (Output_section_incremental_inputs::do_write): New function.
8540 (Output_section_incremental_inputs::write_header): New function.
8541 (Output_section_incremental_inputs::write_input_files): New function.
8542 (Output_section_incremental_inputs::write_info_blocks): New function.
8543 (Output_section_incremental_inputs::write_symtab): New function.
8544 * incremental.h (Incremental_script_entry): Forward declaration.
8545 (Incremental_object_entry): Forward declaration.
8546 (Incremental_archive_entry): Forward declaration.
8547 (Incremental_inputs): Forward declaration.
8548 (Incremental_inputs_header_data): Remove.
8549 (Incremental_inputs_header): Remove.
8550 (Incremental_inputs_header_write): Remove.
8551 (Incremental_inputs_entry_data): Remove.
8552 (Incremental_inputs_entry): Remove.
8553 (Incremental_inputs_entry_write): Remove.
8554 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8555 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8556 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8557 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8559 (Incremental_input_entry): New class.
8560 (Incremental_script_entry): New class.
8561 (Incremental_object_entry): New class.
8562 (Incremental_archive_entry): New class.
8563 (Incremental_inputs::Incremental_inputs): Initialize new data members.
8564 (Incremental_inputs::report_inputs): Remove.
8565 (Incremental_inputs::report_archive): Remove.
8566 (Incremental_inputs::report_archive_begin): New function.
8567 (Incremental_inputs::report_archive_end): New function.
8568 (Incremental_inputs::report_object): Change prototype.
8569 (Incremental_inputs::report_input_section): New function.
8570 (Incremental_inputs::report_script): Change prototype.
8571 (Incremental_inputs::get_reloc_count): New function.
8572 (Incremental_inputs::set_reloc_count): New function.
8573 (Incremental_inputs::create_data_sections): New function.
8574 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8575 (Incremental_inputs::inputs_section): New function.
8576 (Incremental_inputs::symtab_section): New function.
8577 (Incremental_inputs::relocs_section): New function.
8578 (Incremental_inputs::get_stringpool): Add const.
8579 (Incremental_inputs::command_line): Add const.
8580 (Incremental_inputs::inputs): Remove.
8581 (Incremental_inputs::command_line_key): New function.
8582 (Incremental_inputs::input_file_count): New function.
8583 (Incremental_inputs::input_files): New function.
8584 (Incremental_inputs::relocs_entsize): New function.
8585 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8586 (Incremental_inputs::finalize_inputs): Remove.
8587 (Incremental_inputs::Input_info): Remove.
8588 (Incremental_inputs::lock_): Remove.
8589 (Incremental_inputs::inputs_): Change type.
8590 (Incremental_inputs::inputs_map_): Remove.
8591 (Incremental_inputs::current_object_entry_): New data member.
8592 (Incremental_inputs::inputs_section_): New data member.
8593 (Incremental_inputs::symtab_section_): New data member.
8594 (Incremental_inputs::relocs_section_): New data member.
8595 (Incremental_inputs::reloc_count_): New data member.
8596 (Incremental_inputs_reader): New class.
8597 (Incremental_symtab_reader): New class.
8598 (Incremental_relocs_reader): New class.
8599 * layout.cc (Layout::finalize): Move finalization of incremental info
8600 and creation of incremental info sections to follow finalization of
8601 symbol table. Set offsets for postprocessing sections.
8602 (Layout::create_incremental_info_sections): Call
8603 Incremental_inputs::create_data_sections. Add incremental symtab
8604 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
8605 sections to layout after input sections.
8606 * layout.h (struct Timespec): Forward declaration.
8607 (Layout::incremental_inputs): Add const.
8608 (Layout::create_incremental_info_sections): Add parameter.
8609 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8610 * object.cc: Include incremental.h.
8611 (Relobj::finalize_incremental_relocs): New function.
8612 (Sized_relobj::do_layout): Record input sections in incremental info.
8613 * object.h (Object::output_section): New function.
8614 (Object::output_section_offset): Moved from Relobj.
8615 (Object::get_incremental_reloc_base): New function.
8616 (Object::get_incremental_reloc_count): New function.
8617 (Object::do_output_section): New function.
8618 (Object::do_output_section_offset): Moved from Relobj.
8619 (Object::do_get_incremental_reloc_base): New function.
8620 (Object::do_get_incremental_reloc_count): New function.
8621 (Object::Object): Initialize new data members.
8622 (Relobj::output_section): Renamed do_output_section and moved to
8624 (Relobj::output_section_offset): Moved to Object.
8625 (Relobj::do_get_incremental_reloc_base): New function.
8626 (Relobj::do_get_incremental_reloc_count): New function.
8627 (Relobj::allocate_incremental_reloc_counts): New function.
8628 (Relobj::count_incremental_reloc): New function.
8629 (Relobj::finalize_incremental_relocs): New function.
8630 (Relobj::next_incremental_reloc_index): New function.
8631 (Relobj::reloc_counts_): New data member.
8632 (Relobj::reloc_bases_): New data member.
8633 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
8634 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
8635 (Sized_relobj::incremental_relocs_scan): New function.
8636 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8637 (Sized_relobj::incremental_relocs_write): New function.
8638 (Sized_relobj::incremental_relocs_write_reltype): New function.
8639 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8641 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8642 archives and object files elsewhere.
8643 (Add_symbols::run): Report object files here.
8644 (Finish_group::run): Report end of archive at end of group.
8645 * reloc.cc: Include layout.h, incremental.h.
8646 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8647 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8648 (Sized_relobj::incremental_relocs_scan): New function.
8649 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8650 (Sized_relobj::do_relocate_sections): Write incremental relocations.
8651 (Sized_relobj::incremental_relocs_write): New function.
8652 (Sized_relobj::incremental_relocs_write_reltype): New function.
8653 * script.cc (read_input_script): Rewrite test for incremental link.
8654 Change call to Incremental_inputs::report_script.
8655 * symtab.h (Symbol_table::first_global_index): New function.
8656 (Symbol_table::output_count): New function.
8660 * arm.cc (Target_arm::merge_object_attributes): Check command line
8661 options --no-wchar-size-warning and --no-enum-size-warning.
8662 * options.h (General_options): Add ld-compatible options
8663 --no-enum-size-warning and --no-wchar-size-warning.
8667 * x86_64.cc (Target_x86_64::Scan::local): Use
8668 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8669 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8670 (Target_x86_64::Scan::global): Likewise.
8671 (Target_x86_64::Relocate::relocate): Likewise.
8672 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8677 * merge.cc (Output_merge_string::do_add_input_section): Count strings
8678 to reserve space in merged_strings vector. Keep total input size
8680 (Output_merge_string::do_print_merge_stats): Print total input size.
8681 * merge.h (Output_merge_string): Add input_size_ field.
8682 * stringpool.cc (Stringpool_template::string_length): Move
8683 implementations out of Stringpool_template class and place in
8685 * stringpool.h (string_length): Move out of Stringpool_template.
8690 * layout.cc (relaxation_loop_body): If address of load segment is
8691 set, adjust address to include headers if possible.
8695 * version.cc (version_string): Bump to 1.10.
8700 * layout.h (enum Output_section_order): Define.
8701 (class Layout): Update declarations.
8702 * layout.cc (Layout::get_output_section): Add order parameter.
8703 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8704 is_first_non_relro parameters. Change all callers.
8705 (Layout::choose_output_section): Likewise.
8706 (Layout::add_output_section_data): Likewise.
8707 (Layout::make_output_section): Likewise. Set order.
8708 (Layout::default_section_order): New function.
8709 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8710 * output.cc (Output_section::Output_section): Initialize order_.
8711 Don't initialize deleted fields.
8712 (Output_segment::Output_segment): Don't initialize deleted
8714 (Output_segment::add_output_section_to_load): New function
8715 replacing add_output_section. Change all callers to call this or
8716 add_output_section_to_nonload.
8717 (Output_segment::add_output_section_to_nonload): New function.
8718 (Output_segment::remove_output_section): Rewrite.
8719 (Output_segment::add_initial_output_data): Likewise.
8720 (Output_segment::has_any_data_sections): Likewise.
8721 (Output_segment::is_first_section_relro): Likewise.
8722 (Output_segment::maximum_alignment): Likewise.
8723 (Output_segment::has_dynamic_reloc): New function replacing
8724 dynamic_reloc_count. Change all callers.
8725 (Output_segment::has_dynamic_reloc_list): New function replacing
8726 dynamic_reloc_count_list. Change all callers.
8727 (Output_segment::set_section_addresses): Rewrite.
8728 (Output_segment::set_offset): Rewrite.
8729 (Output_segment::find_first_and_last_list): Remove.
8730 (Output_segment::set_tls_offsets): Rewrite.
8731 (Output_segment::first_section_load_address): Likewise.
8732 (Output_segment::output_section_count): Likewise.
8733 (Output_segment::section_with_lowest_load_address): Likewise.
8734 (Output_segment::write_section_headers): Likewise.
8735 (Output_segment::print_sections_to_map): Likewise.
8736 * output.h (class Output_data): Remove dynamic_reloc_count_
8737 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
8738 (Output_data::add_dynamic_reloc): Rewrite.
8739 (Output_data::has_dynamic_reloc): New function.
8740 (Output_data::dynamic_reloc_count): Remove.
8741 (class Output_section): Add order_ field. Remvoe is_relro_local_,
8742 is_last_relro_, is_first_non_relro_, is_interp_,
8743 is_dynamic_linker_section_ fields. Add order and set_order
8744 functions. Remove is_relro_local, set_is_relro_local,
8745 is_last_relro, set_is_last_relro, is_first_non_relro,
8746 set_is_first_non_relro functions, is_interp, set_is_interp,
8747 is_dynamic_linker_section, and set_is_dynamic_linker_section
8749 (class Output_segment): Change Output_data_list from std::list to
8750 std:;vector. Add output_lists_ field. Remove output_data_ and
8751 output_bss_ fields. Update declarations.
8755 * arm.cc (Target_arm::gc_process_relocs): Use typename.
8756 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8757 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8762 * script.cc (Script_options::Script_options): Initialize
8763 symbol_definitions_ and symbol_references_.
8764 (Script_options::add_symbol_assignment): Update
8765 symbol_definitions_ and symbol_references_.
8766 (Script_options::add_symbol_reference): New function.
8767 (script_symbol): New function.
8768 * script.h (class Script_options): Add symbol_definitions_ and
8769 symbol_references_ fields.
8770 (Script_options::referenced_const_iterator): New type.
8771 (Script_options::referenced_begin): New function.
8772 (Script_options::referenced_end): New function.
8773 (Script_options::is_referenced): New function.
8774 (Script_options::any_unreferenced): New function.
8775 * script-c.h (script_symbol): Declare.
8776 * yyscript.y (exp): Call script_symbol.
8777 * symtab.cc: Include "script.h".
8778 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8779 Change all callers. Check symbols referenced by scripts.
8780 (Symbol_table::add_undefined_symbols_from_command_line): Add
8781 layout parameter. Change all callers.
8782 (Symbol_table::do_add_undefined_symbols_from_command_line):
8783 Likewise. Break out loop body. Check symbols referenced by
8785 (Symbol_table::add_undefined_symbol_from_command_line): New
8786 function broken out of
8787 do_add_undefined_symbols_from_command_line.
8788 * symtab.h (class Symbol_table): Update declarations.
8789 * archive.cc: Include "layout.h".
8790 (Archive::should_include_member): Add layout parameter. Change
8791 all callers. Check for symbol mentioned in expression.
8792 * archive.h (class Archive): Update declaration.
8793 * object.cc (Sized_relobj::do_should_include_member): Add layout
8795 * object.h (Object::should_include_member): Add layout parameter.
8797 (Object::do_should_include_member): Add layout parameter.
8798 (class Sized_relobj): Update declaration.
8799 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8801 * dynobj.h (class Sized_dynobj): Update declaration.
8802 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8804 * plugin.h (class Sized_pluginobj): Update declaration.
8809 * output.cc (Output_segment::set_offset): Search for the first and
8810 last sections rather than assuming that the list is in order.
8811 (Output_segment::find_first_and_last_list): New function.
8812 * output.h (class Output_segment): Update declarations.
8813 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8814 (relro_strip_test_SOURCES): New variable.
8815 (relro_strip_test_DEPENDENCIES): New variable.
8816 (relro_strip_test_LDFLAGS): New variable.
8817 (relro_strip_test_LDADD): New variable.
8818 (relro_strip_test.so): New target.
8822 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8823 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8824 (Target_i386::got_tlsdesc_section): New function.
8825 (Target_i386::got_section): Create space for GOT entries for
8826 TLSDESC relocations.
8827 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8829 (Target_i386::Scan::global): Likewise.
8830 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8832 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8833 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8834 (Target_x86_64::got_tlsdesc_section): New function.
8835 (Target_x86_64::got_section): Create space for GOT entries for
8836 TLSDESC relocations.
8837 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8839 (Target_x86_64::Scan::global): Likewise.
8840 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8845 * testsuite/final_layout.sh: Use dc to convert from hex to
8850 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8851 paramter to the call to gold::gc_process_relocs.
8852 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8853 paramter to the call to gold::gc_process_relocs.
8854 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8855 parameter to the call to gold::gc_process_relocs.
8856 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8857 template parameter to the call to gold::gc_process_relocs.
8858 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8859 paramter to the call to gold::gc_process_relocs.
8860 * gc.h (get_embedded_addend_size): New function.
8861 (gc_process_relocs): Save the size of the reloc for use by ICF.
8862 * icf.cc (get_section_contents): Get the addend from the text section
8863 for SHT_REL relocation sections.
8864 * icf.h (Icf::Reloc_addend_size_info): New typedef.
8865 (Icf::Reloc_info): Add new member reloc_addend_size_info.
8866 * int_encoding.h (read_from_pointer): New overloaded function.
8867 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8868 * testsuite/icf_sht_rel_addend_test.sh: New file.
8869 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8870 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8874 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8875 * Makefile.in: Regenerate.
8876 * testsuite/Makefile.in: Regenerate.
8880 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8881 * gold/testsuite/debug_msg.cc: Likewise.
8882 * gold/testsuite/odr_violation1.cc
8883 * gold/testsuite/odr_violation2.cc
8887 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8888 string, and length fields.
8889 (Output_merge_string::Merged_strings_list): New type.
8890 (Output_merge_string::Merged_strings_lists): New typedef.
8891 (Output_merge_string): Replace merged_strings_ with
8892 merged_strings_lists_.
8893 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8894 Merged_strings_list per input object and section. Don't store pointer
8895 to the string. Don't store length with each merged string entry.
8896 (Output_merge_string::finalize_merged_data): Loop over list of merged
8897 strings lists. Recompute length of each merged string.
8901 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8906 * descriptors.cc (Descriptors::open): Report correct name in error
8911 * arm.cc (Arm_input_section::Arm_input_section): For a
8912 SHT_ARM_EXIDX section, always keeps the input sections.
8913 (Arm_input_section::set_exidx_section_link): New method.
8914 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8915 has_errors_ to false.
8916 (Arm_exidx_input_section::has_errors,
8917 Arm_exidx_input_section::set_has_errors): New methods.
8918 (Arm_exidx_input_section::has_errors_): New data member.
8919 (Arm_relobj::get_exidx_shndx_list): New method.
8920 (Arm_output_section::append_text_sections_to_list): Do not skip
8921 section without SHF_EXECINSTR.
8922 (Arm_output_section::fix_exidx_coverage): Skip input sections with
8924 (Arm_relobj::make_exidx_input_section): Add new parameter for text
8925 section header. Make error messages more verbose. Check for
8926 a non-executable section linked to an EXIDX section.
8927 (Arm_relobj::do_read_symbols): Remove error checking, which has been
8928 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
8929 check that there is no deferred EXIDX section if we exit early.
8930 Instead of not making an EXIDX section in case of an error, make one
8931 and set the has_errors flag of it.
8932 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8933 in a relocatable link.
8934 (Target_arm::do_relax): Look for the EXIDX output section instead of
8935 assuming that it is called .ARM.exidx.
8936 (Target_arm::fix_exidx_coverage): Add a new parameter for input
8937 section list. Do not check for SHF_EXECINSTR section flags but
8938 skip any input section with errors.
8939 * output.cc (Output_section::Output_section): Initialize
8940 always_keeps_input_sections_ to false.
8941 (Output_section::add_input_section): Check for
8942 always_keeps_input_sections_.
8943 * output.h (Output_section::always_keeps_input_sections,
8944 Output_section::set_always_keeps_input_sections): New methods.
8945 (Output_section::always_keeps_input_sections): New data member.
8949 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8950 * fileread.h (Input_file): Add try_extra_search_path and find_file.
8955 * output.h (Output_section_lookup_maps::add_merge_section):
8956 Correct check of whether value was inserted.
8957 (Output_section_lookup_maps::add_merge_input_section): Likewise.
8958 (Output_section_lookup_maps::add_relaxed_input_section):
8960 * arm.cc (Target_arm::got_section): Remove used local os.
8961 * i386.cc (Target_i386::got_section): Likewise.
8962 * x86_64.cc (Target_x86_64::got_section): Likewise.
8963 * sparc.cc (Target_sparc::got_section): Likewise.
8964 (Target_sparc::relocate): Remove unused local have_got_offset.
8965 * powerpc.cc (Target_powerpc::relocate): Likewise.
8969 * compressed_output.cc (zlib_decompress): Fix signature in
8972 * archive.cc (Archive::include_member): Unlock an external member
8973 of a thin archive. Don't bother to delete an object we know is
8978 * compressed_output.cc (zlib_decompress): New function.
8979 (get_uncompressed_size): New function.
8980 (decompress_input_section): New function.
8981 * compressed_output.h (get_uncompressed_size): New function.
8982 (decompress_input_section): New function.
8983 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8984 Handle compressed debug sections.
8985 * layout.cc (is_compressed_debug_section): New function.
8986 (Layout::output_section_name): Map compressed section names to
8988 * layout.h (is_compressed_debug_section): New function.
8989 (is_debug_info_section): Recognize compressed debug sections.
8990 * merge.cc: Include compressed_output.h.
8991 (Output_merge_data::do_add_input_section): Handle compressed
8993 (Output_merge_string::do_add_input_section): Handle compressed
8995 * object.cc: Include compressed_output.h.
8996 (Sized_relobj::Sized_relobj): Initialize new data members.
8997 (build_compressed_section_map): New function.
8998 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8999 * object.h (Object::section_is_compressed): New method.
9000 (Object::do_section_is_compressed): New method.
9001 (Sized_relobj::Compressed_section_map): New type.
9002 (Sized_relobj::do_section_is_compressed): New method.
9003 (Sized_relobj::compressed_sections_): New data member.
9004 * output.cc (Output_section::add_input_section): Handle compressed
9006 * reloc.cc: Include compressed_output.h.
9007 (Sized_relobj::write_sections): Handle compressed debug sections.
9011 * resolve.cc (Symbol_table::resolve): Remember whether undef was
9012 weak when resolving to a dynamic def.
9013 (Symbol_table::should_override): Add adjust_dyndef flag; set it
9014 for weak undef/dynamic def cases. Adjust callers.
9015 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9016 undef_binding_weak_.
9017 (Symbol_table::sized_write_globals): Adjust symbol binding.
9018 (Symbol_table::sized_write_symbol): Add binding parameter.
9019 * symtab.h (Symbol::set_undef_binding): New method.
9020 (Symbol::is_undef_binding_weak): New method.
9021 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9022 (Symbol_table::should_override): Add new parameter.
9023 (Symbol_table::sized_write_symbol): Add new parameter.
9025 * testsuite/weak_undef_file1.cc: Add new test case.
9026 * testsuite/weak_undef_file2.cc: Fix header comment.
9027 * testsuite/weak_undef_test.cc: Add new test case.
9031 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9032 Initialize USE_SYMBOL_.
9033 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9035 (Arm_reloc_property::uses_symbol_): New data member declaration.
9036 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9037 uses symbol value and symbol is undefined but not weakly undefined.
9041 * plugin.cc (Plugin::load): Use dlerror.
9045 * symtab.cc (detect_odr_violations): When reporting an ODR
9046 violation, report an object where the symbol is defined.
9050 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9051 (Target_arm::section_may_have_icf_unsafe_pointers): New method
9053 (Target_arm::Scan::local_reloc_may_be_function_pointer,
9054 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9055 target hook to detect function points.
9056 (Target_arm::Scan::possible_function_pointer_reloc): New method.
9057 * icf.h (Icf::check_section_for_function_pointers): Change type of
9058 parameter SECTION_NAME to const reference to std::string. Use
9059 target hook to determine if section may have unsafe pointers.
9060 * target.h (Target::section_may_have_icf_unsafe_pointers): New
9065 * fileread.cc (Input_file::find_fie): New
9066 (Input_file::open): Use Input_file::find_fie.
9067 * fileread.h (Input_file::find_fie): New
9068 * plugin.cc (set_extra_library_path): New.
9069 (Plugin::load): Add set_extra_library_path to the transfer vector.
9070 (Plugin_manager::set_extra_library_path): New.
9071 (Plugin_manager::add_input_file): Use the extra search path if set.
9072 (set_extra_library_path(): New.
9073 * plugin.h (Plugin_manager): Add set_extra_library_path and
9078 * layout.cc (gdb_sections): Add .debug_types.
9079 (lines_only_debug_sections): Likewise.
9083 * plugin.cc (add_input_file,add_input_library)
9084 (Plugin_manager::add_input_file): Make filename arguments const.
9085 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9090 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9091 .ARM.attributes section if we have not merged any input
9092 attributes sections.
9096 * arm.cc: Allow combining objects with no EABI version
9101 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9105 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9106 (struct iovec): Correct !HAVE_READV definition.
9110 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9111 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9113 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9116 * symtab.h (Symbol::is_placeholder): New member function.
9117 * target-reloc.h (relocate_section): Check for placeholder symbols.
9119 * testsuite/Makefile.am (plugin_test_8): New test.
9120 (plugin_test_9): New test.
9121 * testsuite/Makefile.in: Regenerate.
9125 * yyscript.y (input_list_element): Allow strings prefixed with
9126 the '-' character. Treat these as libraries.
9127 * script.cc (script_add_library): New function. Adds a library
9128 specified by "-l<name>" found in an input script.
9129 * script-c.h: Add prototype for script_add_library.
9133 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9134 Restrict stub-group size to be within long conditional branch
9135 range when working around cortex-A8 erratum.
9139 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9146 (Output_section::Input_section_sort_entry::compare_section_ordering):
9147 Change to return non-zero correctly.
9148 (Output_section::Input_section_sort_section_order_index_compare
9149 ::operator()): Change to fix ambiguity in comparisons.
9153 * gold.h (is_wildcard_string): New function.
9154 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9155 (Layout::layout_eh_frame): Ditto.
9156 (Layout::find_section_order_index): New method.
9157 (Layout::read_layout_from_file): New method.
9158 * layout.h (Layout::find_section_order_index): New method.
9159 (Layout::read_layout_from_file): New method.
9160 (Layout::input_section_position_): New private member.
9161 (Layout::input_section_glob_): New private member.
9162 * main.cc (main): Call read_layout_from_file here.
9163 * options.h (--section-ordering-file): New option.
9164 * output.cc (Output_section::input_section_order_specified_): New
9166 (Output_section::Output_section): Initialize new member.
9167 (Output_section::add_input_section): Add new parameter.
9168 Keep input sections when --section-ordering-file is used.
9169 (Output_section::set_final_data_size): Sort input sections when
9170 section ordering file is specified.
9171 (Output_section::Input_section_sort_entry): Add new parameter.
9173 (Output_section::Input_section_sort_entry::compare_section_ordering):
9175 (Output_section::Input_section_sort_compare::operator()): Change to
9176 consider section_order_index.
9177 (Output_section::Input_section_sort_init_fini_compare::operator()):
9178 Change to consider section_order_index.
9179 (Output_section::Input_section_sort_section_order_index_compare
9180 ::operator()): New method.
9181 (Output_section::sort_attached_input_sections): Change to sort
9182 according to section order when specified.
9183 (Output_section::add_input_section<32, true>): Add new parameter.
9184 (Output_section::add_input_section<64, true>): Add new parameter.
9185 (Output_section::add_input_section<32, false>): Add new parameter.
9186 (Output_section::add_input_section<64, false>): Add new parameter.
9187 * output.h (Output_section::add_input_section): Add new parameter.
9188 (Output_section::input_section_order_specified): New
9190 (Output_section::set_input_section_order_specified): New method.
9191 (Input_section::Input_section): Initialize section_order_index_.
9192 (Input_section::section_order_index): New method.
9193 (Input_section::set_section_order_index): New method.
9194 (Input_section::section_order_index_): New member.
9195 (Input_section::Input_section_sort_section_order_index_compare): New
9197 (Output_section::input_section_order_specified_): New member.
9198 * script-sections.cc (is_wildcard_string): Delete and move modified
9200 (Output_section_element_input::Output_section_element_input): Modify
9201 call to is_wildcard_string.
9202 (Output_section_element_input::Input_section_pattern
9203 ::Input_section_pattern): Ditto.
9204 (Output_section_element_input::Output_section_element_input): Ditto.
9205 * testsuite/Makefile.am (final_layout): New test case.
9206 * testsuite/Makefile.in: Regenerate.
9207 * testsuite/final_layout.cc: New file.
9208 * testsuite/final_layout.sh: New file.
9212 * plugin.cc (Plugin::load): Pass the output name to the plugin.
9216 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9217 visibility of symbols.
9221 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9222 from start of output section instead of address for a local symbol
9223 in a merged or relaxed section when doing a relocatable link.
9228 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9229 adding sections the garbage collector removed.
9230 * gold/testsuite/Makefile.am: Add test.
9231 * gold/testsuite/Makefile.in: Regenerate.
9232 * gold/testsuite/plugin_test_7.sh: New.
9233 * gold/testsuite/plugin_test_7_1.c: New.
9234 * gold/testsuite/plugin_test_7_2.c: New.
9238 * script-sections.cc (Output_section_definition::set_section_addresses):
9239 Check for --section-start.
9243 * arm.cc (Arm_scan_relocatable_relocs): New class.
9244 (Target_arm::relocate_special_relocatable): New method.
9245 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9246 (Arm_relocate_functions::thumb_branch_common): Same.
9247 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9248 instead of Default_scan_relocatable_relocs.
9249 * target-reloc.h (relocate_for_relocatable): Let target handle
9250 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9251 * target.h (Sized_target::relocate_special_relocatable): New method.
9255 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9259 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9261 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9262 with a direct branch, not a conditional branch, to a stub.
9263 * merge.cc (Output_merge_base::record_input_section): New method
9265 (Output_merge_data::do_add_input_section): Record input section if
9266 keeps-input-sections flag is set.
9267 (Output_merge_string::do_add_input_section): Ditto.
9268 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9269 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9271 (Output_merge_base::keeps_input_sections,
9272 Output_merge_base::set_keeps_input_sections,
9273 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9275 (Output_merge_base::Input_sections): New type declaration.
9276 (Output_merge_base::input_sections_begin,
9277 Output_merge_base::input_sections_end,
9278 Output_merge_base::do_set_keeps_input_sections): New method definitions.
9279 (Output_merge_base::bool keeps_input_sections_,
9280 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9281 Output_merge_base::input_sections_): New data members.
9282 (Output_merge_data::do_set_keeps_input_sections): New method
9284 (Output_merge_string::do_set_keeps_input_sections): Ditto.
9285 * output.cc (Output_section::Input_section::relobj): Move method
9286 defintion from class declaration to here and handle merge sections.
9287 (Output_section::Input_section::shndx): Ditto.
9288 (Output_section::Output_section): Remove initializations of removed
9289 data members and initialize new data member LOOKUP_MAPS_.
9290 (Output_section::add_input_section): Set keeps-input-sections flag
9291 for a newly created merge output section as appropriate. Adjust code
9292 to use Output_section_lookup_maps class.
9293 (Output_section::add_relaxed_input_section): Adjst code for lookup
9294 maps code refactoring.
9295 (Output_section::add_merge_input_section): Add a new parameter
9296 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
9297 class. If adding input section to a newly created merge output
9298 section fails, remove the new merge section.
9299 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9300 Adjust code for use of the Output_section_lookup_maps class.
9301 (Output_section::find_merge_section): Ditto.
9302 (Output_section::build_lookup_maps): New method defintion.
9303 (Output_section::find_relaxed_input_section): Adjust code to use
9304 Output_section_lookup_maps class.
9305 (Output_section::get_input_sections): Export merge sections. Adjust
9306 code to use Output_section_lookup_maps class.
9307 (Output_section:::add_script_input_section): Adjust code to use
9308 Output_section_lookup_maps class. Update lookup maps for merge
9310 (Output_section::discard_states): Use Output_section_lookup_maps.
9311 (Output_section::restore_states): Same.
9312 * output.h (Merge_section_properties): Move class defintion out of
9314 (Output_section_lookup_maps): New class.
9315 (Output_section::Input_section::is_merge_section): New method
9317 (Output_section::Input_section::relobj): Move defintion out of class
9318 defintion. Declare method only.
9319 (Output_section::Input_section::shndx): Ditto.
9320 (Output_section::Input_section::output_merge_base): New method defintion.
9321 (Output_section::Input_section::u2_.pomb): New union field.
9322 (Output_section::Merge_section_by_properties_map,
9323 Output_section::Output_section_data_by_input_section_map,
9324 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9326 (Output_section::add_merge_input_section): Add new parameter
9327 KEEPS_INPUT_SECTIONS.
9328 (Output_section::build_lookup_maps): New method declaration.
9329 (Output_section::merge_section_map_,
9330 Output_section::merge_section_by_properties_map_,
9331 Output_section::relaxed_input_section_map_,
9332 Output_section::is_relaxed_input_section_map_valid_): Remove data
9334 (Output_section::lookup_maps_): New data member.
9339 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9340 avoid a compilation error.
9344 * script-sections.cc (Output_section_definition::allocate_to_segment):
9345 Update the phdrs_list even when the output section is NULL.
9346 * testsuite/Makefile.am: Add test.
9347 * testsuite/Makefile.in: Regenerate.
9348 * testsuite/script_test_9.cc: New.
9349 * testsuite/script_test_9.sh: New.
9350 * testsuite/script_test_9.t: New.
9354 * arm.cc (Arm_input_section::original_size): New method.
9355 (Arm_input_section::do_addralign): Add a cast.
9356 (Arm_input_section::do_output_offset): Remove static cast.
9357 (Arm_input_section::original_addralign,
9358 Arm_input_section::original_size_): Change type to uint32_t.
9359 (Arm_input_section::init): Add safe casts for section alignment
9361 (Arm_input_section::set_final_data_size): Do not set address and
9362 offset of stub table.
9363 (Arm_output_section::fix_exidx_coverage): Change use of of
9364 Output_section::Simple_input_section to that of
9365 Output_section::Input_section.
9366 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9367 except for the first pass.
9368 * output.cc (Output_section::get_input_sections): Change type of
9369 input_sections to std::list<Input_section>.
9370 (Output_section::add_script_input_section): Rename from
9371 Output_section::add_simple_input_section. Change type of SIS
9372 parameter from Simple_input_section to Input_section.
9373 * output.h (Output_section::Simple_input_section): Remove class.
9374 (Output_section::Input_section): Change class visibility to public.
9375 (Output_section::Input_section::addralign): Use stored alignments
9376 for special input sections if set.
9377 (Output_section::Input_section::set_addralign): New method.
9378 (Output_section::get_input_sections): Change parameter type from
9379 list of Simple_input_section to list of Input_section.
9380 (Output_section::add_script_input_section): Rename from
9381 Output_section::add_simple_input_section. Change first parameter's
9382 type from Simple_input_section to Input_section and remove the
9383 second and third parameters.
9384 * script-sections.cc (Input_section::Input_section_list): Change
9385 type to list of Output_section::Input_section/
9386 (Input_section_info::Input_section_info): Change parameter type of
9387 INPUT_SECTION to Output_section::Input_section.
9388 (Input_section_info::input_section): Change return type.
9389 (Input_section_info::input_section_): Change type to
9390 Output_section::Input_section.
9391 (Output_section_element_input::set_section_addresses): Adjust code
9392 to use Output_section::Input_section instead of
9393 Output_section::Simple_input_section. Adjust code for renaming
9394 of Output_section::add_simple_input_section.
9395 (Orphan_output_section::set_section_addresses): Ditto.
9399 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9400 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9404 * options.cc (General_options::finalize): Handle -nostdlib.
9405 * options.h (nostdlib): New option.
9406 * script.cc (script_add_search_dir): Handle -nostdlib.
9410 * arm.cc (Target_arm::do_finalize_sections): Create an empty
9411 attributes section only if there no attributes section after merging.
9412 (Target_arm::merge_object_attributes): Move value of
9413 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9414 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9415 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9416 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9417 and arm_attr_merge_7.stdout.
9418 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9419 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9420 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9421 arm_attr_merge_7b.o): New rules.
9422 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9424 * testsuite/Makefile.in: Regenerate.
9425 * testsuite/arm_attr_merge.sh: New file.
9426 * testsuite/arm_attr_merge_[67][ab].s: Same.
9430 * po/es.po: Updated Spanish translation.
9434 * Makefile.am (install-exec-local): Properly install gold as
9435 default cross linker.
9436 * Makefile.in: Regenerated.
9441 * configure.ac (install_as_default): Define and set to false
9442 unless --enable-gold or --enable-gold=both/gold has been
9444 * configure: Regenerate.
9446 * Makefile.am (install-exec-local): Install the executable as
9447 'ld.gold'. If install_as_default is true then also install it as
9449 * Makefile.in: Regenerated.
9453 * layout.cc (Layout::layout_reloc): In relocatable link don't
9454 combine reloc sections for grouped sections.
9458 * gc.h (gc_process_relocs): Pass information on relocs pointing to
9459 sections that are not ordinary to icf.
9460 * icf.cc (get_section_contents): Handle relocation pointing to section
9461 with no object or shndx information.
9462 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9463 * testsuite/Makefile.in: Regenerate.
9464 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9465 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9469 * expression.cc (Expression::Expression_eval_info): Add
9470 result_alignment_pointer field.
9471 (Expression::eval_with_dot): Add result_alignment_pointer
9472 parameter. Change all callers.
9473 (Expression::eval_maybe_dot): Likewise.
9474 (class Binary_expression): Add alignment_pointer parameter to
9475 left_value and right_value. Change all callers.
9476 (BINARY_EXPRESSION): Set result alignment.
9477 (class Trinary_expression): Add alignment_pointer parameter to
9478 arg2_value and arg3_value. Change all callers.
9479 (Trinary_cond::value): Set result alignment.
9480 (Max_expression::value, Min_expression::value): Likewise.
9481 (Align_expression::value): Likewise.
9482 * script-sections.cc (class Sections_element): Add dot_alignment
9483 parameter to set_section_addresses virtual function. Update
9485 (class Output_section_element): Likewise.
9486 (Script_sections::create_segments): Add dot_alignment parameter.
9488 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9489 (Script_sections::set_phdrs_clause_addresses): Likewise.
9490 * script-sections.h: Update declarations.
9491 * script.h: Update declarations.
9492 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9494 * testsuite/script_test_3.t: Set large alignment.
9495 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9496 segment has expected alignment.
9500 * po/gold.pot: Updated by the Translation project.
9501 * po/vi.po: Updated Vietnamese translation.
9505 * testsuite/Makefile.am (check_PROGRAMS): Add
9506 icf_virtual_function_folding_test.
9507 * testsuite/Makefile.in: Regenerated.
9511 * options.h (merge_exidx_entries): New option.
9512 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9513 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9514 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9515 (Target_arm::merge_exidx_entries): New function.
9516 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9517 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9518 to Arm_exidx_fixup constructor.
9519 Add new arg, merge_exidx_entries.
9520 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9521 Arm_output_section::fix_exidx_coverage.
9525 * icf.cc (get_section_contents): Check for preemptible functions.
9526 Ignore addend when appropriate.
9527 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9529 (add_from_relobj): Check for section folded.
9530 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9531 * symtab.h (should_add_dynsym_entry): Add new parameter.
9532 * target-reloc.h (scan_relocs): Check for section folded.
9533 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9534 Check reloc types for function pointers in shared objects.
9535 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9537 (icf_preemptible_functions_test): New test case.
9538 (icf_string_merge_test): New test case.
9539 * testsuite.Makefile.in: Regenerate.
9540 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9541 bar_glob. Refactor code.
9542 * testsuite/icf_preemptible_functions_test.cc: New file.
9543 * testsuite/icf_preemptible_functions_test.sh: New file.
9544 * testsuite/icf_string_merge_test.cc: New file.
9545 * testsuite/icf_string_merge_test.sh: New file.
9546 * testsuite/icf_virtual_function_folding_test.cc: New file.
9547 * testsuite/icf_virtual_function_folding_test.sh: New file.
9551 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9552 for local symbol recounting if we remove a section due to ICF.
9553 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9554 there are no regular objects in input.
9558 * arm.cc (Arm_input_section::set_final_data_size): Compute
9559 accurate final data size instead of using current data size.
9563 * layout.cc (Layout::choose_output_section): Handle script section
9565 (Layout::make_output_section_for_script): Add section type parameter.
9566 Handle script section types.
9567 * layout.h (Layout::make_output_section_for_script): Add section
9569 * output.cc (Output_section::Output_section): Initialize data member
9571 (Output_section::do_reset_address_and_file_offset): Do not set address
9572 to 0 if section is a NOLOAD section.
9573 * output.h (Output_section::is_noload): New method.
9574 (Output_section::set_is_noload): Ditto.
9575 (Output_section::is_noload_): New data member.
9576 * script-c.h (Script_section_type): New enum type.
9577 (struct Parser_output_section_header): Add new file section_type.
9578 * script-sections.cc (Sections_element::output_section_name): Add
9579 parameter for returning script section type.
9580 (Output_section_definition::output_section_name): Ditto.
9581 (Output_section_definition::section_type)P; New method.
9582 (Output_section_definiton::script_section_type_name): Ditto.
9583 (Output_section_definition::script_section_type_): New data member.
9584 (Output_section_definition::Output_section_definition): Initialize
9585 data member Output_section_definition::script_section_type_.
9586 (Output_section_definition::create_sections): Pass script section type
9587 to Layout::make_output_section_for_script.
9588 (Output_section_definition::output_section_name): Return script
9589 section type to caller.
9590 (Output_section_definition::set_section_address): Do not advance
9591 dot value and load address if section type is NOLOAD. Set address
9592 of NOLOAD sections regardless of section flags.
9593 (Output_section_definition::print): Print section type if it is
9594 not SCRIPT_SECTION_TYPE_NONE.
9595 (Output_section_definition::section_type): New method.
9596 (Output_section_definition::script_section_type_name): Ditto.
9597 (Script_sections::output_section_name): Add new parameter
9598 PSECTION_TYPE for returning script section type. Pass it to
9599 section elements. Handle discard sections.
9600 (Sort_output_sections::operator()): Handle NOLOAD sections.
9601 * script-sections.h (Script_sections::Section_type): New enum type.
9602 (Script_sections::output_section_name): Add a new parameter for
9603 returning script section type.
9604 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9606 * yyscript.y (union): Add new field SECTION_TYPE.
9607 (COPY, DSECT, INFO, NOLOAD): New tokens.
9608 (opt_address_and_section_type): Change type to output_section_header.
9609 (section_type): New non-terminal
9610 (section_header): Handle section type.
9611 (opt_address_and_section_type): Return section type value.
9615 * testsuite/plugin_common_test_1.c (foo): Add prototype.
9616 * testsuite/plugin_common_test_2.c (foo): Likewise.
9620 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9622 * output.cc (Output_section::add_merge_input_section): Simplify
9623 code and return status of Output_merge_base::add_input_section.
9624 Update merge section map only if Output_merge_base::add_input_section
9629 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9630 if section is marked as containing instructions but has no mapping
9632 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9633 correct section index.
9634 (Arm_relobj::find_linked_text_section): Ditto.
9638 * archive.cc (include_member): Destroy Read_symbols_data object before
9640 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9641 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9642 (Read_symbols_data::~Read_symbols_data) New destructor.
9643 (Section_relocs::Section_relocs) New constructor.
9644 (Section_relocs::~Section_relocs) New destructor.
9645 (Read_relocs_data::Read_relocs_data) New constructor.
9646 (Read_relocs_data::~Read_relocs_data) New destructor.
9647 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9648 pointers to NULL after deleting.
9652 * arm.cc: Replace "endianity" with "endianness" in comments.
9653 (Arm_exidx_cantunwind): Ditto.
9654 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9655 (Arm_relobj::merge_flags_and_attributes): New method.
9656 (Arm_relobj::merge_flags_and_attributes_): New data member.
9657 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9658 (Arm_relobj::scan_sections_for_stubs): Ditto.
9659 (Arm_relobj::do_read_symbols): Check to see if we really want to
9660 merge processor-specific flags and attributes. Exit early if
9661 an object is empty except for section names and the undefined symbol.
9662 (Target_arm::do_finalize_sections): Move check for ELF format to
9663 Arm_relobj::do_read_symbols. Merge processor specific flags and
9664 attributes from a regular object only when we have determined that
9665 it is aapropriate. Do not create an .ARM.attributes section in
9666 output if there is no regular input object.
9667 (Target_arm::merge_processor_specific_flags): Check
9668 --warn-mismatch before printing any error.
9669 (Target_arm::merge_object_attributes): Ditto.
9670 * gold.cc (queue_middle_tasks): Handle the case in which there is
9671 no regular object in input.
9672 * options.cc (General_options::parse_EB): New method.
9673 (General_options::parse_EL): Same.
9674 (General_options::General_options): Initialize endianness_.
9675 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9677 (General_options::Endianness): New enum.
9678 (General_options::endianness): New method.
9679 (General_options::endianness_): New data member.
9680 * parameters.cc (Parameters::set_options): Check target endianness.
9681 (Parameters::set_target_once): Ditto.
9682 (Parameters::check_target_endianness): New method.
9683 (parameters_force_valid_target): If either -EL or -EB is specified,
9684 use it to define endianness of default target.
9685 * parameters.h (Parameters::check_target_endianness): New method
9687 * target.h (class Target): Change "endianity" to "endianness"
9692 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9693 * configure: Regenerate.
9694 * Makefile.in: Regenerate.
9695 * testsuite/Makefile.in: Regenerate.
9700 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9701 prevailing definitions of common symbols.
9702 * testsuite/plugin_test_6.sh: New test case.
9703 * testsuite/plugin_common_test_1.c: New test case.
9704 * testsuite/plugin_common_test_2.c: New test case.
9705 * testsuite/Makefile.am (plugin_test_6): New test case.
9706 * testsuite/Makefile.in: Regenerate.
9710 * po/vi.po: New Vietnamese translation.
9714 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9718 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9719 to avoid a conversion warning on a 32-bit host.
9723 * testsuite/script_test_3.t: Add a TLS segment.
9724 * testsuite/Makefile.am (check_PROGRAMS): Add
9725 tls_phdrs_script_test.
9726 (tls_phdrs_script_test_SOURCES): Define.
9727 (tls_phdrs_script_test_DEPENDENCIES): Define.
9728 (tls_phdrs_script_test_LDFLAGS): Define.
9729 (tls_phdrs_script_test_LDADD): Define.
9730 * testsuite/Makefile.in: Rebuild.
9734 * fileread.cc (find_or_make_view): Fix comment.
9738 * script-sections.cc (class Orphan_section_placement): Define
9739 PLACE_TLS and PLACE_TLS_BSS.
9740 (Orphan_section_placement::Orphan_section_placement): Initialize
9742 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9743 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9744 (tls_script_test_SOURCES): Define.
9745 (tls_script_test_DEPENDENCIES): Define.
9746 (tls_script_test_LDFLAGS): Define.
9747 (tls_script_test_LDADD): Define.
9748 * testsuite/Makefile.in: Rebuild.
9752 * arm.cc (Arm_relocate_functions::abs8,
9753 Arm_relocate_functions::abs16): Use correct check for overflow
9754 specified in the ARM ELF specs.
9755 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
9756 target of a BLX instruction specially.
9757 (Reloc_stub::stub_type_for_reloc): Ditto.
9758 (Relocate::relocate): Use symbolic names instead of numeric relocation
9759 codes to report error.
9760 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9762 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9763 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9764 thumb2_blx_out_of_range.stdout
9765 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9766 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9767 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9768 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9769 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9770 thumb2_blx_in_range, thumb2_blx_in_range.o,
9771 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9772 thumb2_blx_out_of_range.o): New rules.
9773 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9774 thumb2_blx_in_range and thumb2_blx_out_of_range.
9775 * testsuite/Makefile.in: Regenerate.
9776 * arm_branch_in_range.sh: Add tests for THUMB BLX.
9777 * testsuite/thumb_blx_in_range.s: New file.
9778 * testsuite/thumb_blx_out_of_range.s: New file.
9782 * archive.cc (Should_include): Move to archive.h.
9783 (should_include_member): Make it a member of Archive.
9785 (Add_lib_group_symbols): New.
9786 * archive.h: Include options.h.
9787 (Archive_member): Moved from Archive.
9788 (Should_include): Moved from archive.cc.
9790 (Add_lib_group_symbols): New.
9791 * dynobj.cc (do_should_include_member): New.
9792 * dynobj.h (do_should_include_member): New.
9793 * gold.cc (queue_initial_tasks): Update call to queue.
9794 * main.cc (main): Print lib group stats.
9795 * object.cc (do_should_include_member): New.
9796 * object.h: Include archive.h.
9797 (Object::should_include_member): New.
9798 (Object::do_should_include_member): New.
9799 (Sized_relobj::do_should_include_member): New.
9800 * options.cc (General_options::parse_start_lib): New.
9801 (General_options::parse_end_lib): New.
9802 (Input_arguments::add_file): Handle lib groups.
9803 (Input_arguments::start_group): Check we are not in a lib.
9804 (Input_arguments::start_lib): New.
9805 (Input_arguments::end_lib): New.
9806 * options.h (General_options): Add start_lib and end_lib.
9807 (Input_argument::lib_): New.
9808 (Input_argument::lib): New.
9809 (Input_argument::is_lib): New.
9810 (Input_file_lib): New.
9811 (Input_arguments::in_lib_): New.
9812 (Input_arguments::in_lib): New.
9813 (Input_arguments::start_lib): New.
9814 (Input_arguments::end_lib_): New.
9815 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9816 in unused members as preempted.
9817 (Sized_pluginobj::do_should_include_member): New.
9818 * plugin.h (Sized_pluginobj::do_should_include_member): New.
9819 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9821 (Read_symbols::do_whole_lib_group): New.
9822 (Read_symbols::do_lib_group): New.
9823 (Read_symbols::do_read_symbols): Handle lib groups.
9824 (Read_symbols::get_name): Handle lib groups.
9825 * readsyms.h (Read_symbols): Add an archive member pointer.
9826 (Read_symbols::do_whole_lib_group): New.
9827 (Read_symbols::do_lib_group): New.
9828 (Read_symbols::member_): New.
9829 * script.cc (read_input_script): Update call to queue_soon.
9833 * arm.cc (Stub_table::Stub_table): Initialize new data members
9834 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9835 (Stub_table::add_reloc_stub): Assign stub offset and update
9836 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9837 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9839 (Stub_table::update_data_size_and_addralign): Use
9840 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9841 instead of going over all reloc stubs.
9842 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9843 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9844 Stringpool_template::offset_ to size of Stringpool_char.
9845 (Stringpool_template::new_key_offset): Remove code to initialize
9846 Stringpool_template::offset_.
9847 * stringpool.h (Stringpool_template::set_no_zero_null): Set
9848 Stringpool_template::offset_ to zero.
9852 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9854 (Stringpool_template::new_key_offset): New method.
9855 (Stringpool_template::add_string): Assign offsets when adding new
9857 (Stringpool_template::set_string_offsets): Do not set string offsets
9858 when not optimizing.
9859 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9861 (Chunked_vector::clear): Clear size_.
9862 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9863 (Chunked_vector::size): Return size_.
9864 (Chunked_vector::push_back): Use size_ to find insert position.
9865 (Chunked_vector::size_): New data member.
9866 (Stringpool_template::set_no_zero_null): Assert string set is empty.
9867 (Stringpool_template::new_key_offset): New method declaration.
9868 (Stringpool_template::offset_): New data member.
9872 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9873 Add_symbols' constructor.
9874 * readsyms.h (Add_symbols): Remove the input_group member.
9878 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9879 target to ask whether a reference to a symbol requires a stack
9881 * target.h (Target::is_call_to_non_split): New function.
9882 (Target::do_is_call_to_non_split): Declare virtual function.
9883 * target.cc: Include "symtab.h".
9884 (Target::do_is_call_to_non_split): New function.
9885 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9889 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9890 (File_read::open[1]): Remove initial mapping of whole_file_view_.
9891 (File_read::open[2]): Add whole_file_view_ to list of views.
9892 (File_read::make_view): Remove test of whole_file_view_.
9893 (File_read::find_or_make_view): Create whole_file_view_ if
9895 (File_read::clear_views): Replace bool parameter with enum;
9896 adjust all callers. Don't delete views with permanent data;
9897 do delete cached views and views from archives if
9898 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
9899 if clearing the corresponding view.
9900 * fileread.h (File_read::Clear_views_mode): New enum.
9901 (File_read::View::is_permanent_view): New method.
9902 (File_read::clear_views): Replace bool parameter
9903 with enum; adjust all callers.
9904 * options.h (General_options): Change keep_files_mapped option;
9905 add map_whole_files.
9906 * readsyms.cc (Add_symbols::run): Delete sd_ object before
9908 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9913 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9917 * icf.cc (get_section_contents): Add '@' marker after processing the
9922 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9923 due to a conversion warning.
9924 (Arm_relobj::update_output_local_symbol_count): Check for local
9925 symbol with unset output index.
9929 * options.h (class General_options): Add --spare-dynamic-tags.
9930 * output.cc (Output_data_dynamic::set_final_data_size): Implement
9931 --spare-dynamic-tags.
9935 * incremental.cc: Include "libiberty.h".
9939 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9940 function, is_info_ member.
9941 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9942 (Versions::Versions): Update caller.
9943 (Versions::define_base_version): Likewise.
9944 (Versions::add_def): Likewise.
9948 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9949 (Scan::possible_function_pointer_reloc): New function.
9950 (Scan::local_reloc_may_be_function_pointer): Change to call
9951 possible_function_pointer_reloc.
9952 (Scan::global_reloc_may_be_function_pointer): Ditto.
9953 * icf.h (Icf::check_section_for_function_pointers): Change to reject
9954 relocations in ".data.rel.ro._ZTV" section.
9955 * testsuite/icf_safe_so_test.sh: Change to pass i386.
9956 * testsuite/icf_safe_so_test.cc: Ditto.
9957 * testsuite/icf_safe_test.cc: Ditto.
9958 * testsuite/icf_safe_test.sh: Ditto.
9963 * target-reloc.h (relocate_section): Check the symbol table index
9964 for -1U before setting the local symbol index.
9965 (scan_relocatable_relocs): If copying the relocation, record that
9966 the local symbol is required.
9967 * object.h (Symbol_value::is_output_symtab_index_set): New
9969 (Symbol_value::may_be_discarded_from_output_symtab): New
9971 (Symbol_value::has_output_symtab_entry): New function.
9972 (Symbol_value::needs_output_symtab_entry): Remove.
9973 (Symbol_value::output_symtab_index): Make sure the symbol index is
9975 (Symbol_value::set_output_symtab_index): Make sure the symbol
9976 index is not set. Make sure the new index is valid.
9977 (Symbol_value::set_must_have_output_symtab_entry): New function.
9978 (Symbol_value::has_output_dynsym_entry): New function.
9979 (Symbol_value::set_output_dynsym_index): Make sure the new index
9981 (Sized_relobj::set_must_have_output_symtab_entry): New function.
9982 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9983 local symbol if permitted.
9984 (Sized_relobj::do_finalize_local_symbols): Call
9985 is_output_symtab_index_set rather than needs_output_symtab_entry.
9986 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9987 rather than needs_output_symtab_entry. Call
9988 has_output_dynsym_entry rather than needs_output_dynsym_entry.
9989 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9990 is_output_symtab_index_set rather than needs_output_symtab_entry.
9991 * testsuite/discard_locals_relocatable_test.c: New file.
9992 * testsuite/discard_locals_test.sh: Test -r.
9993 * testsuite/Makefile.am (check_DATA): Add
9994 discard_locals_relocatable_test1.syms,
9995 discard_local_relocatable_test2.syms.
9996 (MOSTLYCLEANFILES): Likewise. Also add
9997 discard_locals_relocatable_test1.lout and
9998 discard_locals_relocatable_test2.out.
9999 (discard_locals_relocatable_test1.syms): New target.
10000 (discard_locals_relocatable_test.o): New target.
10001 (discard_locals_relocatable_test1.out): New target.
10002 (discard_locals_relocatable_test2.syms): New target.
10003 (discard_locals_relocatable_test2.out): New target.
10004 (various): Add missing ../ld-new dependencies.
10005 * testsuite/Makefile.in: Rebuild.
10009 * po/fi.po: New Finnish translation.
10013 * layout.cc (Layout::Layout): Force section types of .init_array*,
10014 .preinit_array* and .fini_array* sections.
10015 * output.cc (Output_section::Input_section_sort_entry::has_priority):
10016 Fix check of return value of std::string::find.().
10017 (Output_section::Input_section_sort_compare::operator()): Remove
10018 comment about .init_array.
10019 (Output_section::Input_section_sort_init_fini_compare::operator()):
10021 (Output_section::sort_attached_input_sections): Handle .init_array
10022 and .fini_array specially.
10023 * output.h (Output_section::Inut_section_sort_compare): Update
10025 (Output_section::Input_section_sort_init_fini_compare): New struct.
10029 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10030 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10031 * testsuite/debug_msg.sh: Avoid matching source line number for
10032 use of global variable undef_int.
10036 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10037 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10038 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10039 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10040 * options.cc (General_options::General_options): Initialize member
10042 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10043 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10044 and rm_no_fix_v4bx.stdout
10045 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10046 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10047 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10048 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10049 and arm_no_fix_v4bx.
10050 * Makefile.in: Regenerate.
10051 * testsuite/arm_fix_v4bx.s: New file.
10052 * testsuite/arm_fix_v4bx.sh: Ditto.
10056 * arm.cc (Target_arm::got_section): Make the .got section the first
10057 non RELRO section in the data segment.
10058 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10059 suffixes of section names.
10063 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10064 flags and attributes merging if an input file is a binary file.
10065 * fileread.cc (Input_file::open): Record format of original file.
10066 * fileread.h (Input_file::Format): New enum type.
10067 (Input_file::Input_file): Initialize data member format_.
10068 (Input_file::format): New method definition.
10069 (Input_file::format_):: New data member.
10073 * arm.cc (Arm_output_data_got): New class.
10074 (ARM_TCB_SIZE): New constant
10075 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10076 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10077 If user uses a script with a SECTIONS clause, issue only a warning
10078 for a misplaced EXIDX input section. Otherwise, issue an error.
10079 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10080 garbage collection.
10081 (Target_arm::got_mode_index_entry): Handle static linking.
10082 (Target_arm::Scan::local): Ditto.
10083 (Target_arm::Scan::global): Ditto.
10084 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
10085 all incorrectly implemented relocations.
10086 (Target_arm::fix_exidx_coverage): Pass layout to
10087 Arm_output_section::fix_exidx_coverage.
10088 * layout.cc (Layout::section_name_mapping): Remove trailing dots
10089 from ".ARM.exidx." and ".ARM.extab.".
10093 * arm.cc (Target_arm::do_finalize_sections): Create attribute
10094 section if it does not already exist.
10095 * attributes.cc (Attributes_section_data::Attributes_section_data):
10096 Don't crash if size is zero.
10101 * gold.cc (queue_middle_tasks): If no input files were opened,
10103 * workqueue.h (Task_function::Task_function): Assert that there is
10108 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10109 * icf.cc (get_section_contents): Cast snprintf arguments to long long
10110 types to avoid warnings due to different uint64_t implementations
10111 on different hosts.
10115 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10116 handling of the maximum backward branch offset.
10117 (Arm_relocate_functions::thumb_branch_common): Ditto.
10118 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10119 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10120 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10121 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10122 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10123 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10124 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10125 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10126 thumb_bl_out_of_range thumb_bl_out_of_range.o,
10127 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10128 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10129 thumb2_bl_out_of_range.o): New rules.
10130 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10131 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10132 thumb2_bl_out_of_range
10133 * testsuite/Makefile.in: Regenerate.
10134 * testsuite/arm_bl_in_range.s: New file.
10135 * testsuite/arm_bl_out_of_range.s: Ditto.
10136 * testsuite/arm_branch_in_range.sh: Ditto.
10137 * testsuite/arm_branch_range.t: Ditto.
10138 * testsuite/thumb2_branch_range.t: Ditto.
10139 * testsuite/thumb_bl_in_range.s: Ditto.
10140 * testsuite/thumb_bl_out_of_range.s: Ditto.
10141 * testsuite/thumb_branch_range.t: Ditto.
10145 * gc.h (gc_process_relocs): Change vectors to point to the new list.
10146 Add reloc offset information.
10147 * icf.cc (get_section_contents): Change iterators to point to the new
10148 vectors. Add reloc offset information to the contents.
10149 * icf.h (Icf::Sections_reachable_info): New typedef.
10150 (Icf::Sections_reachable_list): New typedef.
10151 (Icf::Offset_info): New typedef.
10152 (Icf::Reloc_info): New struct typedef.
10153 (Icf::Reloc_info_list): New typedef.
10154 (Icf::symbol_reloc_list): Delete method.
10155 (Icf::addend_reloc_list): Delete method.
10156 (Icf::section_reloc_list): Delete method.
10157 (Icf::reloc_info_list): New method.
10158 (Icf::reloc_info_list_): New member.
10162 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10163 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10164 * arm.cc (Arm_relocation_functions): New forward declaration.
10165 (Target_arm::Target_arm): Initialize new data members
10166 got_mod_index_offset_ and tls_base_symbol_defined_.
10167 (Target_arm::Relocate::relocate_tls): New method.
10168 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10169 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10171 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10172 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10173 (Target_arm::got_mod_index_offset_,
10174 Target_arm::tls_base_symbol_defined_): New data members.
10175 (Target_arm::Scan::local, Target::Scan::global,
10176 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10181 * arm.cc (Arm_relobj::find_linked_text_section): New method.
10182 (Arm_relobj::make_exidx_input_section): Pass section index of linked
10183 text section as a parameter becuase some broken tools may not set
10184 the link in section header.
10185 (Target_arm::has_got_section): New method.
10186 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10187 without any mapping symbol as data only. Remove warning.
10188 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10189 link in its section header, try to discover the link by inspecting the
10190 REL31 relocation at the beginning of the section.
10191 (Target_arm::Scan::check_non_pic): Report name of offending relocation
10193 (Target_arm::Scan::global): Treat any reference to the symbol
10194 _GLOBAL_OFFSET_TABLE_ as a GOT access.
10198 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10199 (Scan::global_reloc_may_be_function_pointer): New function.
10200 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10201 (Scan::global_reloc_may_be_function_pointer): New function.
10202 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10203 (Scan::global_reloc_may_be_function_pointer): New function.
10204 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10205 (Scan::global_reloc_may_be_function_pointer): New function.
10206 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10207 (Scan::global_reloc_may_be_function_pointer): New function.
10208 (Scan::possible_function_pointer_reloc): New function.
10209 (Target_x86_64::can_check_for_function_pointers): New function.
10210 * gc.h (gc_process_relocs): Scan relocation types to determine if
10211 function pointers were taken for targets that support it.
10212 * icf.cc (Icf::find_identical_sections): Include functions for
10213 folding in safe ICF whose pointer is not taken.
10214 * icf.h (Secn_fptr_taken_set): New typedef.
10215 (fptr_section_id_): New member.
10216 (section_has_function_pointers): New function.
10217 (set_section_has_function_pointers): New function.
10218 (check_section_for_function_pointers): New function.
10219 * options.h: Fix comment for safe ICF option.
10220 * target.h (can_check_for_function_pointers): New function.
10221 * testsuite/Makefile.am: Add icf_safe_so_test test case.
10222 Modify icf_safe_test for X86-64.
10223 * testsuite/Makefile.in: Regenerate.
10224 * testsuite/icf_safe_so_test.cc: New file.
10225 * testsuite/icf_safe_so_test.sh: New file.
10226 * testsuite/icf_safe_test.cc (kept_func_3): New function.
10227 (main): Change to take pointer to function kept_func_3.
10228 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10229 folding is done correctly for X86-64.
10233 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10234 is_symbolless parameter.
10235 (Output_reloc<SHT_REL>::is_symbolless): New.
10236 (Output_reloc<SHT_REL>::is_symbolless_): New.
10237 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10238 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10239 (Output_reloc<SHT_RELA>::is_symbolless): New.
10240 (Output_data_reloc::add_global): Handle is_symbolless.
10241 (Output_data_reloc::add_global_relative): Likewise.
10242 (Output_data_reloc::add_local): Likewise.
10243 (Output_data_reloc::add_local_relative): Likewise.
10244 (Output_data_reloc::add_symbolless_global_addend): New.
10245 (Output_data_reloc::add_symbolless_local_addend): New.
10246 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10248 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10249 instead of ->is_relative_
10250 (Output_reloc::write): Likewise.
10251 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10252 (Output_reloc::write_rel): Simplify.
10254 * sparc.cc (Target_sparc::Scan::local): Use
10255 ->add_symbolless_local_addend as needed.
10256 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10257 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
10258 based upon relocation offset.
10262 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10263 (Target_arm::Scan::global): Ditto. Also remove a comment before the
10264 beginning of function.
10265 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10266 and MOVT_ABS relocations. Those are non issued in scanning. Fix
10267 parameter is_32bit in calls to should_apply_static_reloc.
10268 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10269 (check_DATA): Add arm_abs_global.stdout.
10270 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10271 arm_abs_global.stdout): New rules.
10272 (MOSTLLYCLEANFILES): Add arm_abs_global
10273 * Makefile.in: Regenerate.
10274 * testsuite/arm_abs_global.s: New file.
10275 * testsuite/arm_abs_global.sh: Ditto.
10276 * testsuite/arm_abs_lib.s: Ditto.
10280 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10282 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
10283 Allocate_commons_task first.
10284 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10285 task, rather than symtab_lock_.
10286 (Gc_process_relocs::~Gc_process_relocs): New function.
10287 (Gc_process_relocs::is_runnable): Check this_blocker_.
10288 (Gc_process_relocs::locks): Use next_blocker_ rather than
10290 (Scan_relocs::~Scan_relocs): New function.
10291 (Scan_relocs::is_runnable): Check this_blocker_ rather than
10293 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
10295 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10296 fields. Add this_blocker_ and next_blocker_ fields. Adjust
10297 constructor accordingly.
10298 (class Gc_process_relocs): Likewise.
10299 (class Scan_relocs): Likewise.
10300 * common.h (class Allocate_commons_task): Remove symtab_lock_
10301 field, and corresponding constructor parameter.
10302 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10304 (Allocate_commons_task::locks): Likewise.
10308 * gold-threads.h (class Once): Define.
10309 (class Initialize_lock): Rewrite as child of Once.
10310 * gold-threads.cc (class Once_initialize): Define.
10311 (once_pointer_control): New static variable.
10312 (once_pointer, once_arg): New static variables.
10313 (c_run_once): New static function.
10314 (Once::Once, Once::run_once, Once::internal_run): New functions.
10315 (class Initialize_lock_once): Remove.
10316 (initialize_lock_control): Remove.
10317 (initialize_lock_pointer): Remove.
10318 (initialize_lock_once): Remove.
10319 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10320 (Initialize_lock::initialize): Rewrite.
10321 (Initialize_lock::do_run_once): New function.
10322 * archive.cc (Archive::interpret_header): Only clear name if it is
10324 * fileread.cc: Include "gold-threads.h"
10325 (file_counts_lock): New static variable.
10326 (file_counts_initialize_lock): Likewise.
10327 (File_read::release): Only increment counts when using --stats.
10328 Use a lock around the increment.
10329 * parameters.cc (class Set_parameters_target_once): Define.
10330 (set_parameters_target_once): New static variable.
10331 (Parameters::Parameters): Move here from parameters.h.
10332 (Parameters::set_target): Rewrite.
10333 (Parameters::set_target_once): New function.
10334 (Parameters::clear_target): Move here and rewrite.
10335 * parameters.h (class Parameters): Update declarations. Add
10336 set_parameters_target_once_ field.
10337 (Parameters::Parameters): Move to parameters.cc.
10338 (Parameters::clear_target): Likewise.
10339 * readsyms.cc (Read_symbols::do_group): Create a Start_group
10341 (Start_group::~Start_group): New function.
10342 (Start_group::is_runnable): New function.
10343 (Start_group::locks, Start_group::run): New functions.
10344 (Finish_group::run): Change saw_undefined to size_t.
10345 * readsyms.h (class Start_group): Define.
10346 (class Finish_group): Change saw_undefined_ field to size_t.
10347 (Finish_group::Finish_group): Remove saw_undefined and
10348 this_blocker parameters. Change all callers.
10349 (Finish_group::set_saw_undefined): New function.
10350 (Finish_group::set_blocker): New function.
10351 * symtab.h (class Symbol_table): Change saw_undefined to return
10352 size_t. Change saw_undefined_ field to size_t.
10353 * target-select.cc (Set_target_once::do_run_once): New function.
10354 (Target_selector::Target_selector): Initialize set_target_once_
10355 field. Don't initialize lock_ and initialize_lock_ fields.
10356 (Target_selector::instantiate_target): Rewrite.
10357 (Target_selector::set_target): New function.
10358 * target-select.h (class Set_target_once): Define.
10359 (class Target_selector): Update declarations. Make
10360 Set_target_once a friend. Remove lock_ and initialize_lock_
10361 fields. Add set_target_once_ field.
10365 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10366 queueing any tasks.
10367 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
10368 (queue_middle_tasks): Add all blockers before queueing any tasks.
10369 (queue_final_tasks): Likewise.
10370 * token.h (Task_token::add_blockers): New function.
10371 * object.h (Input_objects::number_of_relobjs): New function.
10375 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10376 shared, not if not position independent.
10377 * x86_64.cc (Relocate::relocate_tls): Likewise.
10378 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10379 (tls_pie_pic_test): New target.
10380 * testsuite/Makefile.in: Rebuild.
10382 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10383 (tls_test_main_pie.o, tls_test_pie.o): New targets.
10384 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10385 * testsuite/Makefile.in: Rebuild.
10389 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10390 R_SPARC_RELATIVE using ->add_local_relative().
10391 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10393 * output.h (Output_data_dynamic::add_section_size): New method
10394 that takes two Output_data objects.
10395 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10396 entry param. Handle it in initializers.
10397 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10398 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10399 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10401 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10402 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10403 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10404 for dynrel_includes_plt.
10405 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10406 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10407 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10409 (Target_sparc::do_finalize_sections): Update to pass true for
10410 dynrel_includes_plt.
10411 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10412 output before .rela.plt
10413 (Target_powerpc::do_finalize_sections): Update to pass true for
10414 dynrel_includes_plt when 32-bit.
10418 * arm.cc (Arm_relobj::simple_input_section_output_address): New
10420 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10421 Arm_relobj::scan_section_for_cortex_a8_stubs,
10422 Arm_relobj::do_relocation_section): Instead of calling
10423 Output_section::output_address, use faster
10424 Arm_relobj::simple_input_section_output_address.
10428 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10429 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10430 relocation helper function.
10432 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10433 just like R_SPARC_GOT{10,13,22}.
10434 (Target_sparc::Scan::local): Likewise.
10435 (Target_sparc::Relocate:relocate): Likewise.
10439 * configure.ac: Rewrite targetobjs duplicate removal code to use
10440 only shell constructs.
10441 * configure: Rebuild.
10446 * arm.cc (Arm_relobj::section_is_scannable): New method.
10447 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10448 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10453 * arm-reloc-property.cc (cstdio): Include.
10454 * configure.ac (targetobjs): Remove duplicates.
10455 * configure: Regenerate.
10456 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10457 big and little endian version for a given address size.
10461 * arm-reloc-property.cc
10462 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10464 * arm-reloc-property.h
10465 (Arm_reloc_property_table::get_implemented_static_reloc_property):
10466 New method definition.
10467 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10469 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10471 (GOT_PREL): Change implemented to Y.
10472 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10473 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10474 (Arm_relocate_functions::movw_abs_nc): Remove method.
10475 (Arm_relocate_functions::movt_abs): Ditto.
10476 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10477 (Arm_relocate_functions::thm_movt_abs): Ditto.
10478 (Arm_relocate_functions::movw_rel_nc): Ditto.
10479 (Arm_relocate_functions::movw_rel): Ditto.
10480 (Arm_relocate_functions::movt_rel): Ditto.
10481 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10482 (Arm_relocate_functions:thm_movw_rel): Ditto.
10483 (Arm_relocate_functions:thm_movt_rel): Ditto.
10484 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10485 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10486 New method definitions.
10487 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10488 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10489 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10490 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10491 (Target_arm::Relocate::relocate): Check for non-static or
10492 unimplemented relocation code and exit early. Change calls to
10493 Target_arm::reloc_uses_thumb_bit and
10494 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10495 instead. Refactor code to handle similar relocations to increase
10496 code sharing. Remove check for unsupported relocation code in switch
10498 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10499 relocation property table to find out size. Change error message to
10500 print out the name of a relocation code instead of the numeric value.
10501 (Target_arm::scan_reloc_for_stub): Use relocation property table
10502 instead of calling Target_arm::reloc_uses_thumb_bit().
10506 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10507 types of relaxed input section.
10511 * Makefile.am (HFILES): Add arm-reloc-property.h.
10513 (TARGETSOURCES): Add arm-reloc-property.cc
10514 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10515 (libgold_a_SOURCES): $(DEFFILES)
10516 * Makefile.in: Regenerate.
10517 * arm-reloc-property.cc: New file.
10518 * arm-reloc-property.h: New file.
10519 * arm-reloc.def: New file.
10520 * arm.cc: Update comments.
10521 (arm-reloc-property.h): New included header.
10522 (arm_reloc_property_table): New global variable.
10523 (Target_arm::do_select_as_default_target): New method definition.
10524 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10525 arm-reloc-property to targ_extra_obj.
10526 * parameters.cc (set_parameters_target): Call
10527 Target::select_as_default_target().
10528 * target.h (Target::select_as_default_target): New method definition.
10529 (Target::do_select_as_default_target): Same.
10533 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10534 first_output_text_section_.
10535 (Arm_exidx_fixup::first_output_text_section): New method definition.
10536 (Arm_exidx_fixup::first_output_text_section_): New data member.
10537 (Arm_exidx_fixup::process_exidx_section): Record the first text
10538 output section seen.
10539 (Arm_output_section::fix_exidx_coverage): Set correct linked section
10540 and entsize in output section header.
10544 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10545 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10546 (Arm_relocate_functions::thm_alu11): New Method.
10547 (Arm_relocate_functions::thm_pc8): New Method.
10548 (Arm_relocate_functions::thm_pc12): New Method.
10549 (Target_arm::Scan::local): Handle the relocations.
10550 (Target_arm::Scan::global): Likewise.
10551 (Target_arm::Relocate::relocate): Likewise.
10552 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10556 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10557 of relocation types as ld.
10561 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10563 (Arm_relocate_functions::thumb_branch_common): Ditto.
10564 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10565 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10566 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10567 Arm_relocate_functions::jump24): Remove.
10568 (Target_arm::Relocate::relocate): Adjust code to call
10569 Arm_relocation_functions::arm_branch_common and
10570 Arm_relocation_functions::thumb_branch_common instead of their removed
10571 wrappers. Merge switch-cases together to reduce source code size.
10575 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10576 output_local_symbol_count_needs_update_.
10577 (Arm_relobj::output_local_symbol_count_needs_update,
10578 Arm_relobj::set_output_local_symbol_count_needs_update,
10579 Arm_relobj::update_output_local_symbol_count): New methods.
10580 (Arm_relobj::output_local_symbol_count_needs_update_): New data
10582 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10583 of pointed function as in a R_ARM_PREL31 relocation.
10584 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10585 for output local symbol count updating.
10586 (Target_arm::do_relax): Update output local symbol counts in objects
10588 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10592 * arm.cc: Added support for the ARM relocations:
10593 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10594 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10595 (Arm_relocate_functions::movw_rel_nc): Renamed (was
10597 (Arm_relocate_functions::movw_rel): New method.
10598 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10599 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10601 (Arm_relocate_functions::thm_movw_rel): New method.
10602 (Arm_relocate_functions::thm_movt_rel): Renamed (was
10604 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10606 (Target_arm::Scan::global): Likewise.
10607 (Target_arm::Relocate::relocate): Likewise.
10608 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10613 * arm.cc: Added support for ARM group relocations.
10614 (Target_arm::reloc_needs_sym_origin): New method.
10615 (Arm_relocate_functions::calc_grp_kn): New method.
10616 (Arm_relocate_functions::calc_grp_residual): New method.
10617 (Arm_relocate_functions::calc_grp_gn): New method.
10618 (Arm_relocate_functions::arm_grp_alu): New Method.
10619 (Arm_relocate_functions::arm_grp_ldr): New Method.
10620 (Arm_relocate_functions::arm_grp_ldrs): New Method.
10621 (Arm_relocate_functions::arm_grp_ldc): New Method.
10622 (Target_arm::Scan::local): Handle the ARM group relocations.
10623 (Target_arm::Scan::global): Likewise.
10624 (Target_arm::Relocate::relocate): Likewise.
10625 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10630 * arm.cc (set): Include.
10631 (class Arm_exidx_fixup): Change type of last_input_section_ to const
10633 (Arm_output_section::Text_section_list): New type.
10634 (Arm_output_section::append_text_sections_to_list): New method.
10635 (Arm_output_section::fix_exidx_coverage): Ditto.
10636 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10637 (Arm_relobj::convert_input_section_to_relaxed_section): Use
10638 Relobj::set_section_offset() instead of
10639 Sized_relobj::invalidate_section_offset().
10640 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10641 parameter for section headers. Ignore relocation sections for
10642 unallocated sections and EXIDX sections.
10643 (Target_arm::fix_exidx_coverage): New method.
10644 (Target_arm::output_section_address_less_than): New type.
10645 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10646 linked text section instead of the EXIDX section.
10647 (Arm_output_section::create_stub_group): Add an assertion to check
10648 that this is not an EXIDX output section.
10649 (Arm_output_section::append_text_sections_to_list): New method.
10650 (Arm_output_section::fix_exidx_coverage): Ditto.
10651 (Arm_relobj::scan_sections_for_stubs): Adjust call to
10652 Arm_relobj::section_needs_reloc_stub_scanning.
10653 (Target_arm::do_relax): Fix EXIDX output section coverage in the
10655 (Target_arm::fix_exidx_coverage): New method.
10656 * object.h (Relobj::set_output_section): New method.
10657 (Sized_relobj::invalidate_section_offset): Remove method.
10658 (Sized_relobj::do_invalidate_section_offset): Remove method.
10659 (Sized_relobj::do_set_section_offset): Handle offset value -1.
10663 * arm.cc (Arm_exidx_merged_section::do_output_offset):
10664 Fix warning due to signed and unsigned comparison on a 32-bit host.
10668 * arm.cc (Target_arm::do_relax): Record an output section for section
10669 offset adjustment it contains any stub table that has changed.
10670 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10671 offsets in an output section if necessary.
10672 * output.cc (Output_section::Output_section): Initialize
10673 section_offsets_need_adjustments_.
10674 (Output_section::add_input_section_for_script): Renamed to
10675 Output_section::add_simple_input_section.
10676 (Output_section::save_states): Add a comment.
10677 (Output_section::discard_states): New method defintion.
10678 (Output_section::adjust_section_offsets): Same.
10679 * output.h (Output_section::add_input_section_for_script): Renamed to
10680 Output_section::add_simple_input_section.
10681 (Output_section::discard_states): New method declaration.
10682 (Output_section::adjust_section_offsets): Same.
10683 (Output_section::section_offsets_need_adjustment,
10684 Output_section::set_section_offsets_need_adjustment): New method
10686 (Output_section::section_offsets_need_adjustment_): New data member.
10687 * script-sections.cc
10688 (Output_section_element_input::set_section_address): Adjust code for
10689 renaming of Output_section::add_input_section_for_script.
10690 (Orphan_output_section::set_section_address): Same.
10694 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10695 Fix_v4bx enum values .
10696 * gold/options.h (General_options): New option definitions.
10697 (General_options::fix_v4bx): New method.
10698 (General_options::Fix_v4bx): New enum.
10699 * gold/options.cc (General_options::parse_fix_v4bx): New method.
10700 (General_options::parse_fix_v4bx_interworking): New method.
10704 * arm.cc (Arm_exidx_fixup): New class.
10708 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10710 (Arm_exidx_section_offset_map): New type.
10714 * arm.cc (Arm_exidx_input_section): New class.
10715 (Arm_relobj::exidx_input_section_by_link,
10716 Arm_relobj::exidx_input_section_by_shndx,
10717 Arm_relobj::make_exidx_input_section): New methods.
10718 (read_arm_attributes_section): Remove.
10719 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10720 information about them.
10721 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10726 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10727 Input_section_specifier to Section_id.
10728 (Target_arm::new_arm_input_section: Adjust code for change of key
10730 (Target_arm::find_arm_input_section): Ditto.
10731 * gc.h (object.h): Include for Section_id nand Section_id_hash.
10732 (Section_id): Remove.
10733 (Garbage_collection::Section_id_hash): Remove.
10734 * icf.h (object.h): Include for Section_id nand Section_id_hash.
10735 (Section_id): Remove.
10736 (Icf::Section_id_hash): Remove.
10737 * object.h (Section_id, Const_section_id, Section_id_hash,
10738 Const_section_id_hash): New type definitions.
10739 * output.cc (Output_section::add_relaxed_input_section): Change to
10740 use Const_section_id instead of Input_section_specifier as key type.
10741 (Output_section::add_merge_input_section): Ditto.
10742 (Output_section::build_relaxation_map): Change to use Section_id
10743 instead of Input_section_specifier as key type.
10744 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10746 (Output_section::convert_input_sections_to_relaxed_sections): Change
10747 to use Const_section_id instead of Input_section_specifier as key type.
10748 (Output_section::find_merge_section): Ditto.
10749 (Output_section::find_relaxed_input_section): Ditto.
10750 * output.h (Input_section_specifier): Remove class.
10751 (Output_section::Output_section_data_by_input_section_map): Change
10752 key type to Const_section_id.
10753 (Output_section::Output_relaxed_input_section_by_input_section_map):
10755 (Output_section::Relaxation_map): Change key type to Section_id.
10759 * gold/arm.cc: Added support for R_ARM_V4BX relocation
10760 (class Arm_v4bx_stub): New class.
10761 (DEF_STUBS): Updated definition to support v4_veneer_bx.
10762 (Stub_factory::make_arm_v4bx_stub): New method.
10763 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10764 (Stub_table::empty): Handle v4bx stubs.
10765 (Stub_table::add_arm_v4bx_stub): New method.
10766 (Stub_table::find_arm_v4bx_stub): New method.
10767 (Arm_relocate_functions::v4bx): New method.
10768 (Target_arm::fix_v4bx): New method.
10769 (Target_arm::Target_arm): Handle R_ARM_V4BX.
10770 (Stub_table::relocate_stubs): Likewise.
10771 (Stub_table::do_write): Likewise.
10772 (Stub_table::update_data_size_and_addralign): Likewise.
10773 (Stub_table::finalize_stubs): Likewise.
10774 (Target_arm::Scan::local): Likewise.
10775 (Target_arm::Scan::global): Likewise.
10776 (Target_arm::do_finalize_sections): Likewise.
10777 (Target_arm::Relocate::relocate): Likewise.
10778 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10780 (Target_arm::scan_reloc_for_stub): Likewise.
10781 (Target_arm::scan_reloc_section_for_stubs): Likewise.
10785 * output.cc (Output_section_headers::do_sized_write): Write large
10786 segment count to sh_info field.
10787 (Output_file_header::do_sized_write): For large segment count,
10788 write PN_XNUM to e_phnum field.
10792 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10793 (Arm_relocate_functions::thm_jump8): New function.
10794 (Arm_relocate_functions::thm_jump11): New function.
10795 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10797 (Target_arm::Scan::global): Likewise.
10798 (Target_arm::Relocate::relocate): Likewise.
10799 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10804 * arm.cc (map, utility): Include headers.
10805 (Target_arm::apply_cortex_a8_workaround): New method.
10806 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10807 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10808 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10809 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10810 the --[no-]fix-cortex-a8 command line options.
10811 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10812 (Target_arm::relocate_stub): Use addend in instruction template.
10813 * options.h (DEFINE_bool): Set the user-set flag.
10814 (General_options): Add --[no-]-fix-cortex options.
10815 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10816 : Update fast look-up map after conversion.
10820 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10821 in the first pass of do_layout.
10825 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10826 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10827 apparent compiler problem of not folding static constant integral
10828 data members of elfcpp::Elf_sizes<32>.
10832 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10833 Arm_relobj::section_needs_cortex_a8_stub_scanning,
10834 Arm_relobj::scan_section_for_cortex_a8_erratum,
10835 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10836 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10837 sections to scan for relocation stubs into a new method
10838 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
10839 relocation and Cortex-A8 stub scanning.
10840 (Target_arm::do_relax): Force stubs to be after stubbed sections
10841 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
10842 the beginning of a new relaxation pass. Update a comment.
10843 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10847 * target-reloc.h (visibility_error): New inline function.
10848 (relocate_section): Call visibility_error.
10849 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10850 (MOSTLYCLEANFILES): Likewise.
10851 (protected_4_pic.o, protected_3.err): New targets.
10852 * testsuite/protected_4.cc: New file.
10856 * arm.cc (Cortex_a8_reloc): New class.
10857 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10858 and cortex_a8_relocs_info_.
10859 (Target_arm::fix_cortex_a8): New method definition.
10860 (Target_arm::Cortex_a8_relocs_info): New type.
10861 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10862 New data member declarations.
10863 (Target_arm::scan_reloc_for_stub): Record information about
10864 relocations for THUMB branches that might be exempted from the
10865 Cortex-A8 workaround.
10866 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10867 at the beginning of a relaxation pass.
10871 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10872 (Arm_relobj::Mapping_symbol_position,
10873 Arm_reloj::Mapping_symbol_position_less,
10874 Arm_relobj::Mapping_symbols_info): New types.
10875 (Target_arm::is_mapping_symbol_name): New method definition.
10876 (Arm_relobj::do_count_local_symbols): Save information about mapping
10881 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10882 Arm_relocate_functions::thumb32_branch_upper,
10883 Arm_relocate_functions::thumb32_branch_lower,
10884 Arm_relocate_functions::thumb32_cond_branch_offset,
10885 Arm_relocate_functions::thumb32_cond_branch_upper,
10886 Arm_relocate_functions::thumb32_cond_branch_lower,
10887 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10888 branch offset encoding.
10889 (Arm_relocate_functions::thumb_branch_common): Use new branch
10890 offset encoding methods to avoid code duplication.
10891 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10892 (Stub_addend_reader::operator()): Use new branch encoding method
10893 to avoid code duplication.
10897 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10898 (Target_arm::do_finalize_sections): Define special EXIDX section
10899 symbols only if referenced.
10900 * gc.h (Garbage_collection::add_reference): New method.
10901 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10906 * script.cc (Version_script_info::build_expression_list_lookup):
10907 Change complaing about duplicate wildcard match from error to
10910 * script.cc (class Lazy_demangler): Recreate--revert part of patch
10912 (Version_script_info::Version_script_info): Initialize globs_,
10913 default_version_, default_is_global_, and exact_. Don't
10914 initialize globals_ or locals_.
10915 (Version_script_info::build_lookup_tables): Build local symbols
10917 (Version_script_info::unquote): New function.
10918 (Version_script_info::add_exact_match): New function.
10919 (Version_script_info::build_expression_list_lookup): Remove lookup
10920 parameter. Add is_global parameter. Change all callers. Handle
10921 wildcard pattern specially. Unquote pattern. Call
10923 (Version_script_info::get_name_to_match): New function.
10924 (Version_script_info::get_symbol_version): New function.
10925 (Version_script_info::get_symbol_version_helper): Remove.
10926 (Version_script_info::check_unmatched_names): Call unquote.
10927 * script.h (class Version_script_info): Change get_symbol_version
10928 to be non-inline and add is_global parameter; change all callers.
10929 Rewrite symbol_is_local. Update declarations. Define struct
10930 Version_tree_match, Exact, Globs. Don't define struct Lookup.
10931 Remove globals_ and locals_ members. Add exact_, globs_,
10932 default_version_, is_global_.
10933 (Version_script_info::Glob): Remove pattern, add expression and
10934 is_global. Update constructor. Change all callers.
10935 * dynobj.cc (Versions::finalize): Mark the version symbol as the
10937 (Versions::symbol_section_contents): If a symbol is undefined, or
10938 defined in a dynamic object, set the version index to
10940 * symtab.cc (Symbol_table::add_from_relobj): Don't call
10942 (Symbol_table::add_from_pluginobj): Likewise.
10943 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10947 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10948 (incremental_dump_LDADD): Add linking option for libintl.
10949 * Makefile.in: Regenerate.
10954 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10956 * testsuite/Makefile.in: Regenerated.
10960 * options.h (DEFINE_var): Use parentheses around argument varname__
10961 in macro body to avoid any unintended subsequent substitutions.
10965 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10966 candidates before doing symbol resolution.
10968 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10969 ODR candidates if only one is weak.
10973 * script.cc (Version_script_info::build_expression_list_lookup):
10974 Don't warn about ambiguous version, just record the ambiguity.
10975 (Version_script_info::get_symbol_version_helper): Give error if
10976 version is ambiguous.
10980 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10981 prev_data_size_ and prev_addralign_. Remove initializer for
10982 deleted data member has_been_changed_.
10983 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10984 to determine if the table is empty.
10985 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10987 (Stub_table::add_reloc_stub): Define method in class definition
10988 instead of just declaring it there.
10989 (Stub_table::add_cortex_a8_stub): New method definition.
10990 (Stub_table::update_data_size_and_addralign): Ditto.
10991 (Stub_table::finalize_stubs): Ditto.
10992 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10993 (Stub_table::do_addralign_): Return address alignment in the
10994 (Stub_table::do_reset_address_and_file_offset): Define method in
10995 class definition instead of declaring it there. Set current data
10996 size to be the data size of the previous pass.
10997 (Stub_table::set_final_data_size): Use current data size as the
10999 (Stub_table::relocate_stub): Change parameter type of stub from
11000 Reloc_stub pointer to Stub pointer.
11001 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11002 (Stub_table::Cortex_a8_stub_list): New typedef.
11003 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11004 Stub_table::prev_addralign_): New data member.
11005 (Arm_relobj::Arm_relobj): Initialize data member
11006 section_has_cortex_a8_workaround_.
11007 (Arm_relobj::section_has_cortex_a8_workaround,
11008 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11010 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11012 (Target_arm::relocate_stub): Change parameter type of stub from
11013 Reloc_stub pointer to Stub pointer.
11014 (Insn_template::size, Insn_template::alignment): Handle
11015 THUMB16_SPECIAL_TYPE.
11016 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11017 Stub_table::update_data_size_and_addralign,
11018 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11020 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11021 (Stub_table::do_write): Ditto.
11022 (Target_arm::do_relax): Adjust code for changes in Stub_table.
11027 * symtab.h (class Symbol): Remove fields is_target_special_ and
11028 has_plt_offset_. Add field is_defined_in_discarded_section_.
11029 (Symbol::is_defined_in_discarded_section): New function.
11030 (Symbol::set_is_defined_in_discarded_section): New function.
11031 (Symbol::has_plt_offset): Rewrite.
11032 (Symbol::set_plt_offset): Verify that new offset is not -1U.
11033 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11034 Don't initialize is_target_special_ or has_plt_offset_.
11035 Initialize is_defined_in_discarded_section_.
11036 (Symbol_table::add_from_relobj): If appropriate, set
11037 is_defined_in_discarded_section.
11038 * resolve.cc (Symbol::override_base_with_special): Don't test
11039 is_target_special_. Change has_plt_offset_ to has_plt_offset().
11040 * target-reloc.h (relocate_section): Do special handling for
11041 symbols defined in discarded sections for global symbols as well
11046 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11047 the SHT_SYMTAB case.
11051 * object.cc (Sized_relobj::do_layout): Don't get confused if
11052 layout_eh_frame returns NULL.
11057 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11058 dynamic symbol table, use the normal symbol table.
11059 (Sized_dynobj::do_read_symbols): Remove assertion about type of
11065 * layout.cc (Layout::include_section): Remove .gnu_debuglink
11070 * version.cc (print_version): Change to "Copyright 2010".
11076 * i386.cc (class Target_i386): Change return type of plt_section
11078 (class Output_data_plt_i386): Add tls_desc_rel_ field.
11079 (Output_data_plt_i386::Output_data_plt_i386): Initialize
11080 tls_desc_rel_ field.
11081 (Output_data_plt_i386::rel_tls_desc): New function.
11082 (Target_i386::rel_tls_desc_section): New function.
11083 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11084 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11085 R_386_TLS_DESC reloc in rel_tls_desc_section.
11086 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11087 Define struct Tlsdesc_info.
11088 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11089 (Target_x86_64::do_reloc_symbol_index): New function.
11090 (Target_x86_64::add_tlsdesc_info): New function.
11091 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11092 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11093 tlsdesc_rel_ field.
11094 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
11096 (Output_data_plt_x86_64::rela_tlsdesc): New function.
11097 (Target_x86_64::rela_tlsdesc_section): New function.
11098 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11100 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11101 (Target_x86_64::do_reloc_addend): New function.
11102 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11103 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11104 declarations. Define TARGET_CODE. Add arg field to u1_ union.
11105 (Output_reloc::type): New function.
11106 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11107 (Output_reloc::is_target_specific): New function.
11108 (Output_reloc::target_arg): New function.
11109 (class Output_reloc) [SHT_RELA]: Add four new constructors for
11110 absolute relocs and target specific relocs.
11111 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11112 add_target_specific.
11113 (class Output_data_reloc) [SHT_RELA]: Likewise.
11114 * output.cc (Output_reloc::Output_reloc): Add four new versions
11115 for absolute relocs and target specific relocs.
11116 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11117 (Output_reloc::get_symbol_index): Likewise.
11118 (Output_reloc::local_section_offset): Check that local_sym_index_
11119 is not TARGET_CODE or 0.
11120 (Output_reloc::symbol_value): Likewise.
11121 (Output_reloc::write) [SHT_RELA]: Call target for target specific
11123 * target.h (class Target): Add reloc_symbol_index and reloc_addend
11124 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
11126 * layout.cc (add_target_dynamic_tags): Use output section for
11127 DT_PLTRELSZ and DT_JMPREL.
11132 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11134 (class Output_data_reloc_generic): Define.
11135 (class Output_data_reloc_base): Change base class to
11136 Output_data_reloc_generic. Change add() method to call
11137 bump_relative_reloc_count for a relative reloc. Remove
11138 sort_relocs_ field.
11139 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11141 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11142 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
11144 * layout.h (class Layout): Update declaration.
11148 * output.h (class Output_data): Add const version of
11149 output_section and do_output_section.
11150 (class Output_section_data): Add const version of
11152 (class Output_section): Likewise.
11153 * layout.cc (Layout::add_target_dynamic_tags): New function.
11154 * layout.h (class Layout): Update declarations.
11155 * arm.cc (Target_arm::do_finalize_sections): Use
11156 add_target_dynamic_tags.
11157 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11158 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11159 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11160 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11165 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11172 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11173 Xindex::read_symtab_xindex.
11177 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11178 (Insn_template::thumb16_bcond_insn): New method declaration.
11179 (Insn_template): Fix spelling.
11180 (Stub::thumb16_special): New method declaration.
11181 (Stub::do_write): Define virtual method which was previously pure
11183 (Stub::do_thumb16_special): New method declaration.
11184 (Stub::do_fixed_endian_write): New template member.
11185 (Reloc_stub::do_write): Remove.
11186 (Reloc_stub::do_fixed_endian_write): Remove.
11187 (Cortex_a8_stub): New class definition.
11188 (Stub_factory::make_cortex_a8_stub): New method definition.
11189 (Stub_factory::Stub_factory): Add missing static storage class
11190 qualifier for elf32_arm_stub_a8_veneer_blx.
11195 * options.h (class General_options): Add --warn-unresolved-symbols
11196 and --error-unresolved-symbols.
11197 * errors.cc (Errors::undefined_symbol): Implement
11198 --warn-unresolved-symbols.
11200 * options.h (class General_options): Add -z text and -z textoff.
11201 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11205 * gc.h (Garbage_collection::Cident_section_map): New typedef.
11206 (Garbage_collection::cident_sections): New function.
11207 (Garbage_collection::add_cident_section): New function.
11208 (Garbage_collection::cident_sections_): New member.
11209 (gc_process_relocs): Add references to sections whose names are C
11211 * gold.h (cident_section_start_prefix): New constant.
11212 (cident_section_stop_prefix): New constant.
11213 (is_cident): New function.
11214 * layout.cc (Layout::define_section_symbols): Replace string constants
11215 with the newly defined constants.
11216 * object.cc (Sized_relobj::do_layout): Track sections whose names are
11218 * testsuite/Makefile.am: Add gc_orphan_section_test.
11219 * testsuite/Makefile.in: Regenerate.
11220 * testsuite/gc_orphan_section_test.cc: New file.
11221 * testsuite/gc_orphan_section_test.sh: New file.
11226 * options.h (class General_options): Add --warn-shared-textrel.
11227 * layout.cc (Layout::finish_dynamic_section): Implement
11228 --warn-shared-textrel.
11231 * options.h (class General_options): Add --warn-multiple-gp.
11235 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11236 $(THREADSLIB) and $(LIBDL).
11237 * Makefile.in: Rebuild.
11242 * options.cc (General_options::parse_section_start): New function.
11243 (General_options::section_start): New function.
11244 (General_options::General_options): Initialize all members.
11245 * options.h: Include <map>
11246 (class General_options): Add --section-start. Add section_starts_
11248 * layout.cc (Layout::attach_allocated_section_to_segment): If
11249 --section-start was used, set the address of the segment. Remove
11250 local sort_sections.
11251 (Layout::relaxation_loop_body): If the address of the load segment
11252 has been set by --section-start, don't use it.
11253 * output.h (Output_segment::update_flags_for_output_section): New
11255 * output.cc (Output_segment::add_output_section): Call
11256 update_flags_for_output_section.
11261 * options.h (class General_options): Add --undefined-version.
11262 * script.cc (struct Version_expression): Add was_matched_by_symbol
11264 (Version_script_info::matched_symbol): New function.
11265 (Version_script_info::get_symbol_version_helper): Call
11267 (Version_script_info::check_unmatched_names): New function.
11268 * script.h (class Version_script_info): Update declarations.
11269 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11271 * options.h (class General_options): Use DEFINE_bool_alias for
11272 allow_multiple_definition.
11273 * resolve.cc (Symbol_table::should_override): Don't test
11274 allow_multiple_definition.
11277 * options.h (class General_options): Add --cref.
11278 * main.cc (main): Print cref table if --cref. Don't close mapfile
11279 until after printing cref table.
11280 * cref.cc: Include "symtab.h".
11281 (class Cref_inputs): Define Cref_table_compare and Cref_table.
11282 (Cref_table_compare::operator()): New function.
11283 (Cref_inputs::gather_cref): New function.
11284 (filecol): New static const.
11285 (Cref_inputs::print_cref): New function.
11286 (Cref::print_cref): New function.
11287 * cref.h: Include <cstdio>.
11288 (class Cref): Update declarations.
11289 * mapfile.h (Mapfile::file): New function.
11290 * object.h (class Object): Define Symbols. Declare virtual
11291 do_get_global_symbols.
11292 (Object::get_global_symbols): New function.
11293 * object.cc (Input_objects::add_object): Pass object to cref_ if
11295 (Input_objects::archive_start): Likewise.
11296 (Input_objects::archive_stop): Likewise.
11297 (Input_objects::print_cref): New function.
11298 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11299 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11301 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11303 * plugin.h (class Sized_pluginobj): Update declarations.
11307 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11308 to is_default_version. Rename insdef to insdefault.
11309 (Symbol_table::add_from_relobj): Rename def to is_default_version
11310 and local to is_forced_local.
11311 (Symbol_table::add_from_pluginobj): Likewise.
11312 (Symbol_table::add_from_dynobj): Likewise.
11313 (Symbol_table::define_special_symbol): Rename insdef to
11319 * options.h (class General_options): Add
11320 --allow-multiple-definition and -z muldefs.
11321 * resolve.cc (Symbol_table::should_override): Don't warn about a
11322 multiple symbol definition if --allow-multiple-definition or -z
11326 * options.h (class General_options): Add --add-needed and
11327 --copy-dt-needed-entries. Tweak --as-needed help entry.
11328 * object.cc (Input_objects::check_dynamic_dependencies): Give an
11329 error if --copy-dt-needed-entries aka --add-needed is used and
11330 would cause a change in behaviour.
11333 * options.h (class General_options): Add -G as a short version of
11334 --shared. Add no-op options -assert, -g, and -i.
11338 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11339 check for .text or .gnu.linkonce.t sections.
11340 * icf.cc (Icf::find_identical_sections): Ditto.
11341 Change the detection for mangled function name within the section
11343 * icf.h (is_section_foldable_candidate): New function.
11348 * options.h (class General_options): Permit two dashes with
11349 --retain-symbols-file.
11354 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11355 don't put the file header and segment headers in the text
11359 * common.cc (Sort_commons::operator()): Stabilize sort when both
11361 (Symbol_table::do_allocate_commons_list): When allocating common
11362 symbols, skip a symbol which is no longer common.
11363 * symtab.h (Symbol::is_common): Test whether the symbol comes from
11364 an object before checking its type.
11365 * testsuite/common_test_2.c: New file.
11366 * testsuite/common_test_3.c: New file.
11367 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11368 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11369 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11370 (common_test_2_pic.o, common_test_2.so): New targets.
11371 (common_test_3_pic.o, common_test_3.so): New targets.
11372 * testsuite/Makefile.in: Rebuild.
11375 * script.cc (read_input_script): If we see a new SECTIONS clause,
11376 and we have added an input section, give an error.
11377 * layout.h (class Layout): Add have_added_input_section function.
11378 Add have_added_input_section_ field.
11379 * layout.cc (Layout::Layout): Initialize
11380 have_added_input_section_.
11381 (Layout::layout): Set have_added_input_section_.
11382 (Layout::layout_eh_frame): Likewise.
11387 * options.h (class General_options): Add --sort-common option.
11388 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11389 * common.cc (Sort_common): Add sort_order parameter to
11390 constructor. Add sort_order_ field.
11391 (Sort_commons::operator): Check sort_order_.
11392 (Symbol_table::allocate_commons): Determine the sort order.
11393 (Symbol_table::do_allocate_commons): Add sort_order parameter.
11394 Change all callers.
11395 (Symbol_table::do_allocate_commons_list): Likewise.
11400 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11401 symbols from this object, don't change the visibility of an
11403 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11408 * script.h (class Version_script_info): Define Language enum.
11409 Update declarations. Define Glob, Exact, and Lookup types. Add
11410 new fields globals_, locals_, and is_finalized_.
11411 * script.cc: Various formatting fixes.
11412 (class Parser_closure): Change language_stack_ from a vector of
11413 std::string to one of Version_script_info::Language. Adjust all
11415 (class Lazy_demangler): Remove.
11416 (struct Version_expression): Change language from std::string to
11417 Version_script_info::Language.
11418 (Version_script_info::Version_script_info): New function.
11419 (Version_script_info::~Version_script_info): Don't call clear.
11420 (Version_script_info::finalize): New function.
11421 (Version_script_info::build_lookup_tables): New function.
11422 (Version_script_info::build_expression_list_lookup): New
11424 (Version_script_info::get_symbol_version_helper): Rewrite to use
11426 (Version_script_info::print_expression_list): Adjust to use
11427 Version_script_info::Language.
11428 (script_push_lex_into_version_mode): Check that the version script
11429 has not been finalized.
11430 (version_script_push_lang): Change language string to
11431 Version_script_info::Language.
11432 * options.cc (Command_line::version_script): New function.
11433 * options.h (class General_options): Add finalize_dynamic_list
11434 function. Change version_script from declaration to definition.
11435 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11436 * testsuite/version_script.map: Remove duplicate def of foo.
11437 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11438 version_script.map.
11439 * testsuite/Makefile.in: Rebuild.
11444 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11445 if the input symbol index is 0, make the output symbol index 0.
11450 * options.h (class General_options): Add -x/--discard-all.
11451 * object.cc (Sized_relobj::do_count_local_symbols): Handle
11452 --discard-all. If the local symbol needs a dynamic entry, check
11453 that before handling --discard-locals.
11458 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11460 (Output_segment::add_output_section): Don't change the flags if
11461 the type is PT_TLS.
11464 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11465 GNU hash table if they need a dynamic value. Otherwise, don't add
11466 them if they are defined in a dynamic object or are forced local.
11471 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11472 .gnu.hash table for a 32-bit target.
11475 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11476 regular and a dynamic object only needs a dynamic symbol table
11477 entry if it is externally visible.
11480 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11481 constructor. Add global_offset_table_ field.
11482 (Target_i386::got_section): Set global_offset_table_.
11483 (Target_i386::do_finalize_sections): Set global_offset_table_
11485 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11486 in constructor. Add global_offset_table_ field.
11487 (Target_x86_64::got_section): Set global_offset_table_.
11488 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11491 * layout.cc (Layout::Layout): Initialize increase_relro_.
11492 (Layout::get_output_section): Add is_relro, is_last_relro, and
11493 is_first_non_relro parameters. Change all callers.
11494 (Layout::choose_output_section): Likewise.
11495 (Layout::add_output_section_data): Likewise.
11496 (Layout::make_output_section): Likewise.
11497 (Layout::set_segment_offsets): Clear increase_relro when using a
11499 * layout.h (class Layout): Add increase_relro method. Add
11500 increase_relro_ field. Update declarations.
11501 * output.cc (Output_section::Output_section): Initialize
11502 is_last_relro_ and is_first_non_relro_.
11503 (Output_segment::add_output_section): Group relro sections is
11504 do_sort is true. Handle is_last_relro and is_first_non_relro.
11505 (Output_segment::maximum_alignment): Remove relro handling.
11506 (Output_segment::set_section_addresses): Add increase_relro
11507 parameter. Change all callers. Add initial alignment to align
11508 relro sections on separate page. Remove old relro handling.
11509 (Output_segment::set_section_list_addresses): Remove in_relro
11510 parameter. Change all callers.
11511 (Output_segment::set_offset): Add increase parameter. Change all
11512 callers. Remove old relro handling.
11513 * output.h (class Output_section): Add new methods: is_last_relro,
11514 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11515 Add is_last_relro_ and is_first_non_relro_ fields.
11516 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11517 Create separate .got.plt section. Call increase_relro.
11518 * x86_64.cc (Target_x86_64::got_section): Likewise.
11519 * testsuite/relro_script_test.t: Add .got.plt.
11522 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11523 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11524 (Layout::finalize): Call set_dynamic_symbol_size.
11525 (Layout::set_dynamic_symbol_size): New function.
11526 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11527 set_dynamic_symbol_size.
11530 * output.h (class Output_section): Add is_entsize_zero_ field.
11531 * output.cc (Output_section::Output_section): Initialize
11533 (Output_section::set_entsize): If two different entsizes are
11534 requested, force it to zero.
11535 (Output_section::add_input_section): Set flags for .debug_str
11536 before updating section flags. Set entsize.
11537 (Output_section::update_flags_for_input_section): Set SHF_MERGE
11538 and SHF_STRING if all input sections have those flags.
11542 * main.cc (main): Fix the sys time reporting.
11543 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11548 * options.cc (General_options::parse_version): Allow -v to exit
11549 without an error if there is nothing to link.
11553 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11554 using a version of gcc before 4.1.
11555 * configure: Rebuild.
11559 * attributes.cc (Output_attributes_section_data::do_write): Use
11560 std::vector::front rather than std::vector::data.
11564 * symtab.h (class Symbol_table): Add enum Defined.
11565 * resolve.cc (Symbol_table::should_override): Add defined
11566 parameter. Change all callers. Test whether object is NULL
11567 before calling a method on it.
11568 (Symbol_table::report_resolve_problem): Add defined parameter.
11569 Change all callers.
11570 (Symbol_table::should_override_with_special): Likewise.
11571 * symtab.cc (Symbol_table::define_in_output_data): Add defined
11572 parameter. Change all callers.
11573 (Symbol_table::do_define_in_output_data): Likewise.
11574 (Symbol_table::define_in_output_segment): Likewise.
11575 (Symbol_table::do_define_in_output_segment): Likewise.
11576 (Symbol_table::define_as_constant): Likewise.
11577 (Symbol_table::do_define_as_constant): Likewise.
11578 * script.h (class Symbol_assignment): Add is_defsym parameter to
11579 constructor; change all callers.
11580 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11581 parameter. Change all callers. Add is_defsym_ field.
11582 (class Parser_closure): Add parsing_defsym parameter to
11583 constructor; change all callers. Add parsing_defsym accessor
11584 function. Add parsing_defsym_ field.
11588 * gold.cc (queue_middle_tasks): Fix formatting.
11589 * object.cc (Relobj::is_section_name_included): Likewise.
11593 * i386.cc (Target_i386::do_calls_non_split): Recognize
11594 -fsplit-stack prologue for a function with a static chain.
11595 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11596 -fsplit-stack prologue when using %r11.
11600 * options.cc (General_options::parse_version): Make -v continue and do
11601 the link like GNU ld does.
11605 * Makefile.am (CCFILES): Add timer.cc.
11606 (HFILES): Add timer.h.
11607 * configure.ac: Check for sysconf and times.
11608 * main.cc: include timer.h.
11609 (main): Use Timer instead of get_run_time.
11612 * workqueue.cc: include timer.h.
11613 (Workqueue::find_and_run_task):
11614 Report user, sys and wall time.
11615 * Makefile.in: Regenerate.
11616 * config.in: Regenerate.
11617 * configure: Regenerate.
11621 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11623 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11624 relaxed input sections.
11625 * output.cc (Output_section::find_relaxed_input_section): Change
11626 return type to Output_relaxed_input_section pointer. Adjust code
11627 for new type of relaxed_input_section_map_.
11628 * output.h (Output_section::find_relaxed_input_section): Change
11629 return type to Output_relaxed_input_section pointer.
11630 (Output_section::Output_relaxed_input_section_by_input_section_map):
11632 (Output_section::relaxed_input_section_map_): Change type to
11633 Output_section::Output_relaxed_input_section_by_input_section_map.
11634 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11639 * layout.cc (Layout::create_shstrtab): Only write out after input
11640 sections if we are compressing debug sections.
11644 * archive.cc (Archive::add_symbols): Only look up a symbol without
11645 a version if there is, in fact, a version.
11649 Revert -Wshadow changes, all changes from:
11652 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11656 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11658 * attributes.cc (Object_attribute::size): Ditto.
11659 (Attributes_section_data::size): Ditto.
11660 (Attributes_section_data::Attributes_section_data): Ditto.
11661 (Output_attributes_section_data::do_write): Ditto.
11662 * attributes.h (Object_attribute::set_type): Ditto.
11663 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11667 * archive.cc: Fix shadowed variable warnings.
11668 * arm.cc: Likewise.
11669 * compressed_output.cc: Likewise.
11670 * compressed_output.h: Likewise.
11671 * configure: Likewise.
11672 * dwarf_reader.cc: Likewise.
11673 * dynobj.cc: Likewise.
11674 * dynobj.h: Likewise.
11675 * ehframe.cc: Likewise.
11676 * ehframe.h: Likewise.
11677 * errors.cc: Likewise.
11678 * expression.cc: Likewise.
11679 * fileread.cc: Likewise.
11680 * fileread.h: Likewise.
11681 * freebsd.h: Likewise.
11682 * i386.cc: Likewise.
11683 * icf.cc: Likewise.
11684 * incremental.h: Likewise.
11685 * layout.cc: Likewise.
11686 * layout.h: Likewise.
11687 * mapfile.cc: Likewise.
11688 * merge.cc: Likewise.
11689 * merge.h: Likewise.
11690 * object.cc: Likewise.
11691 * object.h: Likewise.
11692 * options.h: Likewise.
11693 * output.cc: Likewise.
11694 * output.h: Likewise.
11695 * parameters.cc: Likewise.
11696 * plugin.cc: Likewise.
11697 * powerpc.cc: Likewise.
11698 * reduced_debug_output.cc: Likewise.
11699 * reduced_debug_output.h: Likewise.
11700 * reloc.cc: Likewise.
11701 * reloc.h: Likewise.
11702 * resolve.cc: Likewise.
11703 * script-sections.cc: Likewise.
11704 * script.cc: Likewise.
11705 * script.h: Likewise.
11706 * sparc.cc: Likewise.
11707 * symtab.cc: Likewise.
11708 * symtab.h: Likewise.
11709 * target-select.cc: Likewise.
11710 * target-select.h: Likewise.
11711 * token.h: Likewise.
11712 * workqueue.cc: Likewise.
11713 * workqueue.h: Likewise.
11714 * x86_64.cc: Likewise.
11718 * arm.cc (attributes.h): New include.
11719 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11720 (Arm_relobj::~Arm_relobj): Delete object pointed by
11721 attributes_section_data_.
11722 (Arm_relobj::attributes_section_data): New method definition.
11723 (Arm_relobj::attributes_section_data_): New data member declaration.
11724 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11725 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11726 attributes_section_data_.
11727 (Arm_dynobj::attributes_section_data): New method definition.
11728 (Arm_dynobj::attributes_section_data_): New data member declaration.
11729 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
11730 initialization value of may_use_blx_ to false.
11731 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11732 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11733 object attributes to compute results instead of hard-coding.
11734 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11735 Target_arm::get_secondary_compatible_arch,
11736 Target_arm::set_secondary_compatible_arch
11737 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11738 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11739 New method declarations.
11740 (Target_arm::get_aeabi_object_attribute): New method definition.
11741 (Target_arm::attributes_section_data_): New data member declaration.
11742 (read_arm_attributes_section): New template definition.
11743 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11744 (Arm_dynobj::do_read_symbols): Ditto.
11745 (Target_arm::do_finalize_sections): Merge attributes sections from
11746 input. Check for BLX use after attributes section merging.
11747 Fix __exidx_start and __exidx_end visibility. Create an
11748 .ARM.attributes section if necessary.
11749 (Target_arm::get_secondary_compatible_arch,
11750 Target_arm::set_secondary_compatible_arch,
11751 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11752 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11753 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11754 New method definitions.
11758 * plugin.cc (Plugin::load): Don't cast from void* to a function
11763 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11764 information fields.
11768 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11769 Replace two_file_shared_1.so with two_file_shared_2.so.
11770 * testsuite/Makefile.in: Regenerated.
11774 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11775 (HFILES): Add attributes.h and int_encoding.h.
11776 * Makefile.in: Regenerate.
11777 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11778 function definitions to int_encoding.cc
11779 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11780 prototypes to int_encoding.h
11781 * reduced_debug_output.cc (int_encoding.h): New include.
11782 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11783 function definitions to int_encoding.cc
11784 (insert_into_vector, read_from_pointer): Move template definitions to
11786 * attributes.cc: New file.
11787 * attributes.h: New file.
11788 * int_encoding.cc: New file.
11789 * int_encoding.h: New file.
11794 * incremental-dump.cc (dump_incremental_inputs): New.
11795 (main): Use dump_incremental_inputs.
11800 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11801 checking elfcpp::STT_FUNC.
11802 (Target_i386::Relocate::relocate): Likewise.
11803 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11805 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11806 symbols from shared libraries into normal FUNC symbols.
11808 * symtab.h (Symbol): Add is_func and use it.
11812 * arm.cc (Target_arm::arm_info): Initialize new fields
11813 attributes_section and attributes_vendor.
11814 * i386.cc (Target_i386::i386_info): Same.
11815 * object.cc (Sized_relobj::do_layout): Skip attribute section.
11816 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11817 fields attributes_section and attributes_vendor.
11818 * sparc.cc (Target_sparc::sparc_info): Same.
11819 * target.h (Target::attributes_section, Target::attributes_vendor,
11820 Target::is_attributes_section, Target::attribute_arg_type,
11821 Target::attributes_order): New method definitions.
11822 (Target::Target_info::attributes_section,
11823 Target::Target_info::attributes_vendor): New fields.
11824 (Target::do_attribute_arg_type, Target::do_attributes_order): New
11825 virtual method definitions.
11826 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11827 attributes_section and attributes_vendor.
11828 * testsuite/testfile.cc (Target_test::test_target_info): Same.
11832 * arm.cc: Update comments about interworking and stub generation.
11833 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11834 considered as non-PIC.
11835 (Arm_relocate_functions::base_abs): Fix formatting.
11836 (Arm_relocate_functions::got_prel): Fix comment. Change interface
11837 of function to use GOT entry address instead of offset.
11838 (Target_arm::Scan::global): Issue an error if a symbol would need a
11839 PLT does not get one because it is untyped. Remove code to create
11840 dynamic symbols for relative branches.
11841 (Target_arm::Relocate::relocate: Use 0 instead of false since function
11842 takes unsigned integer instead of boolean.
11846 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11847 (two_file_test_LDADD): Likewise.
11848 (common_test_1_LDADD): Likewise.
11849 (exception_test_LDADD) Likewise.
11850 (weak_test_LDADD): Likewise.
11851 (many_sections_test_LDADD): Likewise.
11852 (initpri1_LDADD): Likewise.
11853 (script_test_1_LDADD): Likewise.
11854 (script_test_2_LDADD): Likewise.
11855 (justsyms_LDADD): Likewise.
11856 (binary_test_LDADD): Likewise.
11857 (large_LDADD): Likewise.
11858 * testsuite/Makefile.in: Regenerated.
11862 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11863 (Symbol_table::override_with_special): Likewise.
11864 (Symbol_table::add_from_object): Likewise.
11868 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11869 Don't set the data_offset twice.
11873 * testsuite/Makefile.in: Regenerate.
11877 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11878 (Target_arm::do_finalize_sections): Add parameter for symbol table
11879 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
11880 * i386.cc (Target_i386::do_finalize_sections): Add an additional
11881 parameter for symbol table pointer.
11882 * layout.cc (Layout::finalize): Call Target::finalize_sections with
11883 an additional parameter for a pointer to symbol table.
11884 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11885 parameter for a symbol table pointer.
11886 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11887 * target.h (Target::finalize_sections, Target::do_finalize_sections):
11889 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11890 parameter for a symbol table pointer.
11894 * incremental.cc (Incremental_inputs_header)
11895 (Incremental_inputs_header_write, Incremental_inputs_entry)
11896 (Incremental_inputs_entry_write): Move ...
11897 * incremental.h (Incremental_inputs_header)
11898 (Incremental_inputs_header_write, Incremental_inputs_entry)
11899 (Incremental_inputs_entry_write): here.
11903 * incremental.cc (make_sized_incremental_binary): Set the target.
11904 Error if it is incompatible.
11905 * output.h (Output_file): Add filename method.
11909 * incremental.cc (Incremental_inputs_entry): Remove unused argument
11910 from the get_* methods.
11914 * incremental-dump.cc (main): Check that the offeset of a script is 0.
11915 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11916 Write 0 for the data_offset of scripts.
11920 * testsuite/Makefile.am: Add the incremental_test.sh test.
11921 * testsuite/incremental_test.sh: New.
11922 * testsuite/incremental_test_1.c: New.
11923 * testsuite/incremental_test_2.c: New.
11927 * incremental-dump.cc (main): Fix typos.
11932 * incremental-dump.cc (main): Use llu to print 64 bit values.
11937 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11939 (incremental_dump_LDADD): Likewise.
11940 * Makefile.in: Regenerated.
11948 * arm.cc (Target_arm::Target_arm): Move method definition
11949 outside of class definition. Add code to handle
11950 --target1-rel, --target1-abs and --target2= options.
11951 (Target_arm::get_reloc_reloc_type): Change method to be
11952 non-static and const.
11953 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11954 New data member declaration.
11955 (Target_arm::Scan::local, Target_arm::Scan::global,
11956 Target_arm::Relocate::relocate,
11957 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11958 Adjust call to Target_arm::get_real_reloc_type.
11959 (Target_arm::get_real_reloc_type): Use command line options
11960 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11961 * options.h (--target1-rel, --target1-abs, --target2): New
11966 * arm.cc (Target_arm::Target_arm): Move method definition outside of
11967 class definition. Add code to handle --target1-rel, --target1-abs
11968 and --target2= options.
11969 (Target_arm::get_reloc_reloc_type): Change method to be non-static
11971 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11972 member declaration.
11973 (Target_arm::Scan::local, Target_arm::Scan::global,
11974 Target_arm::Relocate::relocate,
11975 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11976 call to Target_arm::get_real_reloc_type.
11977 (Target_arm::get_real_reloc_type): Use command line options to
11978 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11979 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11984 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11985 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11986 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11988 (Arm_relocate_functions::thm_call): Replace body with a call to
11989 Arm_relocate_functions::thumb_branch_common.
11990 (Arm_relocate_functions::thm_jump24,
11991 Arm_relocate_functions::thm_xpc22): New method definitions.
11992 (Arm_relocate_functions::thumb_branch_common): New method definition.
11993 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11995 (Target_arm::Relocate::relocate): Adjust call to thm_call.
11996 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12000 * Makefile.am: Build incremental-dump
12001 * Makefile.in: Regenerate.
12002 * incremental-dump.cc: New.
12003 * incremental.cc (Incremental_inputs_header_data,
12004 Incremental_inputs_entry_data): Move to incremental.h
12005 * incremental.h: (Incremental_inputs_header_data,
12006 Incremental_inputs_entry_data): Move from incremental.cc
12010 * incremental.cc (Incremental_inputs_header,
12011 Incremental_inputs_header_write, Incremental_inputs_entry,
12012 Incremental_inputs_entry_write): Add a typedef with the data type.
12016 * incremental.cc (Incremental_inputs_header,
12017 Incremental_inputs_header_write, Incremental_inputs_entry,
12018 Incremental_inputs_entry_write): Update comment about which
12019 type has the filed descriptions.
12023 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12024 (Arm_relocate_functions::arm_branch_common): Change method defintion
12025 in class definition to a method declaration and update list of formal
12027 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12028 Arm_relocation_functions::jump24): Adjust call to
12029 Arm_relocate_functions::arm_branch_common. Update list of formal
12031 (Arm_relocate_functions::xpc25): New method definition.
12032 (Arm_relocate_functions::arm_branch_common): Move method defintion
12033 out from class definition. Use stubs for mode-switching and extending
12035 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12036 specially. Change code to enable use of stubs in ARM branches.
12040 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12041 in method declaration.
12042 (Target_arm::relocate_stub): New method declaration.
12043 (Target_arm::default_target): Change to return a pointer instead of
12045 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12046 Target_arm::default_target.
12047 (Arm_Relobj::do_relocate_sections): Remove options paramater in
12049 (Target_arm::relocate_section): Adjust view.
12050 (Target_arm::relocate_stub): New method definition.
12054 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12056 * incremental.cc (open_incremental_binary): Initialized local
12057 variables to avoid warnings.
12058 * object.cc (make_elf_object): Ditto.
12059 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12065 * testsuite/plugin_test.c: Include "config.h".
12069 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12070 (arm_symbol_value): Remove.
12071 (Arm_relocate_functions::arm_branch_common,
12072 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12073 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12074 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12075 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12076 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12077 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12078 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12079 Arm_relocate_functions::thm_mobw_abs_nc,
12080 Arm_relocate_functions::thm_mov_abs,
12081 Arm_relocate_functions::movw_prel_nc,
12082 Arm_relocate_functions::thm_movt_abs,
12083 Arm_relocate_functions::movt_prel,
12084 Arm_relocate_functions::thm_movw_prel_nc,
12085 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12086 (Target_arm::Relocate::relocate): Only decompose address into two
12087 parts if relocation type uses the thumb-bit and pass the actual
12088 bit instead of a flag indicating that the thumb-bit is used. Adjust
12089 calls to methods in Arm_relocate_functions for this change.
12094 * reloc.cc: Instantiate
12095 Sized_relobj::initialize_input_to_output_maps and
12096 Sized_relobj:free_input_to_output_maps.
12101 * defstd.cc (in_segment): Set only_if_ref true for "end".
12105 * arm.cc (class Reloc_stub): Correct a comment.
12106 (Target_arm::Target_arm): Initialize arm_input_section_map_.
12107 (Target_arm::scan_section_for_stubs): New method declaration.
12108 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12109 Change methods from private to protected.
12110 (Target_arm::do_may_relax): New method definition.
12111 (Target_arm::do_relax, Target_arm::group_sections,
12112 Target_arm::scan_reloc_for_stub,
12113 Target_arm::scan_reloc_section_for_stubs): New method declarations.
12114 (Target_arm::arm_input_section_map_): New data member declaration.
12115 (Target_arm::scan_reloc_for_stub,
12116 Target_arm::scan_reloc_section_for_stubs,
12117 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12118 Target_arm::do_relax): New method definitions.
12122 * configure.ac: Check for (struct stat)::st_mtim
12123 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12124 * config.in: Regenerate.
12125 * configure: Regenerate.
12130 * output.cc (Output_segment::add_output_section): Add missing
12136 * object.h (class Object): Add is_needed and set_is_needed
12137 methods. Add is_needed_ field. Make bool fields into bitfields.
12138 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12139 defined in a dynamic object and referenced by a regular object,
12140 set is_needed for the dynamic object.
12141 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12142 if the file is marked with as_needed and it is not needed.
12147 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12148 tags if data is discarded by linker script.
12149 * i386.cc (Target_i386::do_finalize_sections): Likewise.
12150 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12151 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12152 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12156 * layout.cc (Layout::get_output_section): Add is_interp and
12157 is_dynamic_linker_section parameters. Change all callers.
12158 (Layout::choose_output_section): Likewise.
12159 (Layout::make_output_section): Likewise.
12160 (Layout::add_output_section_data): Add is_dynamic_linker_section
12161 parameter. Change all callers.
12162 * layout.h (class Layout): Update declarations.
12163 * output.h (class Output_section): Add is_interp, set_is_interp,
12164 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12165 Add is_interp_, is_dynamic_linker_section_ fields. Change
12166 generate_code_fills_at_write_ to a bitfield.
12167 * output.cc (Output_section::Output_sections): Initialize new
12169 (Output_segment::add_output_section): Add do_sort parameter.
12170 Change all callers.
12175 * options.h (class General_options): Add --warn-common.
12176 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12177 merging two common symbols.
12178 (Symbol_table::should_override): Handle --warn-common when merging
12179 a common symbol with a defined symbol. Use report_resolve_problem
12180 for multiple definitions.
12181 (Symbol_table::report_resolve_problem): New function.
12182 * symtab.h (class Symbol_table): Declare report_resolve_problem.
12186 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12188 (Target_arm::stub_factory): New method definition.
12189 (Target_arm::new_arm_input_section,
12190 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12191 Target_arm::reloc_uses_thumb_bit): New method declarations.
12192 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12193 New type definitions.
12194 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12195 member declarations.
12196 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12197 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12198 New method definitions.
12202 * options.h (class General_options): Add --warn_constructors.
12207 * defstd.cc (in_section): Add entries for __rel_iplt_start,
12208 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12213 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12214 --msgid-bugs-address.
12215 (install-pdf): New target.
12216 (install-data_yes): Look up one directory to find mkinstalldirs.
12220 * po/Make-in (.po.gmo): Don't generate .gmo files in source
12225 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12229 * arm.cc (Stub_addend_reader): New struct template definition
12230 and partial specializations.
12231 (Stub_addend_reader::operator()): New method definition for a
12232 partially specialized template.
12236 * arm.cc (Arm_relobj::processor_specific_flags): New method
12238 (Arm_relobj::do_read_symbols): New method declaration.
12239 (Arm_relobj::processor_specific_flags_): New data member declaration.
12240 (Arm_dynobj): New class definition.
12241 (Target_arm::do_finalize_sections): Add input_objects parameter.
12242 (Target_arm::do_adjust_elf_header): New method declaration.
12243 (Target_arm::are_eabi_versions_compatible,
12244 (Target_arm::merge_processor_specific_flags): New method declaration.
12245 (Target_arm::do_make_elf_object): New overloaded method definitions
12247 (Arm_relobj::do_read_symbols): New method definition.
12248 (Arm_dynobj::do_read_symbols): Ditto.
12249 (Target_arm::do_finalize_sections): Add input_objects parameters.
12250 Merge processor-specific flags from all input objects.
12251 (Target_arm::are_eabi_versions_compatible,
12252 Target_arm::merge_processor_specific_flags,
12253 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12254 New method definitions.
12255 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12256 Input_objects pointer type parameter.
12257 * layout.cc (Layout::finalize): Pass input objects to target's.
12258 finalize_sections function.
12259 * output.cc (Output_file_header::do_sized_write): Set ELF file
12260 header's processor-specific flags.
12261 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12262 Input_objects pointer type parameter.
12263 * sparc.cc (Target_sparc::do_finalize_sections): Same.
12264 * target.h (Input_objects): New forward class declaration.
12265 (Target::processor_specific_flags,
12266 Target::are_processor_specific_flags_sect): New method definitions.
12267 (Target::finalize_sections): Add input_objects parameter.
12268 (Target::Target): Initialize processor_specific_flags_ and
12269 are_processor_specific_flags_set_.
12270 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12272 (Target::set_processor_specific_flags): New method definition.
12273 (Target::processor_specific_flags_,
12274 Target::are_processor_specific_flags_set_): New data member
12276 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12277 Input_objects pointer type parameter.
12281 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12285 * object.h (class Relobj): Drop options parameter from
12286 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12287 do_scan_relocs, do_relocate. Change all callers.
12288 (class Sized_relobj): Drop options parameters from
12289 do_gc_process_relocs, do_scan_relocs, do_relocate,
12290 do_relocate_sections, relocate_sections, emit_relocs_scan,
12291 emit_relocs_scan_reltype. Change all callers.
12292 (struct Relocate_info): Remove options field and all references to
12294 * reloc.h (class Read_relocs): Remove options constructor
12295 parameter and options_ field. Change all callers.
12296 (class Gc_process_relocs, class Scan_relocs): Likewise.
12297 (class Relocate_task): Likewise.
12298 * target-reloc.h (scan_relocs): Remove options parameter. Change
12300 (scan_relocatable_relocs): Likewise.
12301 * target.h (class Sized_target): Remove options parameter from
12302 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
12304 * gc.h (gc_process_relocs): Remove options parameter. Change all
12306 * arm.cc: Update functions to remove options parameters.
12307 * i386.cc: Likewise.
12308 * powerpc.cc: Likewise.
12309 * sparc.cc: Likewise.
12310 * x86_64.cc: Likewise.
12311 * testsuite/testfile.cc: Likewise.
12315 * arm.cc (Arm_relobj): New class definition.
12316 (Arm_relobj::scan_sections_for_stubs,
12317 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12318 New method definitions.
12322 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12323 (Plugin::cleanup_done_): New member.
12324 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12325 (Plugin_manager::cleanup_done_): Remove.
12326 (Plugin_manager::add_input_file): Edit error message.
12327 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12328 (Plugin_manager::cleanup): Remove use of cleanup_done_.
12332 * fileread.cc: (File_read::View::~View): Use the new
12333 data_ownership_ filed.
12334 (File_read::~File_read): Dispose the new whole_file_view_.
12335 (File_read::open): Mmap the whole file if needed.
12336 (File_read::open): Use whole_file_view_ instead of contents_.
12337 (File_read::find_view): Use whole_file_view_ if applicable.
12338 (File_read::do_read): Use whole_file_view_ instead of contents_.
12339 (File_read::make_view): Use whole_file_view_ instead of contents_,
12340 update File_read::View::View call.
12341 (File_read::find_or_make_view): Update File_read::View::View
12343 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12345 (File_read::View::Data_ownership): New enum.
12346 (File_read::View::View): Replace bool mapped_ with Data_ownership
12348 (File_read::View::mapped_): Remove (replaced by data_ownership_).
12349 (File_read::View::data_ownership_): New field.
12350 (File_read::contents_): Remove (replaced by whole_file_view_).
12351 (File_read::whole_file_view_): New field.
12352 * options.h (class General_options): Add --keep-files-mapped.
12356 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12357 * testsuite/Makefile.am (plugin_test_5): New test case.
12358 * testsuite/Makefile.in: Regenerate.
12362 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12363 from private to protected to allow access by child class.
12364 (Sized_relobj::do_relocate_sections): New method declaration.
12365 (Sized_relobj::relocate_sections): Virtualize.
12366 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12367 Sized_relobj::relocate_sections. Instantiate template explicitly
12368 for different target sizes and endianity.
12372 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12373 (Arm_input_section::as_arm_input_section): New method.
12374 (Arm_output_section): New class definition.
12375 (Arm_output_section::create_stub_group,
12376 Arm_output_section::group_sections): New method definitions.
12380 * arm.cc (Arm_input_section): New class definition.
12381 (Arm_input_section::init, Arm_input_section:do_write,
12382 Arm_input_section::set_final_data_size,
12383 Arm_input_section::do_reset_address_and_file_offset): New method
12388 * arm.cc (Stub_table, Arm_input_section): New forward class
12390 (Stub_table): New class defintion.
12391 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12392 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12393 New method definition.
12397 * arm.cc: Update copyright comments.
12398 (Target_arm): New forward class template declaration.
12399 (Arm_address): New type.
12400 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12401 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12402 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12404 (Insn_template): Same.
12405 (DEF_STUBS): New macro.
12406 (Stub_type): New enum type.
12407 (Stub_template): New class definition.
12409 (Reloc_stub): Same.
12410 (Stub_factory): Same.
12411 (Target_arm::Target_arm): Initialize may_use_blx_ and
12412 should_force_pic_veneer_.
12413 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12414 Target_arm::should_force_pic_veneer,
12415 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12416 Target_arm::using_thumb_only, Target_arm:;default_target): New
12418 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12419 New data member declarations.
12420 (Insn_template::size, Insn_template::alignment): New method defintions.
12421 (Stub_template::Stub_template): New method definition.
12422 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12423 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12424 (Stub_factory::Stub_factory): New method definition.
12425 * gold.h (string_hash): New template.
12426 * output.h (Input_section_specifier::hash_value): Use
12428 (Input_section_specifier::string_hash): Remove.
12429 * stringpool.cc (Stringpool_template::string_hash): Use
12434 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12435 symbols of relaxed input sections.
12436 * output.h (Output_section::find_relaxed_input_section): Make
12441 * dynobj.cc (Versions::Versions): Initialize version_script_.
12442 Only insert base version symbol definition for a shared object
12443 if version script defines any version versions.
12444 (Versions::define_base_version): New method definition.
12445 (Versions::add_def): Check that base version is not needed.
12446 (Versions::add_need): Define base version lazily.
12447 * dynobj.h (Versions::define_base_version): New method declaration.
12448 (Versions::needs_base_version_): New data member declaration.
12449 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12450 (check_DATA): Add no_version_test.stdout.
12451 (libno_version_test.so, no_version_test.o no_version_test.stdout):
12453 * testsuite/Makefile.in: Regenerate.
12454 * testsuite/no_version_test.c: New file.
12455 * testsuite/no_version_test.sh: Ditto.
12459 * expression.cc (class Segment_start_expression): New class definition.
12460 (Segment_start_expression::value): New method definition.
12461 (script_exp_function_segment_start): Return a new
12462 Segment_start_expression.
12463 * gold/script-c.h (script_saw_segment_start_expression): New function
12465 * script-sections.cc (Script_sections::Script_sections): Initialize
12466 SAW_SEGMENT_START_EXPRESSION_ to false.
12467 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12468 and -Tbbs options to specify section addresses if given in
12469 command line and no SEGMENT_START expression is seen in a script.
12470 * script-sections.h (Script_sections::saw_segment_start_expression,
12471 Script_sections::set_saw_segment_start_expression): New method
12473 (Script_sections::saw_segment_start_expression_): New data member
12475 * script.cc (script_saw_segment_start_expression): New function.
12476 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12477 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12478 script_test_7.sh and script_test_8.sh.
12479 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12480 script_test_8.stdout.
12481 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12482 (script_test_6, script_test_6.stdout, script_test_7,
12483 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12484 * Makefile.in: Regenerate.
12485 * testsuite/script_test_6.sh: New file.
12486 * testsuite/script_test_6.t: Same.
12487 * testsuite/script_test_7.sh: Same.
12488 * testsuite/script_test_7.t: Same.
12489 * testsuite/script_test_8.sh: Same.
12493 * output.cc (Output_segment::set_section_list_address): Cast
12494 expressions to unsigned long long type to avoid format warnings.
12498 * script.cc (Script_options::add_symbol_assignment): Always add a
12499 dot assignment to script_sections_.
12500 * script-sections.cc (Script_sections::add_dot_assignment):
12501 Initialize if necessary.
12503 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12504 program headers with no load segment if there is a linker script.
12506 * layout.cc (Layout::set_segment_offsets): Align the file offset
12507 to the segment aligment for -N or -n with no load segment.
12508 * output.cc (Output_segment::add_output_section): Don't crash if
12509 the first section is a TLS section.
12510 (Output_segment::set_section_list_addresses): Print an error
12511 message if the address moves backward in a linker script.
12512 * script-sections.cc
12513 (Output_section_element_input::set_section_addresses): Don't
12514 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12515 (Orphan_output_section::set_section_addresses): Likewise.
12519 * layout.cc (Layout::finish_dynamic_section): Generate tags
12520 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12521 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12522 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12526 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12528 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12529 data_shdr fields of relinfo.
12530 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12531 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
12532 R_386_TLS_LDO_32, adjust based on section flags.
12533 (Target_i386::Relocate::fix_up_ldo): Remove.
12537 Add support for -pie.
12538 * options.h (class General_options): Add -pie and
12540 (General_options::output_is_position_independent): Test -pie.
12541 (General_options::output_is_executable): Return true if not shared
12542 and not relocatable.
12543 (General_options::output_is_pie): Remove.
12544 * options.cc (General_options::finalize): Reject incompatible uses
12546 * gold.cc (queue_middle_tasks): A -pie link is not static.
12547 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12548 * symtab.cc (Symbol::final_value_is_known): Return false if
12549 output_is_position_independent.
12550 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12551 output_is_position_independent.
12552 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12553 output_is_position_independent.
12554 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12555 output_is_position_independent.
12556 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12558 (basic_pie_test.o, basic_pie_test): New targets.
12559 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12560 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12561 (two_file_pie_test): New target.
12562 * testsuite/Makefile.in: Rebuild.
12563 * README: Remove note saying that -pie is not supported.
12567 * options.h (class General_options): Add -init and -fini.
12568 * layout.cc (Layout::finish_dynamic_section): Emit
12569 given init and fini functions.
12573 * gc.h (gc_process_relocs): Check if icf is enabled using new
12575 * gold.cc (queue_initial_tasks): Likewise.
12576 (queue_middle_tasks): Likewise.
12577 * object.cc (do_layout): Likewise.
12578 * symtab.cc (is_section_folded): Likewise.
12579 * main.cc (main): Likewise.
12580 * reloc.cc (Read_relocs::run): Likewise.
12581 (Sized_relobj::do_scan_relocs): Likewise.
12582 * icf.cc (is_function_ctor_or_dtor): New function.
12583 (Icf::find_identical_sections): Check if function is ctor or dtor when
12584 safe icf is chosen.
12585 * options.h (General_options::icf): Change option to be an enum.
12586 (Icf_status): New enum.
12587 (icf_enabled): New method.
12588 (icf_safe_folding): New method.
12589 (set_icf_status): New method.
12590 (icf_status_): New variable.
12591 * (options.cc) (General_options::finalize): Set icf_status_.
12592 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12593 icf_test and icf_keep_unique_test to use the --icf enum flag.
12594 * testsuite/icf_safe_test.sh: New file.
12595 * testsuite/icf_safe_test.cc: New file.
12599 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12600 includes to gc.h and icf.h.
12601 * arm.cc: Include gc.h.
12602 * gold.cc: Likewise.
12603 * i386.cc: Likewise.
12604 * powerpc.cc: Likewise.
12605 * sparc.cc: Likewise.
12606 * x86_64.cc: Likewise.
12607 * gc.h: Include icf.h.
12611 * plugin.cc: Include "gold.h" before other header files.
12615 * options.h (Input_file_argument::Input_file_type): New enum.
12616 (Input_file_argument::is_lib_): Replace with...
12617 (Input_file_argument::type_): New member.
12618 (Input_file_argument::Input_file_argument): Take Input_file_type
12619 'type' rather than boolean 'is_lib' as second argument.
12620 (Input_file_argument::is_lib): Use type_.
12621 (Input_file_argument::is_searched_file): New function.
12622 (Input_file_argument::may_need_search): Handle is_searched_file.
12623 * options.cc (General_options::parse_library): Support -l:filename.
12624 (General_options::parse_just_symbols): Update for Input_file_argument
12626 (Command_line::process): Likewise.
12627 * archive.cc (Archive::get_file_and_offset): Likewise.
12628 * plugin.cc (Plugin_manager::release_input_file): Likewise.
12629 * script.cc (read_script_file, script_add_file): Likewise.
12630 * fileread.cc (Input_file::Input_file): Likewise.
12631 (Input_file::will_search_for): Handle is_searched_file.
12632 (Input_file::open): Likewise.
12633 * readsyms.cc (Read_symbols::get_name): Likewise.
12634 * testsuite/Makefile.am (searched_file_test): New test.
12635 * testsuite/Makefile.in: Regenerate.
12636 * testsuite/searched_file_test.cc: New file.
12637 * testsuite/searched_file_test_lib.cc: New file.
12642 * descriptor.cc: Include <cstdio> and "binary-io.h".
12643 (Descriptors::open): Open the files in binary mode always.
12644 * script.cc (Lex::get_token): Treat \r as whitespace.
12648 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12653 * configure.ac: Check for readv function also.
12654 * fileread.cc (readv): Define if not HAVE_READV.
12655 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12657 * config.in: Regenerate.
12658 * configure: Regenerate.
12662 * layout.cc (Layout::make_output_section): Call target hook to make
12663 ordinary output section.
12664 (Layout::finalize): Adjust parameter list of call the
12665 Target::may_relax().
12666 * layout.h (class Layout::section_list): New method.
12667 * merge.h (Output_merge_base::entsize): Change visibility to public.
12668 (Output_merge_base::is_string, Output_merge_base::do_is_string):
12670 (Output_merge_string::do_is_string): New method.
12671 * object.cc (Sized_relobj::do_setup): renamed from
12672 Sized_relobj::set_up.
12673 * object.h (Sized_relobj::adjust_shndx,
12674 Sized_relobj::initializ_input_to_output_maps,
12675 Sized_relobj::free_input_to_output_maps): Change visibilities to
12677 (Sized_relobj::setup): Virtualize.
12678 (Sized_relobj::do_setup): New method declaration.
12679 (Sized_relobj::invalidate_section_offset,
12680 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12681 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12682 * options.cc (parse_int): New function.
12683 * options.h (parse_int): New declaration.
12684 (DEFINE_int): New macro.
12685 (stub_group_size): New option.
12686 * output.cc (Output_section::Output_section): Initialize memebers
12687 merge_section_map_, merge_section_by_properties_map_,
12688 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12689 (Output_section::add_input_section): Handled deferred code-fill
12690 generation and remove an old comment.
12691 (Output_section::add_relaxed_input_section): New method definition.
12692 (Output_section::add_merge_input_section): Use merge section by
12693 properties map to speed to search. Update merge section maps
12695 (Output_section::build_relaxation_map): New method definition.
12696 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12698 (Output_section::relax_input_section): Renamed to
12699 Output_section::convert_input_sections_to_relaxed_sections and change
12700 interface to take a vector of pointers to relaxed sections.
12701 (Output_section::find_merge_section,
12702 Output_section::find_relaxed_input_section): New method definitions.
12703 (Output_section::is_input_address_mapped,
12704 Output_section::output_offset, Output_section::output_address):
12705 Use output section data maps to speed up searching.
12706 (Output_section::find_starting_output_address): Add comments.
12707 (Output_section::do_write,
12708 Output_section::write_to_postprocessing_buffer): Do code-fill
12709 generation as appropriate.
12710 (Output_section::get_input_sections): Invalidate relaxed input section
12712 (Output_section::restore_states): Adjust type of checkpoint .
12713 Invalidate relaxed input section map.
12714 * output.h (Output_merge_base): New class declaration.
12715 (Input_section_specifier): New class defintion.
12716 (class Output_relaxed_input_section) Change base class to
12717 Output_section_data_build.
12718 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12719 base class initializer.
12720 (Output_section::add_relaxed_input_section): New method declaration.
12721 (Output_section::Input_section): Change visibility to protected.
12722 (Output_section::Input_section::relobj,
12723 Output_section::Input_section::shndx): Handle relaxed input sections.
12724 Output_section::input_sections) Change visibility to protected. Also
12725 define overload to return a non-const pointer.
12726 (Output_section::Merge_section_properties): New class defintion.
12727 (Output_section::Merge_section_by_properties_map,
12728 Output_section::Output_section_data_by_input_section_map,
12729 Output_section::Relaxation_map): New types.
12730 (Output_section::relax_input_section): Rename method to
12731 Output_section::convert_input_sections_to_relaxed_sections and change
12732 interface to take a vector of relaxed section pointers.
12733 (Output_section::find_merge_section,
12734 Output_section::find_relaxed_input_section,
12735 Output_section::build_relaxation_map,
12736 Output_section::convert_input_sections_in_list_to_relaxed_sections):
12737 New method declarations.
12738 (Output_section::merge_section_map_
12739 Output_section::merge_section_by_properties_map_,
12740 Output_section::relaxed_input_section_map_,
12741 Output_section::is_relaxed_input_section_map_valid_,
12742 Output_section::generate_code_fills_at_write_): New data members.
12743 * script-sections.cc
12744 (Output_section_element_input::set_section_addresses): Call
12745 current_data_size and addralign methods of relaxed input sections.
12746 (Orphan_output_section::set_section_addresses): Call current_data_size
12747 and addralign methods of relaxed input sections.
12748 * symtab.cc (Symbol_table::compute_final_value): Extract template
12749 from the body of Symbol_table::sized_finalize_symbol.
12750 (Symbol_table::sized_finalized_symbol): Call
12751 Symbol_table::compute_final_value.
12752 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12753 (Symbol_table::compute_final_value): New templated method declaration.
12754 * target.cc (Target::do_make_output_section): New method defintion.
12755 * target.h (Target::make_output_section): New method declaration.
12756 (Target::relax): Add more parameters for input objects, symbol table
12757 and layout. Adjust call to do_relax.
12758 (Target::do_make_output_section): New method declaration.
12759 (Target::do_relax): Add parameters for input objects, symbol table
12764 * pread.c: Include stdio.h.
12768 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12773 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12774 Change read_shndx type to unsigned int.
12775 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12777 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12778 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12779 Change read_shndx type to unsigned int.
12780 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12782 (Sized_dwarf_line_info::read_line_mappings): Likewise.
12783 * layout.cc (Layout::create_symtab_sections): Cast the result of
12784 local_symcount * symsize to off_t in the gold_assert.
12788 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12789 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12791 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12792 (Arm_relocate_functions::thm_abs5): New function.
12793 (Arm_relocate_functions::abs12): New function.
12794 (Arm_relocate_functions::abs16): New function.
12795 (Arm_relocate_functions::base_abs): New function.
12796 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12797 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
12798 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12800 (Scan::global): Likewise.
12801 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12802 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12803 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12804 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12809 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12810 (Arm_relocate_functions::movt_prel): New function.
12811 (Arm_relocate_functions::thm_movw_prel_nc): New function.
12812 (Arm_relocate_functions::thm_movt_prel): New function.
12813 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12814 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12815 (Scan::global, Relocate::relocate): Likewise.
12816 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12820 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12821 Incremental_checker.
12822 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12824 (class Incremental_inputs_header): New class.
12825 (Incremental_inputs_header_writer): Edit comment.
12826 (Incremental_inputs_entry): New class.
12827 (Incremental_inputs_entry_writer): Edit comment.
12828 (Sized_incremental_binary::do_find_incremental_inputs_section):
12829 Add *strtab_shndx parameter, fill it.
12830 (Sized_incremental_binary::do_check_inputs): New method.
12831 (Incremental_checker::can_incrementally_link_output_file): Use
12832 Sized_incremental_binary::check_inputs.
12833 (Incremental_inputs::report_command_line): Save command line in
12836 (Incremental_binary::find_incremental_inputs_section): New
12838 (Incremental_binary::do_find_incremental_inputs_section): Add
12839 strtab_shndx parameter.
12840 (Incremental_binary::do_check_inputs): New pure virtual method.
12841 (Sized_incremental_binary::do_check_inputs): Declare.
12842 (Incremental_checker::Incremental_checker): Add incremental_inputs
12843 parameter, use it to initialize incremental_inputs_.
12844 (Incremental_checker::incremental_inputs_): New field.
12845 (Incremental_checker::command_line): New method.
12846 (Incremental_checker::inputs): New method.
12847 (Incremental_checker::command_line_): New field.
12851 * incremental.cc: Include <cstdarg> and "target-select.h".
12852 (vexplain_no_incremental): New function.
12853 (explain_no_incremental): New function.
12854 (Incremental_binary::error): New method.
12855 (Sized_incremental_binary::do_find_incremental_inputs_section): New
12857 (make_sized_incremental_binary): New function.
12858 (open_incremental_binary): New function.
12859 (can_incrementally_link_file): Add checks if output is ELF and has
12861 * incremental.h: Include "elfcpp_file.h" and "output.h".
12862 (Incremental_binary): New class.
12863 (Sized_incremental_binary): New class.
12864 (open_incremental_binary): Declare.
12865 * object.cc (is_elf_object): Use
12866 elfcpp::Elf_recognizer::is_elf_file.
12867 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12868 * output.h (Output_file::filesize): New method.
12872 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12874 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12875 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12877 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12879 (Arm_relocate_functions::movw_abs_nc): New function.
12880 (Arm_relocate_functions::movt_abs): New function.
12881 (Arm_relocate_functions::thm_movw_abs_nc): New function.
12882 (Arm_relocate_functions::thm_movt_abs): New function.
12883 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12884 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12885 (Scan::global): Likewise.
12886 (Relocate::relocate): Likewise.
12887 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12891 * arm.cc (Arm_relocate_functions::got_prel) New function.
12892 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12893 (Relocate::relocate): Likewise.
12894 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12898 * options.h (class General_options): Define
12899 split_stack_adjust_size parameter.
12900 * object.h (class Object): Add uses_split_stack_ and
12901 has_no_split_stack_ fields. Add uses_split_stack and
12902 has_no_split_stack accessor functions. Declare
12903 handle_split_stack_section.
12904 (class Reloc_symbol_changes): Define.
12905 (class Sized_relobj): Define Function_offsets. Declare
12906 split_stack_adjust, split_stack_adjust_reltype, and
12908 * object.cc (Object::handle_split_stack_section): New function.
12909 (Sized_relobj::do_layout): Call handle_split_stack_section.
12910 * dynobj.cc (Sized_dynobj::do_layout): Call
12911 handle_split_stack_section.
12912 * reloc.cc (Sized_relobj::relocate_sections): Call
12913 split_stack_adjust for executable sections in split_stack
12914 objects. Pass reloc_map to relocate_section.
12915 (Sized_relobj::split_stack_adjust): New function.
12916 (Sized_relobj::split_stack_adjust_reltype): New function.
12917 (Sized_relobj::find_functions): New function.
12918 * target-reloc.h: Include "object.h".
12919 (relocate_section): Add reloc_symbol_changes parameter. Change
12921 * target.h (class Target): Add calls_non_split method. Declare
12922 do_calls_non_split virtual method. Declare match_view and
12924 * target.cc: Include "elfcpp.h".
12925 (Target::do_calls_non_split): New function.
12926 (Target::match_view): New function.
12927 (Target::set_view_to_nop): New function.
12928 * gold.cc (queue_middle_tasks): Give an error if mixing
12929 split-stack and non-split-stack objects with -r.
12930 * i386.cc (Target_i386::relocate_section): Add
12931 reloc_symbol_changes parameter.
12932 (Target_i386::do_calls_non_split): New function.
12933 * x86_64.cc (Target_x86_64::relocate_section): Add
12934 reloc_symbol_changes parameter.
12935 (Target_x86_64::do_calls_non_split): New function.
12936 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12938 * powerpc.cc (Target_powerpc::relocate_section): Add
12939 reloc_symbol_changes parameter.
12940 * sparc.cc (Target_sparc::relocate_section): Add
12941 reloc_symbol_changes parameter.
12942 * configure.ac: Call AM_CONDITIONAL for the default target.
12943 * configure: Rebuild.
12944 * testsuite/Makefile.am (TEST_AS): New variable.
12945 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12946 (check_DATA): Add split_i386 and split_x86_64 files.
12947 (SPLIT_DEFSYMS): Define.
12948 (split_i386_[1234n].o): New targets.
12949 (split_i386_[124]): New targets.
12950 (split_i386_[1234r].stdout): New targets.
12951 (split_x86_64_[1234n].o): New targets.
12952 (split_x86_64_[124]): New targets.
12953 (split_x86_64_[1234r].stdout): New targets.
12954 (MOSTLYCLEANFILES): Add new executables.
12955 * testsuite/split_i386.sh: New file.
12956 * testsuite/split_x86_64.sh: New file.
12957 * testsuite/split_i386_1.s: New file.
12958 * testsuite/split_i386_2.s: New file.
12959 * testsuite/split_i386_3.s: New file.
12960 * testsuite/split_i386_4.s: New file.
12961 * testsuite/split_i386_n.s: New file.
12962 * testsuite/split_x86_64_1.s: New file.
12963 * testsuite/split_x86_64_2.s: New file.
12964 * testsuite/split_x86_64_3.s: New file.
12965 * testsuite/split_x86_64_4.s: New file.
12966 * testsuite/split_x86_64_n.s: New file.
12967 * testsuite/testfile.cc (Target_test): Update relocation_section
12969 * testsuite/Makefile.in: Rebuild.
12973 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12974 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12975 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
12976 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12977 the address on ldo_addrs_.
12978 (Target_i386::Relocate::fix_up_ldo): New function.
12982 * plugin.cc (add_input_library): New.
12983 (Plugin::load): Add add_input_library to tv.
12984 (Plugin_manager::add_input_file): Add the is_lib argument.
12985 (add_input_file): Update call to Plugin_manager::add_input_file.
12986 (add_input_library): New.
12987 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12991 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12992 symbol and call Symbol::may_need_copy_reloc to determine if
12993 a copy reloc is needed.
12994 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12995 nocopyreloc is given in command line.
12996 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12997 given in command line.
12998 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12999 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13000 of the removed Target_i386::may_need_copy_reloc.
13001 * options.h (copyreloc): New option with default value false.
13002 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13003 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13004 instead of the removed Target_powerpc::may_need_copy_reloc.
13005 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13006 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13007 instead of the removed Target_sparc::may_need_copy_reloc.
13008 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13009 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13010 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13011 instead of the removed Target_x86_64::may_need_copy_reloc.
13015 * object.h (class Object): Remove target_ field, and target,
13016 sized_target, and set_target methods.
13017 (Object::sized_target): Remove.
13018 (class Sized_relobj): Update declarations. Remove sized_target.
13019 * object.cc (Sized_relobj::setup): Remove target parameter.
13020 Change all callers.
13021 (Input_objects::add_object): Don't do anything with the target.
13022 (make_elf_sized_object): Add punconfigured parameter. Change all
13023 callers. Set or test parameter target.
13024 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13025 Change all callers.
13026 * parameters.cc (Parameters::set_target): Change parameter type to
13028 (Parameters::default_target): Remove.
13029 (set_parameters_target): Change parameter type to be non-const.
13030 (parameters_force_valid_target): New function.
13031 (parameters_clear_target): New function.
13032 * parameters.h (class Parameters): Update declarations. Remove
13033 default_target method. Add sized_target and clear_target
13034 methods. Change target_ to be non-const.
13035 (set_parameters_target): Update declaration.
13036 (parameters_force_valid_target): Declare.
13037 (parameters_clear_target): Declare.
13038 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13039 as NULL if we aren't searching.
13040 (Add_symbols::run): Don't check for compatible target.
13041 * fileread.cc (Input_file::open_binary): Call
13042 parameters_force_valid_target.
13043 * gold.cc (queue_middle_tasks): Likewise.
13044 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
13045 set_target on object.
13046 * dynobj.h (class Sized_dynobj): Update declarations.
13047 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13048 make_elf_object returns NULL.
13049 (Archive::include_member): Don't check whether object target is
13051 * output.cc (Output_section::add_input_section): Get target from
13053 (Output_section::relax_input_section): Likewise.
13054 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13056 (Sized_relobj::do_scan_relocs): Likewise.
13057 (Sized_relobj::relocate_sections): Likewise.
13058 * resolve.cc (Symbol_table::resolve): Likewise.
13059 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
13060 parameter. Change all callers.
13061 (Symbol_table::add_from_object): Get target from parameters.
13062 (Symbol_table::add_from_relobj): Don't check object target.
13063 (Symbol_table::add_from_dynobj): Likewise.
13064 (Symbol_table::define_special_symbol): Get target from
13066 * symtab.h (class Symbol_table): Update declaration.
13067 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13068 parameter. Change all callers. Clear parameter target.
13069 (Binary_test): Test target here.
13070 * testsuite/object_unittest.cc (gold_testsuite): Remove
13071 target_test_pointer parameter. Change all callers.
13072 (Object_test): Test target here.
13076 * testsuite/initpri1.c: Don't try to use constructor priorities if
13077 compiling with gcc before 4.3.
13081 * testsuite/retain_symbols_file_test.sh (check_present): Change
13082 output file name to retain_symbols_file_test.stdout.
13083 (check_absent): Likewise.
13087 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13088 * options.cc: Include <cerrno> and <fstream>.
13089 (General_options::finalize): Parse -retain-symbols-file tag.
13090 * options.h: New flag.
13091 (General_options): New method should_retain_symbol, new
13092 variable symbols_to_retain.
13093 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13094 should_retain_symbol map.
13095 * testsuite/Makefile.am (retain_symbols_file_test): New test.
13096 * testsuite/Makefile.in: Regenerate.
13097 * testsuite/retain_symbols_file_test.sh: New file.
13101 * po/es.po: Updated Spanish translation.
13105 * debug.h (DEBUG_RELAXATION): New constant.
13106 (DEBUG_ALL): Add DEBUG_RELAXATION.
13107 (debug_string_to_enum): Add relaxation debug option.
13109 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13110 Layout::Relaxation_debug_check::read_sections,
13111 Layout::Relaxation_debug_check::read_sections): New method definitions.
13112 (Layout::Layout): Initialize data members
13113 record_output_section_data_from_scrips_,
13114 script_output_section_data_list_ and relaxation_debug_check_.
13115 (Layout::save_segments, Layout::restore_segments,
13116 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13117 Layout::relaxation_loop_body): New method definitions.
13118 (Layout::finalize): Support relaxation. Move section layout code to
13119 Layout::relaxation_loop_body.
13120 (Layout::set_asection_address_from_script): Move code for orphan
13121 section placement out.
13122 (Layout::place_orphan_sections_in_script): New method definition.
13123 * layout.h (Output_segment_headers, Output_file_header):
13124 New forward class declarations.
13125 (Layout::~Layout): Define.
13126 (Layout::new_output_section_data_from_script): New method definition.
13127 (Layout::place_orphan_sections_in_script): New method declaration.
13128 (Layout::Segment_states): New type declaration.
13129 (Layout::save_segments, Layout::restore_segments,
13130 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13131 Layout::relaxation_loop_body): New method declarations.
13132 (Layout::Output_section_data_list): New type declaration.
13133 (Layout::Relaxation_debug_check): New class definition.
13134 (Layout::record_output_section_data_from_script_,
13135 Layout::script_output_section_data_list_, Layout::segment_states_,
13136 Layout::relaxation_debug_check_): New data members.
13137 * output.cc: (Output_section_headers::do_size): New method definition.
13138 (Output_section_headers::Output_section_headers): Move size
13139 computation to Output_section_headers::do_size.
13140 (Output_segment_headers::do_size): New method definition.
13141 (Output_file_header::Output_file_header): Move size computation to
13142 Output_file_header::do_size and call it.
13143 (Output_file_header::do_size): New method definition.
13144 (Output_data_group::Output_data_group): Adjust call to
13145 Output_section_data.
13146 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13147 (Output_symtab_xindex::do_write): Add array bound check.
13148 (Output_section::Input_section::print_to_mapfile): Handle
13149 RELAXED_INPUT_SECTION_CODE.
13150 (Output_section::Output_section): Initialize data member checkpoint_.
13151 (Output_section::~Output_section): Delete checkpoint object pointed
13153 (Output_section::add_input_section): Always add an Input_section if
13155 (Output_section::add_merge_input_section): Add assert.
13156 (Output_section::relax_input_section): New method definition.
13157 (Output_section::set_final_data_size): Set load address to zero for
13158 an unallocated section.
13159 (Output_section::do_address_and_file_offset_have_reset_values):
13160 New method definition.
13161 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13162 Handle relaxed input section.
13163 (Output_section::sort_attached_input_sections): Checkpoint input
13164 section list lazily.
13165 (Output_section::get_input_sections): Change type of input_sections to
13166 list of Simple_input_section pointers. Checkpoint input section list
13167 lazily. Also handle relaxed input sections.
13168 (Output_section::add_input_section_for_script): Take a reference to
13169 a Simple_input_section object instead of Relobj pointer and section
13170 index as parameter. Handle relaxed input sections.
13171 (Output_section::save_states, Output_section::restore_states): New
13172 method definitions.
13173 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13174 (Output_data::is_data_size_fixed): New method definition.
13175 (Output_data::reset_addresss_and_file_offset): Do not reset data size
13177 (Output_data::address_and_file_offset_have_reset_values): New method
13179 (Output_data::do_address_and_file_offset_have_reset_values): New method
13181 (Output_data::set_data_size): Check that data size is not fixed.
13182 (Output_data::fix_data_size): New method definition.
13183 (Output_data::is_data_size_fixed_): New data member.
13184 (Output_section_headers::set_final_data_size): New method definition.
13185 (Output_section_headers::do_size): New method declaration.
13186 (Output_segment_headers::set_final_data_size): New method definition.
13187 (Output_segment_headers::do_size): New method declaration.
13188 (Output_file_header::set_final_data_size)::New method definition.
13189 (Output_file_header::do_size)::New method declaration.
13190 (Output_section_data::Output_section_data): Add new parameter
13191 is_data_size_fixed and use it to fix data size.
13192 (Output_data_const::Output_data_const): Adjust call to base class
13193 constructor and fix data size.
13194 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13195 base class constructor and fix data size.
13196 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13197 base class constructor and fix data size.
13198 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13199 class constructor and fix data size.
13200 (Output_data_group::set_final_data_size): New method definition.
13201 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13202 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13203 class constructor and fix data size.
13204 (Output_relaxed_input_section): New class definition.
13205 (Output_section::Simple_input_section): New class definition.
13206 (Output_section::get_input_sections): Adjust parameter list.
13207 (Output_section::add_input_section_for_script): Same.
13208 (Output_section::save_states, Output_section::restore_states,
13209 Output_section::do_address_and_file_offset_have_reset_values,
13210 (Output_section::Input_section::Input_section): Handle
13211 RELAXED_INPUT_SECTION_CODE. Add new overload for
13212 Output_relaxed_input_section.
13213 (Output_section::Input_section::is_input_section,
13214 Output_section::Input_section::set_output_section): Handle relaxed
13216 (Output_section::Input_section::is_relaxed_input_section,
13217 Output_section::Input_section::output_section_data,
13218 Output_section::Input_section::relaxed_input_section): New method
13220 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13222 (Output_section::Input_section::u1_): Update comments.
13223 (Output_section::Input_section::u2_): Add new union member poris.
13224 (Output_section::Checkpoint_output_section): New classs definition.
13225 (Output_section::relax_input_section): New method declaration.
13226 (Output_section::checkpoint_): New data member.
13227 (Output_segment): Update comments.
13228 (Output_segment::Output_segment): Un-privatize copy constructor.
13229 (Output_segment::operator=): Un-privatize.
13230 * script-sections.cc (Output_section_element::Input_section_list):
13231 Change element type to Output_section::Simple_input_section.
13232 (Output_section_element_dot_assignment::set_section_addresses):
13233 Register output section data for relaxation clean up.
13234 (Output_data_exression::Output_data_expression): Adjust call to base
13235 constructor to fix data size.
13236 (Output_section_element_data::set_section_addresses): Register
13237 Output_data_expression object for relaxation clean up.
13238 (struct Input_section_info): Replace Relobj pointer and section index
13239 pair with Output_section::Simple_input_section and Convert struct to a
13241 (Input_section_sorter::operator()): Adjust access to
13242 Input_section_info data member to use accessors.
13243 (Output_section_element_input::set_section_addresses): Use layout
13244 parameter. Adjust code to use Output_section::Simple_input_section
13245 and Input_secction_info classes. Register filler for relaxation
13247 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13248 and section index pair with Output_section::Simple_input_section
13249 class. Adjust code accordingly.
13250 (Phdrs_element::release_segment): New method definition.
13251 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13253 (Script_sections::release_segments): New method definition.
13254 * gold/script-sections.h (Script_sections::release_segments): New
13255 method declaration.
13256 * gold/target.h (Target::may_relax, Target::relax,
13257 Target::do_may_relax, Target::do_relax): New method definitions.
13261 * arm.cc (has_signed_unsigned_overflow): New function.
13262 (Arm_relocate_functions::abs8): New function.
13263 (Target_arm::Scan::local): Handle R_ARM_ABS8.
13264 (Target_arm::Scan::global): Likewise.
13265 (Target_arm::relocate::relocate): Likewise.
13266 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13271 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13272 * testsuite/Makefile.in: Regenerate.
13276 * po/gold.pot: Updated by the Translation project.
13280 * output.cc (Output_file::open): Add execute permission to empty file.
13281 * testsuite/Makefile.am (permission_test): New test.
13282 * testsuite/Makefile.in: Regenerate.
13286 * output.cc (Output_file::resize): Call map_no_anonymous rather
13291 * gold.cc: Include "incremental.h".
13292 (queue_initial_tasks): Call Incremental_checker methods.
13293 * incremental.cc: Include "output.h".
13294 (Incremental_checker::can_incrementally_link_output_file): New
13296 * incremental.h (Incremental_checker): New class.
13298 * output.cc (Output_file::open_for_modification): New method.
13299 (Output_file::map_anonymous): Changed return type to bool. Record
13300 map in base_ field.
13301 (Output_file::map_no_anonymous): New method, broken out of map.
13302 (Output_file::map): Use map_no_anonymous and map_anonymous.
13303 * output.h (class Output_file): Update declarations.
13307 * options.h (Command_line::Pre_options): New class.
13308 (Command_line::pre_options): New member.
13309 * options.cc (gold::options::ready_to_register): New variable.
13310 (One_option::register_option): Do nothing if not registering options.
13311 Assert if same short option registered twice.
13312 (General_options::General_options): Turn off option registration when
13314 (Command_line::Pre_options::Pre_options): New constructor.
13318 * options.h (General_options::no_keep_memory): Remove incorrect
13323 * Makefile.am (am__skiplex, am__skipyacc): New.
13324 * Makefile.in: Regenerate.
13328 * Makefile.am (AM_CPPFLAGS): Renamed from ...
13329 (INCLUDES): ... this.
13330 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13331 (AM_CPPFLAGS): Renamed from ...
13332 (INCLUDE): ... this.
13333 * Makefile.in, testsuite/Makefile.in: Regenerate.
13335 * Makefile.in: Regenerate.
13336 * aclocal.m4: Likewise.
13337 * config.in: Likewise.
13338 * configure: Likewise.
13339 * testsuite/Makefile.in: Likewise.
13341 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13342 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13343 * Makefile.in: Regenerate.
13344 * testsuite/Makefile.in: Regenerate.
13348 * resolve.cc (Symbol_table::resolve): Don't complain about defined
13349 symbols in shared libraries overridden by hidden or internal symbols
13350 in the main program.
13354 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13355 checking source file names in error messages.
13359 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13360 an elcpp::Ehdr as parameter. Adjust call to set_target.
13361 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13362 an elfcpp::Ehdr as parameter.
13363 * object.cc (Object::set_target): Remove the version that looks up
13364 a target and sets it.
13365 (Sized_relobj::setup): Take a Target object instead of
13366 an elfcpp::Ehdr as parameter. Adjust call to set_target.
13367 (make_elf_sized_object): Find target and ask target to
13368 make an ELF object.
13369 * object.h: (Object::set_target): Remove the version that looks up
13370 a target and sets it.
13371 (Sized_relobj::setup): Take a Target object instead of
13372 an elfcpp:Ehdr as parameter.
13373 * target.cc: Include dynobj.h.
13374 (Target::do_make_elf_object_implementation): New.
13375 (Target::do_make_elf_object): New.
13376 * target.h (Target::make_elf_object): New template declaration.
13377 (Target::do_make_elf_object): New method declarations.
13378 (Target::do_make_elf_object_implementation): New template declaration.
13382 * gold.h (FUNCTION_NAME): Define.
13383 (gold_unreachable): Use FUNCTION_NAME.
13387 * icf.cc (Icf::find_identical_sections): Issue a warning when a
13388 symbol in the --keep-unique list is not found.
13392 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13393 been maked as --keep-unique.
13394 (Icf::unfold_section): New function.
13395 * icf.h (Icf::unfold_section): New function.
13396 * options.h (General_options::keep_unique): New option.
13397 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13398 * testsuite/Makefile.in: Regenerate.
13399 * testsuite/icf_keep_unique_test.sh: New file.
13400 * testsuite/icf_keep_unique_test.cc: New file.
13405 * resolve.cc (Symbol_table::resolve): Check for references from
13406 dynamic objects to hidden and internal symbols.
13407 * testsuite/Makefile.am (hidden_test.sh): New test.
13408 * testsuite/Makefile.in: Regenerate.
13409 * testsuite/hidden_test.sh: New script.
13410 * testsuite/hidden_test_1.c: New test source.
13411 * testsuite/hidden_test_main.c: New test source.
13415 * arm.cc: Update comments.
13416 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13417 segment to locate the .ARM.exidx section if present.
13421 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13425 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13430 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13431 valid tls_segment only for non-debug-section relocations.
13432 * testsuite/Makefile.am: Add gc_tls_test.
13433 * testsuite/Makefile.in: Regenerate.
13434 * testsuite/gc_tls_test.cc: New file.
13435 * testsuite/gc_tls_test.sh: New file.
13439 * icf.cc: New file.
13441 * Makefile.am (CCFILES): Add icf.cc.
13442 (HFILES): Add icf.h
13443 * Makefile.in: Regenerate.
13444 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13445 * gc.h (gc_process_relocs): Populate lists used by icf to contain
13446 section, symbol and addend information for the relocs.
13447 * gold.cc (queue_middle_tasks): Call identical code folding.
13448 * gold.h: Add defines for multimap.
13449 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13450 to the call of finalize_local_symbols.
13451 * main.cc (main): Create object of class Icf.
13452 * object.cc (Sized_relobj::do_layout): Allow this function to be
13453 called twice during icf.
13454 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13455 to sections marked as identical by icf.
13456 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13458 (Sized_relobj::do_section_entsize): New function.
13459 * object.h (Object::section_entsize): New function.
13460 (Object::do_section_entsize): New pure virtual function.
13461 (Relobj::finalize_local_symbols): Add new parameter.
13462 (Relobj::do_section_entsize): New function.
13463 * options.h (General_options::icf): New option.
13464 (General_options::icf_iterations): New option.
13465 (General_options::print_icf_sections): New option.
13466 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13467 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13468 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13470 * symtab.cc (Symbol_table::is_section_folded): New function.
13471 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
13472 to sections marked as identical by icf.
13473 * symtab.h (Symbol_table::set_icf): New function.
13474 (Symbol_table::icf): New function.
13475 (Symbol_table::is_section_folded): New function.
13476 (Symbol_table::icf_): New data member.
13477 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13478 * testsuite/Makefile.am: Add commands to build icf_test.
13479 * testsuite/Makefile.in: Regenerate.
13480 * testsuite/icf_test.sh: New file.
13481 * testsuite/icf_test.cc: New file.
13485 * layout.cc (is_compressible_debug_section): Fix incorrect
13486 comment about compressed section names.
13491 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13496 * layout.h: #include <map>.
13497 (class Kept_section): Change from struct to class. Add accessors
13498 and setters. Add section size to Comdat_group mapping. Change
13499 Comdat_group to std::map. Add is_comdat_ field. Add
13500 linkonce_size field in union.
13501 (class Layout): Update declaration of find_or_add_kept_section.
13502 Don't declare find_kept_object.
13503 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13504 parameter. Add object, shndx, is_comdat, and is_group_name
13505 parameters. Change all callers. Adjust for new Kept_section.
13506 (Layout::find_kept_object): Remove.
13507 * object.cc (Sized_relobj::include_section_group): Update use of
13508 Kept_section. Rename secnum to shndx. Only record
13509 Kept_comdat_section if sections are the same size.
13510 (Sized_relobj::include_linkonce_section): Update use of
13511 Kept_section. Only record Kept_comdat_section if sections are the
13512 same size. Set size of linkonce section.
13513 (Sized_relobj::map_to_kept_section): Update call to
13514 get_kept_comdat_section.
13515 * object.h (class Sized_relobj): Rename fields in
13516 Kept_comdat_section to drop trailing underscores; change object
13517 field to Relobj*. Change Kept_comdat_section_table to store
13518 struct rather than pointer.
13519 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13520 Add kept_object and kept_shndx parameters. Change all callers.
13521 (Sized_relobj::get_kept_comdat_section): Change return type to
13522 bool. Add kept_object and kept_shndx parameters. Change all
13524 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13525 Layout::find_or_add_kept_section.
13529 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13530 Reserve space in the hash table.
13534 * fileread.cc (File_read::get_mtime): New method.
13535 * fileread.h (Timespec): New structure.
13536 (File_read::get_mtime): New method.
13537 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13538 Renamed from timestamp_nsec.
13539 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13541 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13543 (Incremental_inputs::report_archive): Save mtime; style fix.
13544 (Incremental_inputs::report_obejct): Save mtime; style fix.
13545 (Incremental_inputs::report_script): Save mtime; style fix.
13546 (Incremental_inputs::finalize_inputs): Style fix.
13547 (Incremental_inputs::finalize): Style fix.
13548 (Incremental_inputs::create_input_section_data): Store inputs
13550 * incremental.h (Incremental_inputs::report_script): Add mtime
13552 (Incremental_inputs::Input_info::Input_info): Intialize only one
13554 (Incremental_inputs::Input_info::archive): Move to nameless
13556 (Incremental_inputs::Input_info::obejct): Move to nameless union.
13557 (Incremental_inputs::Input_info::script): Move to nameless union.
13558 (Incremental_inputs::mtime): New field.
13559 * script.cc (read_input_script): Pass file mtime to
13561 * script.h (Script_info::inputs): Style fix.
13565 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13571 * layout.cc (Layout::choose_output_section): If we find an
13572 existing section, update the flags.
13573 (Layout::create_notes): New function, broken out of
13575 (Layout::finalize): Don't create note sections.
13576 (Layout::create_note): Don't crash if linker script discards
13578 (Layout::create_gold_note): Likewise.
13579 (Layout::create_build_id): Likewise. Don't set
13580 after_input_sections on the section.
13581 (Layout::create_executable_stack_info): Remove target parameter.
13583 * layout.h (class Layout): Declare create_notes. Update
13584 declaration of create_executable_stack_info.
13585 * gold.cc (queue_middle_tasks): Call create_notes.
13586 * output.cc (Output_section::update_flags_for_input_section): Move
13587 here from output.h. If SHF_ALLOC flag is newly set, mark address
13589 * output.h (Output_data::mark_address_invalid): New function.
13590 (class Output_section): Only declare, not define,
13591 update_flags_for_input_section. Remove set_flags.
13595 * script-sections.cc (Output_section_definition::
13596 set_section_addresses): Rename shadowing local load_address to
13602 * reloc.cc (relocate_sections): Skip empty relocation sections.
13607 * layout.cc (Layout::create_note): Use choose_output_section
13608 rather than make_output_section.
13613 * options.cc (General_options::parse_V): Set printed_version_.
13614 (General_options::General_options): Initialize printed_version_.
13615 * options.h (class General_options): Add printed_version_ field.
13616 * gold.cc (queue_initial_tasks): If there are no input files,
13617 don't give a fatal error if we printed the version information.
13618 (queue_middle_tasks): If using -r with a shared object, give a
13619 fatal error rather than an ordinary error.
13624 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13625 (Layout::make_output_section): Set have_stabstr_section_ if we see
13626 a .stab*str section.
13627 (Layout::finalize): Call link_stabs_sections.
13628 (Layout::link_stabs_sections): New file.
13629 * layout.h (class Layout): Add have_stabstr_section_ field.
13630 Declare link_stabs_sections.
13634 * Makefile.am (libgold_a_LIBADD): New.
13635 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13636 * Makefile.in: Regenerate.
13637 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13638 * configure: Regenerate.
13639 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13640 * fileread.cc: Include sys/state.h
13641 * gold.h: Declare memmem and strndup if found missing.
13642 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13646 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13647 * configure: Rebuild.
13652 * object.cc (Object::section_contents): Don't try to get a view if
13653 the section has length zero.
13654 (Object::handle_gnu_warning_section): If the section is empty, use
13655 the name of the section as the warning.
13660 * stringpool.h (class Stringpool_template): Add optimize_ field.
13661 (Stringpool_template::set_optimize): New function.
13662 * stringpool.cc (Stringpool_template::Stringpool_template):
13663 Initialize optimize_ field.
13664 (Stringpool_template::set_string_offsets): Test local optimize
13665 fild rather than parameter.
13666 * layout.cc (Layout::Layout): Call set_optimize on the section
13672 * yyscript.y: Parse TARGET.
13673 * script.cc (script_set_target): New function.
13674 * script-c.h (script_set_target): Declare.
13675 * options.cc (General_options::string_to_object_format): Rename
13676 from string_to_object_format in anonymous namespace. Change
13678 * options.h (class General_options): Declare
13679 string_to_object_format.
13683 * script-sections.cc (Script_sections::create_segments): Don't put
13684 program headers in a PT_LOAD segment if -n or -N.
13689 * options.h (class General_options): Add -z lazy and -z now. Sort
13690 -z options into alphabetical order.
13691 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13695 * layout.cc (Layout::make_output_section): Call
13696 Target::new_output_section.
13697 (Layout::attach_allocated_section_to_segment): Put large section
13698 sections in a separate load segment with the large segment flag
13700 (Layout::segment_precedes): Sort large data segments after other
13702 (align_file_offset): New static function.
13703 (Layout::set_segment_offsets): Use align_file_offset.
13704 * output.h (class Output_section): Add is_small_section_ and
13705 is_large_section_ fields.
13706 (Output_section::is_small_section): New function.
13707 (Output_section::set_is_small_section): New function.
13708 (Output_section::is_large_section): New function.
13709 (Output_section::set_is_large_section): New function.
13710 (Output_section::is_large_data_section): New function.
13711 (class Output_segment): Add is_large_data_segment_ field.
13712 (Output_segment::is_large_data_segment): New function.
13713 (Output_segment::set_is_large_data_segment): New function.
13714 * output.cc (Output_section::Output_section): Initialize new
13716 (Output_segment::Output_segment): Likewise.
13717 (Output_segment::add_output_section): Add assertion that large
13718 data sections always go in large data segments. Force small data
13719 sections to the end of the list of data sections. Force small BSS
13720 sections to the start of the list of BSS sections. For large BSS
13721 sections to the end of the list of BSS sections.
13722 * symtab.h (class Symbol): Declare is_common_shndx.
13723 (Symbol::is_defined): Check Symbol::is_common_shndx.
13724 (Symbol::is_common): Likewise.
13725 (class Symbol_table): Define enum Commons_section_type. Update
13726 declarations. Add small_commons_ and large_commons_ fields.
13727 * symtab.cc (Symbol::is_common_shndx): New function.
13728 (Symbol_table::Symbol_table): Initialize new fields.
13729 (Symbol_table::add_from_object): Put small and large common
13730 symbols in the right list.
13731 (Symbol_table::sized_finalized_symbol): Check
13732 Symbol::is_common_shndx.
13733 (Symbol_table::sized_write_globals): Likewise.
13734 * common.cc (Symbol_table::do_allocate_commons): Allocate new
13735 common symbol lists. Don't call do_allocate_commons_list if the
13737 (Symbol_table::do_allocate_commons_list): Remove is_tls
13738 parameter. Add comons_section_type parameter. Change all
13739 callers. Handle small and large common symbols.
13740 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13741 Symbol::is_common_shndx.
13742 * resolve.cc (symbol_to_bits): Likewise.
13743 * target.h (Target::small_common_shndx): New function.
13744 (Target::small_common_section_flags): New function.
13745 (Target::large_common_shndx): New function.
13746 (Target::large_common_section_flags): New function.
13747 (Target::new_output_section): New function.
13748 (Target::Target_info): Add small_common_shndx, large_common_shndx,
13749 small_common_section_flags, and large_common_section_flags
13751 (Target::do_new_output_section): New virtual function.
13752 * arm.cc (Target_arm::arm_info): Initialize new fields.
13753 * i386.cc (Target_i386::i386_info): Likewise.
13754 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13756 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13757 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13758 (Target_x86_64::do_new_output_section): New function.
13759 * configure.ac: Define conditional MCMODEL_MEDIUM.
13760 * testsuite/Makefile.am (check_PROGRAMS): Add large.
13761 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13762 (large_LDFLAGS): Define.
13763 * testsuite/large.c: New file.
13764 * testsuite/testfile.cc (Target_test::test_target_info):
13765 Initialize new fields.
13766 * configure, testsuite/Makefile.in: Rebuild.
13770 * Makefile.am (CCFILES): Add target.cc.
13771 * Makefile.in: Regenerate.
13772 * i386.cc (class Target_i386): Define new virtual method to
13773 override do_is_local_label_name in parent.
13774 * object.cc (Sized_relobj::do_count_local_symbols): Discard
13775 local symbols if --discard-locals or -X is given.
13776 * options.h (class General_options): Declare new options
13777 '--discard-locals' and '-X' for discarding locals.
13778 * target.h (class Target): Define new methods is_local_label_name.
13779 Declare new virtual method do_is_local_label_name.
13780 * target.cc: New file.
13781 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13782 (check_SCRIPTS): Add discard_locals_test.sh.
13783 (check_DATA): Add discard_local_tests.syms.
13784 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13785 (discard_local_tests.syms, discard_locals_test.o): New make rules.
13786 * testsuite/Makefile.in: Regenerate.
13787 * testsuite/discard_locals_test.c: New file.
13788 * testsuite/discard_locals_test.sh: Same.
13792 * object.cc (Sized_relobj::Sized_relobj): Initialize
13793 discarded_eh_frame_shndx_ to -1U.
13794 (Sized_relobj::do_layout): Record index of a discard .eh_frame
13796 (Sized_relobj::do_count_local_symbols): Skip local symbols in
13797 a discarded .eh_frame section.
13798 (Sized_relobj::do_finalize_local_symbols): Ditto.
13799 * object.h (class Sized_relobj): Declare new member
13800 discarded_eh_frame_shndx_.
13801 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13802 (local_labels_test.o, local_labels_test): New rules.
13803 * testsuite/Makefile.in: Regenerate.
13807 * layout.cc (Layout::section_name_mapping): Add mapping for
13808 special ARM sections.
13812 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13813 (utils::has_overflow): Same.
13817 * layout.cc (Layout::section_name_mapping): New array, replacing
13818 Layout::linkonce_mapping.
13819 (Layout::section_name_mapping_count): New variable, replacing
13820 Layout::linkonce_mapping_count.
13821 (Layout::linkonce_output_name): Remove.
13822 (Layout::output_section_name): Rewrite.
13823 * layout.h (class Layout): Rename Linkonce_mapping to
13824 Section_name_mapping, linkonce_mapping to section_name_mapping,
13825 linkonce_mapping_count to section_name_mapping_count. Don't
13826 declare linkonce_output_name.
13830 * gold/arm.cc (namespace utils): New.
13831 (Target_arm::reloc_is_non_pic): Define new method.
13832 (class Arm_relocate_functions): New.
13833 (Target_arm::Relocate::relocate): Handle relocation types used by
13838 * arm.cc (Target_arm::scan::global): Use || instead of |.
13842 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
13843 issued_non_pic_error_.
13844 (class Target_arm::Scan): Declare new method check_non_pic.
13845 Define new method symbol_needs_plt_entry.
13846 Declare new data member issued_non_pic_error_.
13847 (class Target_arm::Relocate): Declare new method
13848 should_apply_static_reloc.
13849 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13850 (Target_arm::Scan::check_non_pic): Define new method.
13851 (Target_arm::Scan::local): Handle a small subset of reloc types used
13853 (Target_arm::Scan::local): Same.
13854 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13858 * incremental.cc (Incremental_inputs::report_command_line): Filter
13859 out --incremental-* options.
13863 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13865 (class Target_arm): Update comment.
13866 (Target_arm::Target_arm): Initialize new data members GOT_,
13867 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13868 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13869 and Target_arm::rel_dyn_section.
13870 Declare new_enum Target_arm::Got_type.
13871 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13873 Update commments for member do_dynsym_value.
13874 (Target_arm::got_size, Target_arm::plt_section,
13875 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13876 new methods inside class defintion.
13877 (Target_arm::got_section): Define new method.
13878 (Target_arm::rel_dyn_section): Same.
13879 (Output_data_plt_arm): New template class.
13880 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13881 (Output_data_plt_arm:do_adjust_output_section): Define new method.
13882 (Output_data_plt_arm::add_entry): Same.
13883 (Output_data_plt_arm::first_plt_entry): Define new
13884 static data member for PLT instruction template.
13885 (Output_data_plt_arm::plt_entry): Same.
13886 (Output_data_plt_arm::do_write): Define new method.
13887 (Target_arm::make_plt_entry): Same.
13888 (Target_arm::do_finalize_sections): Same.
13889 (Target_arm::do_dynsym_value): Same.
13893 * Makefile.am (TARGETSOURCES): Add arm.cc.
13894 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13895 * Makefile.in: Regenerate.
13896 * arm.cc: New file.
13897 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13901 * options.cc (General_options::parse_exclude_libs). Fix a comment.
13902 (General_options::check_excluded_libs): Strip off directories in
13903 archive name before matching like GNU ld does.
13904 * testsuite/Makefile.am (MOSTLYCLEANFILES,
13905 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13906 (exclude_libs_test_LDFLAGS): Add linker option
13907 -Wl,--exclude-libs,libexclude_libs_test_3
13908 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13909 an explicit archive without using -l.
13910 (alt/libexclude_libs_test_3.a): New make rule.
13911 * testsuite/Makefile.in: Regenerate.
13912 * testsuite/exclude_libs_test.c : Declare lib3_default().
13914 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13915 * exclude_libs_test_3.c: New file.
13919 * po/id.po: New Indonesian translation.
13920 * po/gold.pot: Updated template file.
13924 * testsuite/Makefile.am: Add -ffunction-sections to compile
13925 gc_comdat_test files. Add -Wl,--gc-sections to build
13927 * testsuite/Makefile.in: Regenerate.
13928 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13932 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13933 kept comdat section was garbage collected.
13934 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13935 * testsuite/Makefile.in: Regenerate.
13936 * testsuite/gc_comdat_test.sh: New file.
13937 * testsuite/gc_comdat_test_1.cc: New file.
13938 * testsuite/gc_comdat_test_2.cc: New file.
13942 * archive.cc (Archive::Archive): Move constructor from archive.h
13943 to here. Initialize no_export_.
13944 (Archive::get_elf_object_for_member): Set no_export flag of object.
13945 * archive.h (Archive::Archive): Move constructor body to
13947 (Archive::no_export): New method.
13948 (Archive::no_export_): New field.
13949 * object.h (Object::Object): Initialize no_export_ to false.
13950 (Object::no_export, Object::set_no_export): New methods.
13951 (Object::no_export_): New field.
13952 * options.cc (General_options::parse_exclude_libs): New method.
13953 (General_options::check_excluded_libs) Same.
13954 * options.h (exclude_libs): New option.
13955 (General_options::check_excluded_libs): New method declaration.
13956 (General_options::excluded_libs_): New field.
13957 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13958 default or protected visibility if an object has no-export flag set.
13959 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13960 (check_SCRIPTS): Add exclude_libs_test.sh.
13961 (check_DATA): Add exclude_libs_test.syms.
13962 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13963 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13964 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13965 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13966 (exclude_libs_test.syms, libexclude_libs_test_1.a,
13967 libexclude_libs_test_2.a): New rules.
13968 * testsuite/Makefile.in: Regenerate.
13969 * testsuite/exclude_libs_test.c: New file.
13970 * testsuite/exclude_libs_test.sh: Ditto.
13971 * testsuite/exclude_libs_test_1.c: Ditto.
13972 * testsuite/exclude_libs_test_2.c: Ditto.
13976 * configure.ac: Check for declarations for cases where libiberty.h
13977 checks HAVE_DECL_xxx.
13978 * configure, config.in: Rebuild.
13982 * gold.h (Incremental_argument_list): Remove (invalid) forward
13984 * incremental.cc (Incremental_inputs::report_achive): New method.
13985 (Incremental_inputs::report_object): New method.
13986 (Incremental_inputs::report_script): New method.
13987 (Incremental_inputs::finalize_inputs): New method.
13988 (Incremental_inputs::finalize): Call finalize_inputs().
13989 (Incremental_inputs::sized_create_incremental_inputs_section_data):
13990 Create inputs entries.
13991 * incremental.h (Incremental_input_type): New enum.
13992 (Incremental_inputs::Incremental_input): Initialize new fields.
13993 (Incremental_inputs::report_inputs): New method.
13994 (Incremental_inputs::report_achive): New method.
13995 (Incremental_inputs::report_object): New method.
13996 (Incremental_inputs::report_script): New method.
13997 (Incremental_inputs::finalize_inputs): New method.
13998 (Incremental_inputs::Input_info): New struct.
13999 (Incremental_inputs::Input_info_map): New typedef.
14000 (Incremental_inputs::lock_): New field.
14001 (Incremental_inputs::Inputs_): New field.
14002 (Incremental_inputs::Inputs_map): New field.
14003 * main.cc (main): Call Incremental_input::report_inputs.
14004 * options.h (Input_argument_list): Typedef moved from
14006 (Input_file_group::Files): Remove, use ::Input_argument_list.
14007 (Input_file_group::Input_argument_list): Remove, use
14008 ::Input_argument_list.
14009 * plugin.cc (Plugin_manager::add_input_file): Add error in
14011 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14013 * script.cc (read_input_script): Call
14014 Incremental_input::report_script.
14015 * script.h (Script_info): New class.
14019 * x86_64.cc (do_adjust_output_section): Set entsize to
14024 * output.cc (Output_file::close): After short writes, continue
14025 writing from the correct offset in the buffer being written.
14029 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14030 * configure: Regenerate.
14031 * config.in: Regenerate.
14032 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14033 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14037 * incremental.cc (Incremental_inputs_header_data): Renamed from
14038 Incremental_input_header_data.
14039 (Incremental_inputs_header_data::data_size): New field.
14040 (Incremental_inputs_header_data::put_input_file_count): Renamed
14041 from input_file_count.
14042 (Incremental_inputs_header_data::put_command_line_offset): Renamed
14043 from command_line_offset.
14044 (Incremental_inputs_header_data::put_reserved): Renamed from
14046 (Incremental_inputs_entry_data): Renamed from
14047 Incremental_input_entry_data.
14048 (Incremental_inputs_entry_data::data_size): New field.
14049 (Incremental_inputs::report_command_line): New method.
14050 (Incremental_inputs::finalize): New method.
14051 (Incremental_inputs::create_incremental_inputs_data): New method.
14052 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14053 * incremental.h: New file.
14054 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14055 (Layout::finalize): Create incremental inputs section in
14056 incremental builds.
14057 (Layout::create_incremental_info_sections): New method.
14058 * layout.h (Layout::incremental_inputs): New method.
14059 (Layout::create_incremental_info_sections): New method.
14060 (Layout::incremental_inputs_): New field.
14061 * main.cc (main): Notify Incremental_input of the command line.
14066 * gold.h (reserve_unordered_map): Define, three versions, one for
14067 each version of Unordered_map.
14068 * layout.cc (Layout::Layout): Remove options parameter. Add
14069 number_of_input_files parameter. Don't initialize options_.
14070 Initialize number_of_input_files_ and resized_signatures_. Move
14071 sections_are_attached_.
14072 (Layout::layout_group): Reserve space for group_signatures_.
14073 (Layout::find_or_add_kept_section): Change name parameter to be a
14074 reference. Resize signatures_ map when it gets large enough.
14075 (Layout::layout_eh_frame): Use parameters->options() instead of
14077 (Layout::make_output_section): Likewise.
14078 (Layout::attach_allocated_section_to_segment): Likewise.
14079 (Layout::finalize, Layout::create_executable_stack): Likewise.
14080 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14081 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14082 * layout.h (class Layout): Update declarations. Remove options_
14083 field. Add number_of_input_files_ and resized_signatures_
14084 fields. Move sections_are_attached_ field.
14085 * main.cc (main): Pass number of input files to Layout
14086 constructor. Don't pass options.
14090 * ffsll.c (ffsll): Correct implementation.
14094 * ffsll.c: New file.
14095 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14096 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14097 * ftruncate.c (ftruncate): Declare before definition.
14098 * mremap.c (mremap): Likewise.
14099 * pread.c (pread): Likewise.
14100 * configure, Makefile.in, config.in: Rebuild.
14102 * mremap.c: New file.
14103 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14104 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14105 (mremap): Declare if HAVE_MREMAP is not defined.
14106 * configure, Makefile.in, config.in: Rebuild.
14110 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14111 position independent.
14112 * sparc.cc (Target_sparc::check_non_pic): Likewise.
14113 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14117 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14119 (needs_dynamic_reloc): Likewise.
14123 * yyscript.y (file_cmd): Recognize EXTERN.
14124 (extern_name_list, extern_name_list_body): New nonterminals.
14125 * script.cc (script_add_extern): Define.
14126 * script-c.h (script_add_extern): Declare.
14130 * object.cc (is_elf_object): Define.
14131 * object.h (is_elf_object): Declare.
14132 * archive.cc (Archive::get_elf_object_for_member): Call
14134 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14138 * output.cc (Output_file::map_anonymous): Define.
14139 (Output_file::map): Use map_anonymous. If the regular mmap fails,
14140 try an anonymous one. Report the size if the mmap fails.
14141 * output.h (class Output_file): Declare map_anonymous.
14145 * target-select.cc (instantiate_target): Don't acquire the lock if
14146 the instantiated_target_ field has already been set.
14150 * gold-threads.h (class Initialize_lock): Define.
14151 * gold-threads.cc (class Initialize_lock_once): Define.
14152 (initialize_lock_control): New static variable.
14153 (initialize_lock_pointer): New static variable.
14154 (initialize_lock_once): New static function.
14155 (Initialize_lock::Initialize_lock): Define.
14156 (Initialize_lock::initialize): Define.
14157 * target-select.h: Include "gold-threads.h".
14158 (class Target_selector): Add lock_ and initialize_lock_ fields.
14159 Don't define instantiate_target, just declare it.
14160 * target-select.cc (Target_selector::Target_selector): Initialize
14162 (Target_selector::instantiate_target): Define.
14163 * descriptors.h: Include "gold-threads.h".
14164 (class Descriptors): Add initialize_lock_ field.
14165 * descriptors.cc (Descriptors::Descriptors): Initialize new
14167 (Descriptors::open): Use initialize_lock_ field
14168 * errors.h (class Errors): Add initialize_lock_ field.
14169 * errors.cc (Errors::Errors): Initialize new field.
14170 (Errors::initialize_lock): Use initialize_lock_ field.
14171 * powerpc.cc (class Target_selector_powerpc): Remove
14172 instantiated_target_ field. In do_recognize call
14173 instantiate_target rather than do_instantiate_target. In
14174 do_instantiate_target just allocate a new target.
14175 * sparc.cc (class Target_selector_sparc): Likewise.
14177 * freebsd.h: New file.
14178 * i386.cc: Include "freebsd.h".
14179 (Target_i386): Derive from Target_freebsd rather than
14181 (Target_selector_i386): Derive from Target_selector_freebsd rather
14182 than Target_selector.
14183 * x86_64.cc: Include "freebsd.h".
14184 (Target_x86_64): Derive from Target_freebsd rather than
14186 (Target_selector_x86_64): Derive from Target_selector_freebsd
14187 rather than Target_selector.
14188 * target.h (class Target): Add adjust_elf_header and
14189 do_adjust_elf_header.
14190 * output.cc (Output_file_header:: do_sized_write): Call target
14191 adjust_elf_header routine.
14192 * configure.tgt: Set targ_osabi.
14193 * configure.ac: Define GOLD_DEFAULT_OSABI.
14194 * parameters.cc (Parameters::default_target): Pass
14195 GOLD_DEFAULT_OSABI to select_target.
14196 * target-select.h (class Target_selector): Make instantiate_target
14197 protected rather than private.
14198 * Makefile.am (HFILES): Add freebsd.h.
14199 * configure, Makefile.in, config.in: Rebuild.
14201 * merge.cc (do_add_input_section): Correct pend value. Change
14202 message about last entry not being null terminated from error to
14207 * incremental.cc: New file.
14208 * Makefile.am (CCFILES): Add incremental.cc.
14209 * Makefile.in: Rebuild.
14213 * layout.cc (Layout::output_section_name): Preserve names
14214 of '.note.' sections.
14218 * descriptors.cc (Descriptors::open): Check that the options are
14219 valid before using them.
14223 * script-sections.h: Include <list>.
14224 (class Script_sections): Change Sections_elements from std::vector
14225 to std::list. Typedef public Elements_iterator. Add
14226 orphan_section_placement_, data_segment_align_start_, and
14227 saw_data_segment_align_ fields. Remove data_segment_align_index_
14229 * script-sections.cc (class Orphan_section_placement): New class.
14230 (class Sections_element): Add virtual functions is_relro and
14231 orphan_section_init. Remove virtual function place_orphan_here.
14232 (class Output_section_definition): Add is_relro and
14233 orphan_section_init. Remove place_orphan_here.
14234 (class Orphan_output_section): Likewise.
14235 (Script_sections::Script_sections): Update for field changes.
14236 (Script_sections::data_segment_align): Set saw_data_segment_align_
14237 and data_segment_align_start_, not data_segment_align_index.
14238 (Script_sections::data_segment_relro_end): Check
14239 saw_data_segment_align_. Use data_segment_align_start_ rather
14240 than data_segment_align_index_.
14241 (Script_sections::place_orphan): Rewrite to use
14242 Orphan_section_placement.
14246 * archive.cc (Archive::add_symbols): Check for a version attached
14247 to the symbol name in the archive map.
14248 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14249 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14250 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14251 (ver_test_11.a): New target.
14252 * testsuite/Makefile.in: Rebuild.
14254 * configure.ac: Check for chsize and posix_fallocate. Replace
14256 * ftruncate.c: New file, from gnulib.
14257 * output.cc (posix_fallocate): Define dummy version if not
14258 HAVE_POSIX_FALLOCATE.
14259 (Output_file::map): Call posix_fallocate rather than lseek and
14261 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14262 * configure, Makefile.in, config.in: Rebuild.
14266 * layout.h (Layout::create_note): Add section_name parameter.
14267 * layout.cc (Layout::create_note): Likewise.
14268 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14272 * descriptors.cc: Include "options.h".
14273 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14274 (Descriptors::open): Always use O_CLOEXEC when opening a new
14275 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
14276 then set FD_CLOEXEC.
14278 * sparc.cc (class Target_sparc): Add has_got_section.
14279 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14280 make sure we have a GOT section.
14282 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14283 (Target_sparc::Scan::local): Likewise.
14284 (Target_sparc::Scan::global): Likewise.
14285 (Target_sparc::Relocate::relocate): Likewise.
14286 (Target_sparc::Relocate::relocate_tls): Likewise.
14288 * symtab.cc (Symbol_table::define_default_version): New function,
14289 broken out of add_from_object.
14290 (Symbol_table::add_from_object): Call define_default_version.
14291 (Symbol_table::define_special_symbol): Add resolve_oldsym
14292 parameter. Change all callers. If the version for a symbol comes
14293 from a version script, resolve it with the symbol with the same
14294 name with no version. Also add the symbol without a version if
14296 (do_define_in_output_data): If resolving with oldsym, don't delete
14298 (do_define_in_output_segment): Likewise.
14299 (do_define_as_constant): Likewise.
14300 * symtab.h (class Symbol_table): Update declarations.
14304 * readsyms.cc (Read_symbols::incompatible_warning): New function.
14305 (Read_symbols::requeue): New function.
14306 (Read_symbols::do_read_symbols): If make_elf_object fails because
14307 the target type is not configured, and the file was searched for,
14308 issue a warning and retry with the next directory.
14309 (Add_symbols::run): If the file has an incompatible format, and
14310 it was searched for, requeue the Read_symbols task. On error,
14311 release the object.
14312 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
14313 dirindex parameter to constructor. Change all callers. Declare
14314 incompatible_warning and requeue.
14315 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14316 input_argument_ and input_group_ fields. Add them to
14317 constructor. Change all callers.
14318 (class Read_script): Add dirindex_ field. Add it to constructor.
14319 Change all callers.
14320 * archive.cc (Archive::setup): Remove input_objects parameter.
14321 Change all callers.
14322 (Archive::get_file_and_offset): Likewise.
14323 (Archive::read_all_symbols): Likewise.
14324 (Archive::read_symbols): Likewise.
14325 (Archive::get_elf_object_for_member): Remove input_objects
14326 parameter. Add punconfigured parameter. Change all callers.
14327 (Archive::add_symbols): Change return type to bool. Check return
14328 value of include_member.
14329 (Archive::include_all_members): Likewise.
14330 (Archive::include_member): Change return type to bool. Return
14331 false if first included object has incompatible target. Set
14332 included_member_ field.
14333 (Add_archive_symbols::run): If add_symbols returns false, requeue
14335 * archive.h (class Archive): Add included_member_ field.
14336 Initialize it in constructor. Add input_file and searched_for
14337 methods. Update declarations.
14338 (class Add_archive_symbols): Add dirpath_, dirindex_, and
14339 input_argument_ fields. Add them to constructor. Change all
14341 * script.cc: Include "target-select.h".
14342 (class Parser_closure): Add skip_on_incompatible_target_ and
14343 found_incompatible_target_ fields. Add
14344 skip_on_incompatible_target parameter to constructor. Change all
14345 callers. Add methods skip_on_incompatible_target,
14346 clear_skip_on_incompatible_target, found_incompatible_target, and
14347 set_found_incompatible_target.
14348 (read_input_script): Add dirindex parameter. Change all callers.
14349 If parser finds an incompatible target, requeue Read_symbols
14351 (script_set_symbol): Clear skip_on_incompatible_target in
14353 (script_add_assertion, script_parse_option): Likewise.
14354 (script_start_sections, script_add_phdr): Likewise.
14355 (script_check_output_format): New function.
14356 * script.h (read_input_script): Update declaration.
14357 * script-c.h (script_check_output_format): Declare.
14358 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14359 (ignore_cmd): Remove OUTPUT_FORMAT.
14360 * fileread.cc (Input_file::Input_file): Add explicit this.
14361 (Input_file::will_search_for): New function.
14362 (Input_file::open): Add pindex parameter. Change all callers.
14363 * fileread.h (class Input_file): Add input_file_argument method.
14364 Declare will_search_for. Update declarations.
14365 * object.cc (make_elf_object): Add punconfigured parameter.
14366 Change all callers.
14367 * object.h (class Object): Make input_file public. Add
14368 searched_for method.
14369 (make_elf_object): Update declaration.
14370 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
14372 * dirsearch.h (class Dirsearch): Update declaration.
14373 * options.h (class General_options): Add --warn-search-mismatch.
14374 * parameters.cc (Parameters::is_compatible_target): New function.
14375 * parameters.h (class Parameters): Declare is_compatible_target.
14376 * workqueue.cc (Workqueue::add_blocker): New function.
14377 * workqueue.h (class Workqueue): Declare add_blocker.
14379 * fileread.cc (Input_file::open): Remove options parameter.
14380 Change all callers.
14381 (Input_file::open_binary): Likewise.
14382 * script.cc (read_input_script): Likewise.
14383 * readsyms.h (class Read_symbols): Remove options_ field. Remove
14384 options parameter from constructor. Change all callers.
14385 (class Read_script): Likewise.
14386 * fileread.h (class Input_file): Update declarations.
14387 * script.h (read_input_script): Update declaration.
14391 * po/es.po: New Spanish translation.
14395 * options.cc (parse_short_option): Keep dash_z from registering itself.
14400 * target-reloc.h (relocate_section): Pass output_section to
14402 * i386.cc (Target_i386::should_apply_static_reloc): Add
14403 output_section parameter. Change all callers.
14404 (Target_i386::Relocate::relocate): Add output_section parameter.
14405 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14406 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14407 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14408 * testsuite/two_file_shared.sh: New script.
14409 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14410 (check_DATA): Add two_file_shared.dbg.
14411 (two_file_shared.dbg): New target.
14412 * testsuite/Makefile.in: Rebuild.
14416 * configure.ac: Check for byteswap.h.
14417 * configure: Rebuild.
14418 * config.in: Rebuild.
14422 * layout.cc (Layout::find_or_add_kept_section): New function.
14423 (Layout::add_comdat): Removed.
14424 * layout.h (struct Kept_section): Move out of class Layout.
14425 Remove trailing underscores from field names. Add group_sections
14426 field. Rename group_ field to is_group. Change all uses.
14427 (class Layout): Declare find_or_add_kept_section, not add_comdat.
14428 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14429 comdat_groups_ field.
14430 (Sized_relobj::include_section_group): Use
14431 find_or_add_kept_section and Kept_section::group_sections.
14432 (Sized_relobj::include_linkonce_section): Likewise.
14433 * object.cc (class Sized_relobj): Don't define Comdat_group or
14434 Comdat_group_table. Remove find_comdat_group and
14435 add_comdat_group. Remove comdat_groups_ field.
14436 * plugin.cc (include_comdat_group): Use
14437 Layout::find_or_add_kept_section.
14441 * README: --gc-sections and map files are now supported. Document
14442 some build requirements.
14445 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14446 relocatable link set the value of the section symbol to zero.
14447 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14448 relocatable link don't include the section address in the local
14454 * options.h (class Search_directory): Add is_system_directory.
14455 (class General_options): Declare is_in_system_directory.
14456 * options.cc (get_relative_sysroot): Make static.
14457 (get_default_sysroot): Make static.
14458 (General_optoins::is_in_system_directory): New function.
14459 * fileread.cc (Input_file::is_in_system_directory): New function.
14460 * fileread.h (class Input_file): Declare is_in_system_directory.
14461 * object.h (class Object): Add is_in_system_directory.
14462 (class Input_objects): Remove system_library_directory_ field.
14463 * object.cc (Input_objects::add_object): Don't set
14464 system_library_directory_.
14465 (input_objects::found_in_system_library_directory): Remove.
14466 * symtab.cc (Symbol_table::write_globals): Remove input_objects
14467 parameter. Change all callers.
14468 (Symbol_table::sized_write_globals): Likewise.
14469 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14470 Call Object::is_in_system_directory.
14471 * symtab.h (class Symbol_table): Update declarations.
14474 * descriptors.h (Open_descriptor): Add is_on_stack field.
14475 * descriptors.cc (Descriptors::open): If the descriptor is on the
14476 top of the stack, remove it. Initialize is_on_stack field.
14477 (Descriptors::release): Only add pod to stack if it is not on the
14479 (Descriptors::close_some_descriptor): Clear stack_next and
14480 is_on_stack fields.
14483 * output.cc (Output_section::find_starting_output_address): Rename
14484 from starting_output_address; add PADDR parameter; change return
14486 * output.h (class Output_section): Declare
14487 find_starting_output_address instead of starting_output_address.
14488 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14489 section symbol for which we can't find a merge section.
14492 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14493 hidden or internal, force the symbol to be local.
14494 * resolve.cc (Symbol::override_visibility): Define.
14495 (Symbol::override_base): Use override_visibility.
14496 (Symbol_table::resolve): Likewise.
14497 (Symbol::override_base_with_special): Likewise.
14498 (Symbol_table::override_with_special): If the visibility is hidden
14499 or internal, force the symbol to be local.
14500 * symtab.h (class Symbol): Add set_visibility and
14501 override_visibility.
14502 * testsuite/ver_test_1.sh: New file.
14503 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14504 (check_DATA): Add ver_test_1.syms.
14505 (ver_test_1.syms): New target.
14506 * testsuite/Makefile.in: Rebuild.
14510 * layout.cc (Layout::choose_output_section): Don't rename sections
14511 when using a linker script that has a SECTIONS clause.
14512 * Makefile.in: Regenerate.
14514 * testsuite/Makefile.am (script_test_5.sh): New test case.
14515 * testsuite/Makefile.in: Regenerate.
14516 * testsuite/script_test_5.cc: New file.
14517 * testsuite/script_test_5.sh: New file.
14518 * testsuite/script_test_5.t: New file.
14522 * archive.cc (Archive::include_member): Update calls to add_symbols.
14523 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14524 the Layout argument.
14525 * dynobj.h (do_add_symbols): Add the Layout argument.
14526 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14528 * object.h (Object::add_symbols): Add the Layout argument.
14529 (Object::do_add_symbols): Add the Layout argument.
14530 (Sized_relobj::do_add_symbols): Add the Layout argument.
14531 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14532 Unify the two versions.
14533 (Add_plugin_symbols): Remove.
14534 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14535 (Sized_pluginobj::do_add_symbols): Unify the two versions.
14536 (Add_plugin_symbols): Remove.
14537 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14538 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14539 (Add_symbols::run): Make it work with Pulginobj.
14543 * object.cc (Sized_relobj::do_layout): Make info message start
14544 with lower case letter.
14548 * binary.cc: Fix file comment.
14550 * options.h (enum Incremental_disposition): Define.
14551 (class General_options): Add new options: --incremental,
14552 --incremental_changed, --incremental_unchanged,
14553 --incremental_unknown. Add incremental_disposition_ and
14554 implicit_incremental_ fields.
14555 (General_options::incremental_disposition): New function.
14556 (class Position_dependent_options): Add incremental_disposition
14558 (Position_dependent_options::copy_from_options): Set incremental
14560 * options.cc (General_options::parse_incremental_changed): New
14562 (General_options::parse_incremental_unchanged): New function.
14563 (General_options::parse_incremental_unknown): New function.
14564 (General_options::General_options): Initialize new fields
14565 incremental_disposition_ and implicit_incremental_.
14566 (General_options::finalize): Check for uasge of --incremental-*
14567 without --incremental.
14571 * gold.h (gold_undefined_symbol): Change to take only a Symbol
14572 pointer and to report location as the file name associated with
14574 (gold_undefined_symbol_at_location): New function to replace the
14575 old gold_undefined_symbol functionality.
14576 * target-reloc.h (relocate_section): Update to use
14577 gold_undefined_symbol_at_location.
14578 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14579 Call gold_undefined_symbol function rather than gold_error.
14580 * errors.h (Errors::undefined_symbol): Take location as a
14581 string, rather than calculating it from a relocation.
14582 * errors.cc (Errors::fatal): Print "fatal error:" before the
14584 (Errors::error, Errors::error_at_location): Print "error: "
14585 before the formatted message.
14586 (Errors::undefined_symbol): Take location as a string, rather
14587 than calculating it from a relocation.
14588 (gold_undefined_symbol_at_location): New function akin to
14589 old gold_undefined_symbol, calculates location from relocation.
14590 (gold_undefined_symbol): Change to take only a Symbol pointer
14591 and to report location as the file name associated with the symbol.
14592 * testsuite/debug_msg.sh: Update for changed error messages.
14593 * testsuite/undef_symbol.sh: Likewise.
14598 * reduced_debug_output.h
14599 (Output_reduced_debug_abbrev_section::failed): Use format for
14601 (Output_reduced_debug_info_section::faild): Likewise.
14605 * script.cc (Lazy_demangler): New class.
14606 (Version_script_info::get_symbol_version_helper): Demangle a
14611 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14613 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14617 * version.cc (version_string): Bump to 1.9.
14619 * gold.h: Include <cstring> and <stdint.h>.
14620 * version.cc: Include <cstdio>.
14621 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14623 * reduced_debug_output.cc (insert_into_vector): Rename from
14624 Insert_into_vector; change all callers. Use Swap_unaligned to
14625 avoid aliasing issue; remove union since it is unnecessary.
14629 * Makefile.am (CCFILES): Add gc.cc.
14630 (HFILES): Add gc.h.
14631 * Makefile.in: Regenerate.
14632 * gold.cc (Gc_runner): New class.
14633 (queue_initial_tasks): Call garbage collection related tasks
14634 when corresponding options are invoked.
14635 (queue_middle_gc_tasks): New function.
14636 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14637 processed early before laying out sections during garbage collection.
14638 * gold.h (queue_middle_gc_tasks): New function.
14639 (is_prefix_of): Move from "layout.cc".
14640 * i386.cc (Target_i386::gc_process_relocs): New function.
14641 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14642 * main.cc (main): Create object of class "Garbage_collection".
14643 * object.cc (Relobj::copy_symbols_data): New function.
14644 (Relobj::is_section_name_included): New function.
14645 (Sized_relobj::do_layout): Allow this function to be called twice
14646 during garbage collection and defer layout of section during the
14648 * object.h (Relobj::get_symbols_data): New function.
14649 (Relobj::is_section_name_included): New function.
14650 (Relobj::copy_symbols_data): New function.
14651 (Relobj::set_symbols_data): New function.
14652 (Relobj::get_relocs_data): New function.
14653 (Relobj::set_relocs_data): New function.
14654 (Relobj::is_output_section_offset_invalid): New pure virtual function.
14655 (Relobj::gc_process_relocs): New function.
14656 (Relobj::do_gc_process_relocs): New pure virtual function.
14657 (Relobj::sd_): New data member.
14658 (Sized_relobj::is_output_section_offset_invalid): New function.
14659 (Sized_relobj::do_gc_process_relocs): New function.
14660 * options.h (General_options::gc_sections): Modify to not be a no-op.
14661 (General_options::print_gc_sections): New option.
14662 * plugin.cc (Plugin_finish::run): Remove function call to
14663 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
14664 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14665 * reloc.cc (Read_relocs::run): Add task to process relocs and
14666 determine unreferenced sections when doing garbage collection.
14667 (Gc_process_relocs): New class.
14668 (Sized_relobj::do_gc_process_relocs): New function.
14669 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14670 sections that are garbage collected.
14671 * reloc.h (Gc_process_relocs): New class.
14672 * sparc.cc (Target_sparc::gc_process_relocs): New function.
14673 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14674 symbols whose corresponding sections are garbage collected.
14675 (Symbol_table::Symbol_table): Add new parameter for the garbage
14677 (Symbol_table::gc_mark_undef_symbols): New function.
14678 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14679 (Symbol_table::gc_mark_dyn_syms): New function.
14680 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14682 (Symbol_table::add_from_object): Likewise.
14683 (Symbol_table::add_from_relobj): When building shared objects, do not
14684 treat externally visible symbols as garbage.
14685 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14686 table information for static and relocatable links.
14687 * symtab.h (Symbol_table::set_gc): New function.
14688 (Symbol_table::gc): New function.
14689 (Symbol_table::gc_mark_undef_symbols): New function.
14690 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14691 (Symbol_table::gc_mark_dyn_syms): New function.
14692 (Symbol_table::gc_): New data member.
14693 * target.h (Sized_target::gc_process_relocs): New pure virtual
14695 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14696 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14700 * options.h (General_options::gc_sections): Define as a no-op for now.
14701 (General_options::no_keep_memory): Ditto.
14702 (General_options::Bshareable): Define.
14703 * options.cc (General_options::finalize): Honor -Bshareable.
14707 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14708 read the value in the contents, since we don't use it. Use the
14709 template endianness when writing.
14710 (Relocate::relocate): Use it for R_PPC_REL16_HA.
14714 * configure.tgt (powerpc64-*): Fix targ_obj.
14718 * object.cc (Sized_relobj::write_local_symbols): Don't write out
14719 local symbols when stripping all symbols.
14723 * output.cc (Output_reloc): Add explicit instantiations.
14727 * archive.cc (Archive::get_elf_object_for_member): Remove call
14728 to File_read::claim_for_plugin.
14729 * descriptors.cc (Descriptors::open): Remove reference to
14731 (Descriptors::claim_for_plugin): Remove.
14732 * descriptors.h (Descriptors::claim_for_plugin): Remove.
14733 (Descriptors::is_claimed): Remove.
14734 (claim_descriptor_for_plugin): Remove.
14735 * fileread.cc (File_read::claim_for_plugin): Remove.
14736 * fileread.h (File_read::claim_for_plugin): Remove.
14737 (File_read::descriptor): Reopen descriptor if necessary.
14738 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
14739 (Plugin_manager::all_symbols_read): Add task parameter. Change
14741 (Plugin_manager::get_input_file): New function.
14742 (Plugin_manager::release_input_file): New function.
14743 (Pluginobj::Pluginobj): Add filesize parameter and initialize
14744 corresponding data member.
14745 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14746 and pass to base constructor. Change all callers.
14747 (get_input_file, release_input_file): New functions.
14748 (make_sized_plugin_object): Add filesize parameter. Change all callers.
14749 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14750 (Plugin_manager::all_symbols_read): Add task parameter.
14751 (Plugin_manager::get_input_file): New function.
14752 (Plugin_manager::release_input_file): New function.
14753 (Plugin_manager::task_): New data member.
14754 (Pluginobj::Pluginobj): Add filesize parameter.
14755 (Pluginobj::filename): New function.
14756 (Pluginobj::descriptor): New function.
14757 (Pluginobj::filesize): New function.
14758 (Pluginobj::filesize_): New data member.
14759 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14760 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14761 File_read::claim_for_plugin; use Object::unlock to unlock the file.
14763 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14764 with archive libraries.
14765 * testsuite/Makefile.in: Regenerate.
14766 * testsuite/plugin_test.c (struct sym_info): New type.
14767 (get_input_file, release_input_file): New static variables.
14768 (onload): Capture new transfer vector entries.
14769 (claim_file_hook): Stop reading at end of file according to filesize.
14770 Factor out parsing of readelf output into separate function.
14771 (all_symbols_read_hook): Exercise get_input_file and release_input_file
14772 APIs and get the source file name from the symbol table. Convert
14773 source file name to corresponding object file name. Print info
14774 message when adding new input files.
14775 (parse_readelf_line): New function.
14776 * testsuite/plugin_test_1.sh: Add checks for new info messages.
14777 * testsuite/plugin_test_2.sh: Likewise.
14778 * testsuite/plugin_test_3.sh: Likewise.
14779 * testsuite/plugin_test_4.sh: New test case.
14783 * version.cc (version_string): Bump to 1.8.
14787 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14788 * plugin.cc (Plugin_manager::finish): Rename as
14789 layout_deferred_objects. Move cleanup to separate function.
14790 (Plugin_manager::cleanup): New function.
14791 (Plugin_finish::run): Call layout_deferred_objects and cleanup
14793 * plugin.h (Plugin_manager::finish): Rename as
14794 layout_deferred_objects.
14795 (Plugin_manager::cleanup): New function.
14796 (Plugin_manager::cleanup_done): New field.
14800 * plugin.cc (is_visible_from_outside): New function.
14801 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14802 so we don't return "IR only" status for exported symbols or -r links.
14804 * testsuite/Makefile.am (plugin_test_3): New test case.
14805 * testsuite/Makefile.in: Regenerate.
14806 * testsuite/plugin_test_3.sh: New file.
14810 * object.cc (Sized_relobj::layout_section): New function.
14811 (Sized_relobj::do_layout): Defer layout of input sections until after
14812 plugin has provided replacement files.
14813 (Sized_relobj::do_layout_deferred_sections): New function.
14814 * object.h (Relobj::set_section_offset): Remove virtual keyword.
14815 (Relobj::layout_deferred_sections): New function.
14816 (Relobj::do_layout_deferred_sections): New function.
14817 (Sized_relobj::do_layout_deferred_sections): New function.
14818 (Sized_relobj::layout_section): New function.
14819 (Sized_relobj::Deferred_layout): New structure.
14820 (Sized_relobj::deferred_layout_): New field.
14821 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14822 Change all callers. Layout deferred sections.
14823 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
14825 (Plugin_hook::run): Move code from do_plugin_hook inline.
14826 (Plugin_hook::do_plugin_hook): Remove.
14827 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14828 (Plugin_manager::finish): Renamed, was cleanup.
14829 (Plugin_manager::should_defer_layout): New function.
14830 (Plugin_manager::add_deferred_layout_object): New function.
14831 (Plugin_manager::Deferred_layout_list): New type.
14832 (Plugin_manager::deferred_layout_objects_): New field.
14833 (Plugin_hook::do_plugin_hook): Remove.
14837 * options.h (class General_options): Add --no case for
14842 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14844 (Plugin_manager::claim_file): Create plugin object even if
14845 plugin did not call the add_symbols callback.
14846 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14847 asking for more symbols than were added.
14848 * testsuite/Makefile.am (plugin_test_1): Add test case with
14850 (empty.syms): New target.
14851 * testsuite/Makefile.in: Regenerate.
14852 * testsuite/plugin_test.c (claim_file_hook): Add new debug
14853 message. Don't call add_symbols if no globals.
14854 (all_symbols_read_hook): Don't provide replacement for empty
14859 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14860 r_type == 0 for a local symbol with r_sym == 0.
14861 (scan_relocatable_relocs): Pass r_sym to
14862 local_non_section_strategy.
14863 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14866 * configure.ac: Update test for TLS descriptors: they are
14867 supported as of glibc 2.9.
14868 * configure: Rebuild.
14873 * target-reloc.h (Default_scan_relocatable_relocs): For each
14874 function, map r_type == 0 to RELOC_DISCARD.
14878 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14879 object to override a kept COMDAT group from a plugin object.
14884 * yyscript.y (file_cmd): Handle INPUT.
14886 * testsuite/initpri1.c: Change all declarations to be full
14887 prototypes by adding void, to avoid compiler warnings.
14891 * options.cc (General_options::parse_plugin_opt): New.
14892 (General_options::add_plugin): The argument now is just the filename.
14893 (General_options::add_plugin_option): New.
14894 * options.h (plugin_opt): New.
14895 (add_plugin): Change argument name.
14896 (add_plugin_option): New.
14897 * plugin.cc (Plugin::load): Don't parse the plugin option.
14898 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14899 (Plugin::add_option): New.
14900 (Plugin::args_): Change type.
14901 (Plugin::filename_): New.
14902 (Plugin_manager::add_plugin_option): New.
14903 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14904 * testsuite/Makefile.in: Regenerate.
14908 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14909 Handle --strip-lto-sections option.
14910 * options.h (strip_lto_sections): New option.
14914 * plugin.cc (ld_plugin_message): Change format parameter to const.
14915 Fix mismatch between new[] and delete.
14919 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14924 * options.cc (General_options::parse_dynamic_list): New function.
14925 * options.h (General_options): New flags dynamic_list,
14926 dynamic_list_data, dynamic_list_cpp_new, and
14927 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
14928 (General_options::in_dynamic_list): New function.
14929 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14930 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14931 (Lex::can_continue_name): Likewise.
14933 (read_script_file): New parameter script_options.
14934 (read_dynamic_list): New function.
14935 (Script_options::define_dynamic_list): New function.
14936 (dynamic_list_keyword_parsecodes): New variable.
14937 (dynamic_list_keywords): New variable.
14938 * script.h (Script_options::define_dynamic_list): New function
14940 (read_dynamic_list): New function prototype.
14941 * symtab.cc (strprefix): New macro.
14942 (Symbol::should_add_dynsym_entry): Support dynamic_list,
14943 dynamic_list_data, dynamic_list_cpp_new, and
14944 dynamic_list_cpp_typeinfo.
14945 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14946 (dynamic_list_expr): New rule.
14947 (dynamic_list_nodes): Likewise.
14948 (dynamic_list_node): Likewise.
14949 * testsuite/Makefile.am (dynamic_list): New test.
14950 * testsuite/Makefile.in: Regenerated.
14951 * testsuite/dynamic_list.t: New file.
14952 * testsuite/dynamic_list.sh: New file.
14956 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14957 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14958 (t11_last): Likewise.
14959 * testsuite/ver_test_6.c (main): Likewise.
14963 * options.c (General_options::finalize): Add check for -static and
14965 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14970 * plugin.cc (make_sized_plugin_object): Fix conditional
14971 compilation to work when not all targets are enabled.
14975 * archive.cc (Archive::get_file_and_offset): Use filename instead
14976 of name to get library path.
14977 (Archive::include_member): Unlock external member of a thin archive.
14979 * testsuite/Makefile.am (TEST_AR): New variable.
14980 (thin_archive_test_1): New test.
14981 (thin_archive_test_2): New test.
14982 * testsuite/Makefile.in: Regenerate.
14983 * testsuite/thin_archive_main.cc: New file.
14984 * testsuite/thin_archive_test_1.cc: New file.
14985 * testsuite/thin_archive_test_2.cc: New file.
14986 * testsuite/thin_archive_test_3.cc: New file.
14987 * testsuite/thin_archive_test_4.cc: New file.
14991 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14992 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14994 (Sized_relobj::do_finalize_local_symbols): Likewise.
14995 (Sized_relobj::map_to_kept_section): Likewise.
14996 * object.h (Sized_relobj::invalid_address): New constant.
14997 (Sized_relobj::do_output_section_offset): Check for invalid_address
14999 * output.cc (Output_reloc::local_section_offset): Use constant
15000 invalid_address instead of -1U.
15001 (Output_reloc::get_address): Likewise.
15002 (Output_section::output_address): Change -1U to -1ULL.
15003 * output.h (Output_reloc::invalid_address): New constant.
15004 * reloc.cc (Sized_relobj::write_sections): Use constant
15005 invalid_address instead of -1U.
15006 (Sized_relobj::relocate_sections): Likewise.
15007 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15008 values for merge sections.
15009 * target-reloc.h (relocate_for_relocatable): Use constant
15010 invalid_address instead of -1U.
15014 Add plugin functionality for link-time optimization (LTO).
15015 * configure.ac (plugins): Add --enable-plugins option.
15016 * configure: Regenerate.
15017 * config.in: Regenerate.
15018 * Makefile.am (LIBDL): New variable.
15019 (CCFILES): Add plugin.cc.
15020 (HFILES): Add plugin.h.
15021 (ldadd_var): Add LIBDL.
15022 * Makefile.in: Regenerate.
15024 * archive.cc: Include "plugin.h".
15025 (Archive::setup): Don't preread archive symbols when using a plugin.
15026 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
15027 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15029 (Archive::include_member): Add symbols from plugin objects.
15030 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15031 * descriptors.cc (Descriptors::open): Check for file descriptors
15032 abandoned by plugins.
15033 (Descriptors::claim_for_plugin): New function.
15034 * descriptors.h (Descriptors::claim_for_plugin): New function.
15035 (Open_descriptor::is_claimed): New field.
15036 (claim_descriptor_for_plugin): New function.
15037 * fileread.cc (File_read::claim_for_plugin): New function.
15038 * fileread.h (File_read::claim_for_plugin): New function.
15039 (File_read::descriptor): New function.
15040 * gold.cc: Include "plugin.h".
15041 (queue_initial_tasks): Add task to call plugin hooks for generating
15043 * main.cc: Include "plugin.h".
15044 (main): Load plugin libraries.
15045 * object.h (Pluginobj): Declare.
15046 (Object::pluginobj): New function.
15047 (Object::do_pluginobj): New function.
15048 (Object::set_target): New function.
15049 * options.cc: Include "plugin.h".
15050 (General_options::parse_plugin): New function.
15051 (General_options::General_options): Initialize plugins_ field.
15052 (General_options::add_plugin): New function.
15053 * options.h (Plugin_manager): Declare.
15054 (General_options): Add --plugin option.
15055 (General_options::has_plugins): New function.
15056 (General_options::plugins): New function.
15057 (General_options::add_plugin): New function.
15058 (General_options::plugins_): New field.
15059 * plugin.cc: New file.
15060 * plugin.h: New file.
15061 * readsyms.cc: Include "plugin.h".
15062 (Read_symbols::do_read_symbols): Check for archive before checking
15063 for ELF file. Call plugin hooks to claim files.
15064 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15065 from a real object file; force override when processing replacement
15067 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15068 (Symbol::init_base_object): Likewise.
15069 (Symbol::init_base_output_data): Likewise.
15070 (Symbol::init_base_output_segment): Likewise.
15071 (Symbol::init_base_constant): Likewise.
15072 (Symbol::init_base_undefined): Likewise.
15073 (Symbol::output_section): Assert that object is not a plugin.
15074 (Symbol_table::add_from_pluginobj): New function.
15075 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15077 (Symbol_table::sized_write_globals): Likewise.
15078 (Symbol_table::add_from_pluginobj): Instantiate template.
15079 * symtab.h (Sized_pluginobj): Declare.
15080 (Symbol::in_real_elf): New function.
15081 (Symbol::set_in_real_elf): New function.
15082 (Symbol::in_real_elf_): New field.
15083 (Symbol_table::add_from_pluginobj): New function.
15085 * testsuite/Makefile.am (AM_CFLAGS): New variable.
15086 (LIBDL): New variable.
15087 (LDADD): Add LIBDL.
15088 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15089 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15090 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15091 (MOSTLYCLEANFILES): Likewise.
15092 * testsuite/Makefile.in: Regenerate.
15093 * testsuite/plugin_test.c: New file.
15094 * testsuite/plugin_test_1.sh: New file.
15095 * testsuite/plugin_test_2.sh: New file.
15099 * target-reloc.h (relocate_section): Check whether a symbol is
15100 defined by the ABI before reporting an undefined symbol error.
15101 * target.h (Target::is_defined_by_abi): Make parameter const.
15102 (Target::do_is_defined_by_abi): Likewise.
15103 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15104 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15105 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15106 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15107 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15108 * testsuite/Makefile.in: Rebuild.
15110 * fileread.cc (make_view): Add casts to avoid warning.
15114 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15115 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15119 * options.h (General_options::output_is_executable): New.
15120 (General_options::output_is_pie): New.
15121 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15122 for shared libraries.
15123 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15127 * options.h (origin): New -z option.
15128 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15129 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15134 * fileread.cc (File_read::make_view): Add check for attempt to map
15135 beyond end of file.
15139 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15140 explicit instantiations.
15145 * options.cc (General_options::finalize): Allow undefined symbols
15146 in shlibs if linking -shared.
15149 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15150 symbols as not needing a dynsym entry.
15154 * fileread.cc (File_read::open): Do not lock the file unless it
15155 was successfully opened.
15159 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15160 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15161 * testsuite/tls_test.cc (struct int128): 128-bit struct
15162 for testing TLS relocs with non-zero addend.
15163 (v12): New TLS variable.
15165 (t_last): Add check for v12.
15166 * testsuite/tls_test.h (t12): New function.
15167 * testsuite/tls_test_main.cc (thread_routine): Call new test.
15171 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15172 set tls_segment_ or relro_segment_.
15173 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15175 * output.h (Output_section::clear_is_relro): New function.
15176 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15177 sections specially even when output_data_ is empty.
15178 (Output_segment::maximum_alignment): When first section is relro,
15179 only force alignment for PT_LOAD segments.
15180 * script.cc (script_data_segment_align): New function.
15181 (script_data_segment_relro_end): New function.
15182 * script-c.h (script_data_segment_align): Declare.
15183 (script_data_segment_relro_end): Declare.
15184 * script-sections.h (class Script_sections): Declare
15185 data_segment_align and data_segment_relro_end. Add fields
15186 segment_align_index_ and saw_relro_end_.
15187 * script-sections.cc (class Sections_element): Add set_is_relro
15188 virtual function. Add new bool* parameter to place_orphan_here.
15189 Add get_output_section virtual function.
15190 (class Output_section_definition): Add set_is_relro. Add new
15191 bool* parameter to place_orphan_here. Add get_output_section.
15192 Add is_relro_ field.
15193 (Output_section_definition::Output_section_definition): Initialize
15194 evaluated_address_, evaluated_load_address, evaluated_addralign_,
15195 and is_relro_ fields.
15196 (Output_section_definition::place_orphan_here): Add is_relro
15198 (Output_section_definition::set_section_addresses): Set relro for
15200 (Output_section_definition::alternate_constraint): Likewise.
15201 (class Orphan_output_section): Add new bool* parameter to
15202 place_orphan_here. Add get_output_section.
15203 (Orphan_output_section::place_orphan_here): Add is_relro
15205 (Script_sections::Script_sections): Initialize
15206 data_segment_align_index_ and saw_relro_end_.
15207 (Script_sections::data_segment_align): New function.
15208 (Script_sections::data_segment_relro_end): New function.
15209 (Script_sections::place_orphan): Set or clear is_relro.
15210 (Script_sections::set_section_addresses): Force alignment of first
15212 * yyscript.y (exp): Call script_data_segment_align and
15213 script_data_segment_relro_end.
15214 * testsuite/relro_script_test.t: New file.
15215 * testsuite/relro_test.cc (using_script): Declare.
15216 (t1, t2): Test using_script.
15217 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15218 (relro_script_test_SOURCES): Define.
15219 (relro_script_test_DEPENDENCIES): Define.
15220 (relro_script_test_LDFLAGS): Define.
15221 (relro_script_test_LDADD): Define.
15222 (relro_script_test.so): New target.
15223 * testsuite/Makefile.in: Rebuild.
15227 * archive.cc (Archive::total_archives, Archive::total_members)
15228 (Archive::total_members_loaded): New variables.
15229 (Archive::setup): Add parameter. Add option to preread
15231 (Archive::read_armap): Add counter.
15232 (Archive::get_file_and_offset): New function.
15233 (Archive::get_elf_object_for_member): New function.
15234 (Archive::read_all_symbols): New function.
15235 (Archive::read_symbols): New function.
15236 (Archive::add_symbols): Add counters.
15237 (Archive::include_all_members): Use armap to find members if it's
15239 (Archive::include_member): Skip reading symbols if already read.
15240 Factored code into Archive::get_file_and_offset and
15241 Archive::get_elf_object_for_member. Changed call to
15242 Mapfile::report_include_archive_member.
15243 (Archive::print_stats): New function.
15244 * archive.h: Declare Object and Read_symbols_data classes.
15245 (Archive::Archive): Add initializers for new members.
15246 (Archive::setup): Add parameter.
15247 (Archive::print_stats): New function.
15248 (Archive::total_archives, Archive::total_members)
15249 (Archive::total_members_loaded): New variables.
15250 (Archive::get_file_and_offset): New function.
15251 (Archive::get_elf_object_for_member): New function.
15252 (Archive::read_all_symbols): New function.
15253 (Archive::read_symbols): New function.
15254 (Archive::Archive_member): New class.
15255 (Archive::members_): New member.
15256 (Archive::num_members_): New member.
15257 * main.cc: Include archive.h.
15258 (main): Call Archive::print_stats.
15259 * mapfile.cc (Mapfile::report_include_archive_member): Delete
15260 archive parameter; member_name is now the fully-decorated name.
15261 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15262 * options.h: (General_options): Add --preread-archive-symbols option.
15263 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15268 * symtab.h (Symbol::use_plt_offset): New function.
15269 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15270 * powerpc.cc (Relocate::relocate): Likewise.
15271 * sparc.cc (Relocate::relocate): Likewise.
15272 * x86_64.cc (Relocate::relocate): Likewise.
15273 * testsuite/weak_plt.sh: New test.
15274 * testsuite/weak_plt_main.cc: New test.
15275 * testsuite/weak_plt_shared.cc: New test.
15276 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15277 (check_PROGRAMS): Add weak_plt.
15278 (check_DATA): Add weak_plt_shared.so.
15279 (weak_plt_main_pic.o, weak_plt): New targets.
15280 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15281 * testsuite/Makefile.in: Rebuild.
15283 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15285 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15286 * testsuite/Makefile.in: Rebuild.
15290 * Makefile.am (POTFILES.in): Set LC_ALL=C.
15291 * Makefile.in: Regenerate.
15292 * po/POTFILES.in: Regenerate.
15296 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15297 symbols before other symbols.
15298 * testsuite/script_test_2.cc (test_addr): Declare.
15299 (test_addr_alias): Declare.
15300 (main): Check that test_addr and test_addr_alias have the right
15302 * testsuite/script_test_2.t: Define test_addr_alias and
15308 * descriptors.cc: New file.
15309 * descriptors.h: New file.
15310 * gold-threads.h (class Hold_optional_lock): New class.
15311 * fileread.cc: Include "descriptors.h".
15312 (File_read::~File_read): Release descriptor rather than closing
15314 (File_read::open) [file]: Call open_descriptor rather than open.
15315 Set is_descriptor_opened_.
15316 (File_read::open) [memory]: Assert that descriptor is not open.
15317 (File_read::reopen_descriptor): New function.
15318 (File_read::release): Release descriptor.
15319 (File_read::do_read): Make non-const. Reopen descriptor.
15320 (File_read::read): Make non-const.
15321 (File_read::make_view): Reopen descriptor.
15322 (File_read::do_readv): Likewise.
15323 * fileread.h (class File_read): Add is_descriptor_opened_ field.
15324 Update declarations.
15325 * layout.cc: Include "descriptors.h".
15326 (Layout::create_build_id): Use open_descriptor rather than open.
15327 * output.cc: Include "descriptors.h".
15328 (Output_file::open): Use open_descriptor rather than open.
15329 * archive.cc (Archive::const_iterator): Change Archive to be
15331 (Archive::begin, Archive::end): Make non-const.
15332 (Archive::count_members): Likewise.
15333 * archive.h (class Archive): Update declarations.
15334 * object.h (Object::read): Make non-const.
15335 * Makefile.am (CCFILES): Add descriptors.cc.
15336 (HFILES): Add descriptors.h.
15337 * Makefile.in: Rebuild.
15340 * gold.h: Always include <clocale>. Add Solaris workarounds
15341 following code in binutils/sysdep.h.
15344 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15345 this->eh_frame_hdr_ is NULL before using it.
15347 * dynobj.cc (Versions::Versions): Update comment.
15349 * dynobj.cc (Versions::Versions): If there is an soname, use it as
15350 the base version name.
15352 * stringpool.cc (Stringpool_template::add_with_length): Set key to
15353 array size plus one.
15354 (Stringpool_template::set_string_offsets): Subtract one from key
15355 before using it as an array index.
15356 (Stringpool_template::get_offset_with_length): Likewise.
15357 (Stringpool_template::write_to_buffer): Likewise.
15358 * stringpool.h (Stringpool_template::get_offset_from_key):
15364 * object.h (Merged_symbol_value::value): Do our best to handle a
15368 * script.cc (Version_script_info::get_versions): Don't add empty
15369 version tag to return value.
15370 (Version_script_info::get_symbol_version_helper): Change return
15371 type to bool. Add pversion parameter. Change all callers.
15372 (script_register_vers_node): Don't require a non-NULL tag.
15373 * script.h (class Version_script_info): Update declarations.
15374 (Version_script_info::get_symbol_version): Change return type to
15375 bool. Add version parameter. Change all callers.
15376 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15377 handling. Handle an empty version from a version script.
15378 (Symbol_table::define_special_symbol): Likewise.
15379 * testsuite/ver_test_10.script: New file.
15380 * testsuite/ver_test_10.sh: New file.
15381 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15382 (check_DATA): Add ver_test_10.syms.
15383 (ver_test_10.syms, ver_test_10.so): New target.
15384 * testsuite/Makefile.in: Rebuild.
15388 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15389 to zero for undefined symbols from dynamic libraries.
15393 * symtab.cc (Symbol_table::resolve): Remove version parameter.
15394 Change all callers.
15395 * symtab.h (class Symbol_table): Update declaration.
15396 * testsuite/ver_test_9.cc: New file.
15397 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15398 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15399 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15400 (ver_test_9.so, ver_test_9.o): New targets.
15401 * testsuite/Makefile.in: Rebuild.
15405 * options.h (class General_options): Define --check-sections.
15406 * layout.cc (Layout::set_segment_offsets): Handle
15409 * options.h (class General_options): Define -n/--nmagic and
15411 * options.cc (General_options::finalize): For -n/--nmagic or
15412 -N/--omagic, set -static.
15413 * layout.cc (Layout::attach_allocated_section_to_segment): If
15414 -N/--omagic, don't put read-only and read-write sections in
15415 different segments.
15416 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15417 finding a read-only segment.
15418 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15419 don't set the minimum segment alignment to the common page size,
15420 and don't set the file offset to the address modulo the page size.
15421 * script-sections.cc (Script_sections::create_segments): If
15422 -n/--omagic, don't put read-only and read-write sections in
15423 different segments.
15425 * cref.cc: New file.
15426 * cref.h: New file.
15427 * options.h (class General_options): Add --print-symbol-counts.
15428 * main.cc (main): Issue defined symbol report if requested.
15429 * archive.cc (Archive::interpret_header): Make into a const member
15431 (Archive::add_symbols): Call Input_objects::archive_start and
15433 (Archive::const_iterator): Define new class.
15434 (Archive::begin, Archive::end): New functions.
15435 (Archive::include_all_members): Rewrite to use iterator.
15436 (Archive::count_members): New function.
15437 * archive.h (class Archive): Update declarations.
15438 (Archive::filename): New function.
15439 * object.cc: Include "cref.h".
15440 (Sized_relobj::Sized_relobj): Initialize defined_count_.
15441 (Sized_relobj::do_get_global_symbol_counts): New function.
15442 (Input_objects::add_object): Add object to cross-referencer.
15443 (Input_objects::archive_start): New function.
15444 (Input_objects::archive_stop): New function.
15445 (Input_objects::print_symbol_counts): New function.
15446 * object.h: Declare Cref and Archive.
15447 (Object::get_global_symbol_counts): New function.
15448 (Object::do_get_global_symbol_counts): New pure virtual function.
15449 (class Sized_relobj): Add defined_count_ field. Update
15451 (class Input_objects): Add cref_ field. Update constructor.
15452 Update declarations.
15453 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15455 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15457 (Sized_dynobj::do_get_global_symbol_counts): New function.
15458 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15459 defined_count_. Update declarations. Define Symbols typedef.
15460 * symtab.cc (Symbol_table::add_from_relobj): Add defined
15461 parameter. Change all callers.
15462 (Symbol_table::add_from_dynobj): Add sympointers and defined
15463 parameters. Change all callers.
15464 * symtab.h (class Symbol_table): Update declarations.
15465 * Makefile.am (CCFILES): Add cref.cc.
15466 (HFILES): Add cref.h.
15467 * Makefile.in: Rebuild.
15471 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15472 to zero when writing undefined symbols.
15476 * output.cc (Output_section::add_input_section): Don't try to
15477 merge empty merge sections.
15481 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15482 Include symbol version in error message.
15486 * configure.ac (gold_cv_c_random_seed): New configured variable.
15487 (RANDOM_SEED_CFLAGS): New substituted variable.
15488 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15489 * configure: Rebuild.
15490 * Makefile.in: Likewise.
15491 * testsuite/Makefile.in: Likewise.
15495 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15496 where we see NAME/NULL and NAME/VERSION as separate symbols.
15497 * testsuite/ver_test_main.cc (main): Call t4.
15498 (t4, t4_2a): Define.
15499 * testsuite/ver_test_2.cc (t4_2): Define.
15500 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15501 * testsuite/ver_test_4.cc (t4_2a): Define.
15502 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15503 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15507 * dynobj.cc (Versions::add_def): If we give an error about a
15508 missing version, go ahead and create the version anyhow.
15512 Handle output sections with more than 0x7fffffff bytes.
15513 * object.h (class Relobj): Change map_to_output_ to
15514 output_sections_, and just keep a section pointer. Change all
15515 uses. Move comdat group support to Sized_relobj.
15516 (Relobj::is_section_specially_mapped): Remove.
15517 (Relobj::output_section): Remove poff parameter. Change all
15519 (Relobj::output_section_offset): New function.
15520 (Relobj::set_section_offset): Rewrite.
15521 (Relobj::map_to_output): Remove.
15522 (Relobj::output_sections): New function.
15523 (Relobj::do_output_section_offset): New pure virtual function.
15524 (Relobj::do_set_section_offset): Likewise.
15525 (class Sized_relobj): Add section_offsets_ field. Add comdat
15526 group support from Relobj. Update declarations.
15527 (Sized_relobj::get_output_section_offset): New function.
15528 (Sized_relobj::do_output_section_offset): New function.
15529 (Sized_relobj::do_set_section_offset): New function.
15530 * object.cc (Relobj::output_section_address): Remove.
15531 (Sized_relobj::Sized_relobj): Initialize new fields.
15532 (Sized_relobj::include_section_group): Cast find_kept_object to
15534 (Sized_relobj::include_linkonce_section): Likewise.
15535 (Sized_relobj::do_layout): Use separate arrays for output section
15537 (Sized_relobj::do_count_local_symbols): Change map_to_output to
15539 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15540 output_sections and section_offsets.
15541 (Sized_relobj::write_local_symbols): Likewise.
15542 (map_to_kept_section): Compute output address directly.
15543 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15544 output_sections and section_offsets.
15545 (Sized_relobj::write_sections): Likewise.
15546 (Sized_relobj::relocate_sections): Likewise.
15547 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15548 * output.h (class Output_reloc): Update declarations. Change
15549 u2_.relobj to Sized_relobj*.
15550 (class Output_data_reloc): Change add functions to use
15552 * output.cc (Output_reloc::Output_reloc): Change relobj to
15554 (Output_reloc::local_section_offset): Change return type to
15555 Elf_Addr. Use get_output_section_offset.
15556 (Output_reloc::get_address): Likewise.
15557 (Output_section::is_input_address_mapped): Don't call
15558 is_section_specially_mapped.
15559 (Output_section::output_offset): Likewise.
15560 (Output_section::output_address): Likewise.
15561 (Output_section::starting_output_address): Likewise.
15562 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15563 parameter to Sized_relobj*.
15564 (Copy_relocs::need_copy_reloc): Likewise.
15565 (Copy_relocs::save): Likewise.
15566 * copy-relocs.h (class Copy_relocs): Update declarations.
15567 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15568 Sized_relobj*. Change relobj_ field to Sized_relobj*.
15569 * target-reloc.h (relocate_for_relocatable): Change
15570 offset_in_output_section type to Elf_Addr. Change code that uses
15572 * layout.cc (Layout::layout): Always set *off.
15573 * mapfile.cc (Mapfile::print_input_section): Use
15574 output_section_offset.
15575 * i386.cc (Target_i386::copy_reloc): Change object parameter to
15577 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15578 * sparc.cc (Target_sparc::copy_reloc): Likewise.
15579 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15583 * layout.cc (Layout::include_section): Do not discard unrecognized
15584 SHT_STRTAB sections.
15588 * script.cc (Lex::can_continue_name): Make '?' allowable in
15589 version-script names.
15590 * testsuite/version_script.map: Change glob pattern to use '?'
15595 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15602 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15603 versions]: Don't try to read the value in the contents, since we
15604 don't use it. Use the template endianness when writing.
15608 * fileread.cc (File_read::make_view): Assert on zero-length view.
15609 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15610 symbol table when there are no symbols to read.
15614 * version.cc (version_string): Bump to 1.7
15618 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15619 constant 0xFFFF to type Valtype.
15620 (Powerpc_relocate_functions::rel16_ha): Likewise.
15624 * output.h (Output_section::Input_section): Initialize p2align_ to
15625 zero for Output_section_data constructors.
15626 (Output_section::Input_section::addralign): If not an input
15627 section, return the alignment of the Output_section_data.
15628 * testsuite/copy_test.cc: New file.
15629 * testsuite/copy_test_1.cc: New file.
15630 * testsuite/copy_test_2.cc: New file.
15631 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15632 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15633 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15634 (copy_test_1_pic.o, copy_test_1.so): New targets.
15635 (copy_test_2_pic.o, copy_test_2.so): New targets.
15636 * testsuite/Makefile.in: Rebuild.
15638 * script-sections.cc (Script_sections::place_orphan): Initialize
15639 local variable exact.
15643 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15648 * powerpc.cc: New file.
15649 * Makefile.am (TARGETSOURCES): Add powerpc.cc
15650 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15651 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15652 * Makefile.in: Rebuild.
15656 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15658 (throwing, orig_terminate): New static variables.
15659 (terminate_handler): New static function.
15660 (t2): Set terminate handler.
15665 * binary.cc (Binary_to_elf::sized_convert): Fix .data
15670 * archive.cc (Archive::include_all_members) Correct to step
15671 over symbol table and extended name table in thin archives.
15676 * target-reloc.h (relocate_for_relocatable): Fix new_offset
15681 * reduced_debug_output.cc: New file.
15682 * reduced_debug_output.h: New file.
15683 * options.h (class General_options): Add --strip-debug-non-line.
15684 * options.cc (General_options::finalize): Add strip_debug_non_line
15685 to the strip heirarchy.
15686 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15688 * layout.cc: Include "reduced_debug_output.h".
15689 (Layout::Layout): Initialize new fields.
15690 (line_only_debug_sections): New static array.
15691 (is_lines_only_debug_sections): New static inline function.
15692 (Layout::include_section): Handle --strip-debug-non-line.
15693 (Layout::make_output_section): If --strip-debug-non-line, build
15694 new output sections for .debug_abbrev and .debug_info.
15695 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15696 gold. Warn about possible overflow.
15697 (read_signed_LEB_128): Likewise.
15698 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15699 (read_signed_LEB_128): Declare.
15700 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15701 (HFILES): Add reduced_debug_output.h.
15702 * Makefile.in: Rebuild.
15706 * mapfile.cc: New file.
15707 * mapfile.h: New file.
15708 * options.h (class General_options): Add -M/--print-map and -Map.
15709 * options.cc (General_options::finalize): Make -M equivalent to
15711 * main.cc: Include <cstdio> and "mapfile.h".
15712 (main): Open mapfile if requested.
15713 * gold.cc (class Middle_runner): Add mapfile_ field. Update
15714 constructor. Change caller.
15715 (queue_initial_tasks): Add mapfile parameter. Change caller.
15716 (queue_middle_tasks): Likewise.
15717 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15719 * archive.cc: Include "mapfile.h".
15720 (Archive::add_symbols): Add mapfile parameter. Change all
15721 callers. Pass mapfile, symbol, and reason to include_member.
15722 (Archive::include_all_members): Add mapfile parameter. Change all
15724 (Archive::include_member): Add mapfile, sym, and why parameters.
15725 Change all callers. Report inclusion to map file.
15726 * archive.h: Include "fileread.h".
15727 (class Archive): Update declarations.
15728 (Archive::file): New const method.
15729 (class Add_archive_symbols): Add mapfile_ field. Update
15730 constructor. Change all callers.
15731 * readsyms.h (class Read_symbols): Likewise.
15732 (class Finish_group): Likewise.
15733 (class Read_script): Likewise.
15734 * common.cc: Include "mapfile.h".
15735 (Symbol_table::allocate_commons): Add mapfile parameter. Change
15737 (Symbol_table::do_allocate_commons): Likewise.
15738 (Symbol_table::do_allocate_commons_list): Likewise. Report common
15739 symbol allocation to mapfile.
15740 * common.h (class Allocate_commons_task): Add mapfile_ field.
15741 Update constructor. Change all callers.
15742 * symtab.h (class Symbol_table): Update declarations.
15743 * layout.cc: Include "mapfile.h".
15744 (Layout_task_runner::run): Print information to mapfile.
15745 (Layout::create_gold_note): Change Output_data_fixed_space to
15746 Output_data_zero_fill.
15747 (Layout::create_build_id): Likewise.
15748 (Layout::print_to_mapfile): New function.
15749 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
15750 constructor. Change caller.
15751 (class Layout): Declare print_to_mapfile.
15752 * output.cc (Output_section::Input_section::print_to_mapfile): New
15754 (Output_section::add_input_section): If producing a map, always
15755 add to input_sections_ list.
15756 (Output_section::do_print_to_mapfile): New function.
15757 (Output_segment::print_sections_to_mapfile): New function.
15758 (Output_segment::print_section_list_to_mapfile): New function.
15759 * output.h: Include "mapfile.h".
15760 (Output_data::print_to_mapfile): New function.
15761 (Output_data::do_print_to_mapfile): New virtual function.
15762 (Output_segment_headers::do_print_to_mapfile): New function.
15763 (Output_file_header::do_print_to_mapfile): New function.
15764 (Output_data_const::do_print_to_mapfile): New function.
15765 (class Output_data_const_buffer): Add map_name_ field. Update
15766 constructor. Change all callers. Add do_print_to_mapfile
15768 (class Output_data_fixed_space): Likewise.
15769 (class Output_data_space): Likewise.
15770 (class Output_data_zero_fill): New class.
15771 (Output_data_strtab::do_print_to_mapfile): New function.
15772 (Output_data_reloc_base::do_print_to_mapfile): New function.
15773 (Output_relocatable_relocs::do_print_to_mapfile): New function.
15774 (Output_data_group::do_print_to_mapfile): New function.
15775 (Output_data_got::do_print_to_mapfile): New function.
15776 (Output_data_dynamic::do_print_to_mapfile): New function.
15777 (Output_symtab_xindex::do_print_to_mapfile): New function.
15778 (class Output_section): Declare do_print_to_mapflie. Declare
15779 print_to_mapfile in Input_section.
15780 (class Output_segment): Declare new functions.
15781 * object.h (Sized_relobj::symbol_count): New function.
15782 * script-sections.cc
15783 (Output_section_element_dot_assignment::set_section_addresses):
15784 Change Output_data_fixed_space to Output_data_zero_fill.
15785 (Output_data_expression::do_print_to_mapfile): New function.
15786 * script.cc (read_input_script): Add mapfile parameter. Change
15788 * script.h (read_input_script): Update declaration.
15789 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15790 (Eh_frame::do_print_to_mapfile): New function.
15791 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15792 (Output_merge_string::do_print_to_mapfile): New function.
15793 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15795 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15797 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15799 * Makefile.am (CCFILES): Add mapfile.cc.
15800 (HFILES): Add mapfile.h.
15801 * Makefile.in: Rebuild.
15805 * options.h (class General_options): Add -z relro.
15806 * layout.cc (Layout::Layout): Initialize relro_segment_.
15807 (Layout::add_output_section_data): Return the output section.
15808 (Layout::make_output_section): Rcognize relro sections and mark
15809 them appropriately.
15810 (Layout::attach_allocated_section_to_segment): Put relro sections
15811 in a PT_GNU_RELRO segment.
15812 (Layout::create_initial_dynamic_sections): Mark the .dynamic
15814 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15816 (Layout::linkonce_mapping): Map d.rel.ro.local to
15817 .data.rel.ro.local.
15818 (Layout::output_section_name): Us .data.rel.ro.local for any
15819 section which begins with that.
15820 * layout.h (class Layout): Update add_output_section_data
15821 declaration. Add relro_segment_ field.
15822 * output.cc (Output_section::Output_section): Initialize is_relro_
15823 and is_relro_local_ fields.
15824 (Output_segment::add_output_section): Group relro sections.
15825 (Output_segment::is_first_section_relro): New function.
15826 (Output_segment::maximum_alignment): If there is a relro section,
15827 align the segment to the common page size.
15828 (Output_segment::set_section_addresses): Track whether we are
15829 looking at relro sections. If the last section is a relro
15830 section, align to the common page size.
15831 (Output_segment::set_section_list_addresses): Add in_relro
15832 parameter. Change all callers. Align to the page size when
15833 moving from relro to non-relro section.
15834 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15836 * output.h (class Output_section): Add is_relro_ and
15837 is_relro_local_ fields.
15838 (Output_section::is_relro): New function.
15839 (Output_section::set_is_relro): New function.
15840 (Output_section::is_relro_local): New function.
15841 (Output_section::set_is_relro_local): New function.
15842 (class Output_segment): Update declarations.
15843 * i386.cc (Target_i386::got_section): Mark .got section as relro.
15844 * sparc.cc (Target_sparc::got_section): Likewise.
15845 * x86_64.cc (Target_x86_64::got_section): Likewise.
15846 * testsuite/relro_test_main.cc: New file.
15847 * testsuite/relro_test.cc: New file.
15848 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15849 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15850 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15851 (relro_test.so, relro_test_pic.o): New targets.
15852 * testsuite/Makefile.in: Rebuild.
15856 * output.cc (Output_segment::add_output_section): Remove front
15858 * output.h (class Output_segment): Remove
15859 add_initial_output_section and overloaded add_output_section.
15860 Update declaration of remaining add_output_section.
15861 * layout.cc (Layout::create_interp): Call add_output_section
15862 rather than add_initial_output_section.
15863 (Layout::finish_dynamic_section): Likewise.
15865 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15866 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
15867 know the dynamic type.
15868 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15869 field. Initialize it in constructor.
15870 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15871 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15872 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15875 * output.cc (Output_reloc::get_address): Change return type to
15877 * output.h (class Output_reloc): Update get_address declaration.
15878 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15879 for section addresses.
15884 * gold.cc (gold_nomem): Use return value of write.
15888 * symtab.c (Symbol::init_base_output_data): Add version
15889 parameter. Change all callers.
15890 (Symbol::init_base_output_segment): Likewise.
15891 (Symbol::init_base_constant): Likewise.
15892 (Symbol::init_base_undefined): Likewise.
15893 (Sized_symbol::init_output_data): Likewise.
15894 (Sized_symbol::init_output_segment): Likewise.
15895 (Sized_symbol::init_constant): Likewise.
15896 (Sized_symbol::init_undefined): Likewise.
15897 (Symbol_table::do_define_in_output_data): If the new symbol has a
15898 version, mark it as the default.
15899 (Symbol_table::do_define_in_output_segment): Likewise.
15900 (Symbol_table::do_define_as_constant): Likewise.
15901 * symtab.h (class Symbol): Update declarations.
15902 (class Sized_symbol): Likewise.
15903 * resolve.cc (Symbol::override_version): New function.
15904 (Symbol::override_base): Call override_version.
15905 (Symbol::override_base_with_special): Likewise.
15906 * testsuite/ver_script_8.script: New file.
15907 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15908 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15909 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15910 (ver_test_8_1.so, ver_test_8_2.so): New targets.
15915 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15917 (class General_options): Remove existing --undefined, and add
15918 --no-undefined instead. Add new --undefined as synonym for -u.
15919 * archive.cc (Archive::add_symbols): Check whether symbol was
15921 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15922 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15923 all uses. Add IS_UNDEFINED. Update declarations to split
15924 different versions of init_base. Declare init_base_undefined.
15925 (Symbol::is_defined): Handle IS_UNDEFINED.
15926 (Symbol::is_undefined): Likewise.
15927 (Symbol::is_weak_undefined): Call is_undefined.
15928 (Symbol::is_absolute): Handle IS_CONSTANT.
15929 (class Sized_symbol): Update declarations to split different
15930 versions of init. Declare init_undefined.
15931 (class Symbol_table): Declare new functions.
15932 * symtab.cc (Symbol::init_base_object): Rename from init_base.
15933 Change all callers.
15934 (Symbol::init_base_output_data): Likewise.
15935 (Symbol::init_base_output_segment): Likewise.
15936 (Symbol::init_base_constant): Likewise.
15937 (Symbol::init_base_undefined): New function.
15938 (Sized_symbol::init_object): Rename from init. Change all
15940 (Sized_symbol::init_output_data): Likewise.
15941 (Sized_symbol::init_output_segment): Likewise.
15942 (Sized_symbol::init_constant): Likewise.
15943 (Sized_symbol::init_undefined): New function.
15944 (Symbol_table::add_undefined_symbols_from_command_line): New
15946 (Symbol_table::do_add_undefined_symbols_from_command_line): New
15948 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15949 (Symbol::output_section): Likewise.
15950 (Symbol::set_output_section): Likewise.
15951 (Symbol_table::sized_finalize_symbol): Likewise.
15952 (Symbol_table::sized_write_globals): Likewise.
15953 * resolve.cc (Symbol_table::should_override): Likewise.
15954 (Symbol::override_base_with_special): Likewise.
15956 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15957 symbol, change it to have default visibility.
15958 * testsuite/protected_1.cc: New file.
15959 * testsuite/protected_2.cc: New file.
15960 * testsuite/protected_3.cc: New file.
15961 * testsuite/protected_main_1.cc: New file.
15962 * testsuite/protected_main_2.cc: New file.
15963 * testsuite/protected_main_3.cc: New file.
15964 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15965 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15966 (protected_1_LDFLAGS, protected_1_LDADD): Define.
15967 (protected_1.so): New target.
15968 (protected_1_pic.o, protected_2_pic.o): New targets.
15969 (protected_3_pic.o): New target.
15970 (check_PROGRAMS): Add protected_2.
15971 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15972 (protected_2_LDFLAGS, protected_2_LDADD): Define.
15973 * testsuite/Makefile.in: Rebuild.
15975 * options.h (DEFINE_var): Add set_user_set_##varname__.
15976 (DEFINE_bool_alias): New macro.
15977 (class General_options): Define -Bstatic using DEFINE_bool_alias
15978 rather than DEFINE_special. Add --undefined as an alias for -z
15980 * options.cc (General_options::parse_Bstatic): Remove.
15982 * options.h (class General_options): Add --fatal-warnings.
15983 * main.cc (main): Implement --fatal-warnings.
15984 * errors.h (Errors::warning_count): New function.
15986 * options.h (class General_options): Add -Bsymbolic-functions.
15987 * symtab.h (Symbol::is_preemptible): Check for
15988 -Bsymbolic-functions.
15992 * options.h (DEFINE_bool): For DASH_Z, create the negative option
15993 as noVARNAME rather than no-VARNAME.
15994 (class General_options): Add option -z combreloc.
15995 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15997 (Output_reloc::sort_before) [SHT_REL]: New function.
15998 (Output_reloc::sort_before) [SHT_RELA]: New function.
15999 (class Output_data_reloc_base): Add sort_relocs_ field. Define
16000 Sort_relocs_comparison.
16001 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16002 parameter. Change all callers.
16003 (Output_data_reloc::Output_data_reloc) [both versions]: Add
16004 sort_relocs parameter. Change all callers.
16005 * output.cc (Output_reloc::get_address): New function, broken out
16007 (Output_reloc::write_rel): Call it.
16008 (Output_reloc::compare): New function.
16009 (Output_data_reloc_base::do_write): Optionally sort relocs.
16011 * configure.ac: If targ_extra_obj is set, link it in.
16012 * configure.tgt: Initialize all variables.
16013 (x86_64*): Set targ_extra_obj and targ_extra_size.
16014 * configure: Rebuild.
16016 * object.cc (Sized_relobj::include_section_group): Adjust section
16017 indexes read from group data. Build vector to pass to
16019 * layout.cc (Layout::layout_group): Add flags and shndxes
16020 parameters. Remove contents parameter. Change caller. Update
16021 explicit instantiations.
16022 * layout.h (class Layout): Update layout_group declaration.
16023 * output.cc (Output_data_group::Output_data_group): Add flags and
16024 input_shndxes parameters. Remove contents parameter. Change
16026 (Output_data_group::do_write): Change input_sections_ to
16028 * output.h (class Output_data_group): Update constructor
16029 declaration. Rename input_sections_ to input_shndxes_.
16030 * testsuite/many_sections_test.cc: Add template.
16034 * target-reloc.h (relocate_section): Fix dead-pointer bug.
16036 * layout.cc (Layout::include_section): Refactored check for debug
16038 (Layout::add_comdat): Add new parameters. Change type
16039 of signature parameter. Add object and shndx to signatures table.
16040 (Layout::find_kept_object): New function.
16041 * layout.h: Include <cstring>.
16042 (Layout::is_debug_info_section): New function.
16043 (Layout::add_comdat): Add new parameters.
16044 (Layout::find_kept_object): New function.
16045 (Layout::Kept_section): New struct.
16046 (Layout::Signatures): Change type of map range.
16047 * object.cc (Relobj::output_section_address): New function.
16048 (Sized_relobj::include_section_group): Add new parameters. Change
16049 calls to Layout::add_comdat. Change to build table of kept comdat
16050 groups and table mapping discarded sections to kept sections.
16051 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
16052 (Sized_relobj::do_layout): Change calls to include_section_group and
16053 include_linkonce_section.
16054 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16055 value to zero when section is discarded.
16056 (Sized_relobj::map_to_kept_section): New function.
16057 * object.h (Relobj::output_section_address): New function.
16058 (Relobj::Comdat_group): New type.
16059 (Relobj::find_comdat_group): New function.
16060 (Relobj::Comdat_group_table): New type.
16061 (Relobj::Kept_comdat_section): New type.
16062 (Relobj::Kept_comdat_section_table): New type.
16063 (Relobj::add_comdat_group): New function.
16064 (Relobj::set_kept_comdat_section): New function.
16065 (Relobj::get_kept_comdat_section): New function.
16066 (Relobj::comdat_groups_): New field.
16067 (Relobj::kept_comdat_sections_): New field.
16068 (Symbol_value::input_value): Update comment.
16069 (Sized_relobj::map_to_kept_section) New function.
16070 (Sized_relobj::include_linkonce_section): Add new parameter.
16071 * target-reloc.h (Comdat_behavior): New type.
16072 (get_comdat_behavior): New function.
16073 (relocate_section): Add code to map a discarded section to the
16074 corresponding kept section when applying a relocation.
16078 * dwarf_reader.cc (next_generation_count): New static var.
16079 (Addr2line_cache_entry): New struct.
16080 (addr2line_cache): New static var.
16081 (Dwarf_line_info::one_addr2line): Added caching.
16082 (Dwarf_line_info::clear_addr2line_cache): New function.
16083 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16084 cache-size parameter.
16085 (Dwarf_line_info::one_addr2line_cache): New function.
16086 * symtab.cc (Symbol_table::detect_odr_violations): Pass
16087 new cache-size argument to one_addr2line(), and clear cache.
16091 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16092 R_386_PC8 relocations.
16096 * object.cc (Sized_relobj::include_section_group): Check for
16097 invalid section group.
16099 * object.cc (make_elf_object): Correct test for 64-bit ELF file
16102 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16103 than read for file header.
16104 * archive.cc (Archive::include_member): Likewise.
16108 * aclocal.m4: Regenerate.
16109 * configure: Regenerate.
16113 * version.cc (version_string): Bump to 1.6.
16115 * testsuite/Makefile.am (many_sections_r_test): New target.
16116 (many_sections_r_test_SOURCES): Remove.
16117 (many_sections_r_test_DEPENDENCIES): Remove.
16118 (many_sections_r_test_LDFLAGS): Remove.
16119 (many_sections_r_test_LDADD): Remove.
16121 * object.cc (Sized_relobj::do_add_symbols): Always pass
16122 local_symbol_count_ to add_from_relobj.
16124 * testsuite/Makefile.am (many_sections_check.h): Only check one in
16125 every thousand variables.
16126 * testsuite/Makefile.in: Rebuild.
16128 * object.cc (Xindex::initialize_symtab_xindex): New function.
16129 (Xindex::read_symtab_xindex): New function.
16130 (Xindex::sym_xindex_to_shndx): New function.
16131 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16133 (Sized_relobj::do_initialize_xindex): New function.
16134 (Sized_relobj::do_read_symbols): Adjust section links.
16135 (Sized_relobj::symbol_section_and_value): Add is_ordinary
16136 parameter. Change all callers.
16137 (Sized_relobj::include_section_group): Adjust section links and
16138 symbol section indexes.
16139 (Sized_relobj::do_layout): Adjust section links.
16140 (Sized_relobj::do_count_local_symbols): Adjust section links and
16141 symbol section indexes.
16142 (Sized_relobj::do_finalize_local_symbols): Distinguish between
16143 ordinary and special symbols.
16144 (Sized_relobj::write_local_symbols): Add symtab_xindex and
16145 dynsym_xindex parameters. Change all callers. Adjust section
16146 links. Use SHN_XINDEX when needed.
16147 (Sized_relobj::get_symbol_location_info): Adjust section links.
16148 Don't get fooled by special symbols.
16149 * object.h (class Xindex): Define.
16150 (class Object): Add xindex_ parameter. Declare virtual functoin
16151 do_initialize_xindex.
16152 (Object::adjust_sym_shndx): New function.
16153 (Object::set_xindex): New protected function.
16154 (class Symbol_value): Add is_ordinary_shndx_ field.
16155 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16156 (Symbol_value::value): Assert ordinary section.
16157 (Symbol_value::initialize_input_to_output_map): Likewise.
16158 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16159 Change all callers.
16160 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
16162 (class Sized_relobj): Update declarations.
16163 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16164 parameter. Change all callers.
16165 (Sized_relobj::adjust_shndx): New function.
16166 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16168 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16169 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
16170 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
16171 (Sized_dynobj::read_dynsym_section): Adjust section links.
16172 (Sized_dynobj::read_dynamic): Likewise.
16173 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
16175 (Sized_dynobj::do_initialize_xindex): New function.
16176 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
16177 do_initialize_xindex.
16178 (Sized_dynobj::adjust_shndx): New function.
16179 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16180 dynsym_xindex_ fields.
16181 (Layout::finalize): Add a call to set_section_indexes before
16182 creating the symtab sections.
16183 (Layout::set_section_indexes): Don't do anything if the section
16184 already has a section index.
16185 (Layout::create_symtab_sections): Add shnum parameter. Change
16186 caller. Create .symtab_shndx section if needed.
16187 (Layout::create_shdrs): Add shstrtab_section parameter. Change
16189 (Layout::allocated_output_section_count): New function.
16190 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16192 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16193 fields. Update declarations.
16194 (Layout::symtab_xindex): New function.
16195 (Layout::dynsym_xindex): New function.
16196 (class Write_symbols_task): Add layout_ field.
16197 (Write_symbols_task::Write_symbols_task): Add layout parameter.
16199 * output.cc (Output_section_headers::Output_section_headers): Add
16200 shstrtab_section parameter. Change all callers.
16201 (Output_section_headers::do_sized_write): Store overflow values
16202 for section count and section string table section index in
16203 section header zero.
16204 (Output_file_header::do_sized_write): Check for overflow of
16205 section count and section string table section index.
16206 (Output_symtab_xindex::do_write): New function.
16207 (Output_symtab_xindex::endian_do_write): New function.
16208 * output.h (class Output_section_headers): Add shstrtab_section_.
16209 Update declarations.
16210 (class Output_symtab_xindex): Define.
16211 (Output_section::has_out_shndx): New function.
16212 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16214 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16215 Change all callers.
16216 (Sized_symbol::init): Likewise.
16217 (Symbol::output_section): Check for ordinary symbol.
16218 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
16219 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
16221 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16222 Change all callers. Simplify handling of symbols from sections
16223 not included in the link.
16224 (Symbol_table::add_from_dynobj): Handle ordinary symbol
16226 (Weak_alias_sorter::operator()): Assert that symbols are
16228 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16230 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16231 parameters. Change all callers.
16232 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
16233 symbol distinction. Use SHN_XINDEX when needed.
16234 (Symbol_table::write_section_symbol): Add symtab_xindex
16235 parameter. Change all callers.
16236 (Symbol_table::sized_write_section_symbol): Likewise. Use
16237 SHN_XINDEX when needed.
16238 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
16240 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
16241 (Symbol::is_defined): Check is_ordinary.
16242 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16243 (Symbol::is_absolute, Symbol::is_common): Likewise.
16244 (class Sized_symbol): Update declarations.
16245 (class Symbol_table): Update declarations.
16246 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16247 parameters. Change all callers.
16248 (Sized_symbol::override): Likewise.
16249 (Symbol_table::override): Likewise.
16250 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
16251 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
16252 is_ordinary, and orig_st_shndx parameters. Change all callers.
16253 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16254 to be in an ordinary section.
16255 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16256 object and is_ordinary parameters. Change all callers.
16257 (Sized_dwarf_line_info::read_relocs): Add object parameter.
16258 Change all callers. Don't add undefined or non-ordinary symbols
16260 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16261 Change all callers.
16262 * dwarf_reader.h (class Sized_dwarf_line_info): Update
16264 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16265 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16266 (Sized_relobj::relocate_sections): Likewise.
16267 * target-reloc.h (scan_relocs): Adjust section symbol index.
16268 (scan_relocatable_relocs): Likewise.
16269 * i386.cc (Scan::local): Check for ordinary symbols.
16270 * sparc.cc (Scan::local): Likewise.
16271 * x86_64.cc (Scan::local): Likewise.
16272 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16273 to symbol_section_and_value.
16274 * testsuite/many_sections_test.cc: New file.
16275 * testsuite/Makefile.am (BUILT_SOURCES): Define.
16276 (check_PROGRAMS): Add many_sections_test.
16277 (many_sections_test_SOURCES): Define.
16278 (many_sections_test_DEPENDENCIES): Define.
16279 (many_sections_test_LDFLAGS): Define.
16280 (BUILT_SOURCES): Add many_sections_define.h.
16281 (many_sections_define.h): New target.
16282 (BUILT_SOURCES): Add many_sections_check.h.
16283 (many_sections_check.h): New target.
16284 (check_PROGRAMS): Add many_sections_r_test.
16285 (many_sections_r_test_SOURCES): Define.
16286 (many_sections_r_test_DEPENDENCIES): Define.
16287 (many_sections_r_test_LDFLAGS): Define.
16288 (many_sections_r_test_LDADD): Define.
16289 (many_sections_r_test.o): New target.
16290 * testsuite/Makefile.in: Rebuild.
16294 * errors.cc (Errors::info): New function.
16295 (gold_info): New function.
16296 * errors.h (Errors::info): New function.
16297 * gold.h (gold_info): New function.
16298 * object.cc (Input_objects::add_object): Print trace output.
16299 * options.cc (options::parse_set): New function.
16300 (General_options::parse_wrap): Deleted.
16301 (General_options::General_options): Deleted initializer.
16302 * options.h (options::String_set): New typedef.
16303 (options::parse_set): New function.
16304 (DEFINE_set): New macro.
16305 (General_options::wrap): Changed to use DEFINE_set. Changed
16306 callers of any_wrap_symbols and is_wrap_symbol.
16307 (General_options::trace, General_options::trace_symbol):
16309 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16310 (General_options::wrap_symbols_): Deleted.
16311 * symtab.cc (Symbol_table::add_from_object): Print trace output.
16315 * options.cc (General_options::parse_V): New function.
16316 * options.h: Add entries for -V and -Qy.
16320 * common.cc (Symbol_table::allocate_commons): Remove options
16321 parameter. Change caller.
16322 (Symbol_table::do_allocate_commons): Remove options parameter.
16323 Change caller. Just call do_allocate_commons_list twice.
16324 (Symbol_table::do_allocate_commons_list): New function, broken out
16325 of do_allocate_commons.
16326 * common.h (class Allocate_commons_task): Remove options_ field.
16327 Update constructor.
16328 * symtab.cc (Symbol_table::Symbol_table): Initialize
16330 (Symbol_table::add_from_object): Put TLS common symbols on
16332 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16333 which are IN_OUTPUT_DATA.
16334 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
16335 allocate_commons and do_allocate_commons declarations. Declare
16336 do_allocate_commons_list.
16337 * gold.cc (queue_middle_tasks): Update creation of
16338 Allocate_commons_task to not pass options.
16339 * testsuite/Makefile.am (INCLUDES): Add -I.. .
16340 (TLS_TEST_C_FLAGS): New variable.
16341 (tls_test_c_pic.o): New target.
16342 (tls_test_shared.so): Link in tls_test_c_pic.o.
16343 (tls_test_c_pic_ie.o): New target.
16344 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16345 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16346 (tls_test_c.o): New target.
16347 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16348 (tls_pic_test_LDADD): Likewise.
16349 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16350 (tls_shared_gd_to_ie_test_LDADD): Likewise.
16351 (tls_test_c_gnu2.o): New target.
16352 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16354 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16355 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16356 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16357 * testsuite/tls_test.cc: Include "config.h".
16358 (t_last): Call t11_last.
16359 * testsuite/tls_test.h (t11, t11_last): Declare.
16360 * testsuite/tls_test_c.c: New file.
16361 * testsuite/tls_test_main.cc (thread_routine): Call t11.
16362 * configure.ac: Check for OpenMP support.
16363 * configure, config.in, Makefile.in: Rebuild.
16364 * testsuite/Makefile.in: Rebuild.
16368 * i386.cc (Target_i386::define_tls_base_symbol): New function.
16369 (Target_i386::tls_base_symbol_defined_): New field.
16370 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16371 (Target_i386::Scan::global): Likewise.
16372 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16373 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16374 (Target_x86_64::tls_base_symbol_defined_): New field.
16375 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16376 (Target_x86_64::Scan::global): Likewise.
16380 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16381 (Symbol::needs_plt_entry): Allow weak undefined symbols.
16382 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16383 building shared libraries.
16384 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16385 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16386 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16387 * testsuite/Makefile.in: Rebuild.
16388 * testsuite/weak_undef.h: New file.
16389 * testsuite/weak_undef_file1.cc: Add extra test cases.
16390 * testsuite/weak_undef_file2.cc: Likewise.
16391 * testsuite/weak_undef_test.cc: Likewise.
16395 * sparc.cc (Target_sparc::Scan): Change from struct to class.
16396 Add issued_non_pic_error_ field. Declare check_non_pic.
16397 (Target_sparc::Scan::check_non_pic): New function.
16398 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16399 (Target_sparc::Scan::global): Likewise.
16401 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16402 * configure: Rebuild.
16404 * options.h (DEFINE_enable): New macro.
16405 (new_dtags): New enable option.
16406 (initfirst, interpose, loadfltr, nodefaultlib,
16407 nodelete, nodlopen, nodump): New -z options.
16408 * layout.cc (Layout:finish_dynamic_section): If new
16409 dtags enabled, emit DT_RUNPATH. Also, emit a
16410 DT_FLAGS_1 containing any specified -z flags.
16414 * copy-relocs.cc: New file.
16415 * copy-relocs.h: New file.
16416 * reloc.cc: Remove Copy_relocs code.
16417 * reloc.h: Likewise.
16418 * reloc-types.h (struct Reloc_types) [both versions]: Add
16419 get_reloc_addend_noerror.
16420 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16421 variants of add_global which take an addend which must be zero.
16422 * i386.cc: Include "copy-relocs.h".
16423 (class Target_i386): Change type of copy_relocs_ to variable,
16424 update initializer.
16425 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16426 Change all callers.
16427 (Target_i386::do_finalize_sections): Change handling of
16429 * sparc.cc: Include "copy-relocs.h".
16430 (class Target_sparc): Change type of copy_relocs_ to variable,
16431 update initializer.
16432 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16433 Change all callers.
16434 (Target_sparc::do_finalize_sections): Change handling of
16436 * x86_64.cc: Include "copy-relocs.h".
16437 (class Target_x86_64): Change type of copy_relocs_ to variable,
16438 update initializer.
16439 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16440 class. Change all callers.
16441 (Target_x86_64::do_finalize_sections): Change handling of
16443 * Makefile.am (CCFILES): Add copy-relocs.cc.
16444 (HFILES): Add copy-relocs.h.
16446 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16448 * testsuite/script_test_4.sh: Permit leading zeroes.
16452 * script-sections.cc (Script_sections::create_segments): Use
16453 header_size_adjustment even when there is enough room for the
16455 * testsuite/script_test_4.sh: New file.
16456 * testsuite/script_test_4.t: New file.
16457 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16458 (check_DATA): Add script_test_4.stdout.
16459 (MOSTLYCLEANFILES): Likewise.
16460 (script_test_4): New target.
16461 (script_test_4.stdout): New target.
16462 * testsuite/Makefile.in: Rebuild.
16464 * sparc.cc: Add definitions for Output_data_plt_sparc class
16469 * sparc.cc: New file.
16470 * Makefile.am (TARGETSOURCES): Add sparc.cc
16471 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16472 * configure.tgt: Document targ_extra_size and
16473 targ_extra_big_endian. Add entries for sparc-* and
16475 * configure.ac: Handle targ_extra_size and
16476 targ_extra_big_endian.
16477 * Makefile.in: Rebuild.
16478 * configure: Likewise.
16479 * po/POTFILES.in: Likewise.
16480 * po/gold.pot: Likewise.
16484 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16485 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16486 in the name/type/flags to section mapping. Don't call
16487 allocate_output_section.
16488 (Layout::choose_output_section): Change parameter from adjust_name
16489 to is_input_section. Don't permit input sections after sections
16490 are attached to segments. Don't call allocate_output_section.
16491 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16492 not write_enable_output_section.
16493 (Layout::make_output_section): Don't push to
16494 unattached_section_list_ nor call attach_to_segment. Call
16495 attach_section_to_segment if sections are attached.
16496 (Layout::attach_sections_to_segments): New function.
16497 (Layout::attach_section_to_segment): New function.
16498 (Layout::attach_allocated_section_to_segment): Rename from
16499 attach_to_segment. Remove flags parameter.
16500 (Layout::allocate_output_section): Remove function.
16501 (Layout::write_enable_output_section): Remove function.
16502 * layout.h (class Layout): Update for above changes. Add new
16503 field sections_are_attached_.
16504 * output.h (Output_section::update_flags_for_input_section): New
16506 * output.cc (Output_section::add_input_section): Call
16507 update_flags_for_input_section.
16508 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16512 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16513 thought unnecessary.
16514 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16518 * output.h (class Output_section_data): Remove inline definition
16520 * output.cc (Output_section_data::set_addralign): New function.
16524 Add support for TLS descriptors for i386 and x86_64.
16525 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16526 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16527 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16529 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16530 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16531 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
16533 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16534 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16535 Fix problem with initial-exec relocations.
16536 (Target_i386::Relocate::relocate_tls): Likewise.
16537 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16539 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16540 support for section-plus-offset dynamic table entries.
16541 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16542 (Output_data_dynamic::Dynamic_entry): Add support for
16543 section-plus-offset dynamic table entries.
16544 (Output_data_dynamic::Classification): Likewise.
16545 (Output_data_dynamic::classification_): Renamed offset_.
16546 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16547 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16548 (Target_x86_64::make_plt_section): New function.
16549 (Target_x86_64::reserve_tlsdesc_entries): New function.
16550 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16551 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16552 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16553 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16554 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16555 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16556 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16557 add extra PLT entry for TLS descriptors.
16558 (Output_data_plt_x86_64::got_): New field.
16559 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16560 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16562 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16564 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16565 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16566 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16567 R_386_TLS_DESC_CALL relocations.
16568 (Target_x86_64::Scan::global): Likewise.
16569 (Target_x86_64::do_finalize_sections): Add dynamic table entries
16570 for TLS descriptors.
16571 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16572 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16573 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16574 GD-to-IE relaxation.
16575 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16576 and TLS_DESCRIPTORS.
16577 * Makefile.in: Rebuild.
16578 * configure: Rebuild.
16579 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16580 (tls_test_shared2.so): New target.
16581 (tls_shared_gd_to_ie_test_SOURCES): New variable.
16582 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16583 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16584 (tls_shared_gd_to_ie_test_LDADD): New variable.
16585 (tls_shared_gnu2_gd_to_ie_test): New target.
16586 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16588 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16589 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16590 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16591 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16592 (tls_shared_gnu2_test): New target.
16593 (tls_test_gnu2_shared.so): New target.
16594 (tls_shared_gnu2_test_SOURCES): New variable.
16595 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16596 (tls_shared_gnu2_test_LDFLAGS): New variable.
16597 (tls_shared_gnu2_test_LDADD): New variable.
16598 * testsuite/Makefile.in: Rebuild.
16599 * testsuite/Makefile.
16603 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16605 * testsuite/Makefile.in: Rebuild.
16607 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16609 * testsuite/script_test_2.cc (main): Adjust test.
16614 * options.h (General_options): Add entries for '-Y' and
16616 * options.cc (General_options:finalize): If -Y was used, add those
16617 entries to the library path instead of the default "/lib" and
16622 * testsuite/justsyms.t: Start at 0x100.
16623 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16624 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16626 * testsuite/script_test_2.cc: Adjust string and section length
16632 * script-sections.cc (Sections_element::allocate_to_segment): Add
16634 (Output_section_definition::allocate_to_segment): Likewise.
16635 (Orphan_output_section::allocate_to_segment): Likewise.
16636 (Script_sections::attach_sections_using_phdrs_clause): Don't
16637 propagate non-PT_LOAD segments to orphan sections.
16638 * testsuite/Makefile.am (script_test_3.stdout): Generate using
16639 readelf rather than objdump.
16640 * testsuite/script_test_3.sh: Adjust accordingly. Test that
16641 .interp section and PT_INTERP segment are the same size.
16642 * testsuite/Makefile.in: Rebuild.
16644 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16645 aliases for symbols defined in the same object.
16646 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16647 (weak_alias_test_SOURCES): New variable.
16648 (weak_alias_test_DEPENDENCIES): New variable.
16649 (weak_alias_test_LDFLAGS): New variable.
16650 (weak_alias_test_LDADD): New variable.
16651 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16652 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16653 (weak_alias_test_3.o): New target.
16654 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16655 * testsuite/weak_alias_test_main.cc: New file.
16656 * testsuite/weak_alias_test_1.cc: New file.
16657 * testsuite/weak_alias_test_2.cc: New file.
16658 * testsuite/weak_alias_test_3.cc: New file.
16662 * options.h (class General_options): Add --noinhibit-exec option.
16663 * main.cc (main): Check --noinhibit-exec.
16665 * options.h (class General_options): Define --wrap as a special
16666 option. Add wrap_symbols_ field.
16667 (General_options::any_wrap_symbols): New function.
16668 (General_options::is_wrap_symbol): New function.
16669 * options.cc (General_options::parse_wrap): New function.
16670 (General_options::General_options): Initialize wrap_symbols_.
16671 * symtab.cc (Symbol_table::wrap_symbol): New function.
16672 (Symbol_table::add_from_object): Handle --wrap.
16673 * symtab.h (class Symbol_table): Declare wrap_symbol.
16674 * target.h (Target::wrap_char): New function.
16675 (Target::Target_info): Add wrap_char field.
16676 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16677 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16678 * testsuite/testfile.cc (Target_test::test_target_info):
16681 * errors.cc (Errors::undefined_symbol): Mention symbol version if
16684 * layout.h (class Layout): Add added_eh_frame_data_ field.
16685 * layout.cc (Layout::Layout): Initialize new field.
16686 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16687 output section until we find a section we merged successfully.
16688 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16689 that the size be non-zero.
16691 * merge.cc (Object_merge_map::get_output_offset): Remove inline
16696 * configure.ac: Export new conditional variable HAVE_ZLIB.
16697 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16699 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16700 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16704 * version.cc (version_string): Set to "1.5".
16706 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16707 Add issued_non_pic_error_ field. Declare check_non_pic.
16708 (Target_x86_64::Scan::check_non_pic): New function.
16709 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16710 (Target_x86_64::Scan::global): Likewise.
16712 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16713 addend parameter. Change caller. Handle merge sections.
16714 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16715 Address to Addend. Don't add in the result of
16716 local_section_offset, pass down the addend and use the returned
16718 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16719 Update declarations of local_section_offset and symbol_value.
16720 * testsuite/two_file_test_1.cc (t18): New function.
16721 * testsuite/two_file_test_2.cc (f18): New function.
16722 * testsuite/two_file_test_main.cc (main): Call t18.
16723 * testsuite/two_file_test.h (t18, f18): Declare.
16725 * configure.ac: Don't test for objdump, c++filt, or readelf.
16726 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16728 (TEST_READELF): New variable.
16729 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16730 (check_PROGRAMS): Add two_file_strip_test.
16731 (two_file_strip_test): New target.
16732 (check_PROGRAMS): Add two_file_same_shared_strip_test.
16733 (two_file_same_shared_strip_test_SOURCES): New variable.
16734 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16735 (two_file_same_shared_strip_test_LDFLAGS): New variable.
16736 (two_file_same_shared_strip_test_LDADD): New variable.
16737 (two_file_shared_strip.so): New target.
16738 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16739 (ver_test_5.syms, ver_test_7.syms): Likewise.
16740 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16741 (strip_test_3.stdout): Use TEST_OBJDUMP.
16742 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16746 * symtab.h (Symbol::is_weak_undefined): New function.
16747 (Symbol::is_strong_undefined): New function.
16748 (Symbol::is_absolute): New function.
16749 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16750 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16752 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16753 (weak_undef_test): New target.
16754 * testsuite/Makefile.in: Rebuild.
16755 * testsuite/weak_undef_file1.cc: New file.
16756 * testsuite/weak_undef_file2.cc: New file.
16757 * testsuite/weak_undef_test.cc: New file.
16761 * compressed_output.h (class Output_compressed_section): Use
16763 * compressed_output.cc (zlib_compress): Use unsigned buffers,
16765 (zlib_compressed_suffix): Removed.
16766 (Output_compressed_section::set_final_data_size): Use unsigned
16768 * testsuite/Makefile.am (flagstest_compress_debug_sections):
16769 Fix linker invocation.
16770 (flagstest_o_specialfile_and_compress_debug_sections):
16772 * testsuite/Makefile.in: Regenerated.
16776 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16777 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16785 * fileread.cc (File_read::find_view): Add byteshift and vshifted
16786 parameters. Update for new key type to views_. Change all
16788 (File_read::read): Adjust for byteshift in returned view.
16789 (File_read::add_view): New function, broken out of
16790 find_and_make_view.
16791 (File_read::make_view): New function, broken out of
16792 find_and_make_view.
16793 (File_read::find_or_make_view): Add offset and aligned
16794 parameters. Rewrite accordingly. Change all callers.
16795 (File_read::get_view): Add offset and aligned parameters. Adjust
16796 for byteshift in return value.
16797 (File_read::get_lasting_view): Likewise.
16798 * fileread.h (class File_read): Update declarations.
16799 (class File_read::View): Add byteshift_ field. Add byteshift to
16800 constructor. Add byteshift method.
16801 * archive.h (Archive::clear_uncached_views): New function.
16802 (Archive::get_view): Add aligned parameter. Change all callers.
16803 * object.h (Object::get_view): Add aligned parameter. Change all
16805 (Object::get_lasting_view): Likewise.
16807 * fileread.cc (File_read::release): Don't call clear_views if
16808 there are multiple objects.
16809 * fileread.h (File_read::clear_uncached_views): New function.
16810 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16815 Add thin archive support.
16816 * archive.cc (Archive::armagt): New const.
16817 (Archive::setup): Remove task parameter and calls to unlock.
16818 (Archive::unlock_nested_archives): New function.
16819 (Archive::read_header): Add nested_off parameter. Change
16821 (Archive::interpret_header): Likewise.
16822 (Archive::include_all_members): Change to handle thin
16824 (Archive::include_member): Likewise.
16825 * archive.h (Archive::Archive): Add new parameters and
16827 (Archive::armagt): New const.
16828 (Archive::setup): Remove task parameter.
16829 (Archive::unlock_nested_archives): New function.
16830 (Archive::read_header): Add nested_off parameter.
16831 (Archive::interpret_header): Likewise.
16832 (Archive::Nested_archive_table): New typedef.
16833 (Archive::is_thin_archive_): New field.
16834 (Archive::nested_archives_): New field.
16835 (Archive::options_): New field.
16836 (Archive::dirpath_): New field.
16837 (Archive::task_): New field.
16838 * readsyms.cc (Read_symbols::do_read_symbols): Add check
16839 for thin archives. Pass additional parameters to
16840 Archive::Archive. Unlock the archive file after calling
16845 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16846 version symbol to be local.
16847 * testsuite/ver_test_4.sh: New file.
16848 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16849 (check_DATA): Add ver_test_4.syms.
16850 (ver_test_4.syms): New target.
16851 * testsuite/Makefile.in: Rebuild.
16854 (Output_section::Input_section_sort_entry::has_priority): New
16856 (Output_section::Input_section_sort_entry::match_file_name): New
16858 (Output_section::Input_section_sort_entry::match_section_name):
16860 (Output_section::Input_section_sort_entry::match_section_name_prefix):
16862 (Output_section::Input_section_sort_entry::match_section_file):
16864 (Output_section::Input_section_sort_compare::operator()): Rewrite
16865 using new Input_section_sort_entry functions. Sort crtbegin and
16866 crtend first. Sort sections with no priority before sections with
16868 * testsuite/initpri1.c (d3): Check j != 4.
16869 (cd5): New constructor/destructor function.
16870 (main): Check j != 2.
16872 * symtab.cc (Symbol_table::add_from_object): If we don't use the
16873 new symbol when resolving, don't call set_is_default.
16874 * testsuite/ver_test_7.cc: New file.
16875 * testsuite/ver_test_7.sh: New file.
16876 * testsuite/Makefile.am (ver_test_7.so): New target.
16877 (ver_test_7.o): New target.
16878 (check_SCRIPTS): Add ver_test_7.sh.
16879 (check_DATA): Add ver_test_7.syms.
16880 (ver_test_7.syms): New target.
16884 * layout.cc (Layout::layout): If we see an input section with a
16885 name that needs sorting, set the must_sort flag for the output
16887 (Layout::make_output_section): If the name of the output section
16888 indicates that it might require sorting, set the may_sort flag.
16889 * output.h (Output_section::may_sort_attached_input_sections): New
16891 (Output_section::set_may_sort_attached_input_sections): New
16893 (Output_section::must_sort_attached_input_sections): New
16895 (Output_section::set_must_sort_attached_input_sections): New
16897 (class Output_section): Declare Input_section_sort_entry. Define
16898 Input_section_sort_compare. Declare
16899 sort_attached_input_sections. Add new fields:
16900 may_sort_attached_input_sections_,
16901 must_sort_attached_input_sections_,
16902 attached_input_sections_are_sorted_.
16903 * output.cc (Output_section::Output_section): Initialize new
16905 (Output_section::add_input_section): Add an entry to
16906 input_sections_ if may_sort or must_sort are true.
16907 (Output_section::set_final_data_size): Call
16908 sort_attached_input_sections if necessary.
16909 (Output_section::Input_section_sort_entry): Define new class.
16910 (Output_section::Input_section_sort_compare::operator()): New
16912 (Output_section::sort_attached_input_sections): New function.
16913 * configure.ac: Check whether the compiler supports constructor
16914 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
16915 * testsuite/initpri1.c: New file.
16916 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16917 CONSTRUCTOR_PRIORITY.
16918 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16919 (initpri1_LDFLAGS): New variable.
16920 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16924 * common.cc (Sort_commons::operator): Correct sorting algorithm.
16925 * testsuite/common_test_1.c: New file.
16926 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16927 (common_test_1_SOURCES): New variable.
16928 (common_test_1_DEPENDENCIES): New variable.
16929 (common_test_1_LDFLAGS): New variable.
16931 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16932 and commons_ correctly when NAME/VERSION does not override
16934 * testsuite/ver_test_6.c: New file.
16935 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16936 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16937 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16941 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16942 of an undefined symbol from a version script.
16943 * testsuite/Makefile.am (ver_test_5.so): New target.
16944 (ver_test_5.o): New target.
16945 (check_SCRIPTS): Add ver_test_5.sh.
16946 (check_DATA): Add ver_test_5.syms.
16947 (ver_test_5.syms): New target.
16948 * testsuite/ver_test_5.cc: New file.
16949 * testsuite/ver_test_5.script: New file.
16950 * testsuite/ver_test_5.sh: New file.
16951 * Makefile.in, testsuite/Makefile.in: Rebuild.
16954 Fix problems building gold with gcc 4.3.0.
16955 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16956 (gold_error_at_location, gold_warning_at_location): Use it.
16957 * configure.ac: Check whether we can compile and use a template
16958 function with a printf attribute.
16959 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16960 when jumping over bytes.
16961 * object.cc: Instantiate Object::read_section_data.
16962 * debug.h: Include <cstring>
16963 * dwarf_reader.cc: Include <algorithm>
16964 * main.cc: Include <cstring>.
16965 * options.cc: Include <cstring>.
16966 * output.cc: Include <cstring>.
16967 * script.cc: Include <cstring>.
16968 * script.h: Include <string>.
16969 * symtab.cc: Include <cstring> and <algorithm>.
16970 * target-select.cc: Include <cstring>.
16971 * version.cc: Include <string>.
16972 * testsuite/testmain.cc: Include <cstdlib>.
16973 * configure, config.in: Rebuild.
16977 * options.cc: Include "../bfd/bfdver.h".
16978 (options::help): Print bug reporting address.
16980 * version.cc (print_version): Adjust output for current value of
16981 BFD_VERSION_STRING.
16985 * options.cc (options::help): Print list of supported targets.
16986 * target-select.h: Include <vector>.
16987 (class Target_selector): Make machine_, size_, and is_big_endian_
16988 fields const. Add bfd_name_ and instantiated_target_ fields.
16989 (Target_selector::Target_selector): Add bfd_name parameter.
16990 (Target_selector::recognize): Make non-virtual, call
16992 (Target_selector::recognize_by_name): Make non-virtual, call
16993 do_recognize_by_name.
16994 (Target_selector::supported_names): New function.
16995 (Target_selector::bfd_name): New function.
16996 (Target_selector::do_instantiate_target): New pure virtual
16998 (Target_selector::do_recognize): New virtual function.
16999 (Target_selector::do_recognize_by_name): New virtual function.
17000 (Target_selector::instantiate_target): New private function.
17001 (supported_target_names): Declare.
17002 * target-select.cc (Target_selector::Target_selector): Update for
17003 new parameter and fields.
17004 (select_target_by_name): Check that the name matches before
17005 calling recognize_by_name.
17006 (supported_target_names): New function.
17007 * i386.cc (class Target_selector_i386): Update Target_selector
17008 constructor call. Remove recognize and recognize_by_name. Add
17009 do_instantiate_target.
17010 * x86_64.cc (class Target_selector_x86_64): Likewise.
17011 * testsuite/testfile.cc (class Target_selector_test): Update for
17012 changes to Target_selector.
17014 * README: Rewrite, with some notes on unsupported features.
17018 * i386.cc (Target_i386::Got_type): New enum declaration.
17019 (Target_i386::Scan::local): Updated callers of Output_data_got
17021 (Target_i386::Scan::global): Likewise.
17022 (Target_i386::Relocate::relocate): Likewise.
17023 (Target_i386::Relocate::relocate_tls): Likewise.
17024 * object.h (Got_offset_list): New class.
17025 (Sized_relobj::local_has_got_offset): Added got_type parameter.
17026 (Sized_relobj::local_got_offset): Likewise.
17027 (Sized_relobj::set_local_got_offset): Likewise.
17028 (Sized_relobj::local_has_tls_got_offset): Removed.
17029 (Sized_relobj::local_tls_got_offset): Removed.
17030 (Sized_relobj::set_local_tls_got_offset): Removed.
17031 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17032 * output.cc (Output_data_got::add_global): Added got_type parameter.
17033 (Output_data_got::add_global_with_rel): Likewise.
17034 (Output_data_got::add_global_with_rela): Likewise.
17035 (Output_data_got::add_global_pair_with_rel): New function.
17036 (Output_data_got::add_global_pair_with_rela): New function.
17037 (Output_data_got::add_local): Added got_type parameter.
17038 (Output_data_got::add_local_with_rel): Likewise.
17039 (Output_data_got::add_local_with_rela): Likewise.
17040 (Output_data_got::add_local_pair_with_rel): New function.
17041 (Output_data_got::add_local_pair_with_rela): New function.
17042 (Output_data_got::add_global_tls): Removed.
17043 (Output_data_got::add_global_tls_with_rel): Removed.
17044 (Output_data_got::add_global_tls_with_rela): Removed.
17045 (Output_data_got::add_local_tls): Removed.
17046 (Output_data_got::add_local_tls_with_rel): Removed.
17047 (Output_data_got::add_local_tls_with_rela): Removed.
17048 * output.h (Output_data_got::add_global): Added got_type parameter.
17049 (Output_data_got::add_global_with_rel): Likewise.
17050 (Output_data_got::add_global_with_rela): Likewise.
17051 (Output_data_got::add_global_pair_with_rel): New function.
17052 (Output_data_got::add_global_pair_with_rela): New function.
17053 (Output_data_got::add_local): Added got_type parameter.
17054 (Output_data_got::add_local_with_rel): Likewise.
17055 (Output_data_got::add_local_with_rela): Likewise.
17056 (Output_data_got::add_local_pair_with_rel): New function.
17057 (Output_data_got::add_local_pair_with_rela): New function.
17058 (Output_data_got::add_global_tls): Removed.
17059 (Output_data_got::add_global_tls_with_rel): Removed.
17060 (Output_data_got::add_global_tls_with_rela): Removed.
17061 (Output_data_got::add_local_tls): Removed.
17062 (Output_data_got::add_local_tls_with_rel): Removed.
17063 (Output_data_got::add_local_tls_with_rela): Removed.
17064 * resolve.cc (Symbol::override_base_with_special): Removed
17065 reference to has_got_offset_ field.
17066 * symtab.cc (Symbol::init_fields): Replaced initialization
17067 of got_offset_ with got_offsets_. Removed initialization
17069 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17070 (Symbol::got_offset): Likewise.
17071 (Symbol::set_got_offset): Likewise.
17072 (Symbol::has_tls_got_offset): Removed.
17073 (Symbol::tls_got_offset): Removed.
17074 (Symbol::set_tls_got_offset): Removed.
17075 (Symbol::got_offset_): Removed.
17076 (Symbol::tls_mod_got_offset_): Removed.
17077 (Symbol::tls_pair_got_offset_): Removed.
17078 (Symbol::got_offsets_): New field.
17079 (Symbol::has_got_offset): Removed.
17080 (Symbol::has_tls_mod_got_offset): Removed.
17081 (Symbol::has_tls_pair_got_offset): Removed.
17082 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17083 (Target_x86_64::Scan::local): Updated callers of Output_data_got
17085 (Target_x86_64::Scan::global): Likewise.
17086 (Target_x86_64::Relocate::relocate): Likewise.
17087 (Target_x86_64::Relocate::relocate_tls): Likewise.
17091 * yyscript.y: Fix spelling error in comment.
17095 * options.h (class General_options): Define build_id option.
17096 * layout.h (class Layout): Declare write_build_id, create_note,
17097 create_build_id. Add build_id_note_ member.
17098 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17099 "libiberty.h", "md5.h", "sha1.h".
17100 (Layout::Layout): Initialize eh_frame_data_,
17101 eh_frame_hdr_section_, and build_id_note_.
17102 (Layout::finalize): Call create_build_id.
17103 (Layout::create_note): New function, broken out of
17104 Layout::create_gold_note.
17105 (Layout::create_gold_note): Call create_note.
17106 (Layout::create_build_id): New function.
17107 (Layout::write_build_id): New function.
17108 (Close_task_runner::run): Call write_build_id.
17110 * x86_64.cc: Correct license to GPLv3.
17114 * options.cc: Include "demangle.h".
17115 (parse_optional_string): New function.
17116 (parse_long_option): Handle takes_optional_argument.
17117 (parse_short_option): Update dash_z initializer. Handle
17118 takes_optional_argument.
17119 (General_options::General_options): Initialize do_demangle_.
17120 (General_options::finalize): Set do_demangle_. Handle demangling
17122 * options.h (parse_optional_string): Declare.
17123 (struct One_option): Add optional_arg field. Update constructor.
17124 Update call constructor calls. Add takes_optional_argument
17126 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
17127 (DEFINE_optional_string): Define.
17128 (General_options::demangle): Change from DEFINE_bool to
17129 DEFINE_optional_string.
17130 (General_options::no_demangle): New function.
17131 (General_options::do_demangle): New function.
17132 (General_options::set_do_demangle): New function.
17133 (General_options::execstack_status_): Move definition to end of
17135 (General_options::static_): Likewise.
17136 (General_options::do_demangle_): New field.
17137 * object.cc (big_endian>::get_symbol_location_info): Call
17138 Options::do_demangle, not Options::demangle.
17139 * symtab.cc (demangle): Likewise.
17143 * gold.h: Include <cstddef> and <sys/types.h>
17144 * options.h: Include <cstring>.
17148 * Added source code to GNU binutils.
17150 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17152 Copying and distribution of this file, with or without modification,
17153 are permitted in any medium without royalty provided the copyright
17154 notice and this notice are preserved.
17160 version-control: never