1 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
3 * mips.cc (Target_mips_nacl): New class.
4 (Target_selector_mips_nacl): New class.
5 (target_selector_mips32): Rename from target_selector_mips32be and use
6 Target_selector_mips_nacl instead of Target_selector_mips.
7 (target_selector_mips32el): Rename from target_selector_mips32 and use
8 Target_selector_mips_nacl instead of Target_selector_mips.
9 (target_selector_mips64): Rename from target_selector_mips64be and use
10 Target_selector_mips_nacl instead of Target_selector_mips.
11 (target_selector_mips64el): Rename from target_selector_mips64 and use
12 Target_selector_mips_nacl instead of Target_selector_mips.
13 (Target_mips::mips_info): Add const attribute.
15 2014-09-02 Cary Coutant <ccoutant@google.com>
17 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
18 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
19 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
20 (Sized_incr_dynobj::do_section_name): Likewise.
21 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
22 (Sized_incr_dynobj::do_section_name): Likewise.
23 * object.h (Object::section_name): Likewise.
24 (Object::do_section_name): Likewise.
25 (Sized_relobj_file::do_section_name): Likewise.
26 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
27 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
29 2014-09-02 Cary Coutant <ccoutant@google.com>
32 * ehframe.cc (Fde::write): Add output_offset parameter.
33 (Cie::write): Likewise.
34 (Eh_frame::set_final_data_size): Account for offset within output
36 (Eh_frame::do_sized_write): Likewise.
37 * ehframe.h (Fde::write): Add output_offset parameter.
38 (Cie::write): Likewise.
39 * output.cc (Output_section::Input_section_sort_entry): Remove
40 section_has_name_; add output_section_name parameter. Use
41 output section name for non-input sections.
42 (Output_section::Input_section_sort_entry::section_has_name): Remove.
43 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
44 (Output_section::Input_section_sort_compare): Remove logic for
45 sections without names.
46 (Output_section::Input_section_sort_init_fini_compare): Likewise.
47 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
49 (Output_section::Input_section_sort_section_name_compare): Likewise.
51 2014-08-29 Han Shen <shenhan@google.com>
52 Jing Yu <jingyu@google.com>
54 * aarch64-reloc-property.cc
55 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
56 reference reloc property in the table.
57 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
59 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
60 2 new overloaded methods.
61 (Output_data_got_aarch64::do_write): Add code to write out
63 (class Output_data_got_aarch64::Static_reloc): New class to wrap
65 (Output_data_got_aarch64::static_relocs): New vector to
67 (Target_aarch64::TCB_SIZE): New const static memeber.
68 (Target_aarch64::tcb_size): New method.
69 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
70 (Target_aarch64::Relocate::relocate_tls): New method.
71 (Target_aarch64::Scan::local): Add code handling new reloc types.
72 (Target_aarch64::Scan::global): Add code handling new reloc types.
74 2014-08-13 Sriraman Tallam <tmsriram@google.com>
76 * options.h (-no-pie): Add option.
78 2014-08-08 Jing Yu <jingyu@google.com>
79 Han Shen <shenhan@google.com>
81 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
82 (DEFFILES): add aarch64-reloc.def.
83 (TARGETSOURCES): Add aarch64-reloc-property.cc.
84 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
85 * Makefile.in: Regenerate.
86 * aarch64-reloc-property.cc: New file.
87 * aarch64-reloc-property.h: New file.
88 * aarch64-reloc.def: New file.
89 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
90 with tab to make the format consistent.
91 (Output_data_got_aarch64::symbol_table_): New method.
92 (Target_aarch64::do_plt_address_for_global): New method.
93 (Target_aarch64::do_plt_address_for_local): New method.
94 (Target_aarch64::do_select_as_default_target): New method.
95 (Target_aarch64::do_make_data_plt): New method.
96 (Target_aarch64::make_data_plt): New method.
97 (Output_data_plt_aarch64::has_irelative_section): New method.
98 (Output_data_plt_aarch64::address_for_global): New method.
99 (Output_data_plt_aarch64::address_for_local): New method.
100 (Output_data_plt_aarch64::irelative_rel_): New parameter.
101 (Output_data_plt_aarch64::add_entry): Implement contents.
102 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
103 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
104 the got_pov entry to plt0.
105 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
107 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
108 (AArch64_howto): New struct.
109 (aarch64_howto[]): New static const array.
110 (AArch64_relocate_functions): New class.
111 (Target_aarch64::Scan::get_reference_flags): Remove method.
112 (Target_aarch64::Scan::local): Implement to support a few relocations.
113 (Target_aarch64::Scan::global): Implement to support a few relocations.
114 (Target_aarch64::make_plt_section): Implement contents.
115 (Target_aarch64::make_plt_entry): Implement contents.
116 (Target_aarch64::do_finalize_sections): Implement contents.
117 (Target_aarch64::Relocate::relocate): Implement a few relocations.
118 (Target_aarch64::relocate_section): Implement contents.
120 2014-08-06 Alan Modra <amodra@gmail.com>
122 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
124 2014-08-06 Alan Modra <amodra@gmail.com>
127 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
129 2014-07-21 Sriraman Tallam <tmsriram@google.com>
131 * object.cc (Relobj::is_section_name_included): Add
132 ".rodata.nptl_version" to not garbage collect this section.
134 2014-07-08 Cary Coutant <ccoutant@google.com>
136 * expression.cc (struct Expression::Expression_eval_info): Add
137 new fields type_pointer, vis_pointer, and nonvis_pointer.
138 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
139 nonvis_pointer parameters. Adjust all calls.
140 (Symbol_expression::value): Update type, visibility, and nonvis bits
142 * script.cc (Symbol_assignment::sized_finalize): Update type,
143 visibility, and remaining st_other bits for new symbol.
144 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
145 vis_pointer, and nonvis_pointer parameters.
146 * symtab.h (Symbol::set_type): New method.
148 * testsuite/Makefile.am (defsym_test): New test.
149 * testsuite/Makefile.in: Regenerate.
150 * testsuite/defsym_test.c: New file.
151 * testsuite/defsym_test.sh: New file.
153 2014-07-08 Cary Coutant <ccoutant@google.com>
156 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
157 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
158 (Sized_dynobj::base_read_symbols): ...new method.
159 * object.h (Sized_relobj_file::base_read_symbols): New method.
160 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
161 (Sized_relobj_file::base_read_symbols): ...new method.
162 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
163 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
164 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
166 2014-07-04 Alan Modra <amodra@gmail.com>
168 * po/POTFILES.in: Regenerate.
170 2014-07-02 Jing Yu <jingyu@google.com>
172 * aarch64.cc: New file
173 * Makefile.am (TARGETSOURCES): Add aarch64.cc
174 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
175 * Makefile.in: Regenerate.
176 * configure.tgt: Add entries for aarch64*.
177 * configure.ac: Likewise.
178 * configure: Likewise.
180 2014-06-27 Alan Modra <amodra@gmail.com>
182 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
184 2014-06-24 Cary Coutant <ccoutant@google.com>
186 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
188 (Dwo_file::sized_read_unit_index): Likewise.
190 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
193 * Makefile.am (TARGETSOURCES): Add mips.cc
194 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
195 * configure.tgt: Add entries for mips*.
196 * configure.ac: Likewise.
197 * Makefile.in: Regenerate.
198 * configure: Likewise.
200 2014-06-09 Cary Coutant <ccoutant@google.com>
202 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
203 unit_length is within section bounds.
205 2014-06-09 Cary Coutant <ccoutant@google.com>
208 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
211 2014-06-07 Alan Modra <amodra@gmail.com>
213 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
215 2014-06-06 Cary Coutant <ccoutant@google.com>
217 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
218 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
219 (Dwarf_pubnames_table::read_header): Likewise.
220 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
223 2014-06-05 Joel Brobecker <brobecker@adacore.com>
225 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
226 * Makefile.in, configure: Regenerate.
228 2014-06-03 Alan Modra <amodra@gmail.com>
230 * powerpc.cc (addis_12_2): Define.
231 (Stub_table::do_write): Support fusion on ELFv2 stubs.
233 2014-06-03 Alan Modra <amodra@gmail.com>
235 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
238 2014-06-02 Alan Modra <amodra@gmail.com>
240 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
241 Only ignore relocs on ELFv1.
242 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
244 2014-05-30 Cary Coutant <ccoutant@google.com>
246 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
247 * testsuite/Makefile.in: Regenerate.
248 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
250 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
253 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
254 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
256 2014-05-15 Alan Modra <amodra@gmail.com>
258 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
259 Compare FDE contents with DW_CFA_nop rather than 0.
261 2014-05-13 Sriraman Tallam <tmsriram@google.com>
263 * symtab.h (may_need_copy_reloc): Remove check for position independent
265 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
266 position independence before pc absolute may_need_copy_reloc call.
267 Add check for executable output befor pc relative may_need_copy_reloc
273 * powerpc.cc: Add check for no position independence before
274 may_need_copy_reloc calls.
275 * testsuite/pie_copyrelocs_test.cc: New file.
276 * testsuite/pie_copyrelocs_shared_test.cc: New file.
277 * Makefile.am (pie_copyrelocs_test): New test.
278 * Makefile.in: Regenerate.
280 2014-05-08 Martin Liška <mliska@suse.cz>
282 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
284 2014-05-06 Cary Coutant <ccoutant@google.com>
287 * i386.cc (Output_data_got_plt_i386): New class.
288 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
289 parameter. Change all callers.
290 (Output_data_plt_i386::layout_): Remove.
291 (Output_data_plt_i386::got_plt_): Change type.
292 (Target_i386::got_plt_): Change type. Change all references.
293 (Target_i386::got_section): Create instance of new class.
294 (Output_data_got_plt_i386::do_write): New function.
295 * x86_64.cc (Output_data_got_plt_x86_64): New class.
296 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
297 parameter. Change all callers.
298 (Output_data_plt_x86_64::layout_): Remove.
299 (Output_data_plt_x86_64::got_plt_): Change type.
300 (Target_x86_64::got_plt_): Change type. Change all references.
301 (Target_x86_64::got_section): Create instance of new class.
302 (Output_data_got_plt_x86_64::do_write): New function.
303 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
304 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
307 2014-05-05 Cary Coutant <ccoutant@google.com>
309 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
310 if we have pubnames/pubtypes.
312 2014-05-02 Cary Coutant <ccoutant@google.com>
314 * defstd.cc (in_segment): Define __ehdr_start here...
315 * layout.cc (Layout::finalize): ...Instead of here. Set the
316 output segment when known.
317 * resolve.cc (Symbol::override_base_with_special): Remember
318 the original binding.
319 * symtab.cc (Symbol::set_output_segment): New function.
320 (Symbol::set_undefined): New function.
321 * symtab.h (Symbol::is_weak_undefined): Check original undef
323 (Symbol::is_strong_undefined): New function.
324 (Symbol::set_output_segment): New function.
325 (Symbol::set_undefined): New function.
326 * target-reloc.h (is_strong_undefined): Remove.
327 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
328 Check for hidden undefs.
329 (relocate_section): Call Symbol::is_strong_undefined.
331 * testsuite/Makefile.am (ehdr_start_test_1)
332 (ehdr_start_test_2, ehdr_start_test_3)
333 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
334 * testsuite/Makefile.in: Regenerate.
335 * testsuite/ehdr_start_def.cc: New source file.
336 * testsuite/ehdr_start_test.cc: New source file.
337 * testsuite/ehdr_start_test.t: New linker script.
338 * testsuite/ehdr_start_test_4.sh: New shell script.
340 2014-04-23 Cary Coutant <ccoutant@google.com>
343 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
345 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
347 * layout.cc (Layout::include_section): Allow a target to decide
348 whether to include a section.
349 * target.h (Target::should_include_section): New function.
350 (Target::do_should_include_section): New function.
352 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
354 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
356 (Copy_relocs::emit): ... here.
357 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
358 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
359 (Copy_reloc_entry::entries_): Change from private to protected.
361 2014-04-02 Sriraman Tallam <tmsriram@google.com>
363 * icf.cc (get_section_contents): Replace copies of reloc
364 vectors with const references.
366 2014-04-02 Cary Coutant <ccoutant@google.com>
368 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
369 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
370 * configure: Regenerate.
371 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
372 -fno-use-linker-plugin.
373 (LINK1, CXXLINK1): Add it to the link command.
374 * testsuite/Makefile.in: Regenerate.
376 2014-03-12 Alan Modra <amodra@gmail.com>
378 * Makefile.in: Regenerate.
380 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
382 * symtab.h (Symbol::set_nonvis): New function.
384 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
386 * symtab.cc (Sized_symbol<32>::init_output_data):
387 Instantiate the template.
388 (Sized_symbol<64>::init_output_data): Likewise.
390 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
392 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
393 adjust dynamic symbol value.
394 * target.h (Target::adjust_dyn_symbol): New function.
395 (Target::do_adjust_dyn_symbol): New function.
397 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
399 * output.cc (Output_data_dynamic::Dynamic_entry::write):
400 Get the value of DYNAMIC_CUSTOM dynamic entry.
401 * output.h (Output_data_dynamic::add_custom): New function.
402 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
404 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
405 * target.h (Target::dynamic_tag_custom_value): New function.
406 (Target::do_dynamic_tag_custom_value): New function.
408 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
410 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
412 * target.h (Target::has_custom_set_dynsym_indexes): New function.
413 (Target::do_has_custom_set_dynsym_indexes): New function.
414 (Target::set_dynsym_indexes): New function.
415 (Target::do_set_dynsym_indexes): New function.
417 2014-03-07 Alan Modra <amodra@gmail.com>
419 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
420 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
421 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
422 (Powerpc_relocate_functions::has_overflow_bitfield,
423 overflowed): Use the above.
424 (Target_powerpc::Relocate::relocate): Correct overflow checking
425 for a number of relocations. Modify overflow test for 16-bit
426 fields in instructions to signed/unsigned according to whether
427 the field takes a signed or unsigned value.
429 2014-03-05 Alan Modra <amodra@gmail.com>
431 Update copyright years.
433 2014-03-05 Alan Modra <amodra@gmail.com>
435 * powerpc.cc (Target_powerpc::Scan::local, global): Support
436 R_PPC64_ADDR64_LOCAL.
437 (Target_powerpc::Relocate::relocate): Likewise.
439 2014-03-03 Alan Modra <amodra@gmail.com>
441 * dwp.cc (print_version): Update copyright year to current.
443 2014-02-10 Alan Modra <amodra@gmail.com>
445 * po/gold.pot: Regenerate.
447 2014-02-06 Cary Coutant <ccoutant@google.com>
449 Fix problem where -u is ignored when a weak undef is seen.
451 * archive.cc (Library_base::should_include_member): Reorder
452 code to check for -u option if a weak undef has already been seen.
453 * testsuite/Makefile.am (weak_undef_test_2): New test case.
454 * testsuite/Makefile.in: Regenerate.
455 * testsuite/weak_undef_file3.cc: New file.
456 * testsuite/weak_undef_file4.cc: New file.
457 * testsuite/weak_undef_test_2.cc: New file.
459 2014-02-05 Cary Coutant <ccoutant@google.com>
461 Fix issues with gold undefined symbol diagnostics.
464 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
466 * target-reloc.h (is_strong_undefined): New function.
467 (relocate_section): Move undef vtable symbol check from here.
468 Check for is_strong_undefined.
470 2014-02-05 Cary Coutant <ccoutant@google.com>
472 Fix problems with the --dynamic-list option.
475 * options.cc (General_options::parse_dynamic_list):
476 Set have_dynamic_list_.
477 (General_options::General_options): Initialize have_dynamic_list_.
478 (General_options::finalize): Turn off -Bsymbolic and
479 -Bsymbolic-functions if --dynamic-list provided.
480 * options.h (General_options::have_dynamic_list): New function.
481 (General_options::have_dynamic_list_): New data member.
482 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
486 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
487 in --dynamic-list, mark it.
489 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
490 (dynamic_list_2): New test case.
491 * testsuite/Makefile.in: Regenerate.
492 * testsuite/dynamic_list_2.cc: New file.
493 * testsuite/dynamic_list_2.t: New file.
494 * testsuite/dynamic_list_lib1.cc: New file.
495 * testsuite/dynamic_list_lib2.cc: New file.
496 * testsuite/gc_dynamic_list_test.c: New file.
497 * testsuite/gc_dynamic_list_test.sh: New file.
498 * testsuite/gc_dynamic_list_test.t: New file.
500 2014-01-28 Cary Coutant <ccoutant@google.com>
502 Add .gdb_index version 7 support.
504 * gold/dwarf_reader.cc: include <utility> (for make_pair).
505 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
507 (Dwarf_ranges_table::read_ranges_table): Likewise.
508 (Dwarf_pubnames_table::read_section): Check for GNU-style
509 sections, and for compressed debug sections.
510 (Dwarf_pubnames_table::read_header): Compute end address of table.
511 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
512 for end of list by offset, not by offset == 0.
513 (Dwarf_info_reader::do_read_string_table): Check for compressed
515 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
516 Initialize new data members.
517 (Dwarf_pubnames_table::next_name): return flag_byte.
518 (Dwarf_pubnames_table::end_of_table_): New data member.
519 (Dwarf_pubnames_table::is_gnu_style_): New data member.
520 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
521 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
522 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
523 read skeleton type unit DIEs.
524 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
525 (Gdb_index::do_write): Write flag_byte.
526 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
527 (Gdb_index::Cu_vector): Store flags along with cu indexes.
528 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
529 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
531 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
533 * version.cc (print_version): Update copyright year to 2014.
535 2013-12-19 Dimitry Andric <dimitry@andric.com>
537 * stringpool.cc (Stringpool_template::reserve): Add
538 HAVE_UNORDERED_MAP case.
539 * stringpool.cc (Stringpool_template::print_stats): Likewise.
541 2013-12-18 Cary Coutant <ccoutant@google.com>
543 * configure.ac: Check for <unordered_set> and <unordered_map>.
544 * config.in: Regenerate.
545 * configure: Regenerate.
546 * system.h: Use <unordered_set> and <unordered_map> if available.
548 2013-12-10 Roland McGrath <mcgrathr@google.com>
550 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
551 with $(INSTALL_PROGRAM_ENV).
552 * Makefile.in: Regenerate.
554 2013-11-22 Cary Coutant <ccoutant@google.com>
556 * configure.ac: Add check for which library is needed for
558 * configure: Regenerate.
560 2013-11-22 Cary Coutant <ccoutant@google.com>
562 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
564 * testsuite/Makefile.in: Regenerate.
566 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
568 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
569 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
570 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
571 (Target_x86_64<size>::Scan::local): Likewise.
572 (Target_x86_64<size>::Scan::global): Likewise.
573 (Target_x86_64<size>::Relocate::relocate): Likewise.
574 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
576 (Target_x86_64<size>::Scan::check_non_pic(): Handle
579 * testsuite/Makefile.am (check_PROGRAMS): Add
580 exception_x86_64_bnd_test.
581 (exception_x86_64_bnd_test_SOURCES): New macro.
582 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
583 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
584 (exception_x86_64_bnd_test_LDADD): Likewise.
585 (exception_x86_64_bnd_1.o): New rule.
586 (exception_x86_64_bnd_2.o): Likewise.
587 * testsuite/Makefile.in: Regenerated.
589 2013-11-15 Alan Modra <amodra@gmail.com>
591 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
593 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
594 Only call ppc64_local_entry_offset for 64-bit. Restrict
595 symval_for_branch lookup to ELFv1.
596 (Stub_table::add_plt_call_entry): Use unsigned int off.
597 (Output_data_glink::Address, invalid_address): New.
598 (Output_data_glink::add_eh_frame): Move out of line. Add
600 (Output_data_glink::add_global_entry, find_global_entry,
601 global_entry_address): New functions.
602 (Output_data_glink::global_entry_stubs_, end_branch_table_,
603 ge_size): New variables.
604 (Output_data_glink::set_final_data_size): Add global entry
606 (Output_data_glink::do_write): Write global entry stubs.
607 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
608 parameter. Return true for ELFv2. Adjust callers.
609 (Target_powerpc::Scan::local, global): Restrict opd lookup to
610 ELFv1. Similarly for ifunc and dynamic relocation processing
611 specific to ELFv1. Recognize that symbols are defined on
612 their plt entries for ELFv2.
613 (Target_powerpc::symval_for_branch): Assert if called for
615 (Target_powerpc::Relocate::relocate): Use global entry plt
616 stub for symbol value if such exists on ELFv2.
617 (Target_powerpc::Relocate::relocate): Don't call
618 symval_for_branch when ELFv2. Do adjust for local entry
620 (Target_powerpc::do_dynsym_value): Set symbols to global entry
622 (Target_powerpc::do_plt_address_for_global): Similarly.
624 2013-11-14 Cary Coutant <ccoutant@google.com>
626 Revert patch -- this did not fix the problem, and there is
629 2013-11-14 Cary Coutant <ccoutant@google.com>
632 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
633 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
634 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
635 updating fde_offsets_.
636 (Eh_frame_hdr::lock_): New data member.
638 2013-11-14 Cary Coutant <ccoutant@google.com>
640 * dwp.cc (Dwo_file_entry): New type.
641 (File_list): Use Dwo_file_entry.
642 (Dwo_file::verify): New function.
643 (Dwo_file::verify_dwo_list): New function.
644 (Dwo_file::sized_verify_dwo_list): New function.
645 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
647 (Dwp_options): New enum type.
648 (dwp_options): Add --verify-only.
651 * dwp.h (gold_info): Add declaration.
653 2013-11-14 Cary Coutant <ccoutant@google.com>
656 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
657 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
658 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
659 updating fde_offsets_.
660 (Eh_frame_hdr::lock_): New data member.
662 2013-11-06 Cary Coutant <ccoutant@google.com>
665 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
666 before reloc sections.
668 2013-11-04 Alan Modra <amodra@gmail.com>
670 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
671 (Symbol::needs_dynamic_reloc): Test new flag.
672 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
673 (Target_powerpc::Scan::get_reference_flags): Add target param.
674 Return FUNC_DESC_ABI for 64-bit ELFv1.
675 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
677 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
678 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
680 2013-10-31 Cary Coutant <ccoutant@google.com>
682 Restore support for dwp v2 DWARF package file format.
684 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
685 tu_length parameter. Adjust all callers.
686 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
687 * dwp.cc: Include dwarf.h.
688 (Section_bounds): New struct type.
689 (Unit_set): New struct type.
690 (Dwo_file::Dwo_file): Initialize new data member.
691 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
692 Combine and rename to...
693 (Dwo_file::read_unit_index): ...this.
694 (Dwo_file::sized_read_compunit_index)
695 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
696 (Dwo_file::sized_read_unit_index): ...this.
697 (Dwo_file::copy_section): Remove section_name, is_str_offsets
698 parameters; add section_id parameter.
699 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
700 (Dwo_file::add_unit_set): ...this.
701 (Dwo_file::shndx_map_): Remove.
702 (Dwo_file::sect_offsets_): New data member.
703 (Dwp_output_file::Dwp_output_file): Initialize new data members.
704 (Dwp_output_file::add_section): Rename to...
705 (Dwp_output_file::add_contribution): ...this.
706 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
707 (Dwp_output_file::add_tu_set): Likewise.
708 (Dwp_output_file::Contribution): New type.
709 (Dwp_output_file::Section::contributions): New data member.
710 (Dwp_output_file::Cu_or_tu_set): Remove.
711 (Dwp_output_file::Section::Section): New ctor.
712 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
713 (Dwp_output_file::Dwp_index::Section_table): New type.
714 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
715 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
717 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
718 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
719 (Dwp_output_file::Dwp_index::section_table): New member function.
720 (Dwp_output_file::Dwp_index::section_table_end): New member function.
721 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
722 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
723 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
724 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
725 (Dwp_output_file::Dwp_index::section_table_): New data member.
726 (Dwp_output_file::Dwp_index::section_mask_): New data member.
727 (Dwp_output_file::add_output_section): New member function.
728 (Dwp_output_file::write_new_section): New member function.
729 (Dwp_output_file::write_contributions): New member function.
730 (Dwp_output_file::section_id_map_): New data member.
731 (class Dwo_id_info_reader): Remove.
732 (class Unit_reader): New class.
733 (get_dwarf_section_name): New function.
734 (Dwo_file::read_executable): Adjust initializations of class data.
735 (Dwo_file::read): Add support for v2 package file format.
736 (Dwo_file::read_unit_index): Likewise.
737 (Dwo_file::sized_read_unit_index): Likewise.
738 (Dwo_file::copy_section): Likewise.
739 (Dwo_file::add_unit_set): Likewise.
740 (Dwp_output_file::add_output_section): Likewise.
741 (Dwp_output_file::add_contribution): Likewise.
742 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
744 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
746 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
748 (Dwp_output_file::initialize): Remove unused function.
749 (Dwp_output_file::finalize): Add support for v2 package file format.
750 (Dwp_output_file::write_index): Likewise.
751 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
754 2013-10-31 Cary Coutant <ccoutant@google.com>
756 * configure.ac: Fix check for -fmerge-constants.
757 * configure.ac: Regenerate.
759 2013-10-30 Roland McGrath <mcgrathr@google.com>
761 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
762 Correct 9-byte nop sequence to match what the assembler generates.
764 2013-10-30 Alan Modra <amodra@gmail.com>
766 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
767 ppc64_local_entry_offset, ppc64_local_entry_offset,
768 do_read_symbols): New functions.
769 (Powerpc_relobj::e_flags_, st_other_): New vars.
770 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
771 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
772 (Powerpc_relobj::e_flags_): New var.
773 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
774 and adjust for ELFv2.
775 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
776 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
777 (Powerpc_dynobj::do_find_special_sections): Likewise.
778 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
779 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
780 to ELFv2 local entry.
781 (Target_powerpc::do_relax): No thread safe barriers needed for
783 (Output_data_plt_powerpc::initial_plt_entry_size_,
784 plt_entry_size): Delete. Replace all uses with
785 first_plt_entry_offset() and plt_entry_size().
786 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
787 reserved_size parm. Update callers.
788 (Output_data_plt_powerpc::entry_count): Update.
789 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
790 and use Target_powerpc::first_plt_entry_offset().
791 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
792 rename to plt_entry_size.
793 (Output_data_plt_powerpc::add_ifunc_entry,
794 add_local_ifunc_entry): Adjust reloc for ELFv2.
795 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
796 (glink_eh_frame_fde_64v2): New.
797 (Stub_table::plt_call_size): Support ELFv2 sizing.
798 (Output_data_glink::add_eh_frame): Use the new FDE.
799 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
800 (Stub_table::do_write): Write ELFv2 stubs and glink.
801 (Target_powerpc::Relocate::relocate): Replaces nop after call
802 with ld 2,24(1) and adjust local offset destination for ELFv2.
804 2013-10-30 Alan Modra <amodra@gmail.com>
806 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
807 (Target_powerpc::Scan::global, local): Likewise.
808 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
809 on all ppc64 @h and @ha relocs.
811 2013-10-14 Alan Modra <amodra@gmail.com>
813 * output.h (Output_data_got::add_constant): Tidy.
814 (Output_data_got::add_constant_pair): New function.
815 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
816 methods used so as to first call reserve_ent().
818 2013-10-11 Roland McGrath <mcgrathr@google.com>
820 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
821 add_got_entry and add_got_entry_pair.
823 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
824 (HAVE_PUBNAMES): Likewise.
825 * configure: Regenerate.
827 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
828 * testsuite/Makefile.in: Regenerate.
830 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
831 Remove const from declaration.
832 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
833 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
834 * output.h (Output_file_header): Remove const from member target_
835 and corresponding constructor argument.
836 * output.cc (Output_file_header::Output_file_header): Update prototype.
837 (Output_file_header::do_sized_write): Use this->target_ in place
838 of parameters()->target().
840 * testsuite/undef_symbol.cc (Foo::get_a): New method.
842 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
843 * configure: Regenerate.
844 * Makefile.in: Regenerate.
845 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
846 * testsuite/merge_string_literals_2.c: Likewise.
847 * testsuite/Makefile.am
848 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
849 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
850 literal -fmerge-constants.
851 * testsuite/Makefile.in: Regenerate.
853 * i386.cc (Target_i386): Remove unused member dynbss_.
854 * arm.cc (Target_arm): Likewise.
855 * powerpc.cc (Target_powerpc): Likewise.
856 * sparc.cc (Target_sparc): Likewise.
857 * tilegx.cc (Target_tilegx): Likewise.
858 * x86_64.cc (Target_x86_64): Likewise.
859 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
860 type_signature_, type_offset_.
861 * plugin.h (Plugin_hook): Remove unused member layout_.
862 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
864 (Read_member): Remove unused members input_objects_, symtab_,
866 (Check_library): Remove unused member symtab_.
867 * archive.h (Lib_group): Remove unused member lib_.
868 * archive.cc (Lib_group::Lib_group): Update initializer.
869 * incremental.h (Incremental_binary): Remove unused member target_.
870 (Incremental_script_entry): Removed unused member script_.
871 * layout.h (Write_symbols_task): Remove unused member input_objects_.
872 * icf.h (Icf): Remove unused member num_tracked_relocs.
874 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
875 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
877 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
879 * archive.h: Use struct rather than class for forward declaration
880 of Read_symbols_data.
882 2013-10-07 Cary Coutant <ccoutant@google.com>
885 * testsuite/Makefile.am (icf_test): Fix dependencies.
886 (icf_safe_test): Likewise.
887 (icf_safe_so_test): Likewise.
888 (large_symbol_alignment): Add empty _LDADD rule.
889 * testsuite/Makefile.in: Regenerate.
891 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
894 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
895 relocation for R_X86_64_32 on x32.
897 2013-08-27 Roland McGrath <mcgrathr@google.com>
899 * output.cc (Output_segment::set_section_addresses): Take new
900 Target* argument. If target->isolate_execinstr() and the segment
901 is executable and starts at a target->abi_pagesize() boundary,
902 pad its end out to a target->abi_pagesize() boundary with code fill.
903 * output.h (Output_segment::set_section_addresses): Update decl.
904 * layout.h (Layout::check_output_data_for_reset_values): Take new
905 argument RELAX_OUTPUTS.
906 (Layout): New member relax_output_list_.
907 (Layout::add_relax_output): New method.
908 * layout.cc (Layout::Layout): Update constructor.
909 (Layout::reset_relax_output): New method.
910 (Layout::clean_up_after_relaxation): Call it.
911 (Layout::prepare_for_relaxation): Update caller.
912 (Layout::set_segment_offsets): Update callers of set_section_addresses.
913 Call reset_relax_output before re-processing segments for
914 isolate_execinstr case.
915 (Layout::write_data): Handle relax_output_list_.
916 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
917 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
919 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
922 * object.h: Fix typos.
924 2013-08-16 Roland McGrath <mcgrathr@google.com>
926 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
927 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
929 2013-08-07 Cary Coutant <ccoutant@google.com>
931 Revert support for v2 DWP files:
933 2013-03-01 Cary Coutant <ccoutant@google.com>
935 Add dwp support for v2 DWARF package file format.
936 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
937 tu_length parameter. Adjust all callers.
938 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
939 * dwp.cc: Include dwarf.h.
940 (Section_bounds): New struct type.
941 (Unit_set): New struct type.
942 (Dwo_file::Dwo_file): Initialize new data member.
943 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
944 Combine and rename to...
945 (Dwo_file::read_unit_index): ...this.
946 (Dwo_file::sized_read_compunit_index)
947 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
948 (Dwo_file::sized_read_unit_index): ...this.
949 (Dwo_file::copy_section): Remove section_name, is_str_offsets
950 parameters; add section_id parameter.
951 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
952 (Dwo_file::add_unit_set): ...this.
953 (Dwo_file::shndx_map_): Remove.
954 (Dwo_file::sect_offsets_): New data member.
955 (Dwp_output_file::Dwp_output_file): Initialize new data members.
956 (Dwp_output_file::add_section): Rename to...
957 (Dwp_output_file::add_contribution): ...this.
958 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
959 (Dwp_output_file::add_tu_set): Likewise.
960 (Dwp_output_file::Contribution): New type.
961 (Dwp_output_file::Section::contributions): New data member.
962 (Dwp_output_file::Cu_or_tu_set): Remove.
963 (Dwp_output_file::Section::Section): New ctor.
964 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
965 (Dwp_output_file::Dwp_index::Section_table): New type.
966 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
967 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
969 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
970 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
971 (Dwp_output_file::Dwp_index::section_table): New member function.
972 (Dwp_output_file::Dwp_index::section_table_end): New member function.
973 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
974 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
975 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
976 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
977 (Dwp_output_file::Dwp_index::section_table_): New data member.
978 (Dwp_output_file::Dwp_index::section_mask_): New data member.
979 (Dwp_output_file::add_output_section): New member function.
980 (Dwp_output_file::write_new_section): New member function.
981 (Dwp_output_file::write_contributions): New member function.
982 (Dwp_output_file::section_id_map_): New data member.
983 (class Dwo_id_info_reader): Remove.
984 (class Unit_reader): New class.
985 (get_dwarf_section_name): New function.
986 (Dwo_file::read_executable): Adjust initializations of class data.
987 (Dwo_file::read): Add support for v2 package file format.
988 (Dwo_file::read_unit_index): Likewise.
989 (Dwo_file::sized_read_unit_index): Likewise.
990 (Dwo_file::copy_section): Likewise.
991 (Dwo_file::add_unit_set): Likewise.
992 (Dwp_output_file::add_output_section): Likewise.
993 (Dwp_output_file::add_contribution): Likewise.
994 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
996 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
998 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1000 (Dwp_output_file::initialize): Remove unused function.
1001 (Dwp_output_file::finalize): Add support for v2 package file format.
1002 (Dwp_output_file::write_index): Likewise.
1003 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1006 2013-07-31 Cary Coutant <ccoutant@google.com>
1008 * object.cc (Sized_relobj::do_output_section_address): New function.
1009 (Sized_relobj): Instantiate explicitly.
1010 * object.h (Object::output_section_address): New function.
1011 (Object::do_output_section_address): New function.
1012 (Sized_relobj::do_output_section_address): New function.
1013 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1015 2013-07-30 Cary Coutant <ccoutant@google.com>
1016 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1018 * parameters.cc (Parameters::entry): Return target-specific entry
1020 * target.h (Target::entry_symbol_name): New function.
1021 (Target_info::entry_symbol_name): New data member.
1023 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1024 * i386.cc (Target_i386::i386_info): Likewise.
1025 (Target_i386_nacl::i386_nacl_info): Likewise.
1026 * sparc.cc (Target_sparc::sparc_info): Likewise.
1027 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1028 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1029 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1030 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1032 2013-07-22 Sterling Augustine <saugustine@google.com>
1034 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1035 Convert parameter shndx to local variable. Add parameters symtab
1036 and symtab_size. Scan over section names. Find relocation
1037 section corresponding to current section. Create and initialize
1038 reloc_mapper_ and reloc_type_.
1039 (Dwarf_pubnames_table::read_header): Add assertion. Change
1040 unit_length to off_t. Initialize member unit_length_. Fill in field
1042 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1043 Initialize new fields unit_length_ and cu_offset_.
1044 (Dwarf_pubnames_table::read_section): Update prototype.
1045 (Dwarf_pubnames_table::cu_offset): New member function.
1046 (Dwarf_pubnames_table::subsection_size): Likewise.
1047 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1049 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1050 member functions public.
1051 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1052 Update comment. Rework logic. Move repeated parts to...
1053 (Gdb_index_info_reader::read_pubtable): ...here. New function.
1054 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1055 pubtypes_table_, and stmt_list_offset.
1056 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1057 Gdb_index::find_pubtype_offset,
1058 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1059 (Gdb_index::pubnames_read): Update prototype and rework logic.
1060 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1062 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1063 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1064 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1065 Gdb_index::map_pubtable_to_dies):
1067 (Gdb_index::pubnames_read): Update declaration.
1068 (Gdb_index::Pubname_offset_map): New type.
1069 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1070 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1071 Gdb_index::stmt_list_offset): Declare.
1072 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1073 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1074 Gdb_index::pubtypes_offset_): Remove.
1076 2013-07-19 Roland McGrath <mcgrathr@google.com>
1078 * options.h (General_options): Add -Trodata-segment option.
1079 * parameters.cc (Parameters::check_rodata_segment): New function.
1080 (Parameters::set_target_once): Call it.
1081 * parameters.h (Parameters): Declare it (private member function).
1082 * layout.cc (load_seg_unusable_for_headers): New function, broken
1083 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1084 then validate rodata segment rather than text segment.
1085 (relaxation_loop_body): Call that.
1086 (is_text_segment): New function. Don't admit a non-executable
1087 segment if TARGET->isolate_execinstr().
1088 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1090 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1093 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1094 * nacl.h (Sniff_file::View::View): Request aligned view.
1096 2013-07-11 Cary Coutant <ccoutant@google.com>
1098 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1099 correct BRLT entry size.
1101 2013-07-03 Alan Modra <amodra@gmail.com>
1103 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1106 2013-07-01 Cary Coutant <ccoutant@google.com>
1108 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1110 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1111 (Dwarf_ranges_table::lookup_reloc): New function.
1112 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1114 (Dwarf_ranges_table::lookup_reloc): New function.
1115 (Dwarf_ranges_table::reloc_type_): New data member.
1117 2013-06-27 Jing Yu <jingyu@google.com>
1120 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1122 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1123 (Target_powerpc::do_relax): Call the above.
1125 2013-06-27 Cary Coutant <ccoutant@google.com>
1127 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1128 on garbage collected .opd section.
1130 2013-06-27 Alan Modra <amodra@gmail.com>
1132 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1134 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1135 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1137 2013-06-14 Cary Coutant <ccoutant@google.com>
1139 * resolve.cc (Symbol::override_base): Don't override st_type
1140 from plugin placeholder symbols.
1141 (Symbol_table::resolve): Likewise.
1142 (Symbol_table::should_override): Don't complain about TLS mismatch
1143 if the TO symbol is a plugin placeholder.
1144 * testsuite/Makefile.am (plugin_test_tls): New test.
1145 * testsuite/Makefile.in: Regenerate.
1146 * testsuite/plugin_test_tls.sh: New test script.
1147 * testsuite/two_file_test_2_tls.cc: New test source.
1148 * testsuite/two_file_test_tls.cc: New test source.
1150 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1152 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1153 the maximum segment alignment is larger than the page size.
1154 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1155 correctly aligns the symbols with large alignemnt.
1156 * testsuite/Makefile.in: Regenerate.
1157 * testsuite/large_symbol_alignment.cc: New file.
1159 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1160 Sriraman Tallam <tmsriram@google.com>
1162 * options.h (sort_section): New option.
1163 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1164 Rename from Input_section_sort_section_name_special_ordering_compare.
1165 (Input_section_sort_section_name_compare): New struct.
1166 * output.cc (Output_section::Input_section_sort_section_name_compare::
1167 operator()): New function.
1168 (Output_section::sort_attached_input_sections): Use new sort function
1169 for .text if --sort-section=name is specified.
1170 * layout.cc (Layout::make_output_section):
1171 Add sorting by name when --sort-section=name is specified.
1172 * testsuite/Makefile.am (text_section_grouping): Test option
1173 --sort-section=name.
1174 * testsuite/Makefile.in: Regenerate.
1175 * testsuite/section_sorting_name.cc: New file.
1176 * testsuite/section_sorting_name.sh: New file.
1178 2013-05-21 Cary Coutant <ccoutant@google.com>
1180 * symtab.h (Symbol::is_cxx_vtable): New function.
1181 * target-reloc.h (relocate_section): Check for vtable symbol.
1182 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1183 * testsuite/Makefile.in: Regenerate.
1184 * testsuite/missing_key_func.cc: New test source.
1185 * testsuite/missing_key_func.sh: New test script.
1187 2013-05-21 Cary Coutant <ccoutant@google.com>
1189 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1190 type of enclosing symbol.
1191 (Relocate_info::location): Check symbol type when describing symbol.
1192 * object.h (Symbol_location_info): Remove unused line_number;
1193 add enclosing_symbol_type.
1194 * testsuite/debug_msg.sh: Adjust expected output.
1196 2013-05-13 Cary Coutant <ccoutant@google.com>
1198 * configure.ac: Export DEFAULT_TARGET.
1199 * configure: Regenerate.
1200 * Makefile.in: Regenerate.
1201 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1202 * testsuite/Makefile.in: Regenerate.
1203 * testsuite/debug_msg.sh: Delete duplicate tests.
1204 Don't check undef_int error message match for powerpc where the
1205 source file and line number aren't available.
1207 2013-05-10 Roland McGrath <mcgrathr@google.com>
1209 * options.h (General_options): Add --rosegment-gap option.
1210 * options.cc (finalize): --rosegment-gap implies --rosegment.
1211 * layout.cc (set_segment_offsets): Let user option override
1212 target->rosegment_gap().
1214 2013-05-10 Roland McGrath <mcgrathr@google.com>
1216 * options.h (General_options): Remove leading space from help
1217 messages for -nostdlib and --rosegment.
1219 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1222 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1224 2013-05-03 Alan Modra <amodra@gmail.com>
1226 * merge.cc (Output_merge_string::do_add_input_section): Correct
1227 scan for number of strings. Rename vars to avoid shadowing.
1228 Include missing terminator in input_size_.
1230 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1232 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1233 Restore empty string handling.
1235 2013-05-01 Cary Coutant <ccoutant@google.com>
1237 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1238 uninitialized warning.
1240 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1242 * output.cc (Output_section::add_merge_input_section): Allow
1243 to merge sections if the alignment is more than character size.
1244 * merge.h (Output_merge_string::Output_merge_string): Remove
1246 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1247 only not-null strings. Check the alignment of strings.
1249 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1250 alignment as the argument.
1251 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1252 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1253 Align non-zero length strings according to the addralign_.
1254 (Stringpool_template<Stringpool_char>::set_string_offsets):
1255 Updating offsets according to the given alignment.
1256 * testsuite/Makefile.am (text_section_grouping): Test if string
1257 literals are getting merged.
1258 * testsuite/Makefile.in: Regenerate.
1259 * testsuite/merge_string_literals_1.c: New file.
1260 * testsuite/merge_string_literals_2.c: Ditto.
1261 * testsuite/merge_string_literals.sh: Ditto.
1263 2013-04-26 Ian Lance Taylor <iant@google.com>
1265 * target-reloc.h (relocate_section): If the reloc offset is out of
1266 range, pass VIEW as NULL to relocate.relocate.
1267 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1268 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1269 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1270 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1271 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1272 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1274 2013-04-26 Geoff Pike <gpike@chromium.org>
1276 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1277 * layout.cc (Hash_task): New class.
1278 (Layout::queue_build_id_tasks): New function.
1279 (Layout::write_build_id): Handle single-thread portion of build ID
1280 computation. (In some cases, all of it is single-threaded.) Replace
1281 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1282 functionality in fewer lines of code.
1283 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1284 * options.h (General_options): make "--build-id" default to tree
1285 rather than sha1. Add two new options related to --build-id=tree:
1286 --build-id-chunk-size-for-treehash and
1287 --build-id-min-file-size-for-treehash.
1288 * Makefile.am: add testing of --build-id=tree and related new options
1289 (these tests will be invoked by "make check").
1290 * Makefile.in: Regenerate.
1292 2013-04-25 Alan Modra <amodra@gmail.com>
1294 * configure.tgt: Add powerpcle and powerpc64le.
1296 2013-04-22 Alan Modra <amodra@gmail.com>
1299 * layout.cc (Layout::segment_precedes): Allow more than one
1300 segment with the same type and flags.
1302 2013-04-15 Cary Coutant <ccoutant@google.com>
1304 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1305 allocate space in file for BSS sections.
1307 2013-04-15 Cary Coutant <ccoutant@google.com>
1309 * script-sections.cc (Orphan_output_section): Reset address
1310 to zero after each orphaned section for relocatable links.
1312 2013-04-15 Cary Coutant <ccoutant@google.com>
1314 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1315 section starting address for relocatable link.
1316 * testsuite/Makefile.am (script_test_11): New test.
1317 * testsuite/Makefile.in: Regenerate.
1318 * testsuite/script_test_11.c: New source file.
1319 * testsuite/script_test_11.t: New linker script.
1321 2013-04-13 Alan Modra <amodra@gmail.com>
1323 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1324 owner when sections are not adjacent and exceed group size.
1325 (Target_powerpc::group_sections): Handle corner case.
1326 (Target_powerpc::Branch_info::make_stub): Handle case where
1327 stub table doesn't exist due to branches in non-exec sections.
1328 (Target_powerpc::Relocate::relocate): Likewise.
1330 2013-04-11 Alan Modra <amodra@gmail.com>
1333 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1334 .branch_lt to match bfd ld. Adjust comments throughout file.
1336 2013-04-04 Ian Lance Taylor <iant@google.com>
1339 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1340 sections before checking whether they are included in the link.
1342 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1344 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1345 object before calling the plugin claim_file handler. Pass the elf
1346 object of the archive to the plugin. Delete the elf object if the
1347 plugin claims the file.
1349 2013-03-21 Alan Modra <amodra@gmail.com>
1351 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1352 segment when omagic.
1354 2013-03-21 Alan Modra <amodra@gmail.com>
1356 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1358 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1359 uninitialized" warning.
1361 2013-03-20 Alan Modra <amodra@gmail.com>
1363 * symtab.h (Symbol::clear_version): New function.
1364 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1365 is_needed by weak references. Clear version for symbols defined
1366 in as-needed objects that are not needed.
1368 2013-03-15 Alan Modra <amodra@gmail.com>
1370 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1371 static and public. Add report_err param. Return false for data refs.
1372 (Target_powerpc::rela_dyn_section): New overloaded function.
1373 (Target_powerpc::plt_, iplt_): Elucidate.
1374 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1375 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1376 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1377 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1378 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1379 push_branch and make_plt_entry for ifunc syms when
1380 reloc_needs_plt_for_ifunc.
1381 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1382 for ifunc unless reloc_needs_plt_for_ifunc.
1384 2013-03-15 Alan Modra <amodra@gmail.com>
1386 * gc.h (gc_process_relocs): Don't look through function descriptors.
1387 * icf.cc (get_section_contents): Do so here instead.
1389 2013-03-13 Alan Modra <amodra@gmail.com>
1391 * powerpc.cc (is_branch_reloc): Forward declare.
1392 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1393 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1394 false for 64-bit, true for 32-bit non-branch relocs.
1395 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1396 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1398 (icf_safe_test): Generate linker map file as well as nm output.
1399 (icf_safe_so_test): Likewise.
1400 * testsuite/Makefile.in: Regenerate.
1401 * testsuite/icf_test.sh: Parse linker map file to determine
1403 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1404 * testsuite/icf_safe_so_test.sh: Likewise.
1405 (X86_32_or_ARM_specific_safe_fold): Merge into..
1406 (arch_specific_safe_fold): ..this.
1407 (X86_64_specific_safe_fold): Delete unused function.
1409 2013-03-12 Alan Modra <amodra@gmail.com>
1411 * gc.h (gc_process_relocs): Look through function descriptors
1412 to determine shndx, symvalue and addend used by ICF. Tidy
1413 variable duplication.
1415 2013-03-11 Alan Modra <amodra@gmail.com>
1417 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1418 * layout.cc (Layout_task_runner::run): ..to here.
1419 * symtab.h (struct Symbol_location): Extract from..
1420 (class Symbol_table): ..here.
1421 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1422 * target.h (class Target): Add function_location and
1423 do_function_location functions.
1424 (class Sized_target): Add do_function_location.
1425 * object.h (class Sized_relobj_file): Move find_shdr..
1426 (class Object): ..to here.
1427 * object.cc: Likewise. Update to suit. Instantiate.
1428 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1429 * powerpc.cc (class Powerpc_dynobj): New.
1430 (Target_powerpc::do_function_location): New function.
1431 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1432 (Powerpc_dynobj::do_read_symbols): New function.
1433 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1435 2013-03-08 Ian Lance Taylor <iant@google.com>
1437 * options.cc (General_options::string_to_object_format): Accept
1440 2013-03-08 Alan Modra <amodra@gmail.com>
1442 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1443 pointer to Post_fde.
1444 (struct Post_fde): Move definition to here..
1445 * ehframe.cc (struct Post_fde): ..from here.
1446 (Cie::write): Don't alloc Post_fde.
1447 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1449 2013-03-07 Alan Modra <amodra@gmail.com>
1451 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1452 relocation referencing .LC0.
1453 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1455 2013-03-07 Alan Modra <amodra@gmail.com>
1457 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1458 always_inline. Add assembly for powerpc to avoid GOT.
1460 2013-03-07 Alan Modra <amodra@gmail.com>
1462 * testsuite/script_test_10.sh: Don't test .bss section
1465 2013-03-06 Alan Modra <amodra@gmail.com>
1467 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1468 (Target_powerpc::symval_for_branch): Add symtab param. Update
1469 all callers. Handle folded sections.
1470 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1472 (Global_symbol_visitor_opd::operator()): Likewise.
1474 2013-03-04 Alan Modra <amodra@gmail.com>
1476 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1477 * testsuite/Makefile.in: Regenerate.
1479 2013-03-01 Cary Coutant <ccoutant@google.com>
1481 Add dwp support for v2 DWARF package file format.
1482 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1483 tu_length parameter. Adjust all callers.
1484 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1485 * dwp.cc: Include dwarf.h.
1486 (Section_bounds): New struct type.
1487 (Unit_set): New struct type.
1488 (Dwo_file::Dwo_file): Initialize new data member.
1489 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1490 Combine and rename to...
1491 (Dwo_file::read_unit_index): ...this.
1492 (Dwo_file::sized_read_compunit_index)
1493 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1494 (Dwo_file::sized_read_unit_index): ...this.
1495 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1496 parameters; add section_id parameter.
1497 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1498 (Dwo_file::add_unit_set): ...this.
1499 (Dwo_file::shndx_map_): Remove.
1500 (Dwo_file::sect_offsets_): New data member.
1501 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1502 (Dwp_output_file::add_section): Rename to...
1503 (Dwp_output_file::add_contribution): ...this.
1504 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1505 (Dwp_output_file::add_tu_set): Likewise.
1506 (Dwp_output_file::Contribution): New type.
1507 (Dwp_output_file::Section::contributions): New data member.
1508 (Dwp_output_file::Cu_or_tu_set): Remove.
1509 (Dwp_output_file::Section::Section): New ctor.
1510 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1511 (Dwp_output_file::Dwp_index::Section_table): New type.
1512 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1513 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1515 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1516 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1517 (Dwp_output_file::Dwp_index::section_table): New member function.
1518 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1519 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1520 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1521 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1522 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1523 (Dwp_output_file::Dwp_index::section_table_): New data member.
1524 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1525 (Dwp_output_file::add_output_section): New member function.
1526 (Dwp_output_file::write_new_section): New member function.
1527 (Dwp_output_file::write_contributions): New member function.
1528 (Dwp_output_file::section_id_map_): New data member.
1529 (class Dwo_id_info_reader): Remove.
1530 (class Unit_reader): New class.
1531 (get_dwarf_section_name): New function.
1532 (Dwo_file::read_executable): Adjust initializations of class data.
1533 (Dwo_file::read): Add support for v2 package file format.
1534 (Dwo_file::read_unit_index): Likewise.
1535 (Dwo_file::sized_read_unit_index): Likewise.
1536 (Dwo_file::copy_section): Likewise.
1537 (Dwo_file::add_unit_set): Likewise.
1538 (Dwp_output_file::add_output_section): Likewise.
1539 (Dwp_output_file::add_contribution): Likewise.
1540 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1542 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1544 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1546 (Dwp_output_file::initialize): Remove unused function.
1547 (Dwp_output_file::finalize): Add support for v2 package file format.
1548 (Dwp_output_file::write_index): Likewise.
1549 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1552 2013-03-01 Cary Coutant <ccoutant@google.com>
1554 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1555 function into class definition in header file.
1556 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1557 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1559 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1561 2013-02-28 Alan Modra <amodra@gmail.com>
1563 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1564 * target.cc (Target::do_plt_fde_location): New function.
1565 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1566 accessor function, and constructor param.
1567 (struct Post_fde, Post_fdes): Declare.
1568 (Cie::write): Add post_fdes param.
1569 * ehframe.cc (Fde::write): Use plt_fde_location.
1570 (struct Post_fde): Define.
1571 (Cie::write): Stash FDEs added post merge mapping.
1572 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1573 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1574 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1576 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1577 (Target_powerpc::has_glink): New function.
1578 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1579 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1580 glink_eh_frame_fde_32, default_fde): New data.
1581 (Stub_table::eh_frame_added_): New var.
1582 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1584 (Stub_table::add_eh_frame): New function.
1585 (Output_data_glink::add_eh_frame): New function.
1586 (Target_powerpc::make_glink_section): Call add_eh_frame.
1588 2013-02-15 Ian Lance Taylor <iant@google.com>
1590 * options.h (DEFINE_uint64_alias): Define.
1591 (class General_options): Add -Ttext-segment as an alias for
1594 2013-02-15 Alan Modra <amodra@gmail.com>
1596 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1597 (Stub_table::do_write): ..here, two places.
1598 (Stub_table::plt_call_size): Use it here too.
1600 2013-02-11 Ian Lance Taylor <iant@google.com>
1602 * descriptors.cc (Descriptors::close_all): New function.
1603 * descriptors.h (class Descriptors): Declare close_all.
1604 (close_all_descriptors): New inline function.
1605 * plugin.cc: Include "descriptors.h".
1606 (Plugin_manager::cleanup): Call close_all_descriptors.
1608 2013-02-06 Alan Modra <amodra@gmail.com>
1610 * README: Update coding style link.
1612 2013-01-28 Cary Coutant <ccoutant@google.com>
1614 * dwp.cc (File_list): New typedef.
1615 (Dwo_name_info_reader): New class.
1616 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1617 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1618 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1619 (Dwo_file::read_executable): New function.
1620 (Dwo_file::read): Move common setup code to ...
1621 (Dwo_file::make_object): ... here.
1622 (dwp_options): Add --exec/-e.
1626 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1628 * layout.cc (Layout::layout): Check for option text_reorder.
1629 (Layout::make_output_section): Ditto.
1630 * options.h (text_reorder): New option.
1631 * output.cc (Input_section_sort_compare): Remove special ordering
1634 Input_section_sort_section_name_special_ordering_compare::
1635 operator()): New function.
1636 (Output_section::sort_attached_input_sections): Use new sort function
1638 * output.h (Input_section_sort_section_name_special_ordering_compare):
1640 * testsuite/Makefile.am (text_section_grouping): Test option
1642 * testsuite/Makefile.in: Regenerate.
1643 * testsuite/text_section_grouping.sh: Check order of functions without
1644 default text reordering.
1646 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1648 * options.h (General_options): Change default to true for new_dtags.
1650 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1652 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1653 when enable_new_dtags is false. Only add DT_RUNPATH when
1654 enable_new_dtags is true.
1656 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1658 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1659 used in declaration and definition consistent.
1660 (Target_powerpc::symval_for_branch): Ditto.
1662 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1664 * testsuite/plugin_final_layout.cc: Fix comment.
1666 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1668 * layout.cc (Layout::layout): Do not do default sorting for
1669 text sections when section ordering is specified.
1670 (make_output_section): Ditto.
1671 * testsuite/plugin_final_layout.cc: Name the function sections
1672 to catch reordering issues.
1674 2013-01-15 Alan Modra <amodra@gmail.com>
1676 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1679 2013-01-15 Alan Modra <amodra@gmail.com>
1681 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1682 * testsuite/Makefile.in: Regenerate.
1684 2013-01-14 Alan Modra <amodra@gmail.com>
1686 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1687 * testsuite/Makefile.in: Regenerate.
1689 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1692 Fix mingw gold build with plugins enabled
1693 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1694 * configure.ac: Export DLOPEN_LIBS and add headers check.
1695 * plugin.cc: Handle non-dlfcn case.
1696 * Makefile.in: Regenerate.
1697 * config.in: Regenerate.
1698 * configure: Regenerate.
1699 * testsuite/Makefile.in: Regenerate.
1701 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1703 * output.h (sort_attached_input_sections): Change to be public.
1704 * script-sections.cc
1705 (Output_section_definition::set_section_addresses): Sort
1706 attached input sections according to section order before linker
1707 script assigns section addresses.
1708 (Orphan_output_section::set_section_addresses): Sort
1709 attached input sections according to section order before linker
1710 script assigns section addresses.
1711 * Makefile.am (final_layout.sh): Use a simple linker script to
1712 check if section ordering still works.
1713 * Makefile.in: Regenerate.
1715 2013-01-09 Ben Cheng <bccheng@google.com>
1717 * arm.cc (Target_arm::attributes_accept_div): New function.
1718 (Target_arm::attributes_forbid_div): New function.
1719 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1720 attribute using the same new functions as what bfd/elf32_arm.c
1723 2013-01-07 Cary Coutant <ccoutant@google.com>
1726 * output.cc (Output_section::add_input_section): For incremental
1727 updates, don't track input sections that are allocated from patch
1730 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1731 Ian Lance Taylor <iant@google.com>
1734 * configure.ac (--enable-ld): Removed.
1735 (install_as_default): Set to yes only for --enable-gold=default
1737 * configure: Regenerated.
1739 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1741 * options.h (General_options): Add -fuse-ld= for GCC linker
1742 option compatibility.
1744 2013-01-04 Cary Coutant <ccoutant@google.com>
1746 * configure.ac: Fix typo restoring CXXFLAGS.
1747 * configure: Regenerate.
1749 2013-01-04 Cary Coutant <ccoutant@google.com>
1751 * testsuite/Makefile.am (CXXLINK_S): New macro.
1752 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1753 * testsuite/Makefile.in: Regenerate.
1755 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1757 * version.cc (print_version): Update copyright year to 2013.
1759 2012-12-20 Ian Lance Taylor <iant@google.com>
1761 * layout.cc (Layout::special_ordering_of_input_section): New
1763 (Layout::layout): If input section requires special ordering, must
1764 sort input sections.
1765 (Layout::make_output_section): May sort .text input sections.
1766 (Layout::is_section_name_prefix_grouped): Remove.
1767 * layout.h (class Layout): Declare
1768 special_ordering_of_input_section. Don't declare
1769 is_section_name_prefix_grouped.
1770 * output.cc (Output_section::add_input_section): Revert last
1772 (Output_section::Input_section_sort::match_file_name): Don't crash
1773 if called on output section data.
1774 (Output_section::Input_section_sort_compare): Sort based on
1776 (Output_section::Input_section_sort_section_order_index_compare):
1778 (Output_section::sort_attached_input_sections): Likewise.
1780 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1782 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1783 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1784 * output.cc (Output_section::add_input_section): Check if section
1785 name contains special prefix. Keep input sections to sort such
1787 (Output_section::Input_section_sort_section_order_index_compare
1788 ::operator()): Group sections according to prefixes.
1789 (Output_section::sort_attached_input_sections): Add condition to
1790 Input_section_entry constructor call.
1791 * testsuite/Makefile.am (text_section_grouping): New test.
1792 * testsuite/Makefile.in: Regenerate.
1793 * testsuite/text_section_grouping.cc: New file.
1794 * testsuite/text_section_grouping.sh: New file.
1796 2012-12-17 Nick Clifton <nickc@redhat.com>
1798 * Makefile.am: Add copyright notice.
1801 * configure.ac: Likewise.
1802 * ftruncate.c: Likewise.
1803 * Makefile.in: Regenerate.
1805 2012-12-14 Cary Coutant <ccoutant@google.com>
1807 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1808 --no-as-needed flag.
1809 (exception_separate_shared_12_test): Likewise.
1810 (incremental_copy_test): Likewise.
1811 * testsuite/Makefile.in: Regenerate.
1813 2012-12-14 Cary Coutant <ccoutant@google.com>
1815 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1816 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1818 2012-12-12 Alan Modra <amodra@gmail.com>
1820 * powerpc.cc (class Track_tls): New.
1821 (class Relocate, class Scan): Inherit Track_tls.
1822 (Target_powerpc::Scan::local, global): Track tls optimization
1823 and avoid creating plt entry for __tls_get_addr if all uses
1825 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1827 2012-12-12 Alan Modra <amodra@gmail.com>
1829 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1830 Replace no_toc_optimize with toc_optimize.
1831 * output.h (Output_section::input_sections): Provide non-const variant.
1832 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1833 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1835 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1836 (class Sort_toc_sections): New.
1837 (Target_powerpc::do_finalize_sections): Sort toc sections.
1838 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1840 2012-12-10 Roland McGrath <mcgrathr@google.com>
1842 * testsuite/binary_unittest.cc (read_all): New function.
1843 (Sized_binary_test): Use it instead of ::read.
1844 * fileread.cc (do_read): Don't assume pread always reads the whole
1845 amount in a single call.
1847 2012-12-10 Alan Modra <amodra@gmail.com>
1849 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1850 Set EM_PPC64 or EM_PPC here.
1851 (Target_selector_powerpc::do_recognize): Delete.
1853 2012-12-10 Alan Modra <amodra@gmail.com>
1855 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1857 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1859 2012-12-07 Roland McGrath <mcgrathr@google.com>
1861 * testsuite/binary_unittest.cc (Sized_binary_test):
1862 Use open_descriptor rather than ::open.
1864 2012-12-07 Alan Modra <amodra@gmail.com>
1866 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1867 typedef and invalid_address constant.
1868 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1869 instantiate constants.
1871 2012-12-06 Roland McGrath <mcgrathr@google.com>
1873 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1874 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1875 * aclocal.m4: Regenerate.
1876 * configure: Regenerate.
1877 * Makefile.in: Regenerate.
1878 * testsuite/Makefile.in: Regenerate.
1880 2012-12-07 Alan Modra <amodra@gmail.com>
1882 * options.h (General_options): Add no_toc_optimize.
1883 * powerpc.cc (ok_lo_toc_insn): New function.
1884 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1886 2012-12-06 Alan Modra <amodra@gmail.com>
1888 * options.h (General_options): Add plt_align, plt_static_chain,
1889 plt_thread_safe. Update stub_group_size help text.
1890 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1891 for new plt_thread_safe_ var.
1892 (use_plt_offset): Correct comments.
1893 (Target_powerpc::do_relax): Look for thread creation symbols to
1894 determine default plt_thread_safe value. Clear plt call stubs
1895 as well as branch stubs each iteration.
1896 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1898 (l, hi, ha, write_insn): Move earlier.
1899 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1900 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1902 (Stub_table::update_size): Adjust.
1903 (Stub_table::prev_size, set_prev_size): Delete.
1904 (Stub_table::stub_align): Let --plt-align affect result.
1905 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1906 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1907 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1908 (Stub_table::do_write): Support more stub variants.
1910 2012-12-04 Alan Modra <amodra@gmail.com>
1912 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1913 (Target_powerpc::do_define_standard_symbols): New function.
1915 2012-12-03 Alan Modra <amodra@gmail.com>
1917 * output.h: Formatting, whitespace.
1919 2012-12-03 Alan Modra <amodra@gmail.com>
1921 * layout.h (Layout::get_executable_sections): Declare.
1922 * layout.cc (Layout::get_executable_sections): New function.
1923 * arm.cc (Target_arm::group_sections): Use it.
1924 (Arm_output_section::group_sections): Delete now redundant test.
1925 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1926 param to handle relative relocs.
1927 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1928 (Output_data_reloc::add_absolute): Adjust.
1929 (Output_data_reloc::add_relative): New function.
1930 (Output_data::reset_data_size): New function.
1931 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1932 (Output_section::set_addralign): New function.
1933 (Output_section::checkpoint_set_addralign): New function.
1934 (Output_section::clear_section_offsets_need_adjustment): New function.
1935 (Output_section::input_sections): Make public.
1936 * powerpc.cc (class Output_data_brlt_powerpc): New.
1937 (class Stub_table, class Stub_control): New.
1938 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1939 stub_table_, set_stub_table, stub_table): New vectors and accessor
1941 (Target_powerpc::do_may_relax, do_relax, push_branch,
1942 new_stub_table, stub_tables, brlt_section, group_sections,
1943 add_branch_lookup_table, find_branch_lookup_table,
1944 write_branch_lookup_table, make_brlt_section): New functions.
1945 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1946 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1947 branch_info_): New vars.
1948 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1949 make call stubs here.
1950 (Output_data_glink): Remove all call stub handling from this class.
1951 (Target_powerpc::Scan::local, global): Save interesting branch
1952 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1953 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1954 functions on final link.
1955 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1956 Handle long branch destinations too.
1957 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1958 do_plt_address_for_local): Adjust lookup of plt call stubs.
1960 2012-11-30 Alan Modra <amodra@gmail.com>
1962 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1963 relocs against protected symbols when building 32-bit shared libs.
1965 2012-11-30 Alan Modra <amodra@gmail.com>
1967 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1968 param. Call got_section() to make .got. Update all callers
1969 and their callers and so on.
1971 2012-11-30 Alan Modra <amodra@gmail.com>
1973 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1974 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1975 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1976 value if it already exists.
1978 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1981 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1983 2012-11-14 Roland McGrath <mcgrathr@google.com>
1985 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1986 than bfc instruction for data sandboxing.
1988 2012-11-08 Alan Modra <amodra@gmail.com>
1990 * po/POTFILES.in: Regenerate.
1992 2012-11-05 Alan Modra <amodra@gmail.com>
1994 * configure.ac: Apply 2012-09-10 change to config.in here.
1995 * configure: Regenerate.
1997 2012-11-05 Alan Modra <amodra@gmail.com>
1999 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2000 (struct Opd_ent): Use "Address" rather than "Offset".
2001 (Output_data_got_powerpc::got_base_offset): Return Valtype.
2002 (Target_powerpc::got_section): Make public.
2003 (Target_powerpc::scan_relocs): Move code setting symbols..
2004 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2005 Create _SDA_BASE_ only when referenced.
2007 2012-11-02 Roland McGrath <mcgrathr@google.com>
2009 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2012 2012-11-01 Roland McGrath <mcgrathr@google.com>
2014 * target.h (Sized_target::relocate_relocs): Use Elf_Off
2015 for offset_in_output_section parameter.
2016 (Sized_target::relocate_special_relocatable): Likewise.
2017 * arm.cc (Target_arm::relocate_relocs): Likewise.
2018 (Target_arm::relocate_special_relocatable): Likewise.
2019 * i386.cc (Target_i386::relocate_relocs): Likewise.
2020 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2021 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2022 * target-reloc.h (relocate_relocs): Likewise.
2023 * testsuite/testfile.cc (Target_test): Likewise.
2024 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2025 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2027 * system.h: Move inclusion of <clocale> to after <libintl.h> in
2028 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2030 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2031 parameter, which is unused in the [!F_SETFD] case.
2033 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2034 SYMNDX to off_t before comparing it to this->data_size().
2035 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2036 * incremental.cc (Output_section_incremental_inputs::do_write):
2037 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2039 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2041 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
2043 * gold.cc (Target_arm::do_adjust_elf_header): Add the
2044 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2047 2012-10-29 Cary Coutant <ccoutant@google.com>
2049 * dwp.cc (usage): Add file and exit status parameters;
2050 add --help and --version options.
2051 (print_version): New function.
2052 (main): Add --help and --version options.
2054 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2056 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2057 final_layout_sequence.txt.
2058 * testsuite/Makefile.in: Regenerated.
2060 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2062 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2063 COMPILE generated by automake.
2065 (CXXCOMPILE1): Likewise.
2066 (CXXLINK1): Likewise.
2067 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2069 (CXXCOMPILE): Likewise.
2070 (CXXLINK): Likewise.
2071 * testsuite/Makefile.in: Regenerated.
2073 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2075 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2076 on bad fwrite return.
2078 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2080 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2083 2012-10-23 Cary Coutant <ccoutant@google.com>
2085 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2086 * testsuite/Makefile.in: Regenerate.
2087 * testsuite/dwp_test.h: New source file.
2088 * testsuite/dwp_test_1.cc: New source file.
2089 * testsuite/dwp_test_1.s: New source file.
2090 * testsuite/dwp_test_1.sh: New source file.
2091 * testsuite/dwp_test_1b.cc: New source file.
2092 * testsuite/dwp_test_1b.s: New source file.
2093 * testsuite/dwp_test_2.cc: New source file.
2094 * testsuite/dwp_test_2.s: New source file.
2095 * testsuite/dwp_test_2.sh: New source file.
2096 * testsuite/dwp_test_main.cc: New source file.
2097 * testsuite/dwp_test_main.s: New source file.
2099 2012-10-23 Cary Coutant <ccoutant@google.com>
2101 * dwp.h: New header file.
2102 * dwp.cc: New source file.
2103 * gold.h: Move shared declarations to system.h.
2104 * system.h: New header file.
2105 * Makefile.am: Add dwp.
2106 * Makefile.in: Regenerate.
2108 2012-10-23 Cary Coutant <ccoutant@google.com>
2110 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2111 Dwarf_info_reader::read_from_pointer.
2112 (Dwarf_pubnames_table::read_header): Likewise.
2113 (Dwarf_pubnames_table::next_name): Likewise.
2114 (Dwarf_die::read_attributes): Likewise.
2115 (Dwarf_die::skip_attributes): Likewise.
2116 (Dwarf_info_reader::read_from_pointer): New function template.
2117 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2118 (Dwarf_pubnames_table): Likewise.
2119 (Dwarf_info_reader::read_from_pointer): New function template.
2120 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2121 Dwarf_pubnames_table ctor.
2123 2012-10-23 Cary Coutant <ccoutant@google.com>
2125 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2127 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2129 (Dwarf_info_reader::set_abbrev_shndx): New method.
2130 (Dwarf_info_reader::abbrev_shndx_): New data member.
2132 2012-10-23 Cary Coutant <ccoutant@google.com>
2134 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2135 from object, not parameters.
2136 (Dwarf_info_reader::parse): Likewise.
2137 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2138 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2139 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2142 2012-10-23 Cary Coutant <ccoutant@google.com>
2144 * fileread.cc (Input_file::Input_file): New constructor.
2145 * fileread.h (class Input_file): Add new constructor.
2147 2012-10-18 Alan Modra <amodra@gmail.com>
2150 * object.cc (Relobj::is_section_name_included): Also match
2151 .sdata personality section.
2153 2012-10-18 Alan Modra <amodra@gmail.com>
2155 * target-reloc.h (class Default_comdat_behavior): New, package up..
2156 (get_comdat_behaviour): ..this.
2157 (relocate_section): Add Relocate_comdat_behavior template arg,
2158 adjust code to suit.
2159 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2160 (Target_arm::scan_reloc_section): Likewise.
2161 * i386.cc (Target_i386::relocate_section): Likewise.
2162 * sparc.cc (Target_sparc::relocate_section): Likewise.
2163 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2164 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2165 * powerpc.cc (class Relocate_comdat_behavior): New.
2166 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2167 gold::relocate_section with new template arg.
2169 2012-10-18 Alan Modra <amodra@gmail.com>
2171 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2172 dynamic relocs for GOT_TPREL got entries, without symbol if
2174 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2175 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2176 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2178 2012-10-17 Alan Modra <amodra@gmail.com>
2181 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2183 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2185 * layout.cc (Layout::include_section): Keep sections marked
2186 SHF_EXCLUDE when doing relocatable links.
2188 2012-10-16 Alan Modra <amodra@gmail.com>
2190 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2191 (Target_powerpc::do_finalize_sections): Call it.
2192 (Output_data_save_res): New class and supporting functions.
2193 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2194 normal symbols defined in object files.
2196 2012-10-12 Alan Modra <amodra@gmail.com>
2198 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2199 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2200 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2201 section if scan_opd_relocs not yet called.
2202 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2204 2012-10-12 Alan Modra <amodra@gmail.com>
2206 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2207 add_local_ifunc_entry): Revert last change.
2208 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2210 2012-10-05 Alan Modra <amodra@gmail.com>
2212 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2213 do_plt_address_for_global): New functions.
2214 (Output_data_got_powerpc::do_write): Don't segfault when linking
2216 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2217 add_local_ifunc_entry): Return true on adding entry..
2218 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2219 glink->add_entry call. Remove unused symtab param. Adjust calls.
2220 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2221 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2222 set up symbols here.
2223 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2224 syms here. Do so even when no .iplt. Don't segfault when linking
2226 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2227 new variants without reloc param.
2228 (Glink_sym_ent::Glink_sym_ent): Likewise.
2229 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2230 reloc when refs will resolve to plt call stub.
2231 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2232 R_PPC_PLTREL24 to resolve locally.
2233 (Target_powerpc::Scan::global): Correct ifunc handling.
2234 (Target_powerpc::Relocate::relocate): Correct local sym glink
2235 lookup. Don't destroy "value" when we have a plt call stub,
2236 and when checking plt call validity.
2237 (Target_powerpc::do_dynsym_value): Simplify.
2239 2012-10-05 Alan Modra <amodra@gmail.com>
2241 * i386.cc (Output_data_plt_i386::address_for_global,
2242 address_for_local): Add plt offset to returned value. Adjust uses.
2243 * sparc.cc (Output_data_plt_sparc::address_for_global,
2244 address_for_local): Likewise.
2245 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2246 address_for_local): Likewise.
2247 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2248 address_for_local): Likewise.
2249 * target.h (Target::plt_address_for_global, plt_address_for_local):
2251 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2252 (Output_data_got::Got_entry::write): Nor here.
2253 * output.h: Comment fix.
2255 2012-10-02 Jiong Wang <jiwang@tilera.com>
2257 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2258 global_offset_table_ value for larget got.
2259 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2261 2012-09-29 Alan Modra <amodra@gmail.com>
2263 * powerpc.cc (Target_powerpc::iplt_): New output section.
2264 (Target_powerpc::iplt_section, make_iplt_section,
2265 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2266 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2267 Target_powerpc::plt_entry_count): Count iplt entries too.
2268 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2269 reloc section in constructor. New params.
2270 (Target_powerpc::make_plt_section): Create reloc section here instead.
2271 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2273 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2274 (Output_data_glink::add_entry, find_entry): New functions to
2275 deal with local syms.
2276 (Glink_sym_ent): Add support for local syms.
2277 (Output_data_glink::do_write): Handle ifunc plt entries.
2278 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2279 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2280 (Target_powerpc::Relocate::relocate): Likewise.
2281 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2283 2012-09-25 Alan Modra <amodra@gmail.com>
2285 * object.h (Sized_relobj_file::adjust_local_symbol,
2286 do_adjust_local_symbol): New functions.
2287 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2288 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2289 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2290 and irregular opd entry spacing.
2291 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2292 (Global_symbol_visitor_opd): New functor.
2293 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2294 on deleted opd entries.
2296 2012-09-15 Jiong Wang <jiwang@tilera.com>
2298 * tilegx.cc: New file.
2299 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2300 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2301 * configure.tgt: Add entries for tilegx*.
2302 * configure.ac: Likewise.
2303 * Makefile.in: Rebuild.
2304 * configure: Likewise.
2305 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2308 2012-09-13 Alan Modra <amodra@gmail.com>
2310 * target-reloc.h (scan_relocs): Call scan.local for relocs
2311 against symbols in discarded sections. Pass is_discarded
2313 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2314 Add is_discarded param.
2315 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2316 is_discarded to flag opd entry as discarded. Don't emit dyn
2317 relocs on such entries.
2318 (Target_powerpc::Scan::global): Similarly detect and handle
2320 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2321 opd_ent_. Update all uses.
2322 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2323 (Target_powerpc::relocate_section): Zero out discarded opd
2326 2012-09-12 Ian Lance Taylor <iant@google.com>
2329 * output.cc: Rename Output_data_got template parameter from size
2330 to got_size for all functions. Compile all variants of
2332 (Output_data_got::Got_entry::write): Correct use of size for
2333 symbol value. Use local_is_tls rather than casting to
2335 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2336 (class Sized_relobj_file): Add do_local_is_tls.
2337 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2339 2012-09-11 Alan Modra <amodra@gmail.com>
2342 * layout.cc (Layout::set_segment_offsets): When using
2343 common-page-size alignment, ensure we are on a new max-page-size
2345 * output.cc (Output_segment::set_section_addresses): Use
2346 abi_pagesize, not common_pagesize for relro boundary.
2347 (Output_segment::set_offset): Likewise.
2349 2012-09-11 Alan Modra <amodra@gmail.com>
2351 * output.h (Output_data_got::add_global_tls, add_local_tls,
2352 add_local_tls_pair): New functions.
2353 (Output_data_got::add_local_pair_with_rel): Remove second
2354 reloc param. Expand comment.
2355 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2356 use_plt_or_tls_offset_, similarly for constructor param.
2357 (Output_data_got::Got_entry::write): Add got_index param.
2358 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2359 add_local_tls_pair): New functions.
2360 (Output_data_got::Got_entry::write): Handle tls symbols
2361 with use_plt_or_tls_offset_ set specially.
2362 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2363 (Output_data_got::do_write): Replace iterator with index, pass
2364 index to entry write function.
2365 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2366 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2367 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2369 * i386.cc (Target_i386::Scan::local): Likewise.
2370 * sparc.cc (Target_sparc::Scan::local): Likewise.
2371 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2372 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2373 do_tls_offset_for_global): New functions.
2374 (Target_powerpc::Scan::local): Correct TLS relocations and got
2376 (Target_powerpc::Scan::global): Don't emit unnecessary
2377 dynamic relocations on TLS GOT entries.
2379 2012-09-10 Matthias Klose <doko@ubuntu.com>
2381 * config.in: Disable sanity check for kfreebsd.
2383 2012-09-10 Sterling Augustine <saugustine@google.com>
2385 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2386 (Gdb_index::pubtypes_read): New parameter.
2387 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2389 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2392 2012-09-09 Alan Modra <amodra@gmail.com>
2394 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2395 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2396 * gc.h (gc_process_relocs): Call target gc_add_reference.
2397 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2398 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2399 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2401 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2402 to cater for when we don't need code offset. Update use.
2403 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2404 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2405 set_opd_valid): New functions.
2406 (Target_powerpc::do_gc_add_reference): New function.
2407 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2409 (Target_powerpc::do_gc_mark_symbol): New function.
2411 2012-09-06 Cary Coutant <ccoutant@google.com>
2413 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2414 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2415 (Dwarf_die::skip_attributes): Likewise.
2416 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2417 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2419 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2421 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2423 * testsuite/script_test_3.t: Add .got.plt output section
2425 * testsuite/script_test_4.t: Likewise.
2427 2012-09-05 Alan Modra <amodra@gmail.com>
2429 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2430 update all uses and lose "enum" when using type.
2432 2012-09-05 Alan Modra <amodra@gmail.com>
2434 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2435 * configure: Regenerate.
2436 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2437 (plugin_final_layout.stdout): Likewise.
2438 (memory_test): Set page sizes to 0x1000.
2439 * testsuite/Makefile.in: Regenerate.
2440 * testsuite/discard_locals_test.sh: Add FIXME comment.
2441 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2442 * testsuite/pr14265.t: Add .got output section statement.
2443 * testsuite/script_test_2.t: Likewise.
2444 * testsuite/script_test_3.t: Likewise.
2445 * testsuite/script_test_4.t: Likewise.
2446 * testsuite/script_test_5.t: Likewise.
2447 * testsuite/script_test_6.t: Likewise.
2448 * testsuite/script_test_7.t: Likewise.
2449 * testsuite/script_test_9.t: Likewise.
2451 2012-09-05 Alan Modra <amodra@gmail.com>
2453 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2454 (Powerpc_relocate_functions::Status): New typedef.
2455 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2456 (Target_powerpc::Scan::local): Handle REL64.
2457 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2458 for REL32 and REL64.
2459 (Target_powerpc::symval_for_branch): New function, extracted from..
2460 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2461 checks. Report overflow errors.
2463 2012-09-05 Alan Modra <amodra@gmail.com>
2465 * object.h (Sized_relobj_file::emit_relocs): Delete.
2466 (Sized_relobj_file::emit_relocs_reltype): Delete.
2467 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2468 relocate_relocs for --emit-relocs.
2469 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2470 * output.h: Update comment.
2471 (Output_segment::first_section): New function.
2472 (Output_segment::first_section_load_address): Use first_section.
2473 * output.cc (Output_segment::first_section): New function extracted..
2474 (Output_segment::first_section_load_address): ..from here. Delete.
2475 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2476 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2477 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2478 adjust call to target.h function.
2479 * i386.cc (Target_i386): Likewise.
2480 * sparc.cc (Target_sparc): Likewise.
2481 * x86_64.cc (Target_x86_64): Likewise.
2482 * powerpc.cc (Target_powerpc): Likewise.
2483 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2484 first tls section has section symbol for optimised local dynamic
2486 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2487 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2489 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2490 Rename to relocate_relocs. Update error message.
2492 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2494 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2497 2012-08-31 Alan Modra <amodra@gmail.com>
2499 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2500 (Powerpc_relobj::toc_base_offset): New stub function.
2501 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2502 got_mod_index_offset to tlsld_got_offset. Update all refs.
2503 (Target_powerpc::Relocate::enum skip_tls): New.
2504 (Target_powerpc::call_tls_get_addr_): New var.
2505 (Target_powerpc::is_branch_reloc): Move to file scope.
2506 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2507 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2509 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2510 (powerpc_info): Correct common_pagesize for ppc64.
2511 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2512 (Powerpc_relocate_functions): Add overflow check enums and functions.
2513 Add non-shift version of rela, rela_ua. Delete all rel public
2514 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2515 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2516 addr16_ha3, addr14 functions.
2517 (Output_data_got_powerpc::add_constant_pair): New function.
2518 (Output_data_got_powerpc::got_base_offset): Likewise.
2519 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2520 (instruction constants): Sort, add some more.
2521 (Output_data_glink::do_write): Add and use Address typedef. Use
2522 object->toc_base_offset() stub for 64-bit.
2523 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2524 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2525 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2526 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2527 Always treat .opd relocs as against locally defined symbol.
2528 Correct condition for RELATIVE relocs.
2529 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2530 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2531 for 32-bit syms with a plt entry. Correct ppc64 toc base
2532 calculations. Handle TLS relocs, and more. Add overflow
2533 checking and adjust for Powerpc_relocate_functions changes.
2534 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2535 Reinstate --emit-relocs code with FIXME.
2537 2012-08-30 Alan Modra <amodra@gmail.com>
2539 * layout.cc (Layout::set_segment_offsets): Set p_align to
2540 abi_pagesize, not common_pagesize.
2541 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2542 to determine whether file header can go in segment.
2544 2012-08-30 Alan Modra <amodra@gmail.com>
2546 * output.h (Output_reloc::Output_reloc <output section>): Add
2547 is_relative param. Adjust calls.
2548 (Output_reloc::add_output_section_relative): New functions.
2549 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2551 (Output_reloc::symbol_value): Handle SECTION_CODE.
2553 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2555 * gold.cc (queue_middle_tasks): Call layout again when unique
2556 segments for sections is desired.
2557 * layout.cc (Layout::Layout): Initialize new members.
2558 (Layout::get_output_section_flags): New function.
2559 (Layout::choose_output_section): Call get_output_section_flags.
2560 (Layout::layout): Make output section for mapping to a unique segment.
2561 (Layout::insert_section_segment_map): New function.
2562 (Layout::attach_allocated_section_to_segment): Make unique segment for
2563 output sections marked so.
2564 (Layout::segment_precedes): Check for unique segments when sorting.
2565 * layout.h (Layout::Unique_segment_info): New struct.
2566 (Layout::Section_segment_map): New typedef.
2567 (Layout::insert_section_segment_map): New function.
2568 (Layout::get_output_section_flags): New function.
2569 (Layout::is_unique_segment_for_sections_specified): New function.
2570 (Layout::set_unique_segment_for_sections_specified): New function.
2571 (Layout::unique_segment_for_sections_specified_): New member.
2572 (Layout::section_segment_map_): New member.
2573 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2574 Rename is_gc_pass_one to is_pass_one.
2575 Rename is_gc_pass_two to is_pass_two.
2576 Rename is_gc_or_icf to is_two_pass.
2577 Check for which pass based on whether symbols data is present.
2578 Make it two pass when unique segments for sections is desired.
2579 * output.cc (Output_section::Output_section): Initialize new
2581 * output.h (Output_section::is_unique_segment): New function.
2582 (Output_section::set_is_unique_segment): New function.
2583 (Output_section::is_unique_segment_): New member.
2584 (Output_section::extra_segment_flags): New function.
2585 (Output_section::set_extra_segment_flags): New function.
2586 (Output_section::extra_segment_flags_): New member.
2587 (Output_section::segment_alignment): New function.
2588 (Output_section::set_segment_alignment): New function.
2589 (Output_section::segment_alignment_): New member.
2590 (Output_segment::Output_segment): Initialize is_unique_segment_.
2591 (Output_segment::is_unique_segment): New function.
2592 (Output_segment::set_is_unique_segment): New function.
2593 (Output_segment::is_unique_segment_): New member.
2594 * plugin.cc (allow_unique_segment_for_sections): New function.
2595 (unique_segment_for_sections): New function.
2596 (Plugin::load): Add new functions to transfer vector.
2597 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2598 * Makefile.in: Regenerate.
2599 * testsuite/plugin_final_layout.sh: Check if unique segment
2600 functionality works.
2601 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2603 (allow_unique_segment_for_sections): New global.
2604 (unique_segment_for_sections): New global.
2605 (claim_file_hook): Call allow_unique_segment_for_sections.
2606 (all_symbols_read_hook): Call unique_segment_for_sections.
2608 2012-08-22 Cary Coutant <ccoutant@google.com>
2610 * layout.cc (Layout::include_section): Don't assert on GROUP
2611 sections with --emit-relocs.
2613 2012-08-21 Cary Coutant <ccoutant@google.com>
2615 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2616 if --export-dynamic-symbol names an undef symbol.
2618 2012-08-18 Alan Modra <amodra@gmail.com>
2620 * powerpc.cc: Formatting and white space.
2621 (Powerpc_relobj): Rename got2_section_ to special_.
2622 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2623 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2624 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2625 (Target_powerpc): Add Address typedef and invalid_address. Use
2627 (Target_powerpc::is_branch_reloc): New function.
2628 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2629 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2630 for dst_mask, value and addend.
2631 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2632 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2633 (Output_data_glink::do_write): Correct toc base. Don't try to use
2634 uint16_t for 24-bit offset. Use get_output_section_offset and
2636 (Target_powerpc::Scan::local): Handle more relocs.
2637 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2638 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2639 Plug in toc restoring insn after plt calls. Translate branches
2640 to function descriptor symbols to corresponding entry point.
2641 (Target_powerpc::relocate_for_relocatable): Check return from
2642 get_output_section_offset.
2643 * symtab.h: Comment typo.
2645 2012-08-14 Ian Lance Taylor <iant@google.com>
2647 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2648 unsupported_relocal_local to call unsupported_reloc_global.
2650 2012-08-14 Nick Clifton <nickc@redhat.com>
2653 * script-sections.cc (Sections_element::output_section_name): Add
2654 keep return parameter.
2655 (Output_section_element::match_name): Add keep return parameter.
2656 Return the value of the keep_ member.
2657 * script-sections.h (class Output_section): Update
2658 output_section_name prototype.
2659 * layout.cc (Layout::keep_input_section): New public member
2661 (Layout::choose_output_section): Pass keep parameter to
2662 output_section_name.
2663 * layout.h (class Layout): Add keep_input_section.
2664 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2666 * testsuite/Makefile.am: Add a test.
2667 * testsuite/Makefile.in: Regenerate.
2668 * testsuite/pr14265.c: Source file for the test.
2669 * testsuite/pr14265.t: Linker script for the test.
2670 * testsuite/pr14265.sh: Shell script for the test.
2672 2012-08-14 Alan Modra <amodra@gmail.com>
2674 * target.h (Target::output_section_name): New function.
2675 (Target::do_output_section_name): New function.
2676 * layout.cc (Layout::choose_output_section): Call the above.
2677 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2679 2012-08-14 Alan Modra <amodra@gmail.com>
2681 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2682 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2683 for replace_constant call.
2684 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2685 (Output_data_glink::do_print_to_mapfile): New function.
2686 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2687 (Target_powerpc::Relocate::relocate): Likewise.
2689 2012-08-14 Alan Modra <amodra@gmail.com>
2691 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2692 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2693 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2694 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2695 all references to shndx_. Handle special case for R_PPC_PLTREL24
2697 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2698 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2699 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2701 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2702 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2704 2012-08-12 Alan Modra <amodra@gmail.com>
2706 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2707 (glink insn constants): Use uint32_t.
2708 (Output_data_glink::add_entry): Use insert, not [] operator.
2710 2012-08-11 Alan Modra <amodra@gmail.com>
2712 * object.h (Sized_relobj_file::find_shdr): New function.
2713 (Sized_relobj_file::find_special_sections): New function.
2714 * object.cc (Sized_relobj_file::find_shdr): New function.
2715 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2716 (Sized_relobj_file::find_special_sections): New function, split out..
2717 (Sized_relobj_file::do_read_symbols): ..from here.
2718 * output.h (Output_data_got::replace_constant): New function.
2719 (Output_data_got::num_entries): New function.
2720 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2721 (Output_data_got::got_offset): Protected rather than private.
2722 (Output_data_got::replace_got_entry): New function.
2723 * output.cc (Output_data_got::replace_got_entry): New function.
2724 * powerpc.cc (class Powerpc_relobj): New.
2725 (class Powerpc_relocate_functions): Delete all psymval variants or
2726 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2727 Implement _ha functions using corresponding _hi function.
2728 (Powerpc_relobj::find_special_sections): New function.
2729 (Target_powerpc::do_make_elf_object): New function.
2730 (class Output_data_got_powerpc): New.
2731 (class Output_data_glink): New.
2732 (class Powerpc_scan_relocatable_reloc): New.
2733 Many more changes througout file.
2735 2012-08-09 Nick Clifton <nickc@redhat.com>
2737 * po/vi.po: Updated Vietnamese translation.
2739 2012-08-07 Ian Lance Taylor <iant@google.com>
2741 * layout.cc (Layout::add_target_dynamic_tags): If
2742 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2745 2012-07-30 Nick Clifton <nickc@redhat.com>
2747 * po/gold.pot: Updated template.
2748 * po/es.po: Updated Spanish translation.
2750 2012-07-18 Cary Coutant <ccoutant@google.com>
2753 * configure.ac: Add check for -gpubnames support.
2754 * configure: Regenerate.
2755 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2756 support; force -gno-pubnames.
2757 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2759 (gdb_index_test_4): New test.
2760 * testsuite/Makefile.in: Regenerate.
2761 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2762 * testsuite/gdb_index_test_2.sh: Likewise.
2763 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2764 * testsuite/gdb_index_test_4.sh: New script.
2765 * testsuite/gdb_index_test_comm.sh: New script with common code;
2766 don't look for space after colon.
2768 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2770 * gold.cc (queue_middle_tasks): Update function order only after
2771 deferred objects due to plugins are processed.
2773 2012-07-11 Ian Lance Taylor <iant@google.com>
2775 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2776 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2777 (Target_arm::scan_reloc_for_stub): Likewise.
2778 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2779 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2780 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2781 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2782 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2784 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2785 Ian Lance Taylor <iant@google.com>
2788 * configure.ac: Test whether std::tr1::hash<off_t> works.
2789 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2791 * output.h (class Output_fill): Add virtual destructor.
2792 * configure, config.in: Rebuild.
2794 2012-06-22 Roland McGrath <mcgrathr@google.com>
2796 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2798 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2800 * plugin.cc (Plugin::load): Handle position independent executables.
2802 2012-06-06 Cary Coutant <ccoutant@google.com>
2804 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2806 (lines_only_debug_sections): Likewise.
2807 (gdb_fast_lookup_sections): New static array.
2808 (is_gdb_debug_section): Rename formal parameter.
2809 (is_lines_only_debug_section): Likewise.
2810 (is_gdb_fast_lookup_section): New function.
2811 (Layout::include_section): Check for ".zdebug_" prefix; pass
2812 section name suffix to is_gdb_debug_section, et al.; check for
2813 fast-lookup sections when building .gdb_index.
2814 * options.h (--strip-debug-gdb): Update GDB version number.
2816 2012-06-06 Cary Coutant <ccoutant@google.com>
2818 * configure.ac: Add check for fallocate.
2819 * configure: Regenerate.
2820 * config.in: Regenerate.
2822 * options.h (class General_options): Add --mmap-output-file and
2823 --posix-fallocate options.
2824 * output.cc: (posix_fallocate): Remove; replace with...
2825 (gold_fallocate): New function.
2826 (Output_file::map_no_anonymous): Call gold_fallocate.
2827 (Output_file::map): Check --mmap-output-file option.
2829 2012-06-05 Jing Yu <jingyu@google.com>
2831 * gold.h (textdomain): Add do {} to empty while(0).
2832 (bindtextdomain): Likewise.
2834 2012-06-04 Cary Coutant <ccoutant@google.com>
2836 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2839 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2841 * symtab.cc (Symbol_table::define_special_symbol):
2842 Initialize *poldsym to prevent uninitialized variable errors.
2844 2012-05-23 Cary Coutant <ccoutant@google.com>
2846 * layout.cc (Layout::section_name_mapping): Add rules to handle
2847 exact match on .data.rel.ro.local or .data.rel.ro.
2848 (Layout::output_section_name): Check for exact matches.
2850 2012-05-23 Cary Coutant <ccoutant@google.com>
2852 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2855 2012-05-22 Cary Coutant <ccoutant@google.com>
2857 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2858 object before exporting symbol.
2860 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2862 * testsuite/tls_test.cc: Include "config.h" first.
2863 * testsuite/tls_test_c.c: Likewise.
2865 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2866 Nick Clifton <nickc@redhat.com>
2869 * configure.in: Add check that sysdep.h has been included before
2870 any system header files.
2871 * configure: Regenerate.
2872 * config.in: Regenerate.
2874 2012-05-14 Cary Coutant <ccoutant@google.com>
2876 * layout.cc (Layout::make_output_section): Mark .tdata section
2878 * testsuite/relro_test.cc: Add a TLS variable.
2880 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2883 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2884 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2887 2012-05-08 Cary Coutant <ccoutant@google.com>
2889 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2890 (lines_only_debug_sections): Likewise.
2892 2012-05-02 Roland McGrath <mcgrathr@google.com>
2894 * nacl.cc: New file.
2896 * Makefile.am (CCFILES, HFILES): Add them.
2897 * Makefile.in: Regenerate.
2898 * i386.cc (Output_data_plt_i386_nacl): New class.
2899 (Output_data_plt_i386_nacl_exec): New class.
2900 (Output_data_plt_i386_nacl_dyn): New class.
2901 (Target_i386_nacl): New class.
2902 (Target_selector_i386_nacl): New class.
2903 (target_selector_i386): Use it instead of Target_selector_i386.
2904 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2905 (Target_x86_64_nacl): New class.
2906 (Target_selector_x86_64_nacl): New class.
2907 (target_selector_x86_64, target_selector_x32): Use it instead of
2908 Target_selector_x86_64.
2909 * arm.cc (Output_data_plt_arm_nacl): New class.
2910 (Target_arm_nacl): New class.
2911 (Target_selector_arm_nacl): New class.
2912 (target_selector_arm, target_selector_armbe): Use it instead of
2913 Target_selector_arm.
2915 * target-select.cc (select_target): Take new Input_file* and off_t
2916 arguments, pass them on to recognize method of selector.
2917 * object.cc (make_elf_sized_object): Update caller.
2918 * parameters.cc (parameters_force_valid_target): Likewise.
2919 * incremental.cc (make_sized_incremental_binary): Likewise.
2920 * target-select.h: Update decl.
2921 (Target_selector::recognize): Take new Input_file* argument,
2922 pass it on to do_recognize.
2923 (Target_selector::do_recognize): Take new Input_file* argument.
2924 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2925 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2926 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2927 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2929 * target.h (Target::Target_info): New members isolate_execinstr
2931 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2932 * arm.cc (Target_arm::arm_info): Update initializer.
2933 * i386.cc (Target_i386::i386_info): Likewise.
2934 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2935 * sparc.cc (Target_sparc::sparc_info): Likewise.
2936 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2937 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2938 * layout.cc (Layout::attach_allocated_section_to_segment):
2939 Take new const Target* argument. If target->isolate_execinstr(), act
2941 (Layout::find_first_load_seg): Take new const Target* argument;
2942 if target->isolate_execinstr(), reject PF_X segments.
2943 (Layout::relaxation_loop_body): Update caller.
2944 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2945 reset file offset to zero when we hit LOAD_SEG, and then do a second
2946 loop over the segments before LOAD_SEG to reassign offsets after
2947 addresses have been determined. Handle target->rosegment_gap().
2948 (Layout::attach_section_to_segment): Take new const Target* argument;
2949 pass it to attach_allocated_section_to_segment.
2950 (Layout::make_output_section): Update caller.
2951 (Layout::attach_sections_to_segments): Take new const Target* argument;
2952 pass it to attach_section_to_segment.
2953 * gold.cc (queue_middle_tasks): Update caller.
2954 * layout.h (Layout): Update method decls with new arguments.
2956 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2957 Target_info pointer to use.
2958 (Target_arm::do_make_data_plt): New virtual method.
2959 (Target_arm::make_data_plt): New method that calls it.
2960 (Target_arm::make_plt_entry): Use it.
2961 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2962 for the section alignment.
2963 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2965 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2966 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2968 (Output_data_plt_arm::get_plt_entry_size): Call it.
2969 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2970 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2971 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2973 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2974 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2975 method instead of sizeof(plt_entry).
2976 (Output_data_plt_arm::add_entry): Likewise.
2977 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2978 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2980 (Target_arm::plt_entry_size): Likewise.
2981 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2983 (Output_data_plt_arm_standard): ... here, new class.
2984 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2985 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2986 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2988 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2989 Take additional argument for the PLT entry size.
2990 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2991 Use get_plt_entry_size method rather than plt_entry_size variable.
2992 (Output_data_plt_x86_64::reserve_slot): Likewise.
2993 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2994 (Output_data_plt_x86_64::add_entry): Likewise.
2995 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2996 (Output_data_plt_x86_64::address_for_global): Likewise.
2997 (Output_data_plt_x86_64::address_for_local): Likewise.
2998 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2999 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3000 Make method non-static.
3001 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3003 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3004 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3005 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3006 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3008 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3009 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3011 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3012 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3014 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3015 (Output_data_plt_x86_64::plt_entry_size)
3016 (Output_data_plt_x86_64::first_plt_entry)
3017 (Output_data_plt_x86_64::plt_entry)
3018 (Output_data_plt_x86_64::tlsdesc_plt_entry)
3019 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3020 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3021 (Output_data_plt_x86_64_standard): ... here, new class.
3022 (Target_x86_64::Target_x86_64): Take optional argument for the
3023 Target_info pointer to use.
3024 (Target_x86_64::do_make_data_plt): New virtual method.
3025 (Target_x86_64::make_data_plt): New method to call it.
3026 (Target_x86_64::init_got_plt_for_update): Use that.
3027 Call this->plt_->add_eh_frame method here.
3028 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3029 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3030 rather than static method.
3031 (Target_x86_64::plt_entry_size): Likewise.
3032 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3033 rather than plt_entry_size variable. Move guts of PLT filling to...
3034 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3035 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3036 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3038 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3039 additional argument for the section alignment.
3040 Don't do add_eh_frame_for_plt here.
3041 (Output_data_plt_i386::first_plt_entry_offset): Make the method
3042 non-static. Use get_plt_entry_size method rather than plt_entry_size
3044 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3046 (Output_data_plt_i386::get_plt_entry_size): Call it.
3047 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3048 (Output_data_plt_i386::add_eh_frame): New method to call it.
3049 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3051 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3052 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3054 (Output_data_plt_i386::fill_plt_entry): New method to call it.
3055 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3056 method instead of plt_entry_size.
3057 (Output_data_plt_i386::plt_entry_size)
3058 (Output_data_plt_i386::plt_eh_frame_fde_size)
3059 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3060 (Output_data_plt_i386_standard): ... here, new class.
3061 (Output_data_plt_i386_exec): New class.
3062 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3063 (Output_data_plt_i386_exec::first_plt_entry): ... here.
3064 (Output_data_plt_i386::exec_plt_entry): Move to ...
3065 (Output_data_plt_i386_exec::plt_entry): ... here.
3066 (Output_data_plt_i386_dyn): New class.
3067 (Output_data_plt_i386::first_plt_entry): Move to ...
3068 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3069 (Output_data_plt_i386::dyn_plt_entry): Move to ...
3070 (Output_data_plt_i386_dyn::plt_entry): ... here.
3071 (Target_i386::Target_i386): Take optional argument for the Target_info
3073 (Target_i386::do_make_data_plt): New virtual method.
3074 (Target_i386::make_data_plt): New method to call it.
3075 (Target_i386::make_plt_section): Use that.
3076 Call this->plt_->add_eh_frame method here.
3077 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3078 rather than plt_entry_size variable.
3079 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3080 (Output_data_plt_i386::address_for_local): Likewise.
3081 (Output_data_plt_i386::do_write): Likewise.
3082 Move guts of PLT filling to...
3083 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3084 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3085 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3086 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3088 2012-05-01 Cary Coutant <ccoutant@google.com>
3090 * dwarf_reader.cc (Dwarf_die::read_attributes)
3091 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3092 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3093 * reduced_debug_output.cc
3094 (Output_reduced_debug_info_section::get_die_end): Remove
3095 DW_FORM_GNU_ref_index. Add default case.
3097 2012-04-26 Mark Wielaard <mjw@redhat.com>
3099 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3100 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3101 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3102 DW_AT_high_pc as offset from DW_AT_low_pc.
3104 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3105 * testsuite/Makefile.in: Regenerate.
3106 * testsuite/gdb_index_test_3.c: New test source file.
3107 * testsuite/gdb_index_test_3.sh: New test source file.
3109 2012-04-25 Ian Lance Taylor <iant@google.com>
3111 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3113 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3114 as a class, not a struct.
3115 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3116 (Target_arm::apply_cortex_a8_workaround): Likewise.
3117 * gc.h: Declare Reloc_types as a struct, not a class.
3118 * object.h: Declare Symbols_data as a struct.
3119 * reloc.h: Declare Read_relocs_data as a struct.
3120 * target.h: Declare Relocate_info as a struct.
3122 2012-04-24 David S. Miller <davem@davemloft.net>
3124 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3125 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3128 2012-04-24 Cary Coutant <ccoutant@google.com>
3130 * incremental-dump.cc (find_input_containing_global): Replace
3131 magic number with symbolic constant.
3132 (dump_incremental_inputs): Update version number.
3133 * incremental.cc (Output_section_incremental_inputs): Update version
3134 number; import symbolic constants from Incremental_inputs_reader.
3135 (Incremental_inputs::create_data_sections): Align relocations
3136 section correctly for 64-bit targets.
3137 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3138 constants; add padding.
3139 (Output_section_incremental_inputs::write_header): Add assert for
3141 (Output_section_incremental_inputs::write_input_files): Add assert
3142 for input_entry_size.
3143 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3144 add assert for object_info_size, input_section_entry_size,
3145 global_sym_entry_size.
3146 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3147 for data structure sizes; use them.
3148 (Incremental_input_entry_reader): Import symbolic constants from
3149 Incremental_inputs_reader; use them.
3151 2012-04-23 David S. Miller <davem@davemloft.net>
3153 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3155 (Target_sparc::Target_sparc): Initialize new fields.
3156 (Target_sparc::do_make_elf_object): New function.
3157 (Target_sparc::do_adjust_elf_header): New function.
3159 2012-04-23 Cary Coutant <ccoutant@google.com>
3161 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3162 CU range table of gdb index.
3164 2012-04-20 David S. Miller <davem@davemloft.net>
3166 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3169 2012-04-16 David S. Miller <davem@davemloft.net>
3171 * sparc.cc (Target_sparc::got_address): New function.
3172 (Sparc_relocate_functions::gdop_hix22): New function.
3173 (Sparc_relocate_functions::gdop_lox10): New function.
3174 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3176 (Target_sparc::Scan::local): Likewise if the global symbol is not
3177 preemptible and is not IFUNC.
3178 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3179 transformations for local and non-preemptible non-IFUNC global
3182 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3183 writing out 64-bit part of ranges.
3185 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3186 -fpic and -fpie respectively.
3187 * Makefile.in: Regenerate.
3189 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3190 (Target_sparc::Target_sparc): Initialize new field.
3191 (Target_sparc::do_plt_section_for_global): New function.
3192 (Target_sparc::do_plt_section_for_local): New function.
3193 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3194 (Target_sparc::make_plt_section): New function, broken out of
3195 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3196 (Target_sparc::make_plt_entry): Call make_plt_section.
3197 (Target_sparc::make_local_ifunc_plt_entry): New function.
3198 (Target_sparc::rela_ifunc_section): New function.
3199 (Target_sparc::plt_section): Remove const.
3200 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3201 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3202 and ifunc_count_ fields.
3203 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3204 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3205 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3206 (Output_data_plt_sparc::rela_ifunc): New function.
3207 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3208 (Output_data_plt_sparc::has_ifunc_section): New function.
3209 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3210 (Output_data_plt_sparc::address_for_global): New function.
3211 (Output_data_plt_sparc::address_for_local): New function.
3212 (Output_data_plt_sparc::plt_index_to_offset): New function.
3213 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3215 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3217 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3218 R_SPARC_JMP_IREL to switch.
3219 (Target_sparc::Scan::check_non_pic): Likewise.
3220 (Target_sparc::Scan::local): Handle IFUNC symbols.
3221 (Target_sparc::Scan::local): Likewise.
3222 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3223 and plt_address_for_local.
3224 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3225 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3227 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3228 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3229 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3230 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3232 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3233 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3235 * sparc.cc (Target_sparc::Scan::global): Likewise.
3236 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3238 2012-04-16 Cary Coutant <ccoutant@google.com>
3240 * archive.cc (Library_base::should_include_member): Check for
3241 --export-dynamic-symbol.
3242 * options.h (class General_options): Add --export-dynamic-symbol.
3243 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3244 --export-dynamic-symbol.
3245 (Symbol_table::gc_mark_undef_symbols): Likewise.
3246 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3248 2012-04-12 David S. Miller <davem@davemloft.net>
3250 * sparc.cc (Reloc::wdisp10): New relocation method.
3251 (Reloc::h34): Likewise.
3252 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3253 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3255 (Target_sparc::Scan::local): Likewise.
3256 (Target_sparc::Scan::global): Likewise.
3257 (Target_sparc::Relocate::relocate): Likewise.
3259 2012-04-09 Cary Coutant <ccoutant@google.com>
3261 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3264 2012-04-06 Ian Lance Taylor <iant@google.com>
3266 * timer.cc: #include <unistd.h>.
3268 2012-04-06 Roland McGrath <mcgrathr@google.com>
3270 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3271 * config.in: Regenerate.
3272 * configure: Regenerate.
3274 2012-04-05 Nick Clifton <nickc@redhat.com>
3276 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3277 (AM_LC_MESSAGES): Add.
3278 * aclocal.m4: Regenerate.
3279 * config.in: Regenerate.
3280 * configure: Regenerate.
3282 2012-03-21 Cary Coutant <ccoutant@google.com>
3284 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3285 * Makefile.in: Regenerate.
3286 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3287 (Sized_elf_reloc_mapper::symbol_section): New function.
3288 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3289 (make_elf_reloc_mapper): New function.
3290 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3291 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3292 (Dwarf_abbrev_table::do_get_abbrev): New function.
3293 (Dwarf_ranges_table::read_ranges_table): New function.
3294 (Dwarf_ranges_table::read_range_list): New function.
3295 (Dwarf_pubnames_table::read_section): New function.
3296 (Dwarf_pubnames_table::read_header): New function.
3297 (Dwarf_pubnames_table::next_name): New function.
3298 (Dwarf_die::Dwarf_die): New function.
3299 (Dwarf_die::read_attributes): New function.
3300 (Dwarf_die::skip_attributes): New function.
3301 (Dwarf_die::set_name): New function.
3302 (Dwarf_die::set_linkage_name): New function.
3303 (Dwarf_die::attribute): New function.
3304 (Dwarf_die::string_attribute): New function.
3305 (Dwarf_die::int_attribute): New function.
3306 (Dwarf_die::uint_attribute): New function.
3307 (Dwarf_die::ref_attribute): New function.
3308 (Dwarf_die::child_offset): New function.
3309 (Dwarf_die::sibling_offset): New function.
3310 (Dwarf_info_reader::check_buffer): New function.
3311 (Dwarf_info_reader::parse): New function.
3312 (Dwarf_info_reader::do_parse): New function.
3313 (Dwarf_info_reader::do_read_string_table): New function.
3314 (Dwarf_info_reader::lookup_reloc): New function.
3315 (Dwarf_info_reader::get_string): New function.
3316 (Dwarf_info_reader::visit_compilation_unit): New function.
3317 (Dwarf_info_reader::visit_type_unit): New function.
3318 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3319 Sized_elf_reloc_mapper.
3320 (Sized_dwarf_line_info::symbol_section): Remove function.
3321 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3322 (Sized_dwarf_line_info::read_line_mappings): Remove object
3323 parameter, adjust callers.
3324 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3325 * dwarf_reader.h: Include <sys/types.h>.
3326 (class Track_relocs): Remove forward declaration.
3327 (class Elf_reloc_mapper): New class.
3328 (class Sized_elf_reloc_mapper): New class.
3329 (class Dwarf_abbrev_table): New class.
3330 (class Dwarf_range_list): New class.
3331 (class Dwarf_ranges_table): New class.
3332 (class Dwarf_pubnames_table): New class.
3333 (class Dwarf_die): New class.
3334 (class Dwarf_info_reader): New class.
3335 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3336 (Sized_dwarf_line_info::symbol_section): Remove member function.
3337 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3339 * gdb-index.cc: New source file.
3340 * gdb-index.h: New source file.
3341 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3342 and .debug_types sections, call Layout::add_to_gdb_index.
3343 (Sized_relobj_incr::do_section_name): Implement.
3344 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3345 return type; Implement.
3346 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3348 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3349 parameter list and return type.
3350 (Sized_incr_dynobj::do_section_contents): Likewise.
3351 * layout.cc: Include gdb-index.h.
3352 (Layout::Layout): Initialize gdb_index_data_.
3353 (Layout::init_fixed_output_section): Check for .gdb_index section.
3354 (Layout::add_to_gdb_index): New function. Instantiate.
3355 * layout.h: Add forward declaration for class Gdb_index.
3356 (Layout::add_to_gdb_index): New member function.
3357 (Layout::gdb_index_data_): New data member.
3358 * main.cc: Include gdb-index.h.
3359 (main): Print statistics for gdb index.
3360 * object.cc (Object::section_contents): Move code into
3361 do_section_contents.
3362 (need_decompressed_section): Check for sections needed when building
3364 (build_compressed_section_map): Likewise.
3365 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3367 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3368 sections; call Layout::add_to_gdb_index.
3369 (Sized_relobj_file::do_decompressed_section_contents): Call
3370 do_section_contents directly.
3371 * object.h (Object::do_section_contents): Adjust parameter list and
3373 (Object::do_decompressed_section_contents): Call do_section_contents
3375 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3377 * options.h (class General_options): Add --gdb-index option.
3378 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3379 list and return type.
3380 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3381 * reloc.h (Track_relocs::checkpoint): New function.
3382 (Track_relocs::reset): New function.
3384 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3386 * testsuite/Makefile.in: Regenerate.
3387 * testsuite/gdb_index_test.cc: New test source file.
3388 * testsuite/gdb_index_test_1.sh: New test source file.
3389 * testsuite/gdb_index_test_2.sh: New test source file.
3391 2012-03-19 Doug Kwan <dougkwan@google.com>
3393 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3394 (Target_arm::do_finalize_sections): Remove code which defines
3395 __exidx_start and __exidx_end. Make symbol table parameter
3396 anonymous as it is not used.
3397 * gold.cc (queue_middle_tasks): Call target hook to define any
3398 target-specific symbols.
3399 * target.h (Target::define_standard_symbols): New method.
3400 (Target::do_define_standard_symbols): Same.
3401 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3402 * testsuite/Makefile.in: Regenerate.
3403 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3405 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3406 relocations are generated for __exidx_start and __exidx_end.
3408 2012-03-16 Doug Kwan <dougkwan@google.com>
3410 * testsuite/Makefile.am: Disable test initpri3b.
3411 * testsuite/Makefile.in: Regenerate.
3413 2012-03-15 Doug Kwan <dougkwan@google.com>
3415 * arm.cc (Target_arm::got_section): Make .got section read-only
3418 2012-03-15 Ian Lance Taylor <iant@google.com>
3421 * layout.cc (Layout::make_output_section): Correctly mark
3422 SHT_INIT_ARRAY, et. al., as relro.
3424 2012-03-14 Doug Kwan <dougkwan@google.com>
3426 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3427 dynamic relocations for protected symbols in shared objects.
3429 2012-03-13 Ian Lance Taylor <iant@google.com>
3431 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3432 keep the larger alignment.
3434 2012-03-12 Cary Coutant <ccoutant@google.com>
3436 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3437 handling of DW_LNE_define_file.
3439 2012-03-12 Cary Coutant <ccoutant@google.com>
3441 * reduced_debug_output.cc
3442 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3445 2012-02-29 Cary Coutant <ccoutant@google.com>
3447 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3449 2012-02-29 Cary Coutant <ccoutant@google.com>
3451 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3452 Call Object::decompressed_section_contents.
3453 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3455 (Sized_dwarf_line_info::buffer_start_): New data member.
3456 * merge.cc (Output_merge_data::do_add_input_section): Call
3457 Object::decompressed_section_contents.
3458 (Output_merge_string::do_add_input_section): Likewise.
3459 * object.cc (need_decompressed_section): New function.
3460 (build_compressed_section_map): Decompress sections needed later.
3461 (Sized_relobj_file::do_decompressed_section_contents): New function.
3462 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3463 * object.h (Object::decompressed_section_contents): New function.
3464 (Object::discard_decompressed_sections): New function.
3465 (Object::do_decompressed_section_contents): New function.
3466 (Object::do_discard_decompressed_sections): New function.
3467 (Compressed_section_info): New type.
3468 (Compressed_section_map): Include decompressed section contents.
3469 (Sized_relobj_file::do_decompressed_section_contents): New function.
3470 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3472 2012-02-16 Cary Coutant <ccoutant@google.com>
3474 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3475 * testsuite/Makefile.in: Regenerate.
3477 2012-02-14 Cary Coutant <ccoutant@google.com>
3479 * options.cc (General_options::finalize): Disallow -pie and -static.
3481 2012-02-03 Doug Kwan <dougkwan@google.com>
3483 * arm.cc (Arm_relocate_functions::abs8,
3484 Arm_relocate_functions::abs16): Use
3485 Bits::has_signed_unsigned_overflow32.
3486 (Arm_relocate_functions::thm_abs8): Correct range of
3488 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3491 2012-02-02 Doug Kwan <dougkwan@google.com>
3493 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3494 position independent outputs, not just shared objects.
3496 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3498 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3499 * configure: Regenerated.
3501 2012-01-27 Ian Lance Taylor <iant@google.com>
3503 * reloc.h (Bits): New class with static functions, copied from
3504 namespace utils in arm.cc.
3505 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3508 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3510 * incremental.cc (write_info_blocks): Correct relocation offset.
3512 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3514 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3515 (Relocate::tls_gd_to_le): Likewise.
3517 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3519 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3521 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3523 * configure.ac: Check if -mcmodel=medium works.
3524 * configure: Regenerated.
3526 2012-01-24 Cary Coutant <ccoutant@google.com>
3528 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3530 (read_unsigned_LEB_128_x): ... this new function.
3531 (read_signed_LEB_128): Replaced with inline definition and ...
3532 (read_signed_LEB_128_x): ... this new function.
3533 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3534 (read_unsigned_LEB_128): Add inline definition.
3535 (read_signed_LEB_128_x): New function.
3536 (read_signed_LEB_128): Add inline definition.
3537 * testsuite/Makefile.am (leb128_unittest): New unit test.
3538 * testsuite/Makefile.in: Regenerate.
3539 * testsuite/leb128_unittest.cc: New unit test.
3541 2012-01-23 Ian Lance Taylor <iant@google.com>
3544 * i386.cc (Target_i386::do_code_fill): When using a jmp
3545 instruction, pad with nop instructions.
3546 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3548 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3550 * x86_64.cc (gc_process_relocs): Add typename on types used in
3552 (scan_relocs): Likewise.
3553 (relocate_section): Likewise.
3554 (apply_relocation): Likewise.
3556 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3558 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3559 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3562 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3564 * x86_64.cc: Initial support for x32.
3566 2012-01-03 Cary Coutant <ccoutant@google.com>
3568 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3569 Use abstract base class for GOT.
3570 * gold/output.h (class Output_data_got_base): New abstract base class.
3571 (class Output_data_got): Derive from new base class, adjust ctors.
3572 (Output_data_got::reserve_slot): Make virtual; rename to
3573 do_reserve_slot; Adjust callers.
3574 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3575 pointer to abstract base class.
3576 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3578 2011-12-18 Ian Lance Taylor <iant@google.com>
3580 * object.h (Relobj::local_symbol_value): New function.
3581 (Relobj::local_plt_offset): New function.
3582 (Relobj::local_has_got_offset): New function.
3583 (Relobj::local_got_offset): New function.
3584 (Relobj::set_local_got_offset): New function.
3585 (Relobj::do_local_symbol_value): New pure virtual function.
3586 (Relobj::do_local_plt_offset): Likewise.
3587 (Relobj::do_local_has_got_offset): Likewise.
3588 (Relobj::do_local_got_offset): Likewise.
3589 (Relobj::do_set_local_got_offset): Likewise.
3590 (Sized_relobj::do_local_has_got_offset): Rename from
3591 local_has_got_offset.
3592 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3593 (Sized_relobj::do_set_local_got_offset): Rename from
3594 set_local_got_offset.
3595 (Sized_relobj_file::do_local_plt_offset): Rename from
3597 (Sized_relobj_file::do_local_symbol_value): New function.
3598 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3600 * output.cc (Output_data_got::Got_entry::write): Change object to
3601 Relobj. Use local_symbol_value.
3602 (Output_data_got::add_global_with_rel): Change rel_dyn to
3603 Output_data_reloc_generic*. Use add_global_generic.
3604 (Output_data_got::add_global_with_rela): Remove. Change all
3605 callers to use add_global_with_rel.
3606 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3607 Output_data_reloc_generic*. Use add_global_generic.
3608 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3609 callers to use add_global_pair_with_rel.
3610 (Output_data_got::add_local): Change object to Relobj*.
3611 (Output_data_got::add_local_plt): Likewise.
3612 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3613 change rel_dyn to Output_data_reloc_generic*. Use
3615 (Output_data_got::add_local_with_rela): Remove. Change all
3616 callers to use all_local_with_rel.
3617 (Output_data_got::add_local_pair_with_rel): Change object to
3618 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3619 add_output_section_generic.
3620 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3621 callers to use add_local_pair_with_rel.
3622 (Output_data_got::reserve_local): Change object to Relobj*.
3623 * output.h: (class Output_data_reloc_generic): Add pure virtual
3624 declarations for add_global_generic, add_local_generic,
3625 add_output_section_generic.
3626 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3627 functions for Output_data_reloc_generic. Update declarations for
3628 changes listed in output.cc.
3629 (class Output_data_got): Change template parameter to got_size.
3630 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3631 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3633 (Sized_relobj_incr::do_local_plt_offset): New function.
3634 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3637 2011-12-17 Cary Coutant <ccoutant@google.com>
3639 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3640 * resolve.cc (Symbol_table::resolve): Likewise.
3641 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3643 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3645 2011-12-16 Ian Lance Taylor <iant@google.com>
3647 * output.h (Output_data_reloc_generic::add): Only call
3648 add_dynamic_reloc if this is a dynamic reloc section.
3650 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3653 * target-reloc.h (apply_relocation): Replace <64, false> with
3656 2011-11-25 Nick Clifton <nickc@redhat.com>
3658 * po/it.po: New Italian translation.
3660 2011-11-17 Sterling Augustine <saugustine@google.com>
3662 * script.cc (script_include_directive): Implement.
3663 (read_script_file): New local variables name and search_path. Update
3664 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3665 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3666 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3668 2011-11-11 Sterling Augustine <saugustine@google.com>
3670 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3671 (file_or_sections_cmd): Likewise.
3673 2011-11-11 Doug Kwan <dougkwan@google.com>
3675 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3676 if --just-symbols is given.
3678 2011-11-10 Doug Kwan <dougkwan@google.com>
3681 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3682 when processing data relocs.
3683 * reloc.h (Relocate_functions::rel_unaligned): New method.
3684 (Relocate_functions::pcrel_unaligned): Ditto.
3685 (Relocate_functions::rel32_unaligned): Ditto.
3686 (Relocate_functions::pcrel32_unaligned): Ditto.
3688 2011-11-09 Doug Kwan <dougkwan@google.com>
3691 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3692 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3693 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3694 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3695 (Relocate_functions::rel_unaligned): New.
3696 (Relocate_functions::rel32_unaligned): New.
3697 * target-reloc.h (relocate_for_relocatable): Add code to handle
3698 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3699 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3700 arm_unaligned_reloc_r): New targets.
3701 * testsuite/Makefile.in: Regenerate.
3702 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3705 2011-11-02 Ian Lance Taylor <iant@google.com>
3707 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3709 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3710 * options.cc (General_options::finalize): Use library search path
3711 from configure script if specified. If not native and no sysroot,
3712 only search TOOLLIBDIR.
3713 * options.h (Search_directory::Search_directory): Change name to
3715 (General_options::add_to_library_path_with_sysroot): Change arg to
3717 * configure, Makefile.in, config.in: Rebuild.
3719 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3721 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3722 we are working around the ARM1176 Erratum.
3723 * options.h (General_options::fix_arm1176): Add option.
3724 * testsuite/Makefile.am: Add testcases, and keep current ones
3726 * testsuite/Makefile.in: Regenerate.
3727 * testsuite/arm_fix_1176.s: New file.
3728 * testsuite/arm_fix_1176.sh: Likewise.
3730 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3732 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3734 (Target_arm::may_use_blx): Remove method.
3735 (Target_arm::set_may_use_blx): Likewise.
3736 (Target_arm::may_use_v4t_interworking): New method.
3737 (Target_arm::may_use_v5t_interworking): Likewise.
3738 (Target_arm::may_use_blx_): Remove member variable.
3739 (Arm_relocate_functions::arm_branch_common): Check for v5T
3741 (Arm_relocate_functions::thumb_branch_common): Likewise.
3742 (Reloc_stub::stub_type_for_reloc): Likewise.
3743 (Target_arm::do_finalize_sections): Correct interworking checks.
3744 * testsuite/Makefile.am: Add new tests.
3745 * testsuite/Makefile.in: Regenerate.
3746 * testsuite/arm_farcall_arm_arm.s: New test.
3747 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3748 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3749 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3750 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3751 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3752 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3753 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3755 2011-10-31 Cary Coutant <ccoutant@google.com>
3758 * expression.cc (Expression::eval_with_dot): Add
3759 is_section_dot_assignment parameter.
3760 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3761 absolute and assigning to dot within a section.
3762 * script-sections.cc
3763 (Output_section_element_assignment::set_section_addresses): Pass
3764 dot_section to set_if_absolute.
3765 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3766 as is_section_dot_assignment flag to eval_with_dot.
3767 (Output_section_element_dot_assignment::set_section_addresses):
3769 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3770 parameter. Also set value if relative to dot_section; set the
3771 symbol's output_section.
3772 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3773 parameter. Adjust all callers.
3774 (Expression::eval_maybe_dot): Likewise.
3775 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3777 * testsuite/script_test_2.t: Test assignment of an absolute value
3778 to dot within an output section element.
3780 2011-10-31 Cary Coutant <ccoutant@google.com>
3782 * options.h (class General_options): Add --[no-]gnu-unique options.
3783 * symtab.cc (Symbol_table::sized_write_globals): Convert
3784 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3786 2011-10-31 Cary Coutant <ccoutant@google.com>
3789 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3790 unnecessary assertion.
3791 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3793 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3795 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3797 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3799 Change to just keep the section associated with symbol.
3800 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3801 they are externally visible and --export-dynamic is turned on.
3802 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3804 2011-10-19 Ian Lance Taylor <iant@google.com>
3807 * script-sections.cc
3808 (Output_section_element_dot_assignment::needs_output_section): New
3811 2011-10-19 Ian Lance Taylor <iant@google.com>
3814 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3815 --section-start option was seen.
3816 * options.h (General_options::any_section_start): New function.
3818 2011-10-18 David S. Miller <davem@davemloft.net>
3821 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3822 member to track relocation locations that have moved during TLS
3823 reloc optimizations.
3824 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3825 (Target_sparc::Relocate::relocate): Adjust view down by 4
3826 bytes if it matches reloc_adjust_addr_.
3827 (Target_sparc::Relocate::relocate_tls): Always move the
3828 __tls_get_addr call delay slot instruction forward 4 bytes when
3829 performing relaxation.
3831 2011-10-18 Cary Coutant <ccoutant@google.com>
3833 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3834 (Output_file::map_no_anonymous): Check for non-zero
3835 return code from posix_fallocate.
3837 2011-10-17 Cary Coutant <ccoutant@google.com>
3840 * plugin.cc (is_visible_from_outside): Check for symbols
3841 referenced from dynamic objects.
3842 * resolve.cc (Symbol_table::resolve): Don't count references
3843 from dynamic objects as references from real ELF files.
3844 * testsuite/plugin_test_2.sh: Adjust expected result.
3846 2011-10-17 Cary Coutant <ccoutant@google.com>
3848 * gold.cc: Include timer.h.
3849 (queue_middle_tasks): Stamp time.
3850 (queue_final_tasks): Likewise.
3851 * main.cc (main): Store timer in parameters. Print timers
3853 * parameters.cc (Parameters::Parameters): Initialize timer_.
3854 (Parameters::set_timer): New function.
3855 (set_parameters_timer): New function.
3856 * parameters.h (Parameters::set_timer): New function.
3857 (Parameters::timer): New function.
3858 (Parameters::timer_): New data member.
3859 (set_parameters_timer): New function.
3860 * timer.cc (Timer::stamp): New function.
3861 (Timer::get_pass_time): New function.
3862 * timer.h (Timer::stamp): New function.
3863 (Timer::get_pass_time): New function.
3864 (Timer::pass_times_): New data member.
3866 2011-10-17 Cary Coutant <ccoutant@google.com>
3868 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3869 task for members of lib groups.
3871 2011-10-17 Cary Coutant <ccoutant@google.com>
3874 * fileread.cc (File_read::find_view): Add assert.
3875 (File_read::make_view): Move bounds check (replace with assert)...
3876 (File_read::find_or_make_view): ... to here.
3878 2011-10-12 Cary Coutant <ccoutant@google.com>
3880 * output.cc (Output_file::open_base_file): Handle case where
3881 ::read returns less than requested size.
3883 2011-10-10 Cary Coutant <ccoutant@google.com>
3885 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3886 Initialize defined_count_.
3887 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3888 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3889 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3890 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3891 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3892 * incremental.h (Sized_relobj_incr::defined_count_): New data
3894 (Sized_incr_dynobj::defined_count_): New data member.
3895 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3896 Return zeroes instead of internal error.
3898 2011-10-10 Cary Coutant <ccoutant@google.com>
3901 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3902 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3903 * output.h (class Output_reloc): Add use_plt_offset flag.
3904 (Output_reloc::type_): Adjust size of bit field.
3905 (Output_reloc::use_plt_offset_): New bit field.
3906 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3907 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3908 flag. Adjust all callers.
3909 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3910 creating RELATIVE relocations.
3912 2011-10-10 Nick Clifton <nickc@redhat.com>
3914 * po/es.po: Updated Spanish translation.
3915 * po/fi.po: Updated Finnish translation.
3917 2011-10-03 Diego Novillo <dnovillo@google.com>
3919 * options.cc (parse_uint): Fix dereference of RETVAL.
3921 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3923 * layout.h (section_order_map_): New member.
3924 (get_section_order_map): New member function.
3925 * output.cc (Output_section::add_input_section): Check for patterns
3926 only when --section-ordering-file is specified.
3927 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3928 output_sections have been formed.
3929 * layout.cc (Layout_Layout): Initialize section_order_map_.
3930 * plugin.cc (update_section_order): Store order in order_map. Do not
3932 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3933 * testsuite/Makefile.in: Regenerate.
3934 * testsuite/plugin_section_order.c: New file.
3935 * testsuite/plugin_final_layout.cc: New file.
3936 * testsuite/plugin_final_layout.sh: New file.
3938 2011-09-29 Cary Coutant <ccoutant@google.com>
3940 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3942 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3943 symbols during incremental update.
3944 (Symbol_table::add_from_dynobj): Likewise.
3946 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3947 Ian Lance Taylor <iant@google.com>
3949 * symtab.cc (Symbol_table::define_special_symbol): Always
3950 canonicalize version string.
3952 2011-09-26 Cary Coutant <ccoutant@google.com>
3954 * gold.cc (queue_initial_tasks): Move option checks ...
3955 * options.cc (General_options::finalize): ... to here. Disable
3956 some options; make others fatal.
3958 2011-09-26 Cary Coutant <ccoutant@google.com>
3961 * plugin.cc (get_symbols_v2): New function.
3962 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3963 (is_referenced_from_outside): New function.
3964 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3965 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3966 (get_symbols): Pass version parameter.
3967 (get_symbols_v2): New function.
3968 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3970 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3971 (onload): Add LDPT_GET_SYMBOLS_V2.
3972 (all_symbols_read_hook): Use get_symbols_v2; check for
3973 LDPR_PREVAILING_DEF_IRONLY_EXP.
3974 * testsuite/plugin_test_3.sh: Update expected results.
3976 2011-09-23 Simon Baldwin <simonb@google.com>
3978 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3979 configuration options.
3980 * configure: Regenerate.
3981 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3982 * Makefile.in: Regenerate.
3983 * testsuite/Makefile.in: Regenerate.
3985 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3987 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3989 2011-09-19 Cary Coutant <ccoutant@google.com>
3991 * incremental.cc (can_incremental_update): Fix typo in comment.
3992 * incremental.h (can_incremental_update): Likewise.
3994 2011-09-18 Cary Coutant <ccoutant@google.com>
3996 * incremental.cc (can_incremental_update): New function.
3997 * incremental.h (can_incremental_update): New function.
3998 * layout.cc (Layout::init_fixed_output_section): Call it.
3999 (Layout::make_output_section): Don't allow patch space in .eh_frame.
4000 * object.cc (Sized_relobj_file::do_layout): Call
4001 can_incremental_update.
4003 2011-09-13 Cary Coutant <ccoutant@google.com>
4005 * configure.ac: Check for glibc support for gnu_indirect_function
4006 support with static linking, setting automake conditional
4008 * Makefile.in: Regenerate.
4009 * configure: Regenerate.
4011 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4012 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4014 * testsuite/Makefile.in: Regenerate.
4016 2011-09-13 Cary Coutant <ccoutant@google.com>
4018 * incremental.cc (Sized_relobj_incr::do_layout): Call
4019 report_comdat_group for kept comdat sections.
4020 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4021 * testsuite/Makefile.in: Regenerate.
4022 * testsuite/incr_comdat_test_1.cc: New source file.
4023 * testsuite/incr_comdat_test_2_v1.cc: New source file.
4024 * testsuite/incr_comdat_test_2_v2.cc: New source file.
4025 * testsuite/incr_comdat_test_2_v3.cc: New source file.
4027 2011-09-13 Ian Lance Taylor <iant@google.com>
4029 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4030 variable external_symbols_offset.
4032 2011-09-12 Ian Lance Taylor <iant@google.com>
4034 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4035 triggered if object has no symbols.
4037 2011-09-09 David S. Miller <davem@davemloft.net>
4039 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4040 (Output_fill_debug_line::do_write): Likewise.
4042 2011-08-29 Cary Coutant <ccoutant@google.com>
4044 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4045 casts to match formatting specs.
4046 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4048 2011-08-26 Cary Coutant <ccoutant@google.com>
4050 * layout.cc (Free_list::allocate): Provide guarantee of minimum
4051 remaining hole size when allocating.
4052 (Layout::make_output_section): Set fill methods for debug sections.
4053 * layout.h (Free_list::Free_list_node): Move from private to
4055 (Free_list::set_min_hole_size): New function.
4056 (Free_list::begin, Free_list::end): New functions.
4057 (Free_list::min_hole_): New data member.
4058 * output.cc: Include dwarf.h.
4059 (Output_fill_debug_info::do_minimum_hole_size): New function.
4060 (Output_fill_debug_info::do_write): New function.
4061 (Output_fill_debug_line::do_minimum_hole_size): New function.
4062 (Output_fill_debug_line::do_write): New function.
4063 (Output_section::Output_section): Initialize new data member.
4064 (Output_section::set_final_data_size): Ensure patch space is larger
4065 than minimum hole size.
4066 (Output_section::do_write): Fill holes in debug sections.
4067 * output.h (Output_fill): New class.
4068 (Output_fill_debug_info): New class.
4069 (Output_fill_debug_line): New class.
4070 (Output_section::set_free_space_fill): New function.
4071 (Output_section::free_space_fill_): New data member.
4072 * testsuite/Makefile.am (incremental_test_3): Add
4073 --incremental-patch option.
4074 (incremental_test_4): Likewise.
4075 (incremental_test_5): Likewise.
4076 (incremental_test_6): Likewise.
4077 (incremental_copy_test): Likewise.
4078 (incremental_common_test_1): Likewise.
4079 * testsuite/Makefile.in: Regenerate.
4081 2011-08-26 Nick Clifton <nickc@redhat.com>
4083 * po/es.po: Updated Spanish translation.
4085 2011-08-01 Cary Coutant <ccoutant@google.com>
4087 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4088 * gold/testsuite/Makefile.in: Regenerate.
4089 * gold/testsuite/justsyms_exec.c: New source file.
4090 * gold/testsuite/justsyms_lib.c: New source file.
4092 2011-08-01 Cary Coutant <ccoutant@google.com>
4094 * layout.cc (Layout::set_segment_offsets): Don't realign text
4095 segment if -Ttext was specified.
4096 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4098 * object.h (Sized_relobj_file::e_type): New function.
4099 (Sized_relobj_file::e_type_): New data member.
4100 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4101 base address for ET_EXEC files.
4102 * target.cc (Target::do_make_elf_object_implementation): Allow
4103 ET_EXEC files with --just-symbols option.
4105 2011-07-28 Cary Coutant <ccoutant@google.com>
4107 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4108 Add thread_number parameter.
4109 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4110 * workqueue-threads.cc
4111 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4112 current thread if its thread number is greater than desired thread
4114 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4115 Add thread_number parameter.
4116 (Workqueue::should_cancel_thread): Likewise.
4117 (Workqueue::find_runnable_or_wait): Pass thread_number to
4118 should_cancel_thread.
4119 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4122 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4124 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4125 only after checking if it cannot be forced local.
4126 * symtab.h (is_externally_visible): Check if the symbol is not forced
4129 2011-07-15 Ian Lance Taylor <iant@google.com>
4131 * options.h (class General_options): Add --print-output-format.
4132 Move -EL next to -EB, for better --help output.
4133 * target-select.cc: Include <cstdio>, "options.h", and
4135 (Target_selector::do_target_bfd_name): New function.
4136 (print_output_format): New function.
4137 * target-select.h (class Target_selector): Update declarations.
4138 (Target_selector::target_bfd_name): New function.
4139 (print_output_format): Declare.
4140 * main.cc: Include "target-select.h".
4141 (main): Handle --print-output-format.
4142 * gold.cc: Include "target-select.h".
4143 (queue_initial_tasks): Handle --print-output-format when there are
4145 * parameters.cc (parameters_force_valid_target): Give a better
4146 error message if -EB/-EL does not match target.
4147 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4150 2011-07-15 Ian Lance Taylor <iant@google.com>
4152 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4153 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4154 (Output_data_plt_i386::do_write): Write address of .dynamic
4155 section to first entry in .got.plt section.
4156 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4157 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4159 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4160 section to first entry in .got.plt section.
4161 * layout.h (Layout::dynamic_section): New function.
4163 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4165 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4167 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4168 input_section_position_, and input_section_glob_.
4169 (read_layout_from_file): Call function section_ordering_specified.
4170 * layout.h (is_section_ordering_specified): New function.
4171 (section_ordering_specified): New function.
4172 (section_ordering_specified_): New boolean member.
4173 * main.cc(main): Call load_plugins after layout object is defined.
4174 * output.cc (Output_section::add_input_section): Use
4175 function section_ordering_specified to check if section ordering is
4177 * output.cc (Output_section::add_relaxed_input_section): Use
4178 function section_ordering_specified to check if section ordering is
4180 (Output_section::update_section_layout): New function.
4181 (Output_section::sort_attached_input_sections): Check if input section
4183 * output.h (Output_section::update_section_layout): New function.
4184 * plugin.cc (get_section_count): New function.
4185 (get_section_type): New function.
4186 (get_section_name): New function.
4187 (get_section_contents): New function.
4188 (update_section_order): New function.
4189 (allow_section_ordering): New function.
4190 (Plugin::load): Add the new interfaces to the transfer vector.
4191 (Plugin_manager::load_plugins): New parameter.
4192 (Plugin_manager::all_symbols_read): New parameter.
4193 (Plugin_manager::claim_file): New parameter. Save the elf object for
4195 (Plugin_manager::get_elf_object): New function.
4196 (Plugin_manager::get_view): Change to directly use the bool to check
4197 if get_view is called from claim_file_hook.
4198 * plugin.h (input_objects): New function
4199 (Plugin__manager::load_plugins): New parameter.
4200 (Plugin_manager::claim_file): New parameter.
4201 (Plugin_manager::get_elf_object): New function.
4202 (Plugin_manager::in_claim_file_handler): New function.
4203 (Plugin_manager::in_claim_file_handler_): New member.
4204 (layout): New function.
4205 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4206 handler with an extra parameter. Make the elf object before calling
4208 * testsuite/plugin_test.c (get_section_count): New function pointer.
4209 (get_section_type): New function pointer.
4210 (get_section_name): New function pointer.
4211 (get_section_contents): New function pointer.
4212 (update_section_order): New function pointer.
4213 (allow_section_ordering): New function pointer.
4214 (onload): Check if the new interfaces exist.
4216 2011-07-13 Ian Lance Taylor <iant@google.com>
4218 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4220 * x86_64.cc (Target_x86_64::got_section): Likewise.
4221 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4222 (relro_now_test_SOURCES): New variable.
4223 (relro_now_test_DEPENDENCIES): New variable.
4224 (relro_now_test_LDFLAGS): New variable.
4225 (relro_now_test_LDADD): New variable.
4226 (relro_now_test.so): New target.
4227 * testsuite/Makefile.in: Rebuild.
4229 2011-07-12 Ian Lance Taylor <iant@google.com>
4232 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4233 GLOB_DAT relocation rather than a RELATIVE relocation for a
4234 protected symbol when creating a shared library.
4235 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4236 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4237 * testsuite/protected_main_1.cc (main): Test that protected
4238 function has same address.
4240 2011-07-11 Ian Lance Taylor <iant@google.com>
4243 * options.h (class General_options): Add -Bgroup.
4244 * options.cc (General_options::finalize): If -Bgroup is set,
4245 default to --unresolved-symbols=report-all.
4246 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4247 * target-reloc.h (issue_undefined_symbol_error): Handle
4248 --unresolved-symbols=report-all.
4250 2011-07-08 Ian Lance Taylor <iant@google.com>
4253 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4254 if linker script discards key sections.
4255 (Layout::create_dynamic_symtab): Likewise.
4256 (Layout::assign_local_dynsym_offsets): Likewise.
4257 (Layout::sized_create_version_sections): Likewise.
4258 (Layout::create_interp): Likewise.
4259 (Layout::finish_dynamic_section): Likewise.
4260 (Layout::set_dynamic_symbol_size): Likewise.
4262 2011-07-08 Ian Lance Taylor <iant@google.com>
4265 * options.h (class General_options): Add --unresolved-symbols.
4266 * target-reloc.h (issue_undefined_symbol_error): Check
4267 --unresolved-symbols. Add comments.
4269 2011-07-08 Ian Lance Taylor <iant@google.com>
4271 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4272 expression more complex.
4274 2011-07-08 Ian Lance Taylor <iant@google.com>
4277 * target-reloc.h (issue_undefined_symbol_error): New inline
4278 function, broken out of relocate_section.
4279 (relocate_section): Call issue_undefined_symbol_error.
4280 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4281 there is no TLS segment if we are about to issue an undefined
4283 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4285 2011-07-08 Ian Lance Taylor <iant@google.com>
4288 * resolve.cc (Symbol_table::should_override): Add fromtype
4289 parameter. Change all callers. Give error when linking together
4290 TLS and non-TLS symbol.
4291 (Symbol_table::should_override_with_special): Add fromtype
4292 parameter. Change all callers.
4293 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4294 there is no TLS segment if we have reported some errors.
4295 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4297 2011-07-08 Ian Lance Taylor <iant@google.com>
4300 * target.h (Target::plt_address_for_global): New function.
4301 (Target::plt_address_for_local): New function.
4302 (Target::plt_section_for_global): Remove.
4303 (Target::plt_section_for_local): Remove.
4304 (Target::do_plt_address_for_global): New virtual function.
4305 (Target::do_plt_address_for_local): New virtual function.
4306 (Target::do_plt_section_for_global): Remove.
4307 (Target::do_plt_section_for_local): Remove.
4308 (Target::register_global_plt_entry): Add Symbol_table and Layout
4310 * output.cc (Output_data_got::Got_entry::write): Use
4311 plt_address_for_global and plt_address_for_local.
4312 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4313 address of output section.
4314 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4315 got_irelative_, and irelative_count_ fields. Update
4317 (Output_data_plt_i386::has_irelative_section): New function.
4318 (Output_data_plt_i386::entry_count): Add irelative_count_.
4319 (Output_data_plt_i386::set_final_data_size): Likewise.
4320 (class Target_i386): Add got_irelative_ and rel_irelative_
4321 fields. Update declarations.
4322 (Target_i386::Target_i386): Initialize new fields.
4323 (Target_i386::do_plt_address_for_global): New function replacing
4324 do_plt_section_for_global.
4325 (Target_i386::do_plt_address_for_local): New function replacing
4326 do_plt_section_for_local.
4327 (Target_i386::got_section): Create got_irelative_.
4328 (Target_i386::rel_irelative_section): New function.
4329 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4330 fields. Don't define __rel_iplt_{start,end}.
4331 (Output_data_plt_i386::add_entry): Add symtab and layout
4332 parameters. Change all callers. Use different PLT and GOT for
4334 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4335 layout parameters. Change all callers. Use different PLT and
4337 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4338 (Output_data_plt_i386::rel_irelative): New function.
4339 (Output_data_plt_i386::address_for_global): New function.
4340 (Output_data_plt_i386::address_for_local): New function.
4341 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4342 IRELATIVE GOT when changing IFUNC GOT entries.
4343 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4345 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4346 if we didn't create an IRELATIVE GOT.
4347 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4348 plt_address_for_local.
4349 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4350 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4351 got_irelative_, and irelative_count_ fields. Update
4353 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4354 Initialize new fields. Remove symtab parameter. Change all
4356 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4358 (Output_data_plt_x86_64::has_irelative_section): New function.
4359 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4360 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4361 fields. Update declarations.
4362 (Target_x86_64::Target_x86_64): Initialize new fields.
4363 (Target_x86_64::do_plt_address_for_global): New function replacing
4364 do_plt_section_for_global.
4365 (Target_x86_64::do_plt_address_for_local): New function replacing
4366 do_plt_section_for_local.
4367 (Target_x86_64::got_section): Create got_irelative_.
4368 (Target_x86_64::rela_irelative_section): New function.
4369 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4370 all callers. Don't create __rel_iplt_{start,end}.
4371 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4372 parameters. Change all callers. Use different PLT and GOT for
4374 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4375 layout parameters. Change all callers. Use different PLT and
4377 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4378 parameters. Change all callers. Use different PLT and GOT for
4380 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4381 (Output_data_plt_x86_64::rela_irelative): New function.
4382 (Output_data_plt_x86_64::address_for_global): New function.
4383 (Output_data_plt_x86_64::address_for_local): New function.
4384 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4385 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4386 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4387 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4389 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4391 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4392 symbols if we didn't create an IRELATIVE GOT.
4393 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4394 plt_address_for_local.
4395 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4396 * testsuite/ifuncvar1.c: New test file.
4397 * testsuite/ifuncvar2.c: New test file.
4398 * testsuite/ifuncvar3.c: New test file.
4399 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4400 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4401 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4402 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4403 * testsuite/Makefile.in: Rebuild.
4405 2011-07-07 Cary Coutant <ccoutant@google.com>
4407 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4408 (two_file_test_1_ndebug.o): Likewise.
4409 (two_file_test_1b_ndebug.o): Likewise.
4410 (two_file_test_2_ndebug.o): Likewise.
4411 (two_file_test_main_ndebug.o): Likewise.
4412 (incremental_test_2): Link with no-debug versions.
4414 2011-07-06 Cary Coutant <ccoutant@google.com>
4416 * gold/incremental.cc
4417 (Output_section_incremental_inputs::write_info_blocks): Check for
4418 hidden and internal symbols.
4420 2011-07-06 Cary Coutant <ccoutant@google.com>
4422 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4423 Check disposition for startup file.
4424 (Incremental_inputs::report_command_line): Ignore
4425 --incremental-startup-unchanged option.
4426 * options.cc (General_options::parse_incremental_startup_unchanged):
4428 (General_options::General_options): Initialize new data member.
4429 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4430 (General_options): Add --incremental-startup-unchanged option.
4431 (General_options::incremental_startup_disposition): New function.
4432 (General_options::incremental_startup_disposition_): New data member.
4434 2011-07-06 Cary Coutant <ccoutant@google.com>
4436 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4437 input file index to Script_info ctor.
4438 (Sized_incremental_binary::do_file_has_changed): Find the
4439 command-line argument for files named in scripts.
4440 * incremental.h (Script_info::Script_info): New ctor
4441 with input file index.
4442 (Script_info::input_file_index): New function.
4443 (Script_info::input_file_index_): New data member.
4444 (Incremental_binary::get_library): Add const.
4445 (Incremental_binary::get_script_info): Add const.
4446 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4447 * testsuite/Makefile.am (incremental_test_5): New test case.
4448 (incremental_test_6): New test case.
4449 * testsuite/Makefile.in: Regenerate.
4451 2011-07-06 Cary Coutant <ccoutant@google.com>
4453 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4454 debug output when command lines differ.
4456 2011-07-06 Cary Coutant <ccoutant@google.com>
4458 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4459 --incremental-patch option.
4460 * layout.cc (Free_list::allocate): Extend allocation beyond original
4462 (Layout::make_output_section): Mark sections that should get
4464 * options.cc (parse_percent): New function.
4465 * options.h (parse_percent): New function.
4466 (DEFINE_percent): New macro.
4467 (General_options): Add --incremental-patch option.
4468 * output.cc (Output_section::Output_section): Initialize new data
4470 (Output_section::add_input_section): Print section name when out
4472 (Output_section::add_output_section_data): Likewise.
4473 (Output_section::set_final_data_size): Add patch space when
4474 doing --incremental-full.
4475 (Output_section::do_reset_address_and_file_offset): Remove patch
4477 (Output_segment::set_section_list_addresses): Print debug output
4478 only if --incremental-update.
4479 * output.h (Output_section::set_is_patch_space_allowed): New function.
4480 (Output_section::is_patch_space_allowed_): New data member.
4481 (Output_section::patch_space_): New data member.
4482 * parameters.cc (Parameters::incremental_full): New function.
4483 * parameters.h (Parameters::incremental_full): New function
4484 * testsuite/Makefile.am (incremental_test_2): Add test for
4485 --incremental-patch option.
4486 * testsuite/Makefile.in: Regenerate.
4487 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4488 (t18): Remove function body.
4490 2011-07-05 Doug Kwan <dougkwan@google.com>
4493 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4494 Arm_Address type for relocation result.
4495 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4497 (Arm_relocate_functions::abs32): Use unaligned access.
4498 (Arm_relocate_functions::rel32): Ditto.
4499 (Arm_relocate_functions::prel31): Ditto.
4500 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4501 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4502 static data relocations.
4503 * testsuite/Makefile.in: Regnerate.
4504 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4506 2011-07-05 Ian Lance Taylor <iant@google.com>
4509 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4510 symbols if necessary.
4511 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4513 2011-07-05 Ian Lance Taylor <iant@google.com>
4516 * resolve.cc (Symbol::override_base_with_special): Simply override
4517 version with special symbol version, ignoring previous version.
4519 2011-07-05 Ian Lance Taylor <iant@google.com>
4521 * object.cc (Sized_relobj_file::include_section_group): Add
4522 information to comment about signature location.
4524 2011-07-02 Ian Lance Taylor <iant@google.com>
4527 * options.h (class General_options): Add -f and -F.
4528 * options.cc (General_options::finalize): Fatal error if -f/-F
4529 are used without -shared.
4530 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4532 2011-07-02 Ian Lance Taylor <iant@google.com>
4534 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4536 2011-07-01 Ian Lance Taylor <iant@google.com>
4540 * resolve.cc (Symbol::override_base_with_special): Don't override
4541 the version if the overriding symbol has a different name.
4542 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4543 all callers. If we give an error about an undefined version,
4544 define the base version if necessary.
4545 * dynobj.h (class Versions): Update declaration.
4546 * testsuite/weak_alias_test_5.cc: New file.
4547 * testsuite/weak_alias_test.script: New file.
4548 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4549 and versioned_alias have the right value, and call t2.
4550 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4551 weak_alias_test_5.so.
4552 (weak_alias_test_LDADD): Likewise.
4553 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4554 * testsuite/Makefile.in: Rebuild.
4556 2011-07-01 Ian Lance Taylor <iant@google.com>
4559 * options.h (class General_options): Support -z notext.
4560 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4562 (two_file_shared_nonpic.so): Likewise.
4563 (two_file_shared_mixed.so): Likewise.
4564 (two_file_shared_mixed_1.so): Likewise.
4565 (weak_undef_lib_nonpic.so): Likewise.
4566 (alt/weak_undef_lib_nonpic.so): Likewise.
4567 (tls_test_shared_nonpic.so): Likewise.
4568 * testsuite/Makefile.in: Rebuild.
4570 2011-07-01 Ian Lance Taylor <iant@google.com>
4573 * configure.ac: Test whether static linking works, setting
4574 the automake conditional HAVE_STATIC.
4575 * testsuite/Makefile.am: Disable tests using -static if
4576 HAVE_STATIC is not true.
4577 * configure, testsuite/Makefile.in: Rebuild.
4579 2011-07-01 Ian Lance Taylor <iant@google.com>
4582 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4583 Assert if we see DW_EH_PE_indirect.
4584 * target.h (Target::ehframe_datarel_base): New function.
4585 (Target::do_ehframe_datarel_base): New target function.
4586 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4587 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4590 2011-07-01 Ian Lance Taylor <iant@google.com>
4593 * options.h (class General_options): Add
4594 --ld-generated-unwind-info.
4595 * ehframe.cc (Fde::write): Add address parameter. Change all
4596 callers. If associated with PLT, fill in address and size.
4597 (Cie::set_output_offset): Only add merge mapping if there is an
4599 (Cie::write): Add address parameter. Change all callers.
4600 (Eh_frame::add_ehframe_for_plt): New function.
4601 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4602 input_offset_ fields into union u_, with new plt field.
4603 (Fde::Fde): Adjust for new union field.
4604 (Fde::Fde) [Output_data version]: New constructor.
4605 (Fde::add_mapping): Only add merge mapping if there is an object.
4606 (class Cie): Update declarations.
4607 (class Eh_frame): Declare add_ehframe_for_plt.
4608 * layout.cc (Layout::layout_eh_frame): Break out code into
4609 make_eh_frame_section, and call it.
4610 (Layout::make_eh_frame_section): New function.
4611 (Layout::add_eh_frame_for_plt): New function.
4612 * layout.h (class Layout): Update declarations.
4613 * merge.cc (Merge_map::add_mapping): Add assertion.
4614 * i386.cc: Include "dwarf.h".
4615 (class Output_data_plt_i386): Make first_plt_entry,
4616 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4617 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4618 and plt_eh_frame_fde.
4619 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4620 boundary. Call add_eh_frame_for_plt if appropriate.
4621 * x86_64.cc: Include "dwarf.h".
4622 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4623 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4624 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4625 and plt_eh_frame_fde.
4626 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4629 2011-06-29 Ian Lance Taylor <iant@google.com>
4632 * object.cc (Sized_relobj_file::layout_section): Change shdr
4633 parameter to be const.
4634 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4636 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4637 appropriate. Call layout_eh_frame_section.
4638 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4640 * object.h (class Sized_relobj_file): Update declarations.
4642 2011-06-29 Ian Lance Taylor <iant@google.com>
4645 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4647 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4649 2011-06-29 Ian Lance Taylor <iant@google.com>
4652 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4654 * layout.cc (Layout::layout_eh_frame): Likewise.
4656 2011-06-29 Ian Lance Taylor <iant@google.com>
4659 * layout.cc (Layout::symtab_section_shndx): New function.
4660 * layout.h (class Layout): Declare symtab_section_shndx.
4661 * output.cc (Output_section::write_header): Call it.
4663 2011-06-29 Ian Lance Taylor <iant@google.com>
4666 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4667 symbols which are not used in a relocation.
4669 2011-06-28 Ian Lance Taylor <iant@google.com>
4672 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4673 script create indistinguishable segments.
4674 (Layout::set_segment_offsets): Use stable_sort when sorting
4675 segments. Pass this to Compare_segments constructor.
4676 * layout.h (class Layout): Make segment_precedes non-static.
4677 (class Compare_segments): Change from struct to class. Add
4678 layout_ field. Add constructor.
4679 * script-sections.cc
4680 (Script_sections::attach_sections_using_phdrs_clause): Rename
4681 local orphan to is_orphan. Don't report failure to put empty
4682 section in segment. On attachment failure, report name of
4683 section, and attach to first PT_LOAD segment.
4685 2011-06-28 Ian Lance Taylor <iant@google.com>
4688 * target-select.cc (Target_selector::Target_selector): Add
4689 emulation parameter. Change all callers.
4690 (select_target_by_bfd_name): Rename from select_target_by_name.
4692 (select_target_by_emulation): New function.
4693 (supported_emulation_names): New function.
4694 * target-select.h (class Target_selector): Add emulation_ field.
4695 Update declarations.
4696 (Target_selector::recognize_by_bfd_name): Rename from
4697 recognize_by_name. Change all callers.
4698 (Target_selector::supported_bfd_names): Rename from
4699 supported_names. Change all callers.
4700 (Target_selector::recognize_by_emulation): New function.
4701 (Target_selector::supported_emulations): New function.
4702 (Target_selector::emulation): New function.
4703 (Target_selector::do_recognize_by_bfd_name): Rename from
4704 do_recognize_by_name. Change all callers.
4705 (Target_selector::do_supported_bfd_names): Rename from
4706 do_supported_names. Change all callers.
4707 (Target_selector::do_recognize_by_emulation): New function.
4708 (Target_selector::do_supported_emulations): New function.
4709 (select_target_by_bfd_name): Change name in declaration.
4710 (select_target_by_emulation): Declare.
4711 (supported_emulation_names): Declare.
4712 * parameters.cc (parameters_force_valid_target): Try to find
4713 target based on emulation from -m option.
4714 * options.h (class General_options): Change doc string for -m.
4715 * options.cc (help): Print emulations.
4716 (General_options::parse_V): Likewise.
4717 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4718 Add emulation parameter. Change all callers.
4720 2011-06-28 Ian Lance Taylor <iant@google.com>
4722 * target.h (class Target): Add osabi_ field.
4723 (Target::osabi): New function.
4724 (Target::set_osabi): New function.
4725 (Target::Target): Initialize osabi_.
4726 (Target::do_adjust_elf_header): Make pure virtual.
4727 (Sized_target::do_adjust_elf_header): Declare.
4728 * target.cc (Sized_target::do_adjust_elf_header): New function.
4729 (class Sized_target): Instantiate all versions.
4730 * freebsd.h (class Target_freebsd): Remove.
4731 (Target_selector_freebsd::do_recognize): Call set_osabi on
4733 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4734 (Target_selector_freebsd::set_osabi): Remove.
4735 * i386.cc (class Target_i386): Inherit from Sized_target rather
4736 than Target_freebsd.
4737 * x86_64.cc (class Target_x86_64): Likewise.
4739 2011-06-28 Ian Lance Taylor <iant@google.com>
4741 * target.h (Target::can_check_for_function_pointers): Rewrite.
4743 (Target::can_icf_inline_merge_sections): Likewise.
4744 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4745 (Target::Target_info): Add can_icf_inline_merge_sections field.
4746 (Target::do_can_check_for_function_pointers): New virtual
4748 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4749 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4750 from can_check_for_function_pointers, move in file.
4751 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4752 section_may_have_icf_unsafe_poineters, move in file.
4753 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4754 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4755 Rename from can_check_for_function_pointers, move in file.
4756 (Target_i386::can_icf_inline_merge_sections): Remove.
4757 (Target_i386::i386_info): Initialize
4758 can_icf_inline_merge_sections.
4759 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4760 Initialize can_icf_inline_merge_sections.
4761 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4762 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4763 Rename from can_check_for_function_pointers, move in file.
4764 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4765 (Target_x86_64::x86_64_info): Initialize
4766 can_icf_inline_merge_sections.
4767 * testsuite/testfile.cc (Target_test::test_target_info):
4769 * icf.cc (get_section_contents): Correct formatting.
4771 2011-06-27 Ian Lance Taylor <iant@google.com>
4773 * symtab.cc (Symbol::versioned_name): New function.
4774 (Symbol_table::add_to_final_symtab): Use versioned_name when
4776 (Symbol_table::sized_write_symbol): Likewise.
4777 * symtab.h (class Symbol): Declare versioned_name.
4778 * stringpool.h (class Stringpool_template): Add variant of add
4779 which takes a std::basic_string.
4780 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4781 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4782 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4783 (ver_test_12.o): New target.
4784 * testsuite/Makefile.in: Rebuild.
4786 2011-06-27 Doug Kwan <dougkwan@google.com>
4788 * arm.cc (Arm_relocate_functions::thm_jump8,
4789 Arm_relocate_functions::thm_jump11): Use a wider signed
4790 type to compute offset.
4791 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4793 * testsuite/Makefile.in: Regenerate.
4794 * testsuite/arm_branch_in_range.sh: Check test results of
4795 arm_thm_jump11 and arm_thm_jump8.
4796 * testsuite/arm_thm_jump11.s: New test source file.
4797 * testsuite/arm_thm_jump11.t: New linker script.
4798 * testsuite/arm_thm_jump8.s: New test source file.
4799 * testsuite/arm_thm_jump8.t: New linker script.
4801 2011-06-24 Ian Lance Taylor <iant@google.com>
4803 * layout.cc: Include "object.h".
4804 (ctors_sections_in_init_array): New static variable.
4805 (Layout::is_ctors_in_init_array): New function.
4806 (Layout::layout): Add entry to ctors_sections_in_init_array if
4808 * layout.h (class Layout): Declare is_ctors_in_init_array.
4809 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4810 is_ctors_reverse_view is set.
4811 (Sized_relobj_file::write_sections): Add layout parameter. Change
4812 all callers. Set is_ctors_reverse_view field of View_size.
4813 (Sized_relobj_file::reverse_words): New function.
4814 * object.h (Sized_relobj_file::View_size): Add
4815 is_ctors_reverse_view field.
4816 (class Sized_relobj_file): Update declarations.
4817 * testsuite/initpri3.c: New test.
4818 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4820 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4821 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4822 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4823 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4824 * testsuite/Makefile.in: Rebuild.
4826 2011-06-24 Cary Coutant <ccoutant@google.com>
4828 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4829 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4830 (debug_msg_cdebug.err): New targets.
4831 * testsuite/Makefile.in: Regenerate.
4832 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4833 Fix checks for link with shared library.
4835 2011-06-24 Doug Kwan <dougkwan@google.com>
4837 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4838 skip empty text sections.
4839 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4841 2011-06-22 Ian Lance Taylor <iant@google.com>
4844 * options.h (class General_options): Add --ctors-in-init-array.
4845 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4846 friends as SHT_PROGBITS for merging sections.
4847 (Layout::layout): Remove special handling of .init_array and
4848 friends. Don't sort if doing relocatable link. Sort for .ctors
4849 and .dtors if ctors_in_init_array.
4850 (Layout::make_output_section): Force correct section types for
4851 .init_array and friends. Don't sort if doing relocatable link,
4852 Don't sort .ctors and .dtors if ctors_in_init_array.
4853 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4854 (Layout::output_section_name): Add relobj parameter. Change all
4855 callers. Handle .ctors. and .dtors. in code rather than table.
4856 Handle .ctors and .dtors if ctors_in_init_array.
4857 (Layout::match_file_name): New function, moved from output.cc.
4858 * layout.h (class Layout): Update declarations.
4859 * output.cc: Include "layout.h".
4860 (Input_section_sort_entry::get_priority): New function.
4861 (Input_section_sort_entry::match_file_name): Just call
4862 Layout::match_file_name.
4863 (Output_section::Input_section_sort_init_fini_compare::operator()):
4864 Handle .ctors and .dtors. Sort by explicit priority rather than
4866 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4867 * testsuite/initpri2.c: New test.
4868 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4869 (check_PROGRAMS): Add initpri2.
4870 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4871 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4872 * configure, testsuite/Makefile.in: Rebuild.
4874 2011-06-19 Ian Lance Taylor <iant@google.com>
4877 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4878 .interp section to a PT_INTERP segment even if we have seen a
4879 --dynamic-linker option. Don't do it if we have seen a PHDRS
4880 clause in a linker script.
4881 (Layout::finalize): Don't create a .interp section if we've
4882 already create a PT_INTERP segment.
4883 (Layout::create_interp): Always call choose_output_section (revert
4884 patch of 2011-06-17). Don't create PT_INTERP segment.
4885 * script-sections.cc
4886 (Script_sections::create_note_and_tls_segments): Add a .interp
4887 section to a PT_INTERP segment even if we have seen a
4888 --dynamic-linker option.
4890 2011-06-18 Ian Lance Taylor <iant@google.com>
4892 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4893 merely because a non-PT_LOAD segment has a dynamic reloc.
4895 2011-06-18 Ian Lance Taylor <iant@google.com>
4897 * layout.cc (Layout::finish_dynamic_section): Don't create
4898 DT_FLAGS entry if not needed.
4900 2011-06-18 Ian Lance Taylor <iant@google.com>
4903 * layout.cc (Layout::layout_eh_frame): Correct handling of
4904 writable .eh_frame section.
4906 2011-06-17 Ian Lance Taylor <iant@google.com>
4909 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4910 symbol is redefined with the exact same object and value.
4912 2011-06-17 Ian Lance Taylor <iant@google.com>
4915 * layout.h (class Layout): Add interp_segment_ field.
4916 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4917 (Layout::attach_allocated_section_to_segment): If making shared
4918 library, put .interp section in PT_INTERP segment.
4919 (Layout::finalize): Also call create_interp if -dynamic-linker
4921 (Layout::create_interp): Assert that there is no PT_INTERP
4922 segment. If not using a SECTIONS clause, use make_output_section.
4923 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4924 * script-sections.cc
4925 (Script_sections::create_note_and_tls_segments): If making shared
4926 library, put .interp section in PT_INTERP segment.
4928 2011-06-17 Ian Lance Taylor <iant@google.com>
4930 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4931 when making a shared library.
4933 2011-06-17 Ian Lance Taylor <iant@google.com>
4935 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4936 parameter. Change all callers. Don't issue warning about PC32
4937 against locally defined symbol.
4939 2011-06-16 Ian Lance Taylor <iant@google.com>
4941 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4942 occurs in same object.
4944 2011-06-14 Alan Modra <amodra@gmail.com>
4946 * po/POTFILES.in: Regenerate.
4948 2011-06-09 Ian Lance Taylor <iant@google.com>
4950 * script-sections.cc
4951 (Orphan_output_section::set_section_addresses): For a relocatable
4952 link set address to 0.
4954 2011-06-09 Cary Coutant <ccoutant@google.com>
4957 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4958 used with --compress-debug-sections.
4959 * gold/object.cc (Sized_relobj_file::do_layout): Report
4960 uncompressed size of compressed input sections.
4962 2011-06-08 Cary Coutant <ccoutant@google.com>
4965 * testsuite/two_file_test_2_v1.cc: Change initialization of
4966 v2 to keep it in .data.
4968 2011-06-07 Cary Coutant <ccoutant@google.com>
4970 * common.cc (Symbol_table::do_allocate_commons_list): Call
4972 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4973 (Errors::fallback): New function.
4974 (gold_fallback): New function.
4975 * errors.h (Errors::fallback): New function.
4976 * gold.cc (gold_exit): Change status parameter to enum; adjust
4978 (queue_initial_tasks): Call gold_fallback.
4979 * gold.h: Include cstdlib.
4980 (Exit_status): New enum type.
4981 (gold_exit): Change status parameter to enum.
4982 (gold_fallback): New function.
4983 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4984 (Layout::create_symtab_sections): Likewise.
4985 (Layout::create_shdrs): Likewise.
4986 * main.cc (main): Adjust call to gold_exit.
4987 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4988 (Output_data_got::add_got_entry_pair): Likewise.
4989 (Output_section::add_input_section): Likewise.
4990 (Output_section::add_output_section_data): Likewise.
4991 (Output_segment::set_section_list_addresses): Likewise.
4992 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4994 2011-06-07 Cary Coutant <ccoutant@google.com>
4996 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4997 for incremental links.
4998 * output.cc (Output_segment::set_section_list_addresses): Remove
4999 FIXME and test for TLS or BSS.
5001 2011-06-07 Cary Coutant <ccoutant@google.com>
5003 * testsuite/Makefile.am: Add incremental_copy_test,
5004 incremental_common_test_1.
5005 * testsuite/Makefile.in: Regenerate.
5006 * testsuite/common_test_1_v1.c: New source file.
5007 * testsuite/common_test_1_v2.c: New source file.
5008 * testsuite/copy_test_v1.cc: New source file.
5010 2011-06-07 Cary Coutant <ccoutant@google.com>
5012 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5013 update, allocate common from bss section's free list.
5014 * incremental-dump.cc (dump_incremental_inputs): Print flag for
5015 linker-defined symbols.
5016 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5017 Skip GOT and PLT entries that are no longer referenced.
5018 (Output_section_incremental_inputs::write_info_blocks): Mark
5019 linker-defined symbols.
5020 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5021 * output.cc (Output_section::allocate): New function.
5022 * output.h (Output_section::allocate): New function.
5023 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5024 linker-defined symbols.
5025 (Symbol::override_base_with_special): Copy is_predefined_ flag.
5026 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5027 (Symbol::init_base_output_data): Likewise.
5028 (Symbol::init_base_output_segment): Likewise.
5029 (Symbol::init_base_constant): Likewise.
5030 (Sized_symbol::init_output_data): Likewise.
5031 (Sized_symbol::init_output_segment): Likewise.
5032 (Sized_symbol::init_constant): Likewise.
5033 (Symbol_table::do_define_in_output_data): Likewise.
5034 (Symbol_table::do_define_in_output_segment): Likewise.
5035 (Symbol_table::do_define_as_constant): Likewise.
5036 * symtab.h (Symbol::is_predefined): New function.
5037 (Symbol::init_base_output_data): Add is_predefined parameter.
5038 (Symbol::init_base_output_segment): Likewise.
5039 (Symbol::init_base_constant): Likewise.
5040 (Symbol::is_predefined_): New data member.
5041 (Sized_symbol::init_output_data): Add is_predefined parameter.
5042 (Sized_symbol::init_output_segment): Likewise.
5043 (Sized_symbol::init_constant): Likewise.
5044 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5046 2011-06-07 Cary Coutant <ccoutant@google.com>
5048 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5049 instead of emit_copy_reloc.
5050 (Copy_relocs::emit_copy_reloc): Refactor.
5051 (Copy_relocs::make_copy_reloc): New function.
5052 (Copy_relocs::add_copy_reloc): Remove.
5053 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5055 (Copy_relocs::make_copy_reloc): New function.
5056 (Copy_relocs::add_copy_reloc): Remove.
5057 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5058 unchanged input files.
5059 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5060 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5061 Reserve BSS space for COPY relocations.
5062 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5063 (Output_section_incremental_inputs::write_info_blocks): Record
5064 whether a symbol is copied from a shared object.
5065 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5066 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5067 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5068 (Incremental_input_entry_reader::get_output_symbol_index): Add
5070 (Incremental_binary::emit_copy_relocs): New function.
5071 (Incremental_binary::do_emit_copy_relocs): New function.
5072 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5074 (Sized_incremental_binary::add_copy_reloc): New function.
5075 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5076 (Sized_incremental_binary::Copy_reloc): New struct.
5077 (Sized_incremental_binary::Copy_relocs): New typedef.
5078 (Sized_incremental_binary::copy_relocs_): New data member.
5079 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5080 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5081 * target.h (Sized_target::emit_copy_reloc): New function.
5082 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5084 2011-06-02 Cary Coutant <ccoutant@google.com>
5087 * gold/archive.cc (Archive::Archive): Initialize new data member.
5088 (Archive::include_all_members): Return if archive has already been
5090 * gold/archive.h (Archive::include_all_members_): New data member.
5092 2011-06-02 Nick Clifton <nickc@redhat.com>
5094 * dynobj.h: Fix spelling mistake in comment.
5095 * output.cc: Likewise.
5097 2011-05-31 Doug Kwan <dougkwan@google.com>
5101 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5102 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5103 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5104 redundant arm_exidx_test.so.
5105 * testsuite/Makefile.in: Regenerate.
5106 (check_SCRIPTS): Add pr12826.sh
5107 (check_DATA): Add pr12826.stdout
5108 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5109 * testsuite/pr12826.sh: New file.
5110 * testsuite/pr12826_1.s: Ditto.
5111 * testsuite/pr12826_1.s: Ditto.
5113 2011-05-30 Ian Lance Taylor <iant@google.com>
5115 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5118 2011-05-29 Ian Lance Taylor <iant@google.com>
5121 * testsuite/Makefile.am: Use different file name for two_file_test
5122 temporary file for each incremental test.
5123 * testsuite/Makefile.in: Rebuild.
5125 2011-05-29 Ian Lance Taylor <iant@google.com>
5127 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5128 binary input file is empty.
5130 2011-05-27 Ian Lance Taylor <iant@google.com>
5132 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5133 (ver_test_9.so): Likewise.
5134 * testsuite/Makefile.in: Rebuild.
5136 2011-05-26 Cary Coutant <ccoutant@google.com>
5138 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5139 * incremental.cc (Incremental_inputs::report_input_section): Fix
5140 comment, indentation.
5141 (Incremental_inputs::report_comdat_group): New function.
5142 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5143 of data for incremental input file entry.
5144 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5145 group count, COMDAT group signatures.
5146 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5147 an unchanged input file.
5148 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5149 Initialize new data member.
5150 (Incremental_object_entry::add_comdat_group): New function.
5151 (Incremental_object_entry::get_comdat_group_count): New function.
5152 (Incremental_object_entry::get_comdat_signature_key): New function.
5153 (Incremental_object_entry::groups_): New data member.
5154 (Incremental_inputs::report_comdat_group): New function.
5155 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5156 data for incremental input file entry.
5157 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5158 (Incremental_input_entry_reader::get_input_section): Adjust size of
5159 data for incremental input file entry.
5160 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5161 (Incremental_input_entry_reader::get_comdat_group_signature): New
5163 * object.cc (Sized_relobj::include_section_group): Report kept
5164 COMDAT groups for incremental links.
5166 2011-05-24 David Meyer <pdox@google.com>
5168 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5169 with name parameter. Add found_name parameter.
5170 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5171 * dirsearch.h (class Dirsearch): Update declaration.
5173 2011-05-24 Ian Lance Taylor <iant@google.com>
5175 * archive.cc (Library_base::should_include_member): Pull in object
5176 from archive if it defines the entry symbol.
5177 * parameters.cc (Parameters::entry): New function.
5178 * parameters.h (class Parameters): Declare entry.
5179 * output.h (class Output_file_header): Remove entry_ field.
5180 * output.cc (Output_file_header::Output_file_header): Remove entry
5181 parameter. Change all callers.
5182 (Output_file_header::entry): Use parameters->entry.
5183 * gold.cc (queue_middle_tasks): Likewise.
5184 * plugin.cc (Plugin_hook::run): Likewise.
5186 2011-05-24 Cary Coutant <ccoutant@google.com>
5188 * gold.cc (queue_initial_tasks): Pass incremental base filename
5189 to Output_file::open_base_file; don't print error message.
5190 * incremental-dump.cc (main): Adjust call to
5191 Output_file::open_for_modification.
5192 * incremental-dump.cc (main): Likewise.
5193 * incremental.cc (Incremental_inputs::report_command_line):
5194 Ignore --incremental-base option when comparing command lines.
5195 Ignore parameter when given as separate argument.
5196 * options.h (class General_options): Add --incremental-base.
5197 * output.cc (Output_file::Output_file):
5198 (Output_file::open_base_file): Add base_name and writable parameters;
5199 read base file into new file; print error message here.
5200 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5202 * output.h (Output_file::open_for_modification): Rename to...
5203 (Output_file::open_base_file): ...this; add base_name and
5204 writable parameters; adjust all callers.
5205 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5207 * testsuite/Makefile.am (incremental_test_4): Test
5209 * testsuite/Makefile.in: Regenerate.
5211 2011-05-24 Cary Coutant <ccoutant@google.com>
5213 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5215 * testsuite/Makefile.in: Regenerate.
5216 * testsuite/two_file_test_1_v1.cc: New test source file.
5217 * testsuite/two_file_test_1b_v1.cc: New test source file.
5218 * testsuite/two_file_test_2_v1.cc: New test source file.
5220 2011-05-24 Cary Coutant <ccoutant@google.com>
5222 * dynobj.h (Dynobj::do_dynobj): New function.
5223 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5224 flag and soname for shared objects.
5225 * incremental.cc (Incremental_inputs::report_object): Make
5226 either Incremental_object_entry or Incremental_dynobj_entry; add
5227 soname to string table.
5228 (Incremental_inputs::report_input_section): Add assertion.
5229 (Output_section_incremental_inputs::set_final_data_size): Adjust
5230 type of input file entry for shared libraries; adjust size of
5231 shared library info entry.
5232 (Output_section_incremental_inputs::write_input_files): Write
5233 as_needed flag for shared libraries.
5234 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5235 of input file entry for shared libraries; write soname.
5236 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5237 soname from incremental info.
5238 * incremental.h (enum Incremental_input_flags): Add
5239 INCREMENTAL_INPUT_AS_NEEDED.
5240 (Incremental_input_entry::Incremental_input_entry): Initialize new
5242 (Incremental_input_entry::set_as_needed): New function.
5243 (Incremental_input_entry::as_needed): New function.
5244 (Incremental_input_entry::do_dynobj_entry): New function.
5245 (Incremental_input_entry::as_needed_): New data member.
5246 (Incremental_object_entry::Incremental_object_entry): Don't check
5248 (Incremental_object_entry::do_type): Likewise.
5249 (class Incremental_dynobj_entry): New class.
5250 (Incremental_input_entry_reader::as_needed): New function.
5251 (Incremental_input_entry_reader::get_soname): New function.
5252 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5253 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5254 size of shared library info entry.
5255 * layout.cc (Layout::finish_dynamic_section): Don't test for
5256 incremental link when adding DT_NEEDED entries.
5257 * object.h (Object::Object): Initialize new data member.
5258 (Object::dynobj): New function.
5259 (Object::set_as_needed): New function.
5260 (Object::as_needed): New function.
5261 (Object::do_dynobj): New function.
5262 (Object::as_needed_): New data member.
5264 2011-05-24 Cary Coutant <ccoutant@google.com>
5266 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5267 info; adjust display of GOT entries.
5268 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5269 vector of input objects; remove file_status_.
5270 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5271 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5272 got_plt reader; call target hooks to reserve GOT entries.
5273 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5274 of input file info header and GOT info entry.
5275 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5277 (Got_plt_view_info::got_descriptor): Remove.
5278 (Got_plt_view_info::sym_index): New data member.
5279 (Got_plt_view_info::input_index): New data member.
5280 (Local_got_offset_visitor::visit): Write input file index.
5281 (Global_got_offset_visitor::visit): Write 0 for input file index.
5282 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5283 with sym_index and input_index.
5284 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5285 incremental info GOT entry; replace got_descriptor with input_index.
5286 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5287 map from input file index to object.
5288 (Sized_relobj_incr::do_layout): Replace direct data member reference
5289 with accessor function.
5290 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5291 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5292 Adjust size of input file info header.
5293 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5294 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5295 (Incremental_input_entry_reader::get_input_section): Adjust size of
5296 input file info header.
5297 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5298 of incremental info GOT entry.
5299 (Incremental_got_plt_reader::get_got_desc): Remove.
5300 (Incremental_got_plt_reader::get_got_symndx): New function.
5301 (Incremental_got_plt_reader::get_got_input_index): New function.
5302 (Sized_incremental_binary::Sized_incremental_binary): Remove
5303 file_status_; add input_objects_.
5304 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5305 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5306 (Sized_incremental_binary::file_is_unchanged): Remove.
5307 (Sized_incremental_binary::set_input_object): New function.
5308 (Sized_incremental_binary::input_object): New function.
5309 (Sized_incremental_binary::file_status_): Remove.
5310 (Sized_incremental_binary::input_objects_): New data member.
5311 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5313 (Sized_relobj_incr::invalid_address): Move to base class.
5314 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5316 (Sized_relobj_incr::do_output_section_offset): Likewise.
5317 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5318 (Sized_relobj_incr::section_offsets_): Likewise.
5319 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5321 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5322 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5323 with accessor function.
5324 (Sized_relobj_file::do_layout): Likewise.
5325 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5326 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5327 (Sized_relobj_file::compute_final_local_value): Replace refs to
5328 section_offsets_ with accessor function.
5329 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5330 * object.h (Relobj::Relobj): Initialize new data members.
5331 (Relobj::add_dyn_reloc): New function.
5332 (Relobj::first_dyn_reloc): New function.
5333 (Relobj::dyn_reloc_count): New function.
5334 (Relobj::first_dyn_reloc_): New data member.
5335 (Relobj::dyn_reloc_count_): New data member.
5336 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5338 (Sized_relobj::Address): New typedef.
5339 (Sized_relobj::invalid_address): Move here from child class.
5340 (Sized_relobj::Sized_relobj): Initialize new data members.
5341 (Sized_relobj::sized_relobj): New function.
5342 (Sized_relobj::is_output_section_offset_invalid): Move here from
5344 (Sized_relobj::get_output_section_offset): Likewise.
5345 (Sized_relobj::local_has_got_offset): Likewise.
5346 (Sized_relobj::local_got_offset): Likewise.
5347 (Sized_relobj::set_local_got_offset): Likewise.
5348 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5349 (Sized_relobj::clear_got_offsets): New function.
5350 (Sized_relobj::section_offsets): Move here from child class.
5351 (Sized_relobj::do_output_section_offset): Likewise.
5352 (Sized_relobj::do_set_section_offset): Likewise.
5353 (Sized_relobj::Local_got_offsets): Likewise.
5354 (Sized_relobj::local_got_offsets_): Likewise.
5355 (Sized_relobj::section_offsets_): Likewise.
5356 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5358 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5360 (Sized_relobj_file::sized_relobj): New function
5361 (Sized_relobj_file::local_has_got_offset): Move to base class.
5362 (Sized_relobj_file::local_got_offset): Likewise.
5363 (Sized_relobj_file::set_local_got_offset): Likewise.
5364 (Sized_relobj_file::get_output_section_offset): Likewise.
5365 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5366 (Sized_relobj_file::do_output_section_offset): Likewise.
5367 (Sized_relobj_file::do_set_section_offset): Likewise.
5368 (Sized_relobj_file::Local_got_offsets): Likewise.
5369 (Sized_relobj_file::local_got_offsets_): Likewise.
5370 (Sized_relobj_file::section_offsets_): Likewise.
5371 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5373 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5374 (Output_reloc::get_symbol_index): Likewise.
5375 (Output_reloc::local_section_offset): Likewise.
5376 (Output_reloc::get_address): Likewise.
5377 (Output_reloc::symbol_value): Likewise.
5378 (Output_data_got::reserve_slot): Move to class definition.
5379 (Output_data_got::reserve_local): New function.
5380 (Output_data_got::reserve_slot_for_global): Remove.
5381 (Output_data_got::reserve_global): New function.
5382 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5383 (all constructors, two instantiations).
5384 (Output_reloc::get_relobj): New function (two instantiations).
5385 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5386 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5387 (Output_data_reloc::add_global): Adjust type of relobj.
5388 (Output_data_reloc::add_global_relative): Likewise.
5389 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5390 (Output_data_reloc::add_local): Likewise.
5391 (Output_data_reloc::add_local_relative): Likewise.
5392 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5393 (Output_data_reloc::add_local_section): Likewise.
5394 (Output_data_reloc::add_output_section): Likewise.
5395 (Output_data_reloc::add_absolute): Likewise.
5396 (Output_data_reloc::add_target_specific): Likewise.
5397 (Output_data_got::reserve_slot): Move definition here.
5398 (Output_data_got::reserve_local): New function.
5399 (Output_data_got::reserve_global): New function.
5400 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5401 section_offsets_ with accessor function.
5402 (Sized_relobj_file::write_sections): Likewise.
5403 (Sized_relobj_file::do_relocate_sections): Likewise.
5404 * target.h (Sized_target::reserve_local_got_entry): New function.
5405 (Sized_target::reserve_global_got_entry): New function.
5406 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5407 (Target_x86_64::reserve_global_got_entry): New function.
5408 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5410 2011-05-23 Cary Coutant <ccoutant@google.com>
5412 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5413 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5414 bit when checking got_type.
5415 * incremental.cc (Sized_incremental_binary::setup_readers):
5416 Store symbol table and string table locations; initialize bit vector
5417 of file status flags.
5418 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5420 (Sized_incremental_binary::do_process_got_plt): New function.
5421 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5422 (Output_section_incremental_inputs::set_final_data_size): Record
5423 file index for each input file.
5424 (Output_section_incremental_inputs::write_got_plt): Store file index
5425 instead of input entry offset for each GOT entry.
5427 (Incremental_input_entry::Incremental_input_entry): Initialize new
5429 (Incremental_input_entry::set_offset): Store file index.
5430 (Incremental_input_entry::get_file_index): New function.
5431 (Incremental_input_entry::file_index_): New data member.
5432 (Incremental_binary::process_got_plt): New function.
5433 (Incremental_binary::do_process_got_plt): New function.
5434 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5436 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5437 (Sized_incremental_binary::set_file_is_unchanged): New function.
5438 (Sized_incremental_binary::file_is_unchanged): New function.
5439 (Sized_incremental_binary::do_process_got_plt): New function.
5440 (Sized_incremental_binary::file_status_): New data member.
5441 (Sized_incremental_binary::main_symtab_loc_): New data member.
5442 (Sized_incremental_binary::main_strtab_loc_): New data member.
5443 * output.cc (Output_data_got::Got_entry::write): Add case
5445 (Output_data_got::add_global): Call add_got_entry.
5446 (Output_data_got::add_global_plt): Likewise.
5447 (Output_data_got::add_global_with_rel): Likewise.
5448 (Output_data_got::add_global_with_rela): Likewise.
5449 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5450 (Output_data_got::add_global_pair_with_rela): Likewise.
5451 (Output_data_got::add_local): Call add_got_entry.
5452 (Output_data_got::add_local_plt): Likewise.
5453 (Output_data_got::add_local_with_rel): Likewise.
5454 (Output_data_got::add_local_with_rela): Likewise.
5455 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5456 (Output_data_got::add_local_pair_with_rela): Likewise.
5457 (Output_data_got::reserve_slot): New function.
5458 (Output_data_got::reserve_slot_for_global): New function.
5459 (Output_data_got::add_got_entry): New function.
5460 (Output_data_got::add_got_entry_pair): New function.
5461 (Output_section::add_output_section_data): Edit FIXME.
5463 (Output_section_data_build::Output_section_data_build): New
5464 constructor with size parameter.
5465 (Output_data_space::Output_data_space): Likewise.
5466 (Output_data_got::Output_data_got): Initialize new data member; new
5467 constructor with size parameter.
5468 (Output_data_got::add_constant): Call add_got_entry.
5469 (Output_data_got::reserve_slot): New function.
5470 (Output_data_got::reserve_slot_for_global): New function.
5471 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5472 (Output_data_got::add_got_entry): New function.
5473 (Output_data_got::add_got_entry_pair): New function.
5474 (Output_data_got::free_list_): New data member.
5475 * target.h (Sized_target::init_got_plt_for_update): New function.
5476 (Sized_target::register_global_plt_entry): New function.
5477 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5478 Initialize new data member; call init; add constructor with PLT count.
5479 (Output_data_plt_x86_64::init): New function.
5480 (Output_data_plt_x86_64::add_relocation): New function.
5481 (Output_data_plt_x86_64::reserve_slot): New function.
5482 (Output_data_plt_x86_64::free_list_): New data member.
5483 (Target_x86_64::init_got_plt_for_update): New function.
5484 (Target_x86_64::register_global_plt_entry): New function.
5485 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5486 incremental updates.
5487 (Output_data_plt_x86_64::add_relocation): New function.
5488 * testsuite/object_unittest.cc (Object_test): Set default options.
5490 2011-05-16 Ian Lance Taylor <iant@google.com>
5492 * options.h (class General_options): Make -i a synonym for -r.
5494 2011-05-16 Ian Lance Taylor <iant@google.com>
5496 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5498 2011-05-10 Cary Coutant <ccoutant@google.com>
5500 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5503 2011-05-06 Ian Lance Taylor <iant@google.com>
5505 * layout.cc (Layout::layout): If the output section flags change,
5506 update the ordering.
5508 2011-04-25 Cary Coutant <ccoutant@google.com>
5510 * incremental-dump.cc (dump_incremental_inputs): Print local
5511 symbol info for each input file.
5513 (Output_section_incremental_inputs::set_final_data_size): Add local
5514 symbol info to input file entries in incremental info.
5515 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5516 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5517 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5518 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5520 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5521 (Sized_incr_relobj::do_relocate): Write the local symbols.
5522 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5523 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5524 Adjust size of input file header.
5525 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5526 (Incremental_inputs_reader::get_local_symbol_count): New function.
5527 (Incremental_inputs_reader::get_input_section): Adjust size of input
5529 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5530 (Sized_incr_relobj::This): New typedef.
5531 (Sized_incr_relobj::sym_size): New const data member.
5532 (Sized_incr_relobj::Local_symbol): New struct.
5533 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5534 (Sized_incr_relobj::do_local_symbol_offset): New function.
5535 (Sized_incr_relobj::local_symbol_count_): New data member.
5536 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5537 (Sized_incr_relobj::local_symbol_index_): New data member.
5538 (Sized_incr_relobj::local_symbol_offset_): New data member.
5539 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5540 (Sized_incr_relobj::local_symbols_): New data member.
5541 * object.h (Relobj::output_local_symbol_count): New function.
5542 (Relobj::local_symbol_offset): New function.
5543 (Relobj::do_output_local_symbol_count): New function.
5544 (Relobj::do_local_symbol_offset): New function.
5545 (Sized_relobj::do_output_local_symbol_count): New function.
5546 (Sized_relobj::do_local_symbol_offset): New function.
5548 2011-04-22 Vladimir Simonov <sv@sw.ru>
5550 * descriptors.cc (set_close_on_exec): New function.
5551 (Descriptors::open): Use set_close_on_exec.
5552 * output.cc (S_ISLNK): Define if not defined.
5554 2011-04-22 Cary Coutant <ccoutant@google.com>
5556 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5558 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5559 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5560 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5562 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5563 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5564 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5566 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5568 (Incremental_binary::apply_incremental_relocs): New function.
5569 (Incremental_binary::do_apply_incremental_relocs): New function.
5570 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5572 (Sized_incremental_binary::add_global_symbol): New function.
5573 (Sized_incremental_binary::global_symbol): New function.
5574 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5575 (Sized_incremental_binary::symbol_map_): New data member.
5576 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5577 * target.h (Sized_target::apply_relocation): New function.
5578 * target-reloc.h (apply_relocation): New function.
5579 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5581 2011-04-22 Doug Kwan <dougkwan@google.com>
5583 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5584 flag of a SHT_ARM_EXIDX section.
5585 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5586 * testsuite/Makefile.in: Regenerate.
5587 * testsuite/arm_exidx_test.s: New file.
5588 * testsuite/arm_exidx_test.sh: Same.
5590 2011-04-20 Cary Coutant <ccoutant@google.com>
5593 * archive.h (Incremental_archive_entry::Archive_member):
5594 Initialize arg_serial_ (second constructor).
5596 2011-04-17 Ian Lance Taylor <iant@google.com>
5598 * object.cc (Relocate_info::location): Simplify location string.
5599 * errors.cc (Errors::error_at_location): Don't print program
5601 (Errors::warning_at_location): Likewise.
5602 (Errors::undefined_symbol): Likewise.
5603 * testsuite/debug_msg.sh: Update accordingly.
5605 2011-04-14 Cary Coutant <ccoutant@google.com>
5607 * gold/layout.cc (Layout::symtab_section_offset): New function.
5608 * gold/layout.h (Layout::symtab_section_offset): New function.
5609 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5611 2011-04-12 Ian Lance Taylor <iant@google.com>
5613 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5614 with MREMAP_MAYMOVE.
5615 * output.h (class Output_file): Add map_is_allocated_ field.
5616 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5617 not available, provide stubs. If mremap is not available, #define
5619 (MREMAP_MAYMOVE): Define if not defined.
5620 (Output_file::Output_file): Initialize map_is_allocated_.
5621 (Output_file::resize): Check map_is_allocated_.
5622 (Output_file::map_anonymous): If mmap fails, use malloc.
5623 (Output_file::unmap): Don't do anything for an anonymous map.
5624 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5625 is not available, provide stubs.
5626 (File_read::View::~View): Use free rather than delete[].
5627 (File_read::make_view): Use malloc rather than new[]. If mmap
5629 (File_read::find_or_make_view): Use malloc rather than new[].
5630 * gold.h: Remove HAVE_REMAP code.
5631 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5632 exists. Rename mremap to gold_mremap. If mmap is not available
5634 * configure, config.in: Rebuild.
5636 2011-04-11 Ian Lance Taylor <iant@google.com>
5638 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5639 initialize local variable v.
5641 2011-04-11 Cary Coutant <ccoutant@google.com>
5643 * archive.cc (Archive::include_member): Adjust call to
5645 (Add_archive_symbols::run): Track argument serial numbers.
5646 (Lib_group::include_member): Likewise.
5647 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5648 * archive.h (Incremental_archive_entry::Archive_member):
5649 Initialize arg_serial_.
5650 (Archive_member::arg_serial_): New data member.
5651 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5652 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5654 (Sized_dynobj::do_for_all_local_got_entries): New function.
5655 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5657 * fileread.cc (get_mtime): New function.
5658 * fileread.h (get_mtime): New function.
5659 * gold.cc (queue_initial_tasks): Check for incremental update.
5660 (process_incremental_input): New function.
5661 (queue_middle_tasks): Don't force valid target for incremental
5663 * incremental-dump.cc (find_input_containing_global): Adjust
5664 size of symbol info entry.
5665 (dump_incremental_inputs): Dump argument serial number and
5666 in_system_directory flag; bias shndx by 1; print symbol names
5667 when dumping per-file symbol lists; use new symbol info readers.
5669 (Output_section_incremental_inputs:update_data_size): New function.
5670 (Sized_incremental_binary::setup_readers): Setup input readers
5671 for each input file; build maps for files added from libraries
5673 (Sized_incremental_binary::check_input_args): New function.
5674 (Sized_incremental_binary::do_check_inputs): Build map of argument
5675 serial numbers to input arguments.
5676 (Sized_incremental_binary::do_file_has_changed): Rename
5677 do_file_is_unchanged to this; compare file modification times.
5678 (Sized_incremental_binary::do_init_layout): New function.
5679 (Sized_incremental_binary::do_reserve_layout): New function.
5680 (Sized_incremental_binary::do_get_input_reader): Remove.
5681 (Sized_incremental_binary::get_symtab_view): New function.
5682 (Incremental_checker::can_incrementally_link_output_file): Remove.
5683 (Incremental_inputs::report_command_line): Exclude --debug options.
5684 (Incremental_inputs::report_archive_begin): Add parameter; track
5685 argument serial numbers; don't put input file entry for archive
5686 before archive members.
5687 (Incremental_inputs::report_archive_end): Put input file entry
5688 for archive after archive members.
5689 (Incremental_inputs::report_object): Add parameter; track argument
5690 serial numbers and in_system_directory flag.
5691 (Incremental_inputs::report_script): Add parameter; track argument
5693 (Output_section_incremental_inputs::set_final_data_size): Adjust
5694 size of symbol info entry; check for forwarding symbols.
5695 (Output_section_incremental_inputs::write_input_files): Write
5696 in_system_directory flag and argument serial number.
5697 (Output_section_incremental_inputs::write_info_blocks): Map section
5698 indices between incremental info and original input file; store
5699 input section index for each symbol.
5700 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5701 change operator() to visit().
5702 (class Global_got_offset_visitor): Likewise.
5703 (class Global_symbol_visitor_got_plt):
5704 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5706 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5707 (Sized_incr_relobj::do_read_symbols): New function.
5708 (Sized_incr_relobj::do_layout): New function.
5709 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5710 (Sized_incr_relobj::do_add_symbols): New function.
5711 (Sized_incr_relobj::do_should_include_member): New function.
5712 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5713 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5714 (Sized_incr_relobj::do_section_size): New function.
5715 (Sized_incr_relobj::do_section_name): New function.
5716 (Sized_incr_relobj::do_section_contents): New function.
5717 (Sized_incr_relobj::do_section_flags): New function.
5718 (Sized_incr_relobj::do_section_entsize): New function.
5719 (Sized_incr_relobj::do_section_address): New function.
5720 (Sized_incr_relobj::do_section_type): New function.
5721 (Sized_incr_relobj::do_section_link): New function.
5722 (Sized_incr_relobj::do_section_info): New function.
5723 (Sized_incr_relobj::do_section_addralign): New function.
5724 (Sized_incr_relobj::do_initialize_xindex): New function.
5725 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5726 (Sized_incr_relobj::do_read_relocs): New function.
5727 (Sized_incr_relobj::do_gc_process_relocs): New function.
5728 (Sized_incr_relobj::do_scan_relocs): New function.
5729 (Sized_incr_relobj::do_count_local_symbols): New function.
5730 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5731 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5732 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5733 (Sized_incr_relobj::do_relocate): New function.
5734 (Sized_incr_relobj::do_set_section_offset): New function.
5735 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5736 (Sized_incr_dynobj::do_read_symbols): New function.
5737 (Sized_incr_dynobj::do_layout): New function.
5738 (Sized_incr_dynobj::do_add_symbols): New function.
5739 (Sized_incr_dynobj::do_should_include_member): New function.
5740 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5741 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5742 (Sized_incr_dynobj::do_section_size): New function.
5743 (Sized_incr_dynobj::do_section_name): New function.
5744 (Sized_incr_dynobj::do_section_contents): New function.
5745 (Sized_incr_dynobj::do_section_flags): New function.
5746 (Sized_incr_dynobj::do_section_entsize): New function.
5747 (Sized_incr_dynobj::do_section_address): New function.
5748 (Sized_incr_dynobj::do_section_type): New function.
5749 (Sized_incr_dynobj::do_section_link): New function.
5750 (Sized_incr_dynobj::do_section_info): New function.
5751 (Sized_incr_dynobj::do_section_addralign): New function.
5752 (Sized_incr_dynobj::do_initialize_xindex): New function.
5753 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5754 (make_sized_incremental_object): New function.
5755 (Incremental_library::copy_unused_symbols): New function.
5756 (Incremental_library::do_for_all_unused_symbols): New function.
5757 * incremental.h (enum Incremental_input_flags): New type.
5758 (class Incremental_checker): Remove.
5759 (Incremental_input_entry::Incremental_input_entry): Add argument
5761 (Incremental_input_entry::arg_serial): New function.
5762 (Incremental_input_entry::set_is_in_system_directory): New function.
5763 (Incremental_input_entry::is_in_system_directory): New function.
5764 (Incremental_input_entry::arg_serial_): New data member.
5765 (Incremental_input_entry::is_in_system_directory_): New data member.
5766 (class Script_info): Move here from script.h.
5767 (Script_info::Script_info): Add filename parameter.
5768 (Script_info::filename): New function.
5769 (Script_info::filename_): New data member.
5770 (Incremental_script_entry::Incremental_script_entry): Add argument
5772 (Incremental_object_entry::Incremental_object_entry): Likewise.
5773 (Incremental_object_entry::add_input_section): Build list of input
5774 sections with map to original shndx.
5775 (Incremental_object_entry::get_input_section_index): New function.
5776 (Incremental_object_entry::shndx_): New data member.
5777 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5778 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5779 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5781 (Incremental_inputs::report_archive_begin): Likewise.
5782 (Incremental_inputs::report_object): Likewise.
5783 (Incremental_inputs::report_script): Likewise.
5784 (class Incremental_global_symbol_reader): New class.
5785 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5786 and store flags and input file type.
5787 (Incremental_input_entry_reader::arg_serial): New function.
5788 (Incremental_input_entry_reader::type): Extract type from flags.
5789 (Incremental_input_entry_reader::is_in_system_directory): New function.
5790 (Incremental_input_entry_reader::get_input_section_count): Call
5791 accessor function for type.
5792 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5793 function for type; adjust size of global symbol entry.
5794 (Incremental_input_entry_reader::get_global_symbol_count): Call
5795 accessor function for type.
5796 (Incremental_input_entry_reader::get_object_count): Likewise.
5797 (Incremental_input_entry_reader::get_object_offset): Likewise.
5798 (Incremental_input_entry_reader::get_member_count): Likewise.
5799 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5800 (Incremental_input_entry_reader::get_member_offset): Likewise.
5801 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5802 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5803 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5804 (Incremental_input_entry_reader::get_global_symbol_reader): New
5806 (Incremental_input_entry_reader::get_output_symbol_index): New
5808 (Incremental_input_entry_reader::type_): Remove.
5809 (Incremental_input_entry_reader::flags_): New data member.
5810 (Incremental_inputs_reader::input_file_offset): New function.
5811 (Incremental_inputs_reader::input_file_index): New function.
5812 (Incremental_inputs_reader::input_file): Call input_file_offset.
5813 (Incremental_inputs_reader::input_file_at_offset): New function.
5814 (Incremental_relocs_reader::get_r_type): Reformat.
5815 (Incremental_relocs_reader::get_r_shndx): Reformat.
5816 (Incremental_relocs_reader::get_r_offset): Reformat.
5817 (Incremental_relocs_reader::data): New function.
5818 (Incremental_binary::Incremental_binary): Initialize new data members.
5819 (Incremental_binary::check_inputs): Add cmdline parameter.
5820 (Incremental_binary::file_is_unchanged): Remove.
5821 (Input_reader::arg_serial): New function.
5822 (Input_reader::get_unused_symbol_count): New function.
5823 (Input_reader::get_unused_symbol): New function.
5824 (Input_reader::do_arg_serial): New function.
5825 (Input_reader::do_get_unused_symbol_count): New function.
5826 (Input_reader::do_get_unused_symbol): New function.
5827 (Incremental_binary::input_file_count): New function.
5828 (Incremental_binary::get_input_reader): Change signature to use
5829 index instead of filename.
5830 (Incremental_binary::file_has_changed): New function.
5831 (Incremental_binary::get_input_argument): New function.
5832 (Incremental_binary::get_library): New function.
5833 (Incremental_binary::get_script_info): New function.
5834 (Incremental_binary::init_layout): New function.
5835 (Incremental_binary::reserve_layout): New function.
5836 (Incremental_binary::output_file): New function.
5837 (Incremental_binary::do_check_inputs): New function.
5838 (Incremental_binary::do_file_is_unchanged): Remove.
5839 (Incremental_binary::do_file_has_changed): New function.
5840 (Incremental_binary::do_init_layout): New function.
5841 (Incremental_binary::do_reserve_layout): New function.
5842 (Incremental_binary::do_input_file_count): New function.
5843 (Incremental_binary::do_get_input_reader): Change signature.
5844 (Incremental_binary::input_args_map_): New data member.
5845 (Incremental_binary::library_map_): New data member.
5846 (Incremental_binary::script_map_): New data member.
5847 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5849 (Sized_incremental_binary::output_section): New function.
5850 (Sized_incremental_binary::inputs_reader): Add const.
5851 (Sized_incremental_binary::symtab_reader): Add const.
5852 (Sized_incremental_binary::relocs_reader): Add const.
5853 (Sized_incremental_binary::got_plt_reader): Add const.
5854 (Sized_incremental_binary::get_symtab_view): New function.
5855 (Sized_incremental_binary::Inputs_reader): New typedef.
5856 (Sized_incremental_binary::Input_entry_reader): New typedef.
5857 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5858 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5859 (Sized_incremental_binary::do_file_has_changed): New function.
5860 (Sized_incremental_binary::do_init_layout): New function.
5861 (Sized_incremental_binary::do_reserve_layout): New function.
5862 (Sized_input_reader::Inputs_reader): Remove.
5863 (Sized_input_reader::Input_entry_reader): Remove.
5864 (Sized_input_reader::do_arg_serial): New function.
5865 (Sized_input_reader::do_get_unused_symbol_count): New function.
5866 (Sized_input_reader::do_get_unused_symbol): New function.
5867 (Sized_incremental_binary::do_input_file_count): New function.
5868 (Sized_incremental_binary::do_get_input_reader): Change signature;
5869 use index instead of filename.
5870 (Sized_incremental_binary::section_map_): New data member.
5871 (Sized_incremental_binary::input_entry_readers_): New data member.
5872 (class Sized_incr_relobj): New class.
5873 (class Sized_incr_dynobj): New class.
5874 (make_sized_incremental_object): New function.
5875 (class Incremental_library): New class.
5876 * layout.cc (Free_list::num_lists): New static data member.
5877 (Free_list::num_nodes): New static data member.
5878 (Free_list::num_removes): New static data member.
5879 (Free_list::num_remove_visits): New static data member.
5880 (Free_list::num_allocates): New static data member.
5881 (Free_list::num_allocate_visits): New static data member.
5882 (Free_list::init): New function.
5883 (Free_list::remove): New function.
5884 (Free_list::allocate): New function.
5885 (Free_list::dump): New function.
5886 (Free_list::print_stats): New function.
5887 (Layout_task_runner::run): Resize output file for incremental updates.
5888 (Layout::Layout): Initialize new data members.
5889 (Layout::set_incremental_base): New function.
5890 (Layout::init_fixed_output_section): New function.
5891 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5892 incremental updates.
5893 (Layout::create_gold_note): Do not create gold note section for
5894 incremental updates.
5895 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5896 for incremental updates.
5897 (Layout::set_section_offsets): For incremental updates, allocate space
5899 (Layout::create_symtab_sections): Layout with offsets relative to
5900 start of section; for incremental updates, allocate space from free
5902 (Layout::create_shdrs): For incremental updates, allocate space from
5904 (Layout::finish_dynamic_section): For incremental updates, do not
5905 check --as-needed (fixed in subsequent patch).
5906 * layout.h (class Free_list): New class.
5907 (Layout::set_incremental_base): New function.
5908 (Layout::incremental_base): New function.
5909 (Layout::init_fixed_output_section): New function.
5910 (Layout::allocate): New function.
5911 (Layout::incremental_base_): New data member.
5912 (Layout::free_list_): New data member.
5913 * main.cc (main): Print Free_list statistics.
5914 * object.cc (Relobj::finalize_incremental_relocs): Add
5915 clear_counts parameter; clear counts only when clear_counts is set.
5916 (Sized_relobj::Sized_relobj): Initialize new base class.
5917 (Sized_relobj::do_layout): Don't report special sections.
5918 (Sized_relobj::do_for_all_local_got_entries): New function.
5919 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5920 symtab_off to all symbol table offsets.
5921 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5922 * object.h (class Got_offset_list): Move to top of file.
5923 (Object::Object): Allow case where input_file == NULL.
5924 (Object::~Object): Likewise.
5925 (Object::input_file): Assert that input_file != NULL.
5926 (Object::lock): Allow case where input_file == NULL.
5927 (Object::unlock): Likewise.
5928 (Object::is_locked): Likewise.
5929 (Object::token): Likewise.
5930 (Object::release): Likewise.
5931 (Object::is_incremental): New function.
5932 (Object::get_mtime): New function.
5933 (Object::for_all_local_got_entries): New function.
5934 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5935 (Object::set_is_in_system_directory): New function.
5936 (Object::is_in_system_directory): New function.
5937 (Object::do_is_incremental): New function.
5938 (Object::do_get_mtime): New function.
5939 (Object::do_for_all_local_got_entries): New function.
5940 (Object::is_in_system_directory_): New data member.
5941 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5942 (class Sized_relobj_base): New class.
5943 (class Sized_relobj): Derive from Sized_relobj_base.
5944 (class Sized_relobj::Symbols): Redeclare from base class.
5945 (class Sized_relobj::local_got_offset_list): Remove.
5946 (class Sized_relobj::Output_sections): Redeclare from base class.
5947 (class Sized_relobj::do_for_all_local_got_entries): New function.
5948 (class Sized_relobj::write_local_symbols): Add offset parameter.
5949 (class Sized_relobj::local_symbol_offset_): Update comment.
5950 (class Sized_relobj::local_dynsym_offset_): Update comment.
5951 * options.cc (Input_arguments::add_file): Remove const.
5952 * options.h (Input_file_argument::Input_file_argument):
5953 Initialize arg_serial_ (all constructors).
5954 (Input_file_argument::set_arg_serial): New function.
5955 (Input_file_argument::arg_serial): New function.
5956 (Input_file_argument::arg_serial_): New data member.
5957 (Input_arguments::Input_arguments): Initialize file_count_.
5958 (Input_arguments::add_file): Remove const.
5959 (Input_arguments::number_of_input_files): New function.
5960 (Input_arguments::file_count_): New data member.
5961 (Command_line::number_of_input_files): Call
5962 Input_arguments::number_of_input_files.
5963 * output.cc (Output_segment_headers::Output_segment_headers):
5965 (Output_section::Input_section::current_data_size): New function.
5966 (Output_section::Output_section): Initialize new data members.
5967 (Output_section::add_input_section): Don't do merge sections for
5968 an incremental link; allocate space from free list for an
5970 (Output_section::add_output_section_data): Allocate space from
5971 free list for an incremental update.
5972 (Output_section::update_data_size): New function.
5973 (Output_section::set_fixed_layout): New function.
5974 (Output_section::reserve): New function.
5975 (Output_segment::set_section_addresses): Remove const.
5976 (Output_segment::set_section_list_addresses): Remove const; allocate
5977 space from free list for an incremental update.
5978 (Output_segment::set_offset): Adjust size of RELRO segment for an
5980 * output.h (Output_data::current_data_size): Move here from
5982 (Output_data::pre_finalize_data_size): New function.
5983 (Output_data::update_data_size): New function.
5984 (Output_section_headers::update_data_size): new function.
5985 (Output_section_data_build::current_data_size): Move to Output_data.
5986 (Output_data_strtab::update_data_size): New function.
5987 (Output_section::current_data_size): Move to Output_data.
5988 (Output_section::set_fixed_layout): New function.
5989 (Output_section::has_fixed_layout): New function.
5990 (Output_section::reserve): New function.
5991 (Output_section::update_data_size): New function.
5992 (Output_section::has_fixed_layout_): New data member.
5993 (Output_section::free_list_): New data member.
5994 (Output_segment::set_section_addresses): Remove const.
5995 (Output_segment::set_section_list_addresses): Remove const.
5996 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5998 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6000 * readsyms.cc (Read_symbols::do_read_symbols): Add library
6001 parameter when calling Add_symbols constructor; store argument
6002 serial number for members of a lib group.
6003 (Add_symbols::locks): Allow case where token == NULL.
6004 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6005 (Read_member::~Read_member): New function.
6006 (Read_member::is_runnable): New function.
6007 (Read_member::locks): New function.
6008 (Read_member::run): New function.
6009 (Check_script::~Check_script): New function.
6010 (Check_script::is_runnable): New function.
6011 (Check_script::locks): New function.
6012 (Check_script::run): New function.
6013 (Check_library::~Check_library): New function.
6014 (Check_library::is_runnable): New function.
6015 (Check_library::locks): New function.
6016 (Check_library::run): New function.
6017 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6018 (Add_symbols::library_): New data member.
6019 (class Read_member): New class.
6020 (class Check_script): New class.
6021 (class Check_library): New class.
6022 * reloc.cc (Read_relocs::is_runnable): Allow case where
6024 (Read_relocs::locks): Likewise.
6025 (Scan_relocs::locks): Likewise.
6026 (Relocate_task::locks): Likewise.
6027 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6029 (Sized_relobj::incremental_relocs_scan): Fix comment.
6030 (Sized_relobj::do_relocate): Pass output file offset to
6031 write_local_symbols.
6032 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6033 from class declaration.
6034 * script.cc (read_input_script): Allocate Script_info; pass
6035 argument serial number to report_script.
6036 * script.h (class Script_info): Move to incremental.h.
6037 * symtab.cc (Symbol_table::add_from_incrobj): New function.
6038 * symtab.h (Symbol_table::add_from_incrobj): New function.
6039 (Symbol_table::set_file_offset): New function.
6041 2011-04-05 Cary Coutant <ccoutant@google.com>
6043 * incremental-dump.cc (dump_incremental_inputs): Change signature
6044 to take a Sized_incremental_binary; change caller. Use readers
6045 in Sized_incremental_binary.
6047 (Sized_incremental_binary::find_incremental_inputs_sections):
6048 Rename do_find_incremental_inputs_sections to this.
6049 (Sized_incremental_binary::setup_readers): New function.
6050 (Sized_incremental_binary::do_check_inputs): Check
6051 has_incremental_info_ flag; move setup code to setup_readers;
6053 (Sized_incremental_binary::do_file_is_unchanged): New function.
6054 (Sized_incremental_binary::do_get_input_reader): New function.
6055 * incremental.h (class Incremental_binary): Move to end of file.
6056 (Incremental_binary::file_is_unchanged): New function.
6057 (Incremental_binary::do_file_is_unchanged): New function.
6058 (Incremental_binary::Input_reader): New class.
6059 (Incremental_binary::get_input_reader): New function.
6060 (class Sized_incremental_binary): Move to end of file.
6061 (Sized_incremental_binary::Sized_incremental_binary): Setup the
6062 input section reader classes.
6063 (Sized_incremental_binary::has_incremental_info): New function.
6064 (Sized_incremental_binary::inputs_reader): New function.
6065 (Sized_incremental_binary::symtab_reader): New function.
6066 (Sized_incremental_binary::relocs_reader): New function.
6067 (Sized_incremental_binary::got_plt_reader): New function.
6068 (Sized_incremental_binary::do_file_is_unchanged): New function.
6069 (Sized_incremental_binary::Sized_input_reader): New class.
6070 (Sized_incremental_binary::get_input_reader): New function.
6071 (Sized_incremental_binary::find_incremental_inputs_sections):
6072 Rename do_find_incremental_inputs_sections to this.
6073 (Sized_incremental_binary::setup_readers): New function.
6074 (Sized_incremental_binary::has_incremental_info_): New data member.
6075 (Sized_incremental_binary::inputs_reader_): New data member.
6076 (Sized_incremental_binary::symtab_reader_): New data member.
6077 (Sized_incremental_binary::relocs_reader_): New data member.
6078 (Sized_incremental_binary::got_plt_reader_): New data member.
6079 (Sized_incremental_binary::current_input_file_): New data member.
6081 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6084 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6087 2011-03-30 Cary Coutant <ccoutant@google.com>
6089 * archive.cc (Archive::include_member): Adjust call to report_object.
6090 (Add_archive_symbols::run): Add script_info to call to
6091 report_archive_begin.
6092 (Lib_group::include_member): Adjust call to report_object.
6093 (Add_lib_group_symbols::run): Adjust call to report_object.
6094 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6095 blocks. Add object count for script input files.
6096 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6097 script_info parameter; change all callers.
6098 (Incremental_inputs::report_object): Add script_info parameter;
6100 (Incremental_inputs::report_script): Store backpointer to
6101 incremental info entry.
6102 (Output_section_incremental_inputs::set_final_data_size): Record
6103 additional information for scripts.
6104 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6105 * incremental.h (Incremental_script_entry::add_object): New function.
6106 (Incremental_script_entry::get_object_count): New function.
6107 (Incremental_script_entry::get_object): New function.
6108 (Incremental_script_entry::objects_): New data member; adjust
6110 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6111 (Incremental_inputs::report_object): Add script_info parameter.
6112 (Incremental_inputs_reader::get_object_count): New function.
6113 (Incremental_inputs_reader::get_object_offset): New function.
6114 * options.cc (Input_arguments::add_file): Return reference to
6116 * options.h (Input_argument::set_script_info): New function.
6117 (Input_argument::script_info): New function.
6118 (Input_argument::script_info_): New data member; adjust all
6120 (Input_file_group::add_file): Return reference to new input argument.
6121 (Input_file_lib::add_file): Likewise.
6122 (Input_arguments::add_file): Likewise.
6123 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6124 * script.cc (Parser_closure::Parser_closure): Add script_info
6125 parameter; adjust all callers.
6126 (Parser_closure::script_info): New function.
6127 (Parser_closure::script_info_): New data member.
6128 (read_input_script): Report scripts earlier to incremental info.
6129 (script_add_file): Set script_info in Input_argument.
6130 (script_add_library): Likewise.
6131 * script.h (Script_options::Script_info): Rewrite class.
6133 2011-03-29 Cary Coutant <ccoutant@google.com>
6135 * archive.cc (Library_base::should_include_member): Move
6136 method here from class Archive.
6137 (Archive::Archive): Initialize base class.
6138 (Archive::should_include_member): Move to base class.
6139 (Archive::do_for_all_unused_symbols): New function.
6140 (Add_archive_symbols::run): Remove redundant access to
6142 (Lib_group::Lib_group): Initialize base class.
6143 (Lib_group::do_filename): New function.
6144 (Lib_group::include_member): Pass pointer to Lib_group to
6146 (Lib_group::do_for_all_unused_symbols): New function.
6147 (Add_lib_group_symbols::run): Report archive information for
6149 * archive.h (class Library_base): New base class.
6150 (class Archive): Derive from Library_base.
6151 (Archive::filename): Move to base class.
6152 (Archive::set_incremental_info): Likewise.
6153 (Archive::incremental_info): Likewise.
6154 (Archive::Should_include): Likewise.
6155 (Archive::should_include_member): Likewise.
6156 (Archive::Armap_entry): Remove.
6157 (Archive::Unused_symbol_iterator): Remove.
6158 (Archive::unused_symbols_begin): Remove.
6159 (Archive::unused_symbols_end): Remove.
6160 (Archive::do_filename): New function.
6161 (Archive::do_get_mtime): New function.
6162 (Archive::do_for_all_unused_symbols): New function.
6163 (Archive::task_): Move to base class.
6164 (Archive::incremental_info_): Likewise.
6165 (class Lib_group): Derive from Library_base.
6166 (Lib_group::do_filename): New function.
6167 (Lib_group::do_get_mtime): New function.
6168 (Lib_group::do_for_all_unused_symbols): New function.
6169 (Lib_group::task_): Move to base class.
6170 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6172 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6174 * incremental.cc (Incremental_inputs::report_archive_begin):
6175 Use Library_base; call library's get_mtime; add incremental inputs
6176 entry before members.
6177 (class Unused_symbol_visitor): New class.
6178 (Incremental_inputs::report_archive_end): Use Library_base; use
6179 visitor class to record unused symbols; don't add incremental inputs
6180 entry after members.
6181 (Incremental_inputs::report_object): Use Library_base.
6183 (Incremental_archive_entry::Incremental_archive_entry): Remove
6184 unused Archive parameter.
6185 (Incremental_inputs::report_archive_begin): Use Library_base.
6186 (Incremental_inputs::report_archive_end): Likewise.
6187 (Incremental_inputs::report_object): Likewise.
6188 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6190 * object.h (Object::for_all_global_symbols): New function.
6191 (Object::do_for_all_global_symbols): New function.
6192 (Sized_relobj::do_for_all_global_symbols): New function.
6193 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6195 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6198 2011-03-27 Ian Lance Taylor <iant@google.com>
6200 * archive.cc (Archive::interpret_header): Return -1 if something
6201 goes wrong. Change callers accordingly.
6203 2011-03-25 Cary Coutant <ccoutant@google.com>
6205 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6206 * testsuite/Makefile.in: Regenerate.
6208 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6210 * plugin.cc (get_view): New.
6211 (Plugin::load): Pass get_view to the plugin.
6212 (Plugin_manager::get_view): New.
6214 2011-03-21 Ian Lance Taylor <iant@google.com>
6216 * testsuite/final_layout.sh: Rewrite to not use dc.
6217 * testsuite/relro_test.sh: Fail if dc is not present.
6219 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6221 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6223 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6224 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6226 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6227 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6229 2011-03-14 Ian Lance Taylor <iant@google.com>
6231 * script-sections.cc (Sort_output_sections::script_compare):
6232 Rename from is_before, change return type.
6233 (Sort_output_sections::operator()): Adjust accordingly.
6235 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6238 * testsuite/odr_violation2.cc: Add comment to make all error line
6239 numbers double digits.
6240 * testsuite/debug_msg.sh: Adjust expected errors.
6242 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6244 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6245 but mark earlier ones as non-canonical
6246 (offset_to_iterator): Update search target and example
6247 (do_addr2line): Return extra lines in a vector*
6248 (format_file_lineno): Extract from do_addr2line
6249 (one_addr2line): Add vector* out-param
6250 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6251 when a lineno entry appeared last for its instruction
6252 (Dwarf_line_info): Add vector* out-param
6253 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6254 * symtab.cc (Odr_violation_compare): Include the lineno in the
6256 (linenos_from_loc): New. Combine the canonical line for an
6257 address with its other lines.
6258 (True_if_intersect): New. Helper functor to make
6259 std::set_intersection a query.
6260 (detect_odr_violations): Compare sets of lines instead of just
6261 one line for each function. This became less deterministic, but
6262 has fewer false positives.
6263 * symtab.h: Declarations.
6264 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6265 mix an optimized and non-optimized object in the same binary
6266 (odr_violation2.so): Same.
6267 * testsuite/Makefile.in: Regenerate from Makefile.am.
6268 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6269 * testsuite/debug_msg.sh: Update line numbers and add
6271 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6272 non-optimized context.
6273 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6274 isn't inlined, and use OdrDerived in an optimized context.
6275 * testsuite/odr_header1.h: Defines OdrDerived, where
6276 optimization will change the
6277 first-instruction-in-the-destructor's file and line number.
6278 * testsuite/odr_header2.h: Defines OdrBase.
6280 2011-03-09 Ian Lance Taylor <iant@google.com>
6282 * fileread.cc (File_read::clear_views): Don't delete the whole
6285 2011-03-08 Ian Lance Taylor <iant@google.com>
6288 * fileread.cc: #include <climits>.
6289 (GOLD_IOV_MAX): Define.
6290 (File_read::read_multiple): Limit number of entries by iov_max.
6291 * fileread.h (class File_read): Always set max_readv_entries to
6294 2011-03-07 Ian Lance Taylor <iant@google.com>
6297 * options.h (class General_options): Add -dy and -dn.
6299 2011-03-02 Cary Coutant <ccoutant@google.com>
6301 * testsuite/script_test_9.t: Add TLS segment.
6303 2011-03-02 Simon Baldwin <simonb@google.com>
6305 * configure.ac: Add check for gnu_indirect_function support in
6306 the toolchain building binutils.
6307 * configure: Rebuild.
6309 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6311 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6312 plugin only symbols.
6313 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6314 in plugin files as not needed in the symbol table.
6316 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6318 * output.cc (Output_section::add_input_section): Delay fill
6319 generation for section ordering.
6321 2011-02-09 Ian Lance Taylor <iant@google.com>
6324 * object.h (class Sized_relobj): Remove clear_local_symbols.
6325 * reloc.cc (Sized_relobj::do_relocate): Don't call
6326 clear_local_symbols.
6328 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6330 * plugin.cc (is_visible_from_outside): Return true for symbols
6333 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6335 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6338 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6340 * icf.h (is_section_foldable_candidate): Change type of parameter
6342 * icf.cc (Icf::find_identical_sections): Change type of local variable
6343 section_name to be std::string.
6344 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6346 2011-01-25 Ian Lance Taylor <iant@google.com>
6348 * script.cc (script_add_extern): Rewrite to use
6349 add_symbol_reference.
6351 2011-01-25 Doug Kwan <dougkwan@google.com>
6353 * icf.cc (get_section_contents): Always lock section's object.
6355 2011-01-24 Ian Lance Taylor <iant@google.com>
6357 * options.h (class General_options): Accept
6358 --no-detect-odr-violations.
6360 2011-01-24 Ian Lance Taylor <iant@google.com>
6362 * version.cc (version_string): Bump to 1.11.
6364 2011-01-24 Ian Lance Taylor <iant@google.com>
6366 * plugin.cc (class Plugin_rescan): Define new class.
6367 (Plugin_manager::claim_file): Set any_claimed_.
6368 (Plugin_manager::save_archive): New function.
6369 (Plugin_manager::save_input_group): New function.
6370 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6372 (Plugin_manager::new_undefined_symbol): New function.
6373 (Plugin_manager::rescan): New function.
6374 (Plugin_manager::rescannable_defines): New function.
6375 (Plugin_manager::add_input_file): Set any_added_.
6376 * plugin.h (class Plugin_manager): define new fields rescannable_,
6377 undefined_symbols_, any_claimed_, and any_added_. Declare
6378 Plugin_rescan as friend. Declare new functions.
6379 (Plugin_manager::Rescannable): Define type.
6380 (Plugin_manager::Rescannable_list): Define type.
6381 (Plugin_manager::Undefined_symbol_list): Define type.
6382 (Plugin_manager::Plugin_manager): Initialize new fields.
6383 * archive.cc (Archive::defines_symbol): New function.
6384 (Add_archive_symbols::run): Pass archive to plugins if any.
6385 * archive.h (class Archive): Declare defines_symbol.
6386 * readsyms.cc (Input_group::~Input_group): New function.
6387 (Finish_group::run): Pass input_group to plugins if any.
6388 * readsyms.h (class Input_group): Declare destructor.
6389 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6392 2011-01-10 Ian Lance Taylor <iant@google.com>
6394 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6396 (Layout::set_segment_offsets): Reset increase_relro before calling
6397 set_section_addresses a second time.
6399 2011-01-04 Cary Coutant <ccoutant@google.com>
6401 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6402 sections before NOBITS sections.
6404 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6406 * version.cc (print_version): Update copyright to 2011.
6408 2010-12-23 Cary Coutant <ccoutant@google.com>
6410 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6411 of OS to this->add. Add OD parameter to second form of the function.
6413 2010-12-20 Ian Lance Taylor <iant@google.com>
6415 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6416 second of two consecutive entries with same offset.
6418 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6420 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6421 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6422 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6423 to avoid unneeded links against $(LDADD).
6424 * testsuite/Makefile.in: Regenerate.
6426 2010-12-15 Ian Lance Taylor <iant@google.com>
6429 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6430 for R_X86_64_32 and R_X86_64_PC32.
6431 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6432 ver_matching_def_pic.o.
6433 (ver_matching_def_pic.o): New target.
6435 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6437 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6438 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6439 Move definition before File_read::View member definitions.
6440 (File_read::View::~View): Initialize and hold lock before
6441 updating current_mapped_bytes.
6443 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6445 * dwarf_reader.cc: Remove outdated comment.
6446 * gold-threads.cc: Fix typo in error message.
6447 * archive.cc: Fix typos in comments.
6448 * archive.h: Likewise.
6449 * arm-reloc-property.cc: Likewise.
6450 * arm-reloc-property.h: Likewise.
6451 * arm-reloc.def: Likewise.
6453 * attributes.h: Likewise.
6454 * cref.cc: Likewise.
6455 * ehframe.cc: Likewise.
6456 * fileread.h: Likewise.
6458 * i386.cc: Likewise.
6460 * incremental.h: Likewise.
6461 * int_encoding.cc: Likewise.
6462 * layout.h: Likewise.
6463 * main.cc: Likewise.
6464 * merge.h: Likewise.
6465 * object.cc: Likewise.
6466 * object.h: Likewise.
6467 * options.cc: Likewise.
6468 * readsyms.cc: Likewise.
6469 * reduced_debug_output.cc: Likewise.
6470 * reloc.cc: Likewise.
6471 * script-sections.cc: Likewise.
6472 * sparc.cc: Likewise.
6473 * symtab.h: Likewise.
6474 * target-reloc.h: Likewise.
6475 * target.cc: Likewise.
6476 * target.h: Likewise.
6477 * timer.cc: Likewise.
6478 * timer.h: Likewise.
6479 * x86_64.cc: Likewise.
6481 2010-12-09 Cary Coutant <ccoutant@google.com>
6483 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6485 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6486 parameter; change all callers.
6487 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6488 * options.h (warn_execstack): New option.
6490 2010-12-07 Doug Kwan <dougkwan@google.com>
6492 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6493 like function call relocations.
6495 2010-12-07 Ian Lance Taylor <iant@google.com>
6497 * archive.cc (Archive::get_elf_object_for_member): Permit
6498 punconfigured to be NULL.
6499 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6500 (Archive::include_member): Pass NULL to get_elf_object_for_member
6501 if we searched for the archive and this is the first included
6504 2010-12-01 Ian Lance Taylor <iant@google.com>
6506 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6507 track_relocs_type_ field.
6508 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6509 Set track_relocs_type_.
6510 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6511 contents when using RELA relocs.
6512 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6514 * reloc.cc (Track_relocs::next_addend): New function.
6515 * reloc.h (class Track_relocs): Declare next_addend.
6517 2010-12-01 Ian Lance Taylor <iant@google.com>
6519 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6522 2010-12-01 Ian Lance Taylor <iant@google.com>
6524 * README: Update compilers known to work and fail.
6526 2010-11-23 Matthias Klose <doko@ubuntu.com>
6528 * configure.in: For --enable-gold, handle value `default' instead of
6529 `both*'. Always install ld as ld.bfd, install as ld if gold is
6531 * configure: Regenerate.
6533 2010-11-18 Doug Kwan <dougkwan@google.com>
6535 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6536 and right_alignment to be zero. Store result alignment only if it is
6537 greater than existing alignment.
6539 2010-11-16 Cary Coutant <ccoutant@google.com>
6542 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6543 Check for ".zdebug_line".
6545 2010-11-16 Doug Kwan <dougkwan@google.com>
6546 Cary Coutant <ccoutant@google.com>
6548 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6549 by reference; adjust all callers.
6550 * output.cc (Output_segment::set_section_addresses): Adjust references
6551 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6553 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6554 end at page boundary.
6556 2010-11-16 Cary Coutant <ccoutant@google.com>
6559 * layout.cc (Layout::choose_output_section): Transform names of
6560 compressed sections even when using a script with a SECTIONS clause.
6561 (Layout::output_section_name): Remove code to transform
6562 compressed debug section names.
6563 * output.cc (Output_section::add_input_section): Use uncompressed
6564 section size when tracking input sections.
6566 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6568 * symtab.h (Symbol::NON_PIC_REF): Remove.
6569 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6570 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6571 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6572 (Symbol::use_plt_offset): Take a flags argument and pass it
6573 directly to needs_dynamic_reloc. Restrict check for undefined
6574 weak symbols to function calls.
6575 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6576 (Target_arm::Scan::global): Use it.
6577 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6578 (Target_arm::Relocate::relocate): Likewise.
6579 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6580 parameter with an r_type parameter. Use get_reference_flags
6582 (Target_arm::Relocate::relocate): Update accordingly.
6583 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6584 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6585 (Target_i386::Scan::global): Likewise.
6586 (Target_i386::Relocate::relocate): Likewise.
6587 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6588 parameter with an r_type parameter. Use get_reference_flags
6590 (Target_i386::Relocate::relocate): Update accordingly.
6591 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6592 (Target_powerpc::Scan::global): Use it.
6593 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6594 (Target_powerpc::Relocate::relocate): Likewise.
6595 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6596 (Target_sparc::Scan::global): Use it.
6597 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6598 (Target_sparc::Relocate::relocate): Likewise.
6599 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6600 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6601 (Target_x86_64::Scan::global): Likewise.
6602 (Target_x86_64::Relocate::relocate): Likewise.
6604 2010-11-08 Doug Kwan <dougkwan@google.com>
6605 Cary Coutant <ccoutant@google.com>
6607 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6608 (Arm_exidx_merge_section::section_contents_): New data member.
6609 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6610 (Arm_input_section::~Arm_input_section): De-allocate memory.
6611 (Arm_input_section::original_contents_): New data member.
6612 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6613 in parameters instead of calling Object::section_contents without
6615 (Arm_output_section::group_section): New parameter TASK. Pass it
6616 to callees that need locking objects.
6617 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6618 to lock EXIDX input sections. Fix a formatting issue. Call
6619 Arm_exidx_merged_section::build_contents to create merged section
6621 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6622 to lock object of stub table owner.
6623 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6624 TEXT_SIZE to initialize data member TEXT_SIZE_.
6625 (Arm_exidx_input_section::addralign): Fix typo in comment.
6626 (Arm_exidx_input_section::text_size): New method.
6627 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6628 that require locking objects. Lock objects before scanning for stubs
6629 and updating local symbols.
6630 (Arm_input_section<big_endian>::init): Copy contents of original
6632 (Arm_input_section<big_endian>::do_write): Use saved contents of
6633 original input section instead of calling Object::section_contents
6635 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6636 size without calling Object::section_size().
6637 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6638 for size. Allocate a buffer for merged EXIDX entries.
6639 (Arm_exidx_merged_section::build_contents): New method.
6640 (Arm_exidx_merged_section::do_write): Move merge section contents
6641 building code to Arm_exidx_merged_section::build_contetns. Write
6642 out contetns in buffer instead of building it on the fly.
6643 (Arm_relobj::make_exidx_input_section): Also pass text section size
6644 to Arm_exidx_input_section constructor.
6645 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6646 (Arm_dynobj::do_read_symbols): Fix memory leak.
6647 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6648 * target.h: (class Task): Add forward declaration.
6649 (Target::relax): Add new parameter TASK and pass it to
6651 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6653 2010-11-05 Cary Coutant <ccoutant@google.com>
6656 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6657 object when reading from the file.
6658 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6660 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6661 when reading section contents.
6662 (get_section_contents): Likewise.
6663 (icf::find_identical_sections): Likewise.
6664 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6665 object when reading from the file.
6666 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6667 the object when doing deferred section layout.
6669 2010-11-03 Nick Clifton <nickc@redhat.com>
6672 * script.h (class Symbol_assignment: name): New member. Returns
6673 the name of the symbol.
6674 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6675 Returns true if the given symbol name is on the list of
6676 assignments wating to be processed.
6677 * archive.cc (should_incldue_member): If the symbol is undefined,
6678 check to see if it is on the list of symbols pending assignment.
6680 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6682 * script-sections.cc (Script_sections::find_memory_region): Check
6683 for a NULL output section pointer.
6685 2010-10-29 Doug Kwan <dougkwan@google.com>
6687 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6688 Output_section::add_relaxed_input_section.
6689 * output.cc (Output_section::add_relaxed_input_section): Add new
6690 arguments LAYOUT and NAME. Set section order index.
6691 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6692 Copy section order index.
6693 * output.h (Output_section::add_relaxed_input_section): Add new
6694 arguments LAYOUT and NAME.
6696 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6698 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6699 NATIVE_OR_CROSS_LINKER.
6700 * testsuite/Makefile.in: Regenerate.
6702 2010-10-20 Doug Kwan <dougkwan@google.com>
6704 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6705 without SHF_LINK_ORDER flags.
6706 * layout.cc (Layout::choose_output_section): Do not filter
6707 SHF_LINK_ORDER flag in a relocatable link.
6709 2010-10-17 Cary Coutant <ccoutant@google.com>
6711 * output.h (Output_segment::set_section_addresses): Change function
6712 signature. Update all callers.
6713 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6715 (Output_segment::set_section_addresses): Align after last TLS
6716 section. Add padding before last relro section instead of after.
6718 2010-10-17 Doug Kwan <dougkwan@google.com>
6720 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6721 GOT output section to be writable.
6723 2010-10-14 Cary Coutant <ccoutant@google.com>
6725 * debug.h (DEBUG_INCREMENTAL): New flag.
6726 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6727 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6729 * incremental.cc (report_command_line): Ignore all forms of
6731 * layout.cc (Layout::Layout): Check parameters for incremental link
6733 * options.cc (General_options::parse_incremental): New function.
6734 (General_options::parse_no_incremental): New function.
6735 (General_options::parse_incremental_full): New function.
6736 (General_options::parse_incremental_update): New function.
6737 (General_options::incremental_mode_): New data member.
6738 (General_options::finalize): Check incremental_mode_.
6739 * options.h (General_options): Update help text for --incremental.
6740 Add --no-incremental, --incremental-full, --incremental-update.
6741 (General_options::Incremental_mode): New enum type.
6742 (General_options::incremental_mode): New function.
6743 (General_options::incremental_mode_): New data member.
6744 * parameters.cc (Parameters::incremental_mode_): New data member.
6745 (Parameters::set_options): Set incremental_mode_.
6746 (Parameters::set_incremental_full): New function.
6747 (Parameters::incremental): New function.
6748 (Parameters::incremental_update): New function.
6749 (set_parameters_incremental_full): New function.
6750 * parameters.h (Parameters::set_incremental_full): New function.
6751 (Parameters::incremental): New function.
6752 (Parameters::incremental_update): New function.
6753 (Parameters::incremental_mode_): New data member.
6754 (set_parameters_incremental_full): New function.
6755 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6756 incremental link mode.
6757 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6758 (Sized_relobj::do_relocate_sections): Likewise.
6759 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6761 * testsuite/Makefile.in: Regenerate.
6762 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6764 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6766 * script-sections.h (class Script_sections): Make
6767 Sections_elements typedef public.
6768 * script-sections.cc (class Sort_output_sections): Add elements_
6769 field. Add constructor which sets it; change all callers.
6770 (Sort_output_sections::is_before): New function.
6771 (Sort_output_sections::operator()): Call is_before.
6772 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6774 * testsuite/script_test_10.sh: New test. Test script section
6776 * testsuite/script_test_10.t: Likewise.
6777 * testsuite/script_test_10.s: Likewise.
6778 * testsuite/Makefile.am: Wrap the cross linker tests and the
6779 common tests into NATIVE_OR_CROSS_LINKER.
6780 (check_SCRIPTS): Add script_test_10.sh.
6781 (check_DATA): Add script_test_10.stdout.
6782 (script_test_10.o, script_test_10): New targets.
6783 (script_test_10.stdout): New target.
6784 * configure, testsuite/Makefile.in: Regenerate.
6786 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6788 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6789 error for the deprecated relocations.
6790 (Target_arm::Scan::global): Likewise.
6791 (Target_arm::Relocate::relocate): Likewise.
6793 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6795 * fileread.cc (Input_file::find_file): Initialize *found_name
6796 and *namep when using the fallback search for case 4.
6798 2010-10-11 Cary Coutant <ccoutant@google.com>
6800 * options.h (class General_options): Redefine -z lazy as an alias for
6801 the negation of -z now.
6803 2010-10-11 Ian Lance Taylor <iant@google.com>
6805 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6808 2010-10-06 Nick Clifton <nickc@redhat.com>
6810 * script-sections.cc(class Memory_region): Remove
6811 current_lma_offset_ field. Rename current_vma_offset_ to
6812 current_offset_. Add last_section_ field.
6813 (Memory_region::get_current_vma_address): Rename to
6814 get_current_address.
6815 (Memory_region::get_current_lma_address): Delete.
6816 (Memory_region::increment_vma_offset): Rename to
6818 (Memory_region::increment_lma_offset): Delete.
6819 (Memory_region::attributes_compatible): New method. Returns
6820 true if the provided section is compatible with the region.
6821 (Memory_region::get_last_section): New method. Returns the last
6822 section to use the region.
6823 (Memory_region::set_last_section): New method. Stores the last
6824 section to use the region.
6825 (Script_sections::block_in_region): New method. Returns true if
6826 a block of memory is contained within a region.
6827 (Script_sections::find_memory_region): New method. Locates a
6828 memory region to be used to set a VMA or LMA address.
6829 (Output_section_definition::set_section_addresses): Add code to
6830 check for addresses set by memory regions.
6831 (Output_segment::set_section_addresses): Remove memory region
6833 (Script_sections::create_segment): Add a warning if a header
6834 segment is created outside of any region.
6835 * script-sections.h (class Script_sections): Add prototypes for
6836 find_memory_region and block_in_region methods.
6837 * testsuite/memory_test.s: Use .long instead of .word.
6838 * testsuite/memory_test.t: Add some more output sections.
6839 * testsuite/memory_test.sh: Update expected output.
6841 2010-10-02 Doug Kwan <dougkwan@google.com>
6843 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6844 defintion to symtab.h
6845 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6846 declaration to defintion.
6848 2010-10-01 Nick Clifton <nickc@redhat.com>
6850 * expression.cc (eval): Replace dummy argument with NULL.
6851 (eval_maybe_dot): Check for a NULL result section pointer.
6852 (Symbol_expression::value): Likewise.
6853 (Dot_expression::value): Likewise.
6854 (BINARY_EXPRESSION): Likewise.
6855 (Max_expression::value): Likewise.
6856 (Min_expression::value): Likewise.
6857 (Absolute_expression::value): Likewise.
6858 (Addr_expression::value_from_output_section): Likewise.
6859 (Loaddddr_expression::value_from_output_section): Likewise.
6860 (Segment_start_expression::value): Likewise.
6861 * script-sections.cc
6862 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6864 (Sections_elememt_dot_assignment::set_section_addresses):
6866 (Output_data_expression::do_write_to_buffer): Likewise.
6867 (Output_section_definition::finalize_symbols): Likewise.
6868 (Output_section_definition::set_section_addresses): Likewise.
6870 2010-09-30 Doug Kwan <dougkwan@google.com>
6872 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6874 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6876 * target.h (Target::can_icf_inline_merge_sections): New virtual
6878 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6880 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6882 * icf.cc (get_section_contents): Inline merge sections only when
6885 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6887 * configure: Regenerate.
6889 2010-09-17 Ian Lance Taylor <iant@google.com>
6891 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6892 * testsuite/Makefile.am (memory_test.o): New target.
6893 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6895 * testsuite/Makefile.in: Rebuild.
6897 2010-09-17 Doug Kwan <dougkwan@google.com>
6899 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6900 defintion if relocation uses GOT entries of the symbol.
6901 * testsuite/icf_safe_test.sh: Fix test.
6902 * testsuite/icf_safe_so_test.sh: Fix test.
6904 2010-09-16 Cary Coutant <ccoutant@google.com>
6906 * script_sections.cc (class Memory_region): Remove "NULL" from
6907 vector initializations.
6909 2010-09-15 Cary Coutant <ccoutant@google.com>
6911 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6912 Resolve forwarding symbols.
6914 2010-09-15 Doug Kwan <dougkwan@google.com>
6916 * gold/testsuite/script_test_3.t: Add ARM special sections.
6917 * gold/testsuite/script_test_4.t: Same.
6918 * gold/testsuite/script_test_5.t: Same.
6919 * gold/testsuite/script_test_6.t: Same.
6920 * gold/testsuite/script_test_7.t: Same.
6921 * gold/testsuite/script_test_7.t: Same.
6922 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6924 2010-09-14 Cary Coutant <ccoutant@google.com>
6926 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6927 (Target_x86_64::Relocate::relocate_tls): Replace check for
6928 saw_tls_block_reloc_ with test for executable section.
6930 2010-09-12 Cary Coutant <ccoutant@google.com>
6932 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6933 position-independent executables to shared libraries need dynamic
6935 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6936 position-independent executables.
6937 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6938 * testsuite/Makefile.in: Regenerate.
6940 2010-09-10 Nick Clifton <nickc@redhat.com>
6943 * testsuite/memory_test.t: Discard any sections that are not
6946 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6949 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6950 "This::" to work around a bug in gcc 4.2.
6952 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6954 2010-09-09 Rafael Espindola <espindola@google.com>
6956 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6957 sections with different PF_X flags in the same segment.
6958 (Layout::find_first_load_seg): Search all segments to find the first
6960 * options.h (rosegment): New.
6962 2010-09-08 Rafael Espindola <espindola@google.com>
6964 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6966 2010-09-08 Doug Kwan <dougkwan@google.com>
6968 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6969 (Arm_relobj::do_relocate_sections): Add new parameter for output
6970 file to match the parent.
6971 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6972 of local symbols instead of input values. Update code to track
6973 changes in gold::relocate_section.
6974 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6975 (Sized_relobj::compute_final_local_value_internal): New methods.
6976 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6977 body into private version of Sized_relobj::compute_final_local_value.
6978 Call the inline method.
6979 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6980 merged symbol value if there is one.
6981 (Symbol_value::has_output_value): New method defintiion.
6982 (Sized_relobj::Compute_final_local_value_status): New enum type.
6983 (Sized_relobj::compute_final_local_value): New methods.
6984 (Sized_relobj::compute_final_local_value_internal): New methods.
6985 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6986 and arm_cortex_a8.sh.
6987 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6988 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6990 * Makefile.in: Regenerate.
6991 * testsuite/arm_bl_out_of_range.s: Update test.
6992 * testsuite/thumb_bl_out_of_range.s: Ditto.
6993 * testsuite/thumb_blx_out_of_range.s: Ditto.
6994 * testsuite/arm_branch_out_of_range.sh: New file.
6995 * testsuite/arm_cortex_a8.sh: Ditto.
6996 * testsuite/arm_cortex_a8_b.s: Ditto.
6997 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6998 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6999 * testsuite/arm_cortex_a8_bl.s: Ditto.
7000 * testsuite/arm_cortex_a8_blx.s: Ditto.
7001 * testsuite/arm_cortex_a8_local.s: Ditto.
7002 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7003 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7005 2010-09-08 Rafael Espindola <espindola@google.com>
7007 * Makefile.am (memory_test.stdout): Run readelf with -W.
7008 * Makefile.in: Regenerate.
7009 * testsuite/memory_test.sh: Make the regexps accept both 32 and
7012 2010-09-08 Rafael Espindola <espindola@google.com>
7014 * script-sections.cc (Script_sections::add_memory_region): Convert
7015 field precision to int.
7016 * script.cc (script_set_section_region, script_set_section_region):
7017 Convert field precision to int.
7019 2010-09-08 Rafael Espindola <espindola@google.com>
7021 * arm.cc (do_finalize_sections): Create the __exidx_start and
7022 __exdix_end symbols even when the section is missing.
7024 2010-09-08 Nick Clifton <nickc@redhat.com>
7026 * README: Remove claim that MEMORY is not supported.
7027 * expression.cc (script_exp_function_origin)
7028 (script_exp_function_length): Move from here to ...
7029 * script.cc: ... here.
7030 (script_set_section_region, script_add_memory)
7031 (script_parse_memory_attr, script_include_directive): New
7033 * script-sections.cc
7034 (class Memory_region): New class.
7035 (class Output_section_definition): Add set_memory_region,
7036 set_section_vma, set_section_lma and get_section_name methods.
7037 (class Script_Sections): Add add_memory_region,
7038 find_memory_region, find_memory_region_origin,
7039 find_memory_region_length and set_memory_region methods.
7040 Have set_section_addresses method walk the list of set memory
7042 Extend the print methos to display memory regions.
7043 * script-sections.h: Add prototypes for new methods.
7044 Add enum for MEMORY region attributes.
7045 * yyscript.y: Add support for parsing MEMORY regions.
7046 * script-c.h: Add prototypes for new functions.
7047 * testsuite/Makefile.am: Add test of MEMORY region functionality.
7048 * testsuite/Makefile.in: Regenerate.
7049 * testsuite/memory_test.sh: New script.
7050 * testsuite/memory_test.s: New assembler source file.
7051 * testsuite/memory_test.t: New linker script.
7053 2010-08-27 Doug Kwan <dougkwan@google.com>
7055 * gold/resolve.cc (Symbol_table::should_override): Let a weak
7056 reference override an existing dynamic weak reference.
7057 * testsuite/Makefile.am: Add new test dyn_weak_ref.
7058 * testsuite/Makefile.in: Regenerate.
7059 * testsuite/dyn_weak_ref.sh: New file.
7060 * testsuite/dyn_weak_ref_1.c: Ditto.
7061 * testsuite/dyn_weak_ref_2.c: Ditto.
7063 2010-08-27 Ian Lance Taylor <iant@google.com>
7065 * incremental.h (class Incremental_input_entry): Add virtual
7068 2010-08-27 Ian Lance Taylor <iant@google.com>
7070 * testsuite/start_lib_test_3.c: Mark t3 as used.
7072 2010-08-27 Nick Clifton <nickc@redhat.com>
7074 * options.cc (version_script): Fix small typo in previous
7077 2010-08-25 Nick Clifton <nickc@redhat.com>
7079 * archive.cc: Formatting fixes: Remove whitespace between
7080 typename and following asterisk. Remove whitespace between
7081 function name and opening parenthesis.
7082 * archive.h: Likewise.
7084 * attributes.cc: Likewise.
7085 * attributes.h: Likewise.
7086 * common.cc: Likewise.
7087 * copy-relocs.cc: Likewise.
7088 * dirsearch.h: Likewise.
7089 * dynobj.cc: Likewise.
7090 * ehframe.cc: Likewise.
7091 * ehframe.h: Likewise.
7092 * expression.cc: Likewise.
7093 * fileread.cc: Likewise.
7094 * fileread.h: Likewise.
7096 * gold-threads.cc: Likewise.
7097 * gold.cc: Likewise.
7098 * i386.cc: Likewise.
7100 * incremental-dump.cc: Likewise.
7101 * incremental.cc: Likewise.
7102 * layout.cc: Likewise.
7103 * layout.h: Likewise.
7104 * main.cc: Likewise.
7105 * merge.cc: Likewise.
7106 * merge.h: Likewise.
7107 * object.cc: Likewise.
7108 * object.h: Likewise.
7109 * options.cc: Likewise.
7110 * options.h: Likewise.
7111 * output.cc: Likewise.
7112 * output.h: Likewise.
7113 * plugin.cc: Likewise.
7114 * plugin.h: Likewise.
7115 * powerpc.cc: Likewise.
7116 * reloc.cc: Likewise.
7117 * script-c.h: Likewise.
7118 * script-sections.cc: Likewise.
7119 * script.cc: Likewise.
7120 * stringpool.cc: Likewise.
7121 * symtab.cc: Likewise.
7122 * symtab.h: Likewise.
7123 * target.cc: Likewise.
7124 * timer.cc: Likewise.
7125 * timer.h: Likewise.
7126 * version.cc: Likewise.
7127 * x86_64.cc: Likewise.
7129 2010-08-24 Nick Clifton <nickc@redhat.com>
7132 * layout.cc (segment_precedes): Sort segments by their physical
7133 addresses, if they have been set.
7135 2010-08-23 Cary Coutant <ccoutant@google.com>
7137 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7139 (Lib_group::include_member): Unlock object after deleting its
7141 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7144 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7145 Cary Coutant <ccoutant@google.com>
7147 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7148 constructor, and set_blocker.
7149 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7151 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7152 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7153 * testsuite/Makefile.am (start_lib_test): New test case.
7154 * testsuite/Makefile.in: Regenerate.
7155 * testsuite/start_lib_test_main.c: New file.
7156 * testsuite/start_lib_test_1.c: New file.
7157 * testsuite/start_lib_test_2.c: New file.
7158 * testsuite/start_lib_test_3.c: New file.
7160 2010-08-19 Ian Lance Taylor <iant@google.com>
7162 * Makefile.in: Rebuild with automake 1.11.1.
7163 * aclocal.m4: Likewise.
7164 * testsuite/Makefile.in: Likewise.
7166 2010-08-19 Ian Lance Taylor <iant@google.com>
7169 * i386.cc (class Output_data_plt_i386): Update declarations.
7170 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7171 local_ifuncs_ fields.
7172 (Target_i386::do_plt_section_for_global): New function.
7173 (Target_i386::do_plt_section_for_local): New function.
7174 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7175 parameter; change all callers. Initialize global_ifuncs_ and
7176 local_ifuncs_. If doing a static link define __rel_iplt_start and
7178 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7179 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7180 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7182 (Target_i386::make_plt_section): New function, broken out of
7183 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7184 (Target_i386::make_plt_entry): Call make_plt_section.
7185 (Target_i386::make_local_ifunc_plt_entry): New function.
7186 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7187 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7188 R_386_IRELATIVE to switch.
7189 (Target_i386::Scan::global): Likewise.
7190 (Target_i386::Relocate::relocate): Likewise.
7191 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7193 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7194 (Target_x86_64::do_plt_section_for_global): New function.
7195 (Target_x86_64::do_plt_section_for_local): New function.
7196 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7197 parameter; change all callers. If doing a static link define
7198 __rela_iplt_start and __rela_iplt_end.
7199 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7200 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7201 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7203 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7204 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7206 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7207 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7208 R_X86_64_IRELATIVE to switch.
7209 (Target_x86_64::Scan::global): Likewise.
7210 (Target_x86_64::Relocate::relocate): Likewise.
7211 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7213 * target.h (class Target): Add plt_section_for_global and
7214 plt_section_for_local functions. Add do_plt_section_for_global
7215 and do_plt_section_for_local virtual functions.
7216 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7217 clarifying comments.
7218 (Symbol::use_plt_offset): Handle IFUNC symbol.
7219 * object.cc (Sized_relobj::Sized_relobj): Initialize
7221 (Sized_relobj::local_has_plt_offset): New function.
7222 (Sized_relobj::local_plt_offset): New function.
7223 (Sized_relobj::set_local_plt_offset): New function.
7224 (Sized_relobj::do_count): Handle IFUNC symbol.
7225 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7226 a bit away from input_shndx_ field. Add set_is_func_symbol and
7227 is_ifunc_symbol functions.
7228 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7229 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7230 local_plt_offsets_ field.
7231 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7232 * output.h (class Output_section_data): Add non-const
7233 output_section function.
7234 (class Output_data_got): Update declarations.
7235 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7236 Add use_plt_offset parameter to global and local constructors.
7237 Change all callers. Change local_sym_index_ field to 31 bits.
7238 Change GSYM_CODE and CONSTANT_CODE accordingly.
7239 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7240 doing a static link don't set sh_link field.
7241 (Output_data_got::Got_entry::write): Use PLT offset if
7243 (Output_data_got::add_global_plt): New function.
7244 (Output_data_got::add_local_plt): New function.
7245 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7246 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7247 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7248 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7249 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7251 * testsuite/ifunc-sel.h: New file.
7252 * testsuite/ifuncmain1.c: New file.
7253 * testsuite/ifuncmain1vis.c: New file.
7254 * testsuite/ifuncmod1.c: New file.
7255 * testsuite/ifuncdep2.c: New file.
7256 * testsuite/ifuncmain2.c: New file.
7257 * testsuite/ifuncmain3.c: New file.
7258 * testsuite/ifuncmod3.c: New file.
7259 * testsuite/ifuncmain4.c: New file.
7260 * testsuite/ifuncmain5.c: New file.
7261 * testsuite/ifuncmod5.c: New file.
7262 * testsuite/ifuncmain6pie.c: New file.
7263 * testsuite/ifuncmod6.c: New file.
7264 * testsuite/ifuncmain7.c: New file.
7265 * configure, testsuite/Makefile.in: Rebuild.
7267 2010-08-18 Ian Lance Taylor <iant@google.com>
7270 (Output_section_incremental_inputs::write_input_files): Add cast
7271 to avoid signed/unsigned comparison warning.
7272 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7274 2010-08-12 Cary Coutant <ccoutant@google.com>
7276 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7278 2010-08-13 Ian Lance Taylor <iant@google.com>
7280 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7282 2010-08-12 Cary Coutant <ccoutant@google.com>
7283 Doug Kwan <dougkwan@google.com>
7285 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7286 defintion overrides non-weak undef, remember that the original undef
7288 * symtab.cc (Symbol_table::sized_write_global): For undef without
7289 an original weak binding, set binding to global in output.
7290 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7291 * testsuite/Makefile.in: Regenerate.
7292 * testsuite/strong_ref_weak_def.sh: New file.
7293 * testsuite/strong_ref_weak_def_1.c: Ditto.
7294 * testsuite/strong_ref_weak_def_2.c: Ditto.
7296 2010-08-12 Cary Coutant <ccoutant@google.com>
7298 * testsuite/incremental_test.sh: Rewrite.
7299 * testsuite/incremental_test_1.c: Rewrite.
7300 * testsuite/incremental_test_2.c: Rewrite.
7302 2010-08-12 Cary Coutant <ccoutant@google.com>
7304 * arm.cc (Target_arm::got_size): Add const.
7305 (Target_arm::got_entry_count): New function.
7306 (Target_arm::plt_entry_count): New function.
7307 (Target_arm::first_plt_entry_offset): New function.
7308 (Target_arm::plt_entry_size): New function.
7309 (Output_data_plt_arm::entry_count): New function.
7310 (Output_data_plt_arm::first_plt_entry_offset): New function.
7311 (Output_data_plt_arm::get_plt_entry_size): New function.
7312 * i386.cc (Target_i386::got_size): Add const.
7313 (Target_i386::got_entry_count): New function.
7314 (Target_i386::plt_entry_count): New function.
7315 (Target_i386::first_plt_entry_offset): New function.
7316 (Target_i386::plt_entry_size): New function.
7317 (Output_data_plt_i386::entry_count): New function.
7318 (Output_data_plt_i386::first_plt_entry_offset): New function.
7319 (Output_data_plt_i386::get_plt_entry_size): New function.
7320 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7321 find_incremental_inputs_sections. Dump incremental_got_plt section.
7322 * incremental.cc: Include target.h.
7323 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7324 parameter. Adjust all callers. Find incremental_got_plt section.
7325 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7327 (Output_section_incremental_inputs::set_final_data_size): Calculate
7328 size of incremental_got_plt section.
7329 (Output_section_incremental_inputs::do_write): Write the
7330 incremental_got_plt section.
7331 (Got_plt_view_info): New struct.
7332 (Local_got_offset_visitor): New class.
7333 (Global_got_offset_visitor): New class.
7334 (Global_symbol_visitor_got_plt): New class.
7335 (Output_section_incremental_inputs::write_got_plt): New function.
7336 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7337 Add parameter. Adjust all callers.
7338 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7339 (Incremental_inputs::got_plt_section): New function.
7340 (Incremental_inputs::got_plt_section_): New data member.
7341 (Incremental_got_plt_reader): New class.
7342 * layout.cc (Layout::create_incremental_info_sections): Add the
7343 incremental_got_plt section.
7344 * object.h (Got_offset_list::get_list): New function.
7345 (Got offset_list::for_all_got_offsets): New function.
7346 (Sized_relobj::local_got_offset_list): New function.
7347 * powerpc.cc (Target_powerpc::got_size): Add const.
7348 (Target_powerpc::got_entry_count): New function.
7349 (Target_powerpc::plt_entry_count): New function.
7350 (Target_powerpc::first_plt_entry_offset): New function.
7351 (Target_powerpc::plt_entry_size): New function.
7352 (Output_data_plt_powerpc::entry_count): New function.
7353 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7354 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7355 * sparc.cc (Target_sparc::got_size): Add const.
7356 (Target_sparc::got_entry_count): New function.
7357 (Target_sparc::plt_entry_count): New function.
7358 (Target_sparc::first_plt_entry_offset): New function.
7359 (Target_sparc::plt_entry_size): New function.
7360 (Output_data_plt_sparc::entry_count): New function.
7361 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7362 (Output_data_plt_sparc::get_plt_entry_size): New function.
7363 * symtab.h (Symbol::got_offset_list): New function.
7364 (Symbol_table::for_all_symbols): New function.
7365 * target.h (Sized_target::got_entry_count): New function.
7366 (Sized_target::plt_entry_count): New function.
7367 (Sized_target::plt_entry_size): New function.
7368 * x86_64.cc (Target_x86_64::got_size): Add const.
7369 (Target_x86_64::got_entry_count): New function.
7370 (Target_x86_64::plt_entry_count): New function.
7371 (Target_x86_64::first_plt_entry_offset): New function.
7372 (Target_x86_64::plt_entry_size): New function.
7373 (Output_data_plt_x86_64::entry_count): New function.
7374 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7375 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7377 2010-08-12 Cary Coutant <ccoutant@google.com>
7379 * archive.cc: Include incremental.h.
7380 (Archive::Archive): Initialize incremental_info_.
7381 (Archive::include_member): Record archive members in incremental info.
7382 (Add_archive_symbols::run): Record begin and end of an archive in
7384 (Lib_group::include_member): Record objects in incremental info.
7385 * archive.h (Incremental_archive_entry): Forward declaration.
7386 (Archive::set_incremental_info): New member function.
7387 (Archive::incremental_info): New member function.
7388 (Archive::Unused_symbol_iterator): New class.
7389 (Archive::unused_symbols_begin): New member function.
7390 (Archive::unused_symbols_end): New member function.
7391 (Archive::incremental_info_): New data member.
7392 * incremental-dump.cc (find_input_containing_global): New function.
7393 (dump_incremental_inputs): Dump new incremental info sections.
7394 * incremental.cc: Include symtab.h.
7395 (Output_section_incremental_inputs): New class.
7396 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7397 new incremental info sections.
7398 (Sized_incremental_binary::do_check_inputs): Likewise.
7399 (Incremental_inputs::report_archive): Remove.
7400 (Incremental_inputs::report_archive_begin): New function.
7401 (Incremental_inputs::report_archive_end): New function.
7402 (Incremental_inputs::report_object): New function.
7403 (Incremental_inputs::finalize_inputs): Remove.
7404 (Incremental_inputs::report_input_section): New function.
7405 (Incremental_inputs::report_script): Rewrite.
7406 (Incremental_inputs::finalize): Do nothing but finalize string table.
7407 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7408 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7409 (Incremental_inputs::create_data_sections): New function.
7410 (Incremental_inputs::relocs_entsize): New function.
7411 (Output_section_incremental_inputs::set_final_data_size): New function.
7412 (Output_section_incremental_inputs::do_write): New function.
7413 (Output_section_incremental_inputs::write_header): New function.
7414 (Output_section_incremental_inputs::write_input_files): New function.
7415 (Output_section_incremental_inputs::write_info_blocks): New function.
7416 (Output_section_incremental_inputs::write_symtab): New function.
7417 * incremental.h (Incremental_script_entry): Forward declaration.
7418 (Incremental_object_entry): Forward declaration.
7419 (Incremental_archive_entry): Forward declaration.
7420 (Incremental_inputs): Forward declaration.
7421 (Incremental_inputs_header_data): Remove.
7422 (Incremental_inputs_header): Remove.
7423 (Incremental_inputs_header_write): Remove.
7424 (Incremental_inputs_entry_data): Remove.
7425 (Incremental_inputs_entry): Remove.
7426 (Incremental_inputs_entry_write): Remove.
7427 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7428 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7429 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7430 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7432 (Incremental_input_entry): New class.
7433 (Incremental_script_entry): New class.
7434 (Incremental_object_entry): New class.
7435 (Incremental_archive_entry): New class.
7436 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7437 (Incremental_inputs::report_inputs): Remove.
7438 (Incremental_inputs::report_archive): Remove.
7439 (Incremental_inputs::report_archive_begin): New function.
7440 (Incremental_inputs::report_archive_end): New function.
7441 (Incremental_inputs::report_object): Change prototype.
7442 (Incremental_inputs::report_input_section): New function.
7443 (Incremental_inputs::report_script): Change prototype.
7444 (Incremental_inputs::get_reloc_count): New function.
7445 (Incremental_inputs::set_reloc_count): New function.
7446 (Incremental_inputs::create_data_sections): New function.
7447 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7448 (Incremental_inputs::inputs_section): New function.
7449 (Incremental_inputs::symtab_section): New function.
7450 (Incremental_inputs::relocs_section): New function.
7451 (Incremental_inputs::get_stringpool): Add const.
7452 (Incremental_inputs::command_line): Add const.
7453 (Incremental_inputs::inputs): Remove.
7454 (Incremental_inputs::command_line_key): New function.
7455 (Incremental_inputs::input_file_count): New function.
7456 (Incremental_inputs::input_files): New function.
7457 (Incremental_inputs::relocs_entsize): New function.
7458 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7459 (Incremental_inputs::finalize_inputs): Remove.
7460 (Incremental_inputs::Input_info): Remove.
7461 (Incremental_inputs::lock_): Remove.
7462 (Incremental_inputs::inputs_): Change type.
7463 (Incremental_inputs::inputs_map_): Remove.
7464 (Incremental_inputs::current_object_entry_): New data member.
7465 (Incremental_inputs::inputs_section_): New data member.
7466 (Incremental_inputs::symtab_section_): New data member.
7467 (Incremental_inputs::relocs_section_): New data member.
7468 (Incremental_inputs::reloc_count_): New data member.
7469 (Incremental_inputs_reader): New class.
7470 (Incremental_symtab_reader): New class.
7471 (Incremental_relocs_reader): New class.
7472 * layout.cc (Layout::finalize): Move finalization of incremental info
7473 and creation of incremental info sections to follow finalization of
7474 symbol table. Set offsets for postprocessing sections.
7475 (Layout::create_incremental_info_sections): Call
7476 Incremental_inputs::create_data_sections. Add incremental symtab
7477 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7478 sections to layout after input sections.
7479 * layout.h (struct Timespec): Forward declaration.
7480 (Layout::incremental_inputs): Add const.
7481 (Layout::create_incremental_info_sections): Add parameter.
7482 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7483 * object.cc: Include incremental.h.
7484 (Relobj::finalize_incremental_relocs): New function.
7485 (Sized_relobj::do_layout): Record input sections in incremental info.
7486 * object.h (Object::output_section): New function.
7487 (Object::output_section_offset): Moved from Relobj.
7488 (Object::get_incremental_reloc_base): New function.
7489 (Object::get_incremental_reloc_count): New function.
7490 (Object::do_output_section): New function.
7491 (Object::do_output_section_offset): Moved from Relobj.
7492 (Object::do_get_incremental_reloc_base): New function.
7493 (Object::do_get_incremental_reloc_count): New function.
7494 (Object::Object): Initialize new data members.
7495 (Relobj::output_section): Renamed do_output_section and moved to
7497 (Relobj::output_section_offset): Moved to Object.
7498 (Relobj::do_get_incremental_reloc_base): New function.
7499 (Relobj::do_get_incremental_reloc_count): New function.
7500 (Relobj::allocate_incremental_reloc_counts): New function.
7501 (Relobj::count_incremental_reloc): New function.
7502 (Relobj::finalize_incremental_relocs): New function.
7503 (Relobj::next_incremental_reloc_index): New function.
7504 (Relobj::reloc_counts_): New data member.
7505 (Relobj::reloc_bases_): New data member.
7506 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7507 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7508 (Sized_relobj::incremental_relocs_scan): New function.
7509 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7510 (Sized_relobj::incremental_relocs_write): New function.
7511 (Sized_relobj::incremental_relocs_write_reltype): New function.
7512 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7514 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7515 archives and object files elsewhere.
7516 (Add_symbols::run): Report object files here.
7517 (Finish_group::run): Report end of archive at end of group.
7518 * reloc.cc: Include layout.h, incremental.h.
7519 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7520 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7521 (Sized_relobj::incremental_relocs_scan): New function.
7522 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7523 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7524 (Sized_relobj::incremental_relocs_write): New function.
7525 (Sized_relobj::incremental_relocs_write_reltype): New function.
7526 * script.cc (read_input_script): Rewrite test for incremental link.
7527 Change call to Incremental_inputs::report_script.
7528 * symtab.h (Symbol_table::first_global_index): New function.
7529 (Symbol_table::output_count): New function.
7531 2010-08-12 Doug Kwan <dougkwan@google.com>
7533 * arm.cc (Target_arm::merge_object_attributes): Check command line
7534 options --no-wchar-size-warning and --no-enum-size-warning.
7535 * options.h (General_options): Add ld-compatible options
7536 --no-enum-size-warning and --no-wchar-size-warning.
7538 2010-08-04 Ian Lance Taylor <iant@google.com>
7540 * x86_64.cc (Target_x86_64::Scan::local): Use
7541 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7542 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7543 (Target_x86_64::Scan::global): Likewise.
7544 (Target_x86_64::Relocate::relocate): Likewise.
7545 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7548 2010-08-03 Cary Coutant <ccoutant@google.com>
7550 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7551 to reserve space in merged_strings vector. Keep total input size
7553 (Output_merge_string::do_print_merge_stats): Print total input size.
7554 * merge.h (Output_merge_string): Add input_size_ field.
7555 * stringpool.cc (Stringpool_template::string_length): Move
7556 implementations out of Stringpool_template class and place in
7558 * stringpool.h (string_length): Move out of Stringpool_template.
7560 2010-08-03 Ian Lance Taylor <iant@google.com>
7563 * layout.cc (relaxation_loop_body): If address of load segment is
7564 set, adjust address to include headers if possible.
7566 2010-08-03 Ian Lance Taylor <iant@google.com>
7568 * version.cc (version_string): Bump to 1.10.
7570 2010-08-03 Ian Lance Taylor <iant@google.com>
7573 * layout.h (enum Output_section_order): Define.
7574 (class Layout): Update declarations.
7575 * layout.cc (Layout::get_output_section): Add order parameter.
7576 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7577 is_first_non_relro parameters. Change all callers.
7578 (Layout::choose_output_section): Likewise.
7579 (Layout::add_output_section_data): Likewise.
7580 (Layout::make_output_section): Likewise. Set order.
7581 (Layout::default_section_order): New function.
7582 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7583 * output.cc (Output_section::Output_section): Initialize order_.
7584 Don't initialize deleted fields.
7585 (Output_segment::Output_segment): Don't initialize deleted
7587 (Output_segment::add_output_section_to_load): New function
7588 replacing add_output_section. Change all callers to call this or
7589 add_output_section_to_nonload.
7590 (Output_segment::add_output_section_to_nonload): New function.
7591 (Output_segment::remove_output_section): Rewrite.
7592 (Output_segment::add_initial_output_data): Likewise.
7593 (Output_segment::has_any_data_sections): Likewise.
7594 (Output_segment::is_first_section_relro): Likewise.
7595 (Output_segment::maximum_alignment): Likewise.
7596 (Output_segment::has_dynamic_reloc): New function replacing
7597 dynamic_reloc_count. Change all callers.
7598 (Output_segment::has_dynamic_reloc_list): New function replacing
7599 dynamic_reloc_count_list. Change all callers.
7600 (Output_segment::set_section_addresses): Rewrite.
7601 (Output_segment::set_offset): Rewrite.
7602 (Output_segment::find_first_and_last_list): Remove.
7603 (Output_segment::set_tls_offsets): Rewrite.
7604 (Output_segment::first_section_load_address): Likewise.
7605 (Output_segment::output_section_count): Likewise.
7606 (Output_segment::section_with_lowest_load_address): Likewise.
7607 (Output_segment::write_section_headers): Likewise.
7608 (Output_segment::print_sections_to_map): Likewise.
7609 * output.h (class Output_data): Remove dynamic_reloc_count_
7610 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7611 (Output_data::add_dynamic_reloc): Rewrite.
7612 (Output_data::has_dynamic_reloc): New function.
7613 (Output_data::dynamic_reloc_count): Remove.
7614 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7615 is_last_relro_, is_first_non_relro_, is_interp_,
7616 is_dynamic_linker_section_ fields. Add order and set_order
7617 functions. Remove is_relro_local, set_is_relro_local,
7618 is_last_relro, set_is_last_relro, is_first_non_relro,
7619 set_is_first_non_relro functions, is_interp, set_is_interp,
7620 is_dynamic_linker_section, and set_is_dynamic_linker_section
7622 (class Output_segment): Change Output_data_list from std::list to
7623 std:;vector. Add output_lists_ field. Remove output_data_ and
7624 output_bss_ fields. Update declarations.
7626 2010-08-02 Ian Lance Taylor <iant@google.com>
7628 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7629 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7630 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7632 2010-08-02 Ian Lance Taylor <iant@google.com>
7635 * script.cc (Script_options::Script_options): Initialize
7636 symbol_definitions_ and symbol_references_.
7637 (Script_options::add_symbol_assignment): Update
7638 symbol_definitions_ and symbol_references_.
7639 (Script_options::add_symbol_reference): New function.
7640 (script_symbol): New function.
7641 * script.h (class Script_options): Add symbol_definitions_ and
7642 symbol_references_ fields.
7643 (Script_options::referenced_const_iterator): New type.
7644 (Script_options::referenced_begin): New function.
7645 (Script_options::referenced_end): New function.
7646 (Script_options::is_referenced): New function.
7647 (Script_options::any_unreferenced): New function.
7648 * script-c.h (script_symbol): Declare.
7649 * yyscript.y (exp): Call script_symbol.
7650 * symtab.cc: Include "script.h".
7651 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7652 Change all callers. Check symbols referenced by scripts.
7653 (Symbol_table::add_undefined_symbols_from_command_line): Add
7654 layout parameter. Change all callers.
7655 (Symbol_table::do_add_undefined_symbols_from_command_line):
7656 Likewise. Break out loop body. Check symbols referenced by
7658 (Symbol_table::add_undefined_symbol_from_command_line): New
7659 function broken out of
7660 do_add_undefined_symbols_from_command_line.
7661 * symtab.h (class Symbol_table): Update declarations.
7662 * archive.cc: Include "layout.h".
7663 (Archive::should_include_member): Add layout parameter. Change
7664 all callers. Check for symbol mentioned in expression.
7665 * archive.h (class Archive): Update declaration.
7666 * object.cc (Sized_relobj::do_should_include_member): Add layout
7668 * object.h (Object::should_include_member): Add layout parameter.
7670 (Object::do_should_include_member): Add layout parameter.
7671 (class Sized_relobj): Update declaration.
7672 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7674 * dynobj.h (class Sized_dynobj): Update declaration.
7675 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7677 * plugin.h (class Sized_pluginobj): Update declaration.
7679 2010-08-02 Ian Lance Taylor <iant@google.com>
7682 * output.cc (Output_segment::set_offset): Search for the first and
7683 last sections rather than assuming that the list is in order.
7684 (Output_segment::find_first_and_last_list): New function.
7685 * output.h (class Output_segment): Update declarations.
7686 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7687 (relro_strip_test_SOURCES): New variable.
7688 (relro_strip_test_DEPENDENCIES): New variable.
7689 (relro_strip_test_LDFLAGS): New variable.
7690 (relro_strip_test_LDADD): New variable.
7691 (relro_strip_test.so): New target.
7693 2010-08-02 Ian Lance Taylor <iant@google.com>
7695 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7696 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7697 (Target_i386::got_tlsdesc_section): New function.
7698 (Target_i386::got_section): Create space for GOT entries for
7699 TLSDESC relocations.
7700 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7702 (Target_i386::Scan::global): Likewise.
7703 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7705 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7706 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7707 (Target_x86_64::got_tlsdesc_section): New function.
7708 (Target_x86_64::got_section): Create space for GOT entries for
7709 TLSDESC relocations.
7710 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7712 (Target_x86_64::Scan::global): Likewise.
7713 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7716 2010-08-02 Ian Lance Taylor <iant@google.com>
7718 * testsuite/final_layout.sh: Use dc to convert from hex to
7721 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7723 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7724 paramter to the call to gold::gc_process_relocs.
7725 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7726 paramter to the call to gold::gc_process_relocs.
7727 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7728 parameter to the call to gold::gc_process_relocs.
7729 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7730 template parameter to the call to gold::gc_process_relocs.
7731 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7732 paramter to the call to gold::gc_process_relocs.
7733 * gc.h (get_embedded_addend_size): New function.
7734 (gc_process_relocs): Save the size of the reloc for use by ICF.
7735 * icf.cc (get_section_contents): Get the addend from the text section
7736 for SHT_REL relocation sections.
7737 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7738 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7739 * int_encoding.h (read_from_pointer): New overloaded function.
7740 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7741 * testsuite/icf_sht_rel_addend_test.sh: New file.
7742 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7743 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7745 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7747 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7748 * Makefile.in: Regenerate.
7749 * testsuite/Makefile.in: Regenerate.
7751 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7753 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7754 * gold/testsuite/debug_msg.cc: Likewise.
7755 * gold/testsuite/odr_violation1.cc
7756 * gold/testsuite/odr_violation2.cc
7758 2010-07-21 Cary Coutant <ccoutant@google.com>
7760 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7761 string, and length fields.
7762 (Output_merge_string::Merged_strings_list): New type.
7763 (Output_merge_string::Merged_strings_lists): New typedef.
7764 (Output_merge_string): Replace merged_strings_ with
7765 merged_strings_lists_.
7766 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7767 Merged_strings_list per input object and section. Don't store pointer
7768 to the string. Don't store length with each merged string entry.
7769 (Output_merge_string::finalize_merged_data): Loop over list of merged
7770 strings lists. Recompute length of each merged string.
7772 2010-07-15 Cary Coutant <ccoutant@google.com>
7774 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7777 2010-07-14 Ian Lance Taylor <iant@google.com>
7779 * descriptors.cc (Descriptors::open): Report correct name in error
7782 2010-07-13 Doug Kwan <dougkwan@google.com>
7784 * arm.cc (Arm_input_section::Arm_input_section): For a
7785 SHT_ARM_EXIDX section, always keeps the input sections.
7786 (Arm_input_section::set_exidx_section_link): New method.
7787 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7788 has_errors_ to false.
7789 (Arm_exidx_input_section::has_errors,
7790 Arm_exidx_input_section::set_has_errors): New methods.
7791 (Arm_exidx_input_section::has_errors_): New data member.
7792 (Arm_relobj::get_exidx_shndx_list): New method.
7793 (Arm_output_section::append_text_sections_to_list): Do not skip
7794 section without SHF_EXECINSTR.
7795 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7797 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7798 section header. Make error messages more verbose. Check for
7799 a non-executable section linked to an EXIDX section.
7800 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7801 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7802 check that there is no deferred EXIDX section if we exit early.
7803 Instead of not making an EXIDX section in case of an error, make one
7804 and set the has_errors flag of it.
7805 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7806 in a relocatable link.
7807 (Target_arm::do_relax): Look for the EXIDX output section instead of
7808 assuming that it is called .ARM.exidx.
7809 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7810 section list. Do not check for SHF_EXECINSTR section flags but
7811 skip any input section with errors.
7812 * output.cc (Output_section::Output_section): Initialize
7813 always_keeps_input_sections_ to false.
7814 (Output_section::add_input_section): Check for
7815 always_keeps_input_sections_.
7816 * output.h (Output_section::always_keeps_input_sections,
7817 Output_section::set_always_keeps_input_sections): New methods.
7818 (Output_section::always_keeps_input_sections): New data member.
7820 2010-07-13 Rafael Espindola <espindola@google.com>
7822 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7823 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7825 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7826 Ian Lance Taylor <iant@google.com>
7828 * output.h (Output_section_lookup_maps::add_merge_section):
7829 Correct check of whether value was inserted.
7830 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7831 (Output_section_lookup_maps::add_relaxed_input_section):
7833 * arm.cc (Target_arm::got_section): Remove used local os.
7834 * i386.cc (Target_i386::got_section): Likewise.
7835 * x86_64.cc (Target_x86_64::got_section): Likewise.
7836 * sparc.cc (Target_sparc::got_section): Likewise.
7837 (Target_sparc::relocate): Remove unused local have_got_offset.
7838 * powerpc.cc (Target_powerpc::relocate): Likewise.
7840 2010-07-13 Ian Lance Taylor <iant@google.com>
7842 * compressed_output.cc (zlib_decompress): Fix signature in
7845 * archive.cc (Archive::include_member): Unlock an external member
7846 of a thin archive. Don't bother to delete an object we know is
7849 2010-07-12 Cary Coutant <ccoutant@google.com>
7851 * compressed_output.cc (zlib_decompress): New function.
7852 (get_uncompressed_size): New function.
7853 (decompress_input_section): New function.
7854 * compressed_output.h (get_uncompressed_size): New function.
7855 (decompress_input_section): New function.
7856 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7857 Handle compressed debug sections.
7858 * layout.cc (is_compressed_debug_section): New function.
7859 (Layout::output_section_name): Map compressed section names to
7861 * layout.h (is_compressed_debug_section): New function.
7862 (is_debug_info_section): Recognize compressed debug sections.
7863 * merge.cc: Include compressed_output.h.
7864 (Output_merge_data::do_add_input_section): Handle compressed
7866 (Output_merge_string::do_add_input_section): Handle compressed
7868 * object.cc: Include compressed_output.h.
7869 (Sized_relobj::Sized_relobj): Initialize new data members.
7870 (build_compressed_section_map): New function.
7871 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7872 * object.h (Object::section_is_compressed): New method.
7873 (Object::do_section_is_compressed): New method.
7874 (Sized_relobj::Compressed_section_map): New type.
7875 (Sized_relobj::do_section_is_compressed): New method.
7876 (Sized_relobj::compressed_sections_): New data member.
7877 * output.cc (Output_section::add_input_section): Handle compressed
7879 * reloc.cc: Include compressed_output.h.
7880 (Sized_relobj::write_sections): Handle compressed debug sections.
7882 2010-07-08 Cary Coutant <ccoutant@google.com>
7884 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7885 weak when resolving to a dynamic def.
7886 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7887 for weak undef/dynamic def cases. Adjust callers.
7888 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7889 undef_binding_weak_.
7890 (Symbol_table::sized_write_globals): Adjust symbol binding.
7891 (Symbol_table::sized_write_symbol): Add binding parameter.
7892 * symtab.h (Symbol::set_undef_binding): New method.
7893 (Symbol::is_undef_binding_weak): New method.
7894 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7895 (Symbol_table::should_override): Add new parameter.
7896 (Symbol_table::sized_write_symbol): Add new parameter.
7898 * testsuite/weak_undef_file1.cc: Add new test case.
7899 * testsuite/weak_undef_file2.cc: Fix header comment.
7900 * testsuite/weak_undef_test.cc: Add new test case.
7902 2010-06-29 Doug Kwan <dougkwan@google.com>
7904 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7905 Initialize USE_SYMBOL_.
7906 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7908 (Arm_reloc_property::uses_symbol_): New data member declaration.
7909 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7910 uses symbol value and symbol is undefined but not weakly undefined.
7912 2010-06-28 Rafael Espindola <espindola@google.com>
7914 * plugin.cc (Plugin::load): Use dlerror.
7916 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7918 * symtab.cc (detect_odr_violations): When reporting an ODR
7919 violation, report an object where the symbol is defined.
7921 2010-06-25 Doug Kwan <dougkwan@google.com>
7923 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7924 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7926 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7927 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7928 target hook to detect function points.
7929 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7930 * icf.h (Icf::check_section_for_function_pointers): Change type of
7931 parameter SECTION_NAME to const reference to std::string. Use
7932 target hook to determine if section may have unsafe pointers.
7933 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7936 2010-06-21 Rafael Espindola <espindola@google.com>
7938 * fileread.cc (Input_file::find_fie): New
7939 (Input_file::open): Use Input_file::find_fie.
7940 * fileread.h (Input_file::find_fie): New
7941 * plugin.cc (set_extra_library_path): New.
7942 (Plugin::load): Add set_extra_library_path to the transfer vector.
7943 (Plugin_manager::set_extra_library_path): New.
7944 (Plugin_manager::add_input_file): Use the extra search path if set.
7945 (set_extra_library_path(): New.
7946 * plugin.h (Plugin_manager): Add set_extra_library_path and
7949 2010-06-19 Cary Coutant <ccoutant@google.com>
7951 * layout.cc (gdb_sections): Add .debug_types.
7952 (lines_only_debug_sections): Likewise.
7954 2010-06-18 Rafael Espindola <espindola@google.com>
7956 * plugin.cc (add_input_file,add_input_library)
7957 (Plugin_manager::add_input_file): Make filename arguments const.
7958 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7961 2010-06-16 Doug Kwan <dougkwan@google.com>
7963 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7964 .ARM.attributes section if we have not merged any input
7965 attributes sections.
7967 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7969 * arm.cc: Allow combining objects with no EABI version
7972 2010-06-15 Rafael Espindola <espindola@google.com>
7974 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7976 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7978 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7979 (struct iovec): Correct !HAVE_READV definition.
7981 2010-06-10 Cary Coutant <ccoutant@google.com>
7983 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7984 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7986 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7989 * symtab.h (Symbol::is_placeholder): New member function.
7990 * target-reloc.h (relocate_section): Check for placeholder symbols.
7992 * testsuite/Makefile.am (plugin_test_8): New test.
7993 (plugin_test_9): New test.
7994 * testsuite/Makefile.in: Regenerate.
7996 2010-06-09 Nick Clifton <nickc@redhat.com>
7998 * yyscript.y (input_list_element): Allow strings prefixed with
7999 the '-' character. Treat these as libraries.
8000 * script.cc (script_add_library): New function. Adds a library
8001 specified by "-l<name>" found in an input script.
8002 * script-c.h: Add prototype for script_add_library.
8004 2010-06-07 Doug Kwan <dougkwan@google.com>
8006 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8007 Restrict stub-group size to be within long conditional branch
8008 range when working around cortex-A8 erratum.
8010 2010-06-07 Damien Diederen <dd@crosstwine.com>
8012 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8015 2010-06-03 Sriraman Tallam <tmsriram@google.com>
8019 (Output_section::Input_section_sort_entry::compare_section_ordering):
8020 Change to return non-zero correctly.
8021 (Output_section::Input_section_sort_section_order_index_compare
8022 ::operator()): Change to fix ambiguity in comparisons.
8024 2010-06-01 Sriraman Tallam <tmsriram@google.com>
8026 * gold.h (is_wildcard_string): New function.
8027 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8028 (Layout::layout_eh_frame): Ditto.
8029 (Layout::find_section_order_index): New method.
8030 (Layout::read_layout_from_file): New method.
8031 * layout.h (Layout::find_section_order_index): New method.
8032 (Layout::read_layout_from_file): New method.
8033 (Layout::input_section_position_): New private member.
8034 (Layout::input_section_glob_): New private member.
8035 * main.cc (main): Call read_layout_from_file here.
8036 * options.h (--section-ordering-file): New option.
8037 * output.cc (Output_section::input_section_order_specified_): New
8039 (Output_section::Output_section): Initialize new member.
8040 (Output_section::add_input_section): Add new parameter.
8041 Keep input sections when --section-ordering-file is used.
8042 (Output_section::set_final_data_size): Sort input sections when
8043 section ordering file is specified.
8044 (Output_section::Input_section_sort_entry): Add new parameter.
8046 (Output_section::Input_section_sort_entry::compare_section_ordering):
8048 (Output_section::Input_section_sort_compare::operator()): Change to
8049 consider section_order_index.
8050 (Output_section::Input_section_sort_init_fini_compare::operator()):
8051 Change to consider section_order_index.
8052 (Output_section::Input_section_sort_section_order_index_compare
8053 ::operator()): New method.
8054 (Output_section::sort_attached_input_sections): Change to sort
8055 according to section order when specified.
8056 (Output_section::add_input_section<32, true>): Add new parameter.
8057 (Output_section::add_input_section<64, true>): Add new parameter.
8058 (Output_section::add_input_section<32, false>): Add new parameter.
8059 (Output_section::add_input_section<64, false>): Add new parameter.
8060 * output.h (Output_section::add_input_section): Add new parameter.
8061 (Output_section::input_section_order_specified): New
8063 (Output_section::set_input_section_order_specified): New method.
8064 (Input_section::Input_section): Initialize section_order_index_.
8065 (Input_section::section_order_index): New method.
8066 (Input_section::set_section_order_index): New method.
8067 (Input_section::section_order_index_): New member.
8068 (Input_section::Input_section_sort_section_order_index_compare): New
8070 (Output_section::input_section_order_specified_): New member.
8071 * script-sections.cc (is_wildcard_string): Delete and move modified
8073 (Output_section_element_input::Output_section_element_input): Modify
8074 call to is_wildcard_string.
8075 (Output_section_element_input::Input_section_pattern
8076 ::Input_section_pattern): Ditto.
8077 (Output_section_element_input::Output_section_element_input): Ditto.
8078 * testsuite/Makefile.am (final_layout): New test case.
8079 * testsuite/Makefile.in: Regenerate.
8080 * testsuite/final_layout.cc: New file.
8081 * testsuite/final_layout.sh: New file.
8083 2010-06-01 Rafael Espindola <espindola@google.com>
8085 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8087 2010-06-01 Rafael Espindola <espindola@google.com>
8089 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8090 visibility of symbols.
8092 2010-05-27 Doug Kwan <dougkwan@google.com>
8094 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8095 from start of output section instead of address for a local symbol
8096 in a merged or relaxed section when doing a relocatable link.
8098 2010-05-26 Rafael Espindola <espindola@google.com>
8101 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8102 adding sections the garbage collector removed.
8103 * gold/testsuite/Makefile.am: Add test.
8104 * gold/testsuite/Makefile.in: Regenerate.
8105 * gold/testsuite/plugin_test_7.sh: New.
8106 * gold/testsuite/plugin_test_7_1.c: New.
8107 * gold/testsuite/plugin_test_7_2.c: New.
8109 2010-05-26 Rafael Espindola <espindola@google.com>
8111 * script-sections.cc (Output_section_definition::set_section_addresses):
8112 Check for --section-start.
8114 2010-05-26 Doug Kwan <dougkwan@google.com>
8116 * arm.cc (Arm_scan_relocatable_relocs): New class.
8117 (Target_arm::relocate_special_relocatable): New method.
8118 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8119 (Arm_relocate_functions::thumb_branch_common): Same.
8120 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8121 instead of Default_scan_relocatable_relocs.
8122 * target-reloc.h (relocate_for_relocatable): Let target handle
8123 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8124 * target.h (Sized_target::relocate_special_relocatable): New method.
8126 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8128 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8130 2010-05-23 Doug Kwan <dougkwan@google.com>
8132 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8134 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8135 with a direct branch, not a conditional branch, to a stub.
8136 * merge.cc (Output_merge_base::record_input_section): New method
8138 (Output_merge_data::do_add_input_section): Record input section if
8139 keeps-input-sections flag is set.
8140 (Output_merge_string::do_add_input_section): Ditto.
8141 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8142 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8144 (Output_merge_base::keeps_input_sections,
8145 Output_merge_base::set_keeps_input_sections,
8146 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8148 (Output_merge_base::Input_sections): New type declaration.
8149 (Output_merge_base::input_sections_begin,
8150 Output_merge_base::input_sections_end,
8151 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8152 (Output_merge_base::bool keeps_input_sections_,
8153 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8154 Output_merge_base::input_sections_): New data members.
8155 (Output_merge_data::do_set_keeps_input_sections): New method
8157 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8158 * output.cc (Output_section::Input_section::relobj): Move method
8159 defintion from class declaration to here and handle merge sections.
8160 (Output_section::Input_section::shndx): Ditto.
8161 (Output_section::Output_section): Remove initializations of removed
8162 data members and initialize new data member LOOKUP_MAPS_.
8163 (Output_section::add_input_section): Set keeps-input-sections flag
8164 for a newly created merge output section as appropriate. Adjust code
8165 to use Output_section_lookup_maps class.
8166 (Output_section::add_relaxed_input_section): Adjst code for lookup
8167 maps code refactoring.
8168 (Output_section::add_merge_input_section): Add a new parameter
8169 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8170 class. If adding input section to a newly created merge output
8171 section fails, remove the new merge section.
8172 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8173 Adjust code for use of the Output_section_lookup_maps class.
8174 (Output_section::find_merge_section): Ditto.
8175 (Output_section::build_lookup_maps): New method defintion.
8176 (Output_section::find_relaxed_input_section): Adjust code to use
8177 Output_section_lookup_maps class.
8178 (Output_section::get_input_sections): Export merge sections. Adjust
8179 code to use Output_section_lookup_maps class.
8180 (Output_section:::add_script_input_section): Adjust code to use
8181 Output_section_lookup_maps class. Update lookup maps for merge
8183 (Output_section::discard_states): Use Output_section_lookup_maps.
8184 (Output_section::restore_states): Same.
8185 * output.h (Merge_section_properties): Move class defintion out of
8187 (Output_section_lookup_maps): New class.
8188 (Output_section::Input_section::is_merge_section): New method
8190 (Output_section::Input_section::relobj): Move defintion out of class
8191 defintion. Declare method only.
8192 (Output_section::Input_section::shndx): Ditto.
8193 (Output_section::Input_section::output_merge_base): New method defintion.
8194 (Output_section::Input_section::u2_.pomb): New union field.
8195 (Output_section::Merge_section_by_properties_map,
8196 Output_section::Output_section_data_by_input_section_map,
8197 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8199 (Output_section::add_merge_input_section): Add new parameter
8200 KEEPS_INPUT_SECTIONS.
8201 (Output_section::build_lookup_maps): New method declaration.
8202 (Output_section::merge_section_map_,
8203 Output_section::merge_section_by_properties_map_,
8204 Output_section::relaxed_input_section_map_,
8205 Output_section::is_relaxed_input_section_map_valid_): Remove data
8207 (Output_section::lookup_maps_): New data member.
8209 2010-05-21 Doug Kwan <dougkwan@google.com>
8212 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8213 avoid a compilation error.
8215 2010-05-19 Rafael Espindola <espindola@google.com>
8217 * script-sections.cc (Output_section_definition::allocate_to_segment):
8218 Update the phdrs_list even when the output section is NULL.
8219 * testsuite/Makefile.am: Add test.
8220 * testsuite/Makefile.in: Regenerate.
8221 * testsuite/script_test_9.cc: New.
8222 * testsuite/script_test_9.sh: New.
8223 * testsuite/script_test_9.t: New.
8225 2010-05-19 Doug Kwan <dougkwan@google.com>
8227 * arm.cc (Arm_input_section::original_size): New method.
8228 (Arm_input_section::do_addralign): Add a cast.
8229 (Arm_input_section::do_output_offset): Remove static cast.
8230 (Arm_input_section::original_addralign,
8231 Arm_input_section::original_size_): Change type to uint32_t.
8232 (Arm_input_section::init): Add safe casts for section alignment
8234 (Arm_input_section::set_final_data_size): Do not set address and
8235 offset of stub table.
8236 (Arm_output_section::fix_exidx_coverage): Change use of of
8237 Output_section::Simple_input_section to that of
8238 Output_section::Input_section.
8239 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8240 except for the first pass.
8241 * output.cc (Output_section::get_input_sections): Change type of
8242 input_sections to std::list<Input_section>.
8243 (Output_section::add_script_input_section): Rename from
8244 Output_section::add_simple_input_section. Change type of SIS
8245 parameter from Simple_input_section to Input_section.
8246 * output.h (Output_section::Simple_input_section): Remove class.
8247 (Output_section::Input_section): Change class visibility to public.
8248 (Output_section::Input_section::addralign): Use stored alignments
8249 for special input sections if set.
8250 (Output_section::Input_section::set_addralign): New method.
8251 (Output_section::get_input_sections): Change parameter type from
8252 list of Simple_input_section to list of Input_section.
8253 (Output_section::add_script_input_section): Rename from
8254 Output_section::add_simple_input_section. Change first parameter's
8255 type from Simple_input_section to Input_section and remove the
8256 second and third parameters.
8257 * script-sections.cc (Input_section::Input_section_list): Change
8258 type to list of Output_section::Input_section/
8259 (Input_section_info::Input_section_info): Change parameter type of
8260 INPUT_SECTION to Output_section::Input_section.
8261 (Input_section_info::input_section): Change return type.
8262 (Input_section_info::input_section_): Change type to
8263 Output_section::Input_section.
8264 (Output_section_element_input::set_section_addresses): Adjust code
8265 to use Output_section::Input_section instead of
8266 Output_section::Simple_input_section. Adjust code for renaming
8267 of Output_section::add_simple_input_section.
8268 (Orphan_output_section::set_section_addresses): Ditto.
8270 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8272 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8273 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8275 2010-05-18 Rafael Espindola <espindola@google.com>
8277 * options.cc (General_options::finalize): Handle -nostdlib.
8278 * options.h (nostdlib): New option.
8279 * script.cc (script_add_search_dir): Handle -nostdlib.
8281 2010-05-12 Doug Kwan <dougkwan@google.com>
8283 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8284 attributes section only if there no attributes section after merging.
8285 (Target_arm::merge_object_attributes): Move value of
8286 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8287 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8288 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8289 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8290 and arm_attr_merge_7.stdout.
8291 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8292 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8293 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8294 arm_attr_merge_7b.o): New rules.
8295 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8297 * testsuite/Makefile.in: Regenerate.
8298 * testsuite/arm_attr_merge.sh: New file.
8299 * testsuite/arm_attr_merge_[67][ab].s: Same.
8301 2010-05-05 Nick Clifton <nickc@redhat.com>
8303 * po/es.po: Updated Spanish translation.
8305 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8307 * Makefile.am (install-exec-local): Properly install gold as
8308 default cross linker.
8309 * Makefile.in: Regenerated.
8311 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8312 Nick Clifton <nickc@redhat.com>
8314 * configure.ac (install_as_default): Define and set to false
8315 unless --enable-gold or --enable-gold=both/gold has been
8317 * configure: Regenerate.
8319 * Makefile.am (install-exec-local): Install the executable as
8320 'ld.gold'. If install_as_default is true then also install it as
8322 * Makefile.in: Regenerated.
8324 2010-04-24 Ian Lance Taylor <iant@google.com>
8326 * layout.cc (Layout::layout_reloc): In relocatable link don't
8327 combine reloc sections for grouped sections.
8329 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8331 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8332 sections that are not ordinary to icf.
8333 * icf.cc (get_section_contents): Handle relocation pointing to section
8334 with no object or shndx information.
8335 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8336 * testsuite/Makefile.in: Regenerate.
8337 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8338 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8340 2010-04-22 Ian Lance Taylor <iant@google.com>
8342 * expression.cc (Expression::Expression_eval_info): Add
8343 result_alignment_pointer field.
8344 (Expression::eval_with_dot): Add result_alignment_pointer
8345 parameter. Change all callers.
8346 (Expression::eval_maybe_dot): Likewise.
8347 (class Binary_expression): Add alignment_pointer parameter to
8348 left_value and right_value. Change all callers.
8349 (BINARY_EXPRESSION): Set result alignment.
8350 (class Trinary_expression): Add alignment_pointer parameter to
8351 arg2_value and arg3_value. Change all callers.
8352 (Trinary_cond::value): Set result alignment.
8353 (Max_expression::value, Min_expression::value): Likewise.
8354 (Align_expression::value): Likewise.
8355 * script-sections.cc (class Sections_element): Add dot_alignment
8356 parameter to set_section_addresses virtual function. Update
8358 (class Output_section_element): Likewise.
8359 (Script_sections::create_segments): Add dot_alignment parameter.
8361 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8362 (Script_sections::set_phdrs_clause_addresses): Likewise.
8363 * script-sections.h: Update declarations.
8364 * script.h: Update declarations.
8365 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8367 * testsuite/script_test_3.t: Set large alignment.
8368 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8369 segment has expected alignment.
8371 2010-04-22 Nick Clifton <nickc@redhat.com>
8373 * po/gold.pot: Updated by the Translation project.
8374 * po/vi.po: Updated Vietnamese translation.
8376 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8378 * testsuite/Makefile.am (check_PROGRAMS): Add
8379 icf_virtual_function_folding_test.
8380 * testsuite/Makefile.in: Regenerated.
8382 2010-04-15 Andrew Haley <aph@redhat.com>
8384 * options.h (merge_exidx_entries): New option.
8385 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8386 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8387 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8388 (Target_arm::merge_exidx_entries): New function.
8389 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8390 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8391 to Arm_exidx_fixup constructor.
8392 Add new arg, merge_exidx_entries.
8393 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8394 Arm_output_section::fix_exidx_coverage.
8396 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8398 * icf.cc (get_section_contents): Check for preemptible functions.
8399 Ignore addend when appropriate.
8400 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8402 (add_from_relobj): Check for section folded.
8403 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8404 * symtab.h (should_add_dynsym_entry): Add new parameter.
8405 * target-reloc.h (scan_relocs): Check for section folded.
8406 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8407 Check reloc types for function pointers in shared objects.
8408 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8410 (icf_preemptible_functions_test): New test case.
8411 (icf_string_merge_test): New test case.
8412 * testsuite.Makefile.in: Regenerate.
8413 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8414 bar_glob. Refactor code.
8415 * testsuite/icf_preemptible_functions_test.cc: New file.
8416 * testsuite/icf_preemptible_functions_test.sh: New file.
8417 * testsuite/icf_string_merge_test.cc: New file.
8418 * testsuite/icf_string_merge_test.sh: New file.
8419 * testsuite/icf_virtual_function_folding_test.cc: New file.
8420 * testsuite/icf_virtual_function_folding_test.sh: New file.
8422 2010-04-14 Doug Kwan <dougkwan@google.com>
8424 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8425 for local symbol recounting if we remove a section due to ICF.
8426 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8427 there are no regular objects in input.
8429 2010-04-13 Doug Kwan <dougkwan@google.com>
8431 * arm.cc (Arm_input_section::set_final_data_size): Compute
8432 accurate final data size instead of using current data size.
8434 2010-04-09 Doug Kwan <dougkwan@google.com>
8436 * layout.cc (Layout::choose_output_section): Handle script section
8438 (Layout::make_output_section_for_script): Add section type parameter.
8439 Handle script section types.
8440 * layout.h (Layout::make_output_section_for_script): Add section
8442 * output.cc (Output_section::Output_section): Initialize data member
8444 (Output_section::do_reset_address_and_file_offset): Do not set address
8445 to 0 if section is a NOLOAD section.
8446 * output.h (Output_section::is_noload): New method.
8447 (Output_section::set_is_noload): Ditto.
8448 (Output_section::is_noload_): New data member.
8449 * script-c.h (Script_section_type): New enum type.
8450 (struct Parser_output_section_header): Add new file section_type.
8451 * script-sections.cc (Sections_element::output_section_name): Add
8452 parameter for returning script section type.
8453 (Output_section_definition::output_section_name): Ditto.
8454 (Output_section_definition::section_type)P; New method.
8455 (Output_section_definiton::script_section_type_name): Ditto.
8456 (Output_section_definition::script_section_type_): New data member.
8457 (Output_section_definition::Output_section_definition): Initialize
8458 data member Output_section_definition::script_section_type_.
8459 (Output_section_definition::create_sections): Pass script section type
8460 to Layout::make_output_section_for_script.
8461 (Output_section_definition::output_section_name): Return script
8462 section type to caller.
8463 (Output_section_definition::set_section_address): Do not advance
8464 dot value and load address if section type is NOLOAD. Set address
8465 of NOLOAD sections regardless of section flags.
8466 (Output_section_definition::print): Print section type if it is
8467 not SCRIPT_SECTION_TYPE_NONE.
8468 (Output_section_definition::section_type): New method.
8469 (Output_section_definition::script_section_type_name): Ditto.
8470 (Script_sections::output_section_name): Add new parameter
8471 PSECTION_TYPE for returning script section type. Pass it to
8472 section elements. Handle discard sections.
8473 (Sort_output_sections::operator()): Handle NOLOAD sections.
8474 * script-sections.h (Script_sections::Section_type): New enum type.
8475 (Script_sections::output_section_name): Add a new parameter for
8476 returning script section type.
8477 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8479 * yyscript.y (union): Add new field SECTION_TYPE.
8480 (COPY, DSECT, INFO, NOLOAD): New tokens.
8481 (opt_address_and_section_type): Change type to output_section_header.
8482 (section_type): New non-terminal
8483 (section_header): Handle section type.
8484 (opt_address_and_section_type): Return section type value.
8486 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8488 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8489 * testsuite/plugin_common_test_2.c (foo): Likewise.
8491 2010-04-08 Doug Kwan <dougkwan@google.com>
8493 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8495 * output.cc (Output_section::add_merge_input_section): Simplify
8496 code and return status of Output_merge_base::add_input_section.
8497 Update merge section map only if Output_merge_base::add_input_section
8500 2010-04-07 Doug Kwan <dougkwan@google.com>
8502 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8503 if section is marked as containing instructions but has no mapping
8505 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8506 correct section index.
8507 (Arm_relobj::find_linked_text_section): Ditto.
8509 2010-04-07 Cary Coutant <ccoutant@google.com>
8511 * archive.cc (include_member): Destroy Read_symbols_data object before
8513 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8514 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8515 (Read_symbols_data::~Read_symbols_data) New destructor.
8516 (Section_relocs::Section_relocs) New constructor.
8517 (Section_relocs::~Section_relocs) New destructor.
8518 (Read_relocs_data::Read_relocs_data) New constructor.
8519 (Read_relocs_data::~Read_relocs_data) New destructor.
8520 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8521 pointers to NULL after deleting.
8523 2010-04-07 Doug Kwan <dougkwan@google.com>
8525 * arm.cc: Replace "endianity" with "endianness" in comments.
8526 (Arm_exidx_cantunwind): Ditto.
8527 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8528 (Arm_relobj::merge_flags_and_attributes): New method.
8529 (Arm_relobj::merge_flags_and_attributes_): New data member.
8530 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8531 (Arm_relobj::scan_sections_for_stubs): Ditto.
8532 (Arm_relobj::do_read_symbols): Check to see if we really want to
8533 merge processor-specific flags and attributes. Exit early if
8534 an object is empty except for section names and the undefined symbol.
8535 (Target_arm::do_finalize_sections): Move check for ELF format to
8536 Arm_relobj::do_read_symbols. Merge processor specific flags and
8537 attributes from a regular object only when we have determined that
8538 it is aapropriate. Do not create an .ARM.attributes section in
8539 output if there is no regular input object.
8540 (Target_arm::merge_processor_specific_flags): Check
8541 --warn-mismatch before printing any error.
8542 (Target_arm::merge_object_attributes): Ditto.
8543 * gold.cc (queue_middle_tasks): Handle the case in which there is
8544 no regular object in input.
8545 * options.cc (General_options::parse_EB): New method.
8546 (General_options::parse_EL): Same.
8547 (General_options::General_options): Initialize endianness_.
8548 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8550 (General_options::Endianness): New enum.
8551 (General_options::endianness): New method.
8552 (General_options::endianness_): New data member.
8553 * parameters.cc (Parameters::set_options): Check target endianness.
8554 (Parameters::set_target_once): Ditto.
8555 (Parameters::check_target_endianness): New method.
8556 (parameters_force_valid_target): If either -EL or -EB is specified,
8557 use it to define endianness of default target.
8558 * parameters.h (Parameters::check_target_endianness): New method
8560 * target.h (class Target): Change "endianity" to "endianness"
8563 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8565 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8566 * configure: Regenerate.
8567 * Makefile.in: Regenerate.
8568 * testsuite/Makefile.in: Regenerate.
8570 2010-04-06 Cary Coutant <ccoutant@google.com>
8573 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8574 prevailing definitions of common symbols.
8575 * testsuite/plugin_test_6.sh: New test case.
8576 * testsuite/plugin_common_test_1.c: New test case.
8577 * testsuite/plugin_common_test_2.c: New test case.
8578 * testsuite/Makefile.am (plugin_test_6): New test case.
8579 * testsuite/Makefile.in: Regenerate.
8581 2010-04-06 Nick Clifton <nickc@redhat.com>
8583 * po/vi.po: New Vietnamese translation.
8585 2010-03-30 Doug Kwan <dougkwan@google.com>
8587 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8589 2010-03-25 Doug Kwan <dougkwan@google.com>
8591 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8592 to avoid a conversion warning on a 32-bit host.
8594 2010-03-24 Ian Lance Taylor <iant@google.com>
8596 * testsuite/script_test_3.t: Add a TLS segment.
8597 * testsuite/Makefile.am (check_PROGRAMS): Add
8598 tls_phdrs_script_test.
8599 (tls_phdrs_script_test_SOURCES): Define.
8600 (tls_phdrs_script_test_DEPENDENCIES): Define.
8601 (tls_phdrs_script_test_LDFLAGS): Define.
8602 (tls_phdrs_script_test_LDADD): Define.
8603 * testsuite/Makefile.in: Rebuild.
8605 2010-03-23 Cary Coutant <ccoutant@google.com>
8607 * fileread.cc (find_or_make_view): Fix comment.
8609 2010-03-23 Ian Lance Taylor <iant@google.com>
8611 * script-sections.cc (class Orphan_section_placement): Define
8612 PLACE_TLS and PLACE_TLS_BSS.
8613 (Orphan_section_placement::Orphan_section_placement): Initialize
8615 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8616 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8617 (tls_script_test_SOURCES): Define.
8618 (tls_script_test_DEPENDENCIES): Define.
8619 (tls_script_test_LDFLAGS): Define.
8620 (tls_script_test_LDADD): Define.
8621 * testsuite/Makefile.in: Rebuild.
8623 2010-03-22 Doug Kwan <dougkwan@google.com>
8625 * arm.cc (Arm_relocate_functions::abs8,
8626 Arm_relocate_functions::abs16): Use correct check for overflow
8627 specified in the ARM ELF specs.
8628 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8629 target of a BLX instruction specially.
8630 (Reloc_stub::stub_type_for_reloc): Ditto.
8631 (Relocate::relocate): Use symbolic names instead of numeric relocation
8632 codes to report error.
8633 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8635 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8636 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8637 thumb2_blx_out_of_range.stdout
8638 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8639 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8640 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8641 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8642 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8643 thumb2_blx_in_range, thumb2_blx_in_range.o,
8644 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8645 thumb2_blx_out_of_range.o): New rules.
8646 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8647 thumb2_blx_in_range and thumb2_blx_out_of_range.
8648 * testsuite/Makefile.in: Regenerate.
8649 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8650 * testsuite/thumb_blx_in_range.s: New file.
8651 * testsuite/thumb_blx_out_of_range.s: New file.
8653 2010-03-22 Rafael Espindola <espindola@google.com>
8655 * archive.cc (Should_include): Move to archive.h.
8656 (should_include_member): Make it a member of Archive.
8658 (Add_lib_group_symbols): New.
8659 * archive.h: Include options.h.
8660 (Archive_member): Moved from Archive.
8661 (Should_include): Moved from archive.cc.
8663 (Add_lib_group_symbols): New.
8664 * dynobj.cc (do_should_include_member): New.
8665 * dynobj.h (do_should_include_member): New.
8666 * gold.cc (queue_initial_tasks): Update call to queue.
8667 * main.cc (main): Print lib group stats.
8668 * object.cc (do_should_include_member): New.
8669 * object.h: Include archive.h.
8670 (Object::should_include_member): New.
8671 (Object::do_should_include_member): New.
8672 (Sized_relobj::do_should_include_member): New.
8673 * options.cc (General_options::parse_start_lib): New.
8674 (General_options::parse_end_lib): New.
8675 (Input_arguments::add_file): Handle lib groups.
8676 (Input_arguments::start_group): Check we are not in a lib.
8677 (Input_arguments::start_lib): New.
8678 (Input_arguments::end_lib): New.
8679 * options.h (General_options): Add start_lib and end_lib.
8680 (Input_argument::lib_): New.
8681 (Input_argument::lib): New.
8682 (Input_argument::is_lib): New.
8683 (Input_file_lib): New.
8684 (Input_arguments::in_lib_): New.
8685 (Input_arguments::in_lib): New.
8686 (Input_arguments::start_lib): New.
8687 (Input_arguments::end_lib_): New.
8688 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8689 in unused members as preempted.
8690 (Sized_pluginobj::do_should_include_member): New.
8691 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8692 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8694 (Read_symbols::do_whole_lib_group): New.
8695 (Read_symbols::do_lib_group): New.
8696 (Read_symbols::do_read_symbols): Handle lib groups.
8697 (Read_symbols::get_name): Handle lib groups.
8698 * readsyms.h (Read_symbols): Add an archive member pointer.
8699 (Read_symbols::do_whole_lib_group): New.
8700 (Read_symbols::do_lib_group): New.
8701 (Read_symbols::member_): New.
8702 * script.cc (read_input_script): Update call to queue_soon.
8704 2010-03-19 Doug Kwan <dougkwan@google.com>
8706 * arm.cc (Stub_table::Stub_table): Initialize new data members
8707 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8708 (Stub_table::add_reloc_stub): Assign stub offset and update
8709 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8710 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8712 (Stub_table::update_data_size_and_addralign): Use
8713 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8714 instead of going over all reloc stubs.
8715 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8716 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8717 Stringpool_template::offset_ to size of Stringpool_char.
8718 (Stringpool_template::new_key_offset): Remove code to initialize
8719 Stringpool_template::offset_.
8720 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8721 Stringpool_template::offset_ to zero.
8723 2010-03-15 Doug Kwan <dougkwan@google.com>
8725 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8727 (Stringpool_template::new_key_offset): New method.
8728 (Stringpool_template::add_string): Assign offsets when adding new
8730 (Stringpool_template::set_string_offsets): Do not set string offsets
8731 when not optimizing.
8732 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8734 (Chunked_vector::clear): Clear size_.
8735 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8736 (Chunked_vector::size): Return size_.
8737 (Chunked_vector::push_back): Use size_ to find insert position.
8738 (Chunked_vector::size_): New data member.
8739 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8740 (Stringpool_template::new_key_offset): New method declaration.
8741 (Stringpool_template::offset_): New data member.
8743 2010-03-15 Rafael Espindola <espindola@google.com>
8745 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8746 Add_symbols' constructor.
8747 * readsyms.h (Add_symbols): Remove the input_group member.
8749 2010-03-10 Ian Lance Taylor <iant@google.com>
8751 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8752 target to ask whether a reference to a symbol requires a stack
8754 * target.h (Target::is_call_to_non_split): New function.
8755 (Target::do_is_call_to_non_split): Declare virtual function.
8756 * target.cc: Include "symtab.h".
8757 (Target::do_is_call_to_non_split): New function.
8758 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8760 2010-03-10 Cary Coutant <ccoutant@google.com>
8762 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8763 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8764 (File_read::open[2]): Add whole_file_view_ to list of views.
8765 (File_read::make_view): Remove test of whole_file_view_.
8766 (File_read::find_or_make_view): Create whole_file_view_ if
8768 (File_read::clear_views): Replace bool parameter with enum;
8769 adjust all callers. Don't delete views with permanent data;
8770 do delete cached views and views from archives if
8771 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8772 if clearing the corresponding view.
8773 * fileread.h (File_read::Clear_views_mode): New enum.
8774 (File_read::View::is_permanent_view): New method.
8775 (File_read::clear_views): Replace bool parameter
8776 with enum; adjust all callers.
8777 * options.h (General_options): Change keep_files_mapped option;
8778 add map_whole_files.
8779 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8781 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8784 2010-03-10 David S. Miller <davem@davemloft.net>
8786 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8788 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8790 * icf.cc (get_section_contents): Add '@' marker after processing the
8793 2010-03-08 Doug Kwan <dougkwan@google.com>
8795 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8796 due to a conversion warning.
8797 (Arm_relobj::update_output_local_symbol_count): Check for local
8798 symbol with unset output index.
8800 2010-03-05 Ian Lance Taylor <iant@google.com>
8802 * options.h (class General_options): Add --spare-dynamic-tags.
8803 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8804 --spare-dynamic-tags.
8806 2010-03-05 Ian Lance Taylor <iant@google.com>
8808 * incremental.cc: Include "libiberty.h".
8810 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8812 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8813 function, is_info_ member.
8814 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8815 (Versions::Versions): Update caller.
8816 (Versions::define_base_version): Likewise.
8817 (Versions::add_def): Likewise.
8819 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8821 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8822 (Scan::possible_function_pointer_reloc): New function.
8823 (Scan::local_reloc_may_be_function_pointer): Change to call
8824 possible_function_pointer_reloc.
8825 (Scan::global_reloc_may_be_function_pointer): Ditto.
8826 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8827 relocations in ".data.rel.ro._ZTV" section.
8828 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8829 * testsuite/icf_safe_so_test.cc: Ditto.
8830 * testsuite/icf_safe_test.cc: Ditto.
8831 * testsuite/icf_safe_test.sh: Ditto.
8833 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8834 Ian Lance Taylor <iant@google.com>
8836 * target-reloc.h (relocate_section): Check the symbol table index
8837 for -1U before setting the local symbol index.
8838 (scan_relocatable_relocs): If copying the relocation, record that
8839 the local symbol is required.
8840 * object.h (Symbol_value::is_output_symtab_index_set): New
8842 (Symbol_value::may_be_discarded_from_output_symtab): New
8844 (Symbol_value::has_output_symtab_entry): New function.
8845 (Symbol_value::needs_output_symtab_entry): Remove.
8846 (Symbol_value::output_symtab_index): Make sure the symbol index is
8848 (Symbol_value::set_output_symtab_index): Make sure the symbol
8849 index is not set. Make sure the new index is valid.
8850 (Symbol_value::set_must_have_output_symtab_entry): New function.
8851 (Symbol_value::has_output_dynsym_entry): New function.
8852 (Symbol_value::set_output_dynsym_index): Make sure the new index
8854 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8855 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8856 local symbol if permitted.
8857 (Sized_relobj::do_finalize_local_symbols): Call
8858 is_output_symtab_index_set rather than needs_output_symtab_entry.
8859 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8860 rather than needs_output_symtab_entry. Call
8861 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8862 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8863 is_output_symtab_index_set rather than needs_output_symtab_entry.
8864 * testsuite/discard_locals_relocatable_test.c: New file.
8865 * testsuite/discard_locals_test.sh: Test -r.
8866 * testsuite/Makefile.am (check_DATA): Add
8867 discard_locals_relocatable_test1.syms,
8868 discard_local_relocatable_test2.syms.
8869 (MOSTLYCLEANFILES): Likewise. Also add
8870 discard_locals_relocatable_test1.lout and
8871 discard_locals_relocatable_test2.out.
8872 (discard_locals_relocatable_test1.syms): New target.
8873 (discard_locals_relocatable_test.o): New target.
8874 (discard_locals_relocatable_test1.out): New target.
8875 (discard_locals_relocatable_test2.syms): New target.
8876 (discard_locals_relocatable_test2.out): New target.
8877 (various): Add missing ../ld-new dependencies.
8878 * testsuite/Makefile.in: Rebuild.
8880 2010-03-03 Nick Clifton <nickc@redhat.com>
8882 * po/fi.po: New Finnish translation.
8884 2010-03-01 Doug Kwan <dougkwan@google.com>
8886 * layout.cc (Layout::Layout): Force section types of .init_array*,
8887 .preinit_array* and .fini_array* sections.
8888 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8889 Fix check of return value of std::string::find.().
8890 (Output_section::Input_section_sort_compare::operator()): Remove
8891 comment about .init_array.
8892 (Output_section::Input_section_sort_init_fini_compare::operator()):
8894 (Output_section::sort_attached_input_sections): Handle .init_array
8895 and .fini_array specially.
8896 * output.h (Output_section::Inut_section_sort_compare): Update
8898 (Output_section::Input_section_sort_init_fini_compare): New struct.
8900 2010-02-26 Doug Kwan <dougkwan@google.com>
8902 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8903 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8904 * testsuite/debug_msg.sh: Avoid matching source line number for
8905 use of global variable undef_int.
8907 2010-02-26 Doug Kwan <dougkwan@google.com>
8909 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8910 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8911 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8912 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8913 * options.cc (General_options::General_options): Initialize member
8915 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8916 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8917 and rm_no_fix_v4bx.stdout
8918 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8919 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8920 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8921 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8922 and arm_no_fix_v4bx.
8923 * Makefile.in: Regenerate.
8924 * testsuite/arm_fix_v4bx.s: New file.
8925 * testsuite/arm_fix_v4bx.sh: Ditto.
8927 2010-02-24 Doug Kwan <dougkwan@google.com>
8929 * arm.cc (Target_arm::got_section): Make the .got section the first
8930 non RELRO section in the data segment.
8931 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8932 suffixes of section names.
8934 2010-02-24 Doug Kwan <dougkwan@google.com>
8936 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8937 flags and attributes merging if an input file is a binary file.
8938 * fileread.cc (Input_file::open): Record format of original file.
8939 * fileread.h (Input_file::Format): New enum type.
8940 (Input_file::Input_file): Initialize data member format_.
8941 (Input_file::format): New method definition.
8942 (Input_file::format_):: New data member.
8944 2010-02-24 Doug Kwan <dougkwan@google.com>
8946 * arm.cc (Arm_output_data_got): New class.
8947 (ARM_TCB_SIZE): New constant
8948 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8949 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8950 If user uses a script with a SECTIONS clause, issue only a warning
8951 for a misplaced EXIDX input section. Otherwise, issue an error.
8952 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8954 (Target_arm::got_mode_index_entry): Handle static linking.
8955 (Target_arm::Scan::local): Ditto.
8956 (Target_arm::Scan::global): Ditto.
8957 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8958 all incorrectly implemented relocations.
8959 (Target_arm::fix_exidx_coverage): Pass layout to
8960 Arm_output_section::fix_exidx_coverage.
8961 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8962 from ".ARM.exidx." and ".ARM.extab.".
8964 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8966 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8967 section if it does not already exist.
8968 * attributes.cc (Attributes_section_data::Attributes_section_data):
8969 Don't crash if size is zero.
8971 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8972 Ian Lance Taylor <iant@google.com>
8974 * gold.cc (queue_middle_tasks): If no input files were opened,
8976 * workqueue.h (Task_function::Task_function): Assert that there is
8979 2010-02-22 Doug Kwan <dougkwan@google.com>
8981 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8982 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8983 types to avoid warnings due to different uint64_t implementations
8986 2010-02-21 Doug Kwan <dougkwan@google.com>
8988 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8989 handling of the maximum backward branch offset.
8990 (Arm_relocate_functions::thumb_branch_common): Ditto.
8991 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8992 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8993 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8994 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8995 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8996 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8997 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8998 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8999 thumb_bl_out_of_range thumb_bl_out_of_range.o,
9000 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9001 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9002 thumb2_bl_out_of_range.o): New rules.
9003 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9004 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9005 thumb2_bl_out_of_range
9006 * testsuite/Makefile.in: Regenerate.
9007 * testsuite/arm_bl_in_range.s: New file.
9008 * testsuite/arm_bl_out_of_range.s: Ditto.
9009 * testsuite/arm_branch_in_range.sh: Ditto.
9010 * testsuite/arm_branch_range.t: Ditto.
9011 * testsuite/thumb2_branch_range.t: Ditto.
9012 * testsuite/thumb_bl_in_range.s: Ditto.
9013 * testsuite/thumb_bl_out_of_range.s: Ditto.
9014 * testsuite/thumb_branch_range.t: Ditto.
9016 2010-02-20 Sriraman Tallam <tmsriram@google.com>
9018 * gc.h (gc_process_relocs): Change vectors to point to the new list.
9019 Add reloc offset information.
9020 * icf.cc (get_section_contents): Change iterators to point to the new
9021 vectors. Add reloc offset information to the contents.
9022 * icf.h (Icf::Sections_reachable_info): New typedef.
9023 (Icf::Sections_reachable_list): New typedef.
9024 (Icf::Offset_info): New typedef.
9025 (Icf::Reloc_info): New struct typedef.
9026 (Icf::Reloc_info_list): New typedef.
9027 (Icf::symbol_reloc_list): Delete method.
9028 (Icf::addend_reloc_list): Delete method.
9029 (Icf::section_reloc_list): Delete method.
9030 (Icf::reloc_info_list): New method.
9031 (Icf::reloc_info_list_): New member.
9033 2010-02-19 Doug Kwan <dougkwan@google.com>
9035 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9036 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9037 * arm.cc (Arm_relocation_functions): New forward declaration.
9038 (Target_arm::Target_arm): Initialize new data members
9039 got_mod_index_offset_ and tls_base_symbol_defined_.
9040 (Target_arm::Relocate::relocate_tls): New method.
9041 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9042 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9044 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9045 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9046 (Target_arm::got_mod_index_offset_,
9047 Target_arm::tls_base_symbol_defined_): New data members.
9048 (Target_arm::Scan::local, Target::Scan::global,
9049 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9052 2010-02-18 Doug Kwan <dougkwan@google.com>
9054 * arm.cc (Arm_relobj::find_linked_text_section): New method.
9055 (Arm_relobj::make_exidx_input_section): Pass section index of linked
9056 text section as a parameter becuase some broken tools may not set
9057 the link in section header.
9058 (Target_arm::has_got_section): New method.
9059 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9060 without any mapping symbol as data only. Remove warning.
9061 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9062 link in its section header, try to discover the link by inspecting the
9063 REL31 relocation at the beginning of the section.
9064 (Target_arm::Scan::check_non_pic): Report name of offending relocation
9066 (Target_arm::Scan::global): Treat any reference to the symbol
9067 _GLOBAL_OFFSET_TABLE_ as a GOT access.
9069 2010-02-12 Sriraman Tallam <tmsriram@google.com>
9071 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9072 (Scan::global_reloc_may_be_function_pointer): New function.
9073 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9074 (Scan::global_reloc_may_be_function_pointer): New function.
9075 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9076 (Scan::global_reloc_may_be_function_pointer): New function.
9077 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9078 (Scan::global_reloc_may_be_function_pointer): New function.
9079 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9080 (Scan::global_reloc_may_be_function_pointer): New function.
9081 (Scan::possible_function_pointer_reloc): New function.
9082 (Target_x86_64::can_check_for_function_pointers): New function.
9083 * gc.h (gc_process_relocs): Scan relocation types to determine if
9084 function pointers were taken for targets that support it.
9085 * icf.cc (Icf::find_identical_sections): Include functions for
9086 folding in safe ICF whose pointer is not taken.
9087 * icf.h (Secn_fptr_taken_set): New typedef.
9088 (fptr_section_id_): New member.
9089 (section_has_function_pointers): New function.
9090 (set_section_has_function_pointers): New function.
9091 (check_section_for_function_pointers): New function.
9092 * options.h: Fix comment for safe ICF option.
9093 * target.h (can_check_for_function_pointers): New function.
9094 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9095 Modify icf_safe_test for X86-64.
9096 * testsuite/Makefile.in: Regenerate.
9097 * testsuite/icf_safe_so_test.cc: New file.
9098 * testsuite/icf_safe_so_test.sh: New file.
9099 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9100 (main): Change to take pointer to function kept_func_3.
9101 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9102 folding is done correctly for X86-64.
9104 2010-02-12 David S. Miller <davem@davemloft.net>
9106 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9107 is_symbolless parameter.
9108 (Output_reloc<SHT_REL>::is_symbolless): New.
9109 (Output_reloc<SHT_REL>::is_symbolless_): New.
9110 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9111 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9112 (Output_reloc<SHT_RELA>::is_symbolless): New.
9113 (Output_data_reloc::add_global): Handle is_symbolless.
9114 (Output_data_reloc::add_global_relative): Likewise.
9115 (Output_data_reloc::add_local): Likewise.
9116 (Output_data_reloc::add_local_relative): Likewise.
9117 (Output_data_reloc::add_symbolless_global_addend): New.
9118 (Output_data_reloc::add_symbolless_local_addend): New.
9119 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9121 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9122 instead of ->is_relative_
9123 (Output_reloc::write): Likewise.
9124 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9125 (Output_reloc::write_rel): Simplify.
9127 * sparc.cc (Target_sparc::Scan::local): Use
9128 ->add_symbolless_local_addend as needed.
9129 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9130 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9131 based upon relocation offset.
9133 2010-02-11 Doug Kwan <dougkwan@google.com>
9135 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9136 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9137 beginning of function.
9138 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9139 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9140 parameter is_32bit in calls to should_apply_static_reloc.
9141 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9142 (check_DATA): Add arm_abs_global.stdout.
9143 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9144 arm_abs_global.stdout): New rules.
9145 (MOSTLLYCLEANFILES): Add arm_abs_global
9146 * Makefile.in: Regenerate.
9147 * testsuite/arm_abs_global.s: New file.
9148 * testsuite/arm_abs_global.sh: Ditto.
9149 * testsuite/arm_abs_lib.s: Ditto.
9151 2010-02-11 Ian Lance Taylor <iant@google.com>
9153 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9155 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9156 Allocate_commons_task first.
9157 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9158 task, rather than symtab_lock_.
9159 (Gc_process_relocs::~Gc_process_relocs): New function.
9160 (Gc_process_relocs::is_runnable): Check this_blocker_.
9161 (Gc_process_relocs::locks): Use next_blocker_ rather than
9163 (Scan_relocs::~Scan_relocs): New function.
9164 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9166 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9168 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9169 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9170 constructor accordingly.
9171 (class Gc_process_relocs): Likewise.
9172 (class Scan_relocs): Likewise.
9173 * common.h (class Allocate_commons_task): Remove symtab_lock_
9174 field, and corresponding constructor parameter.
9175 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9177 (Allocate_commons_task::locks): Likewise.
9179 2010-02-11 Ian Lance Taylor <iant@google.com>
9181 * gold-threads.h (class Once): Define.
9182 (class Initialize_lock): Rewrite as child of Once.
9183 * gold-threads.cc (class Once_initialize): Define.
9184 (once_pointer_control): New static variable.
9185 (once_pointer, once_arg): New static variables.
9186 (c_run_once): New static function.
9187 (Once::Once, Once::run_once, Once::internal_run): New functions.
9188 (class Initialize_lock_once): Remove.
9189 (initialize_lock_control): Remove.
9190 (initialize_lock_pointer): Remove.
9191 (initialize_lock_once): Remove.
9192 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9193 (Initialize_lock::initialize): Rewrite.
9194 (Initialize_lock::do_run_once): New function.
9195 * archive.cc (Archive::interpret_header): Only clear name if it is
9197 * fileread.cc: Include "gold-threads.h"
9198 (file_counts_lock): New static variable.
9199 (file_counts_initialize_lock): Likewise.
9200 (File_read::release): Only increment counts when using --stats.
9201 Use a lock around the increment.
9202 * parameters.cc (class Set_parameters_target_once): Define.
9203 (set_parameters_target_once): New static variable.
9204 (Parameters::Parameters): Move here from parameters.h.
9205 (Parameters::set_target): Rewrite.
9206 (Parameters::set_target_once): New function.
9207 (Parameters::clear_target): Move here and rewrite.
9208 * parameters.h (class Parameters): Update declarations. Add
9209 set_parameters_target_once_ field.
9210 (Parameters::Parameters): Move to parameters.cc.
9211 (Parameters::clear_target): Likewise.
9212 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9214 (Start_group::~Start_group): New function.
9215 (Start_group::is_runnable): New function.
9216 (Start_group::locks, Start_group::run): New functions.
9217 (Finish_group::run): Change saw_undefined to size_t.
9218 * readsyms.h (class Start_group): Define.
9219 (class Finish_group): Change saw_undefined_ field to size_t.
9220 (Finish_group::Finish_group): Remove saw_undefined and
9221 this_blocker parameters. Change all callers.
9222 (Finish_group::set_saw_undefined): New function.
9223 (Finish_group::set_blocker): New function.
9224 * symtab.h (class Symbol_table): Change saw_undefined to return
9225 size_t. Change saw_undefined_ field to size_t.
9226 * target-select.cc (Set_target_once::do_run_once): New function.
9227 (Target_selector::Target_selector): Initialize set_target_once_
9228 field. Don't initialize lock_ and initialize_lock_ fields.
9229 (Target_selector::instantiate_target): Rewrite.
9230 (Target_selector::set_target): New function.
9231 * target-select.h (class Set_target_once): Define.
9232 (class Target_selector): Update declarations. Make
9233 Set_target_once a friend. Remove lock_ and initialize_lock_
9234 fields. Add set_target_once_ field.
9236 2010-02-10 Ian Lance Taylor <iant@google.com>
9238 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9240 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9241 (queue_middle_tasks): Add all blockers before queueing any tasks.
9242 (queue_final_tasks): Likewise.
9243 * token.h (Task_token::add_blockers): New function.
9244 * object.h (Input_objects::number_of_relobjs): New function.
9246 2010-02-10 Ian Lance Taylor <iant@google.com>
9248 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9249 shared, not if not position independent.
9250 * x86_64.cc (Relocate::relocate_tls): Likewise.
9251 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9252 (tls_pie_pic_test): New target.
9253 * testsuite/Makefile.in: Rebuild.
9255 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9256 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9257 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9258 * testsuite/Makefile.in: Rebuild.
9260 2010-02-09 David S. Miller <davem@davemloft.net>
9262 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9263 R_SPARC_RELATIVE using ->add_local_relative().
9264 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9266 * output.h (Output_data_dynamic::add_section_size): New method
9267 that takes two Output_data objects.
9268 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9269 entry param. Handle it in initializers.
9270 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9271 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9272 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9274 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9275 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9276 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9277 for dynrel_includes_plt.
9278 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9279 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9280 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9282 (Target_sparc::do_finalize_sections): Update to pass true for
9283 dynrel_includes_plt.
9284 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9285 output before .rela.plt
9286 (Target_powerpc::do_finalize_sections): Update to pass true for
9287 dynrel_includes_plt when 32-bit.
9289 2010-02-08 Doug Kwan <dougkwan@google.com>
9291 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9293 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9294 Arm_relobj::scan_section_for_cortex_a8_stubs,
9295 Arm_relobj::do_relocation_section): Instead of calling
9296 Output_section::output_address, use faster
9297 Arm_relobj::simple_input_section_output_address.
9299 2010-02-08 David S. Miller <davem@davemloft.net>
9301 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9302 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9303 relocation helper function.
9305 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9306 just like R_SPARC_GOT{10,13,22}.
9307 (Target_sparc::Scan::local): Likewise.
9308 (Target_sparc::Relocate:relocate): Likewise.
9310 2010-02-06 Ian Lance Taylor <iant@google.com>
9312 * configure.ac: Rewrite targetobjs duplicate removal code to use
9313 only shell constructs.
9314 * configure: Rebuild.
9316 2010-02-05 Doug Kwan <dougkwan@google.com>
9319 * arm.cc (Arm_relobj::section_is_scannable): New method.
9320 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9321 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9323 2010-02-04 Doug Kwan <dougkwan@google.com>
9326 * arm-reloc-property.cc (cstdio): Include.
9327 * configure.ac (targetobjs): Remove duplicates.
9328 * configure: Regenerate.
9329 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9330 big and little endian version for a given address size.
9332 2010-02-03 Doug Kwan <dougkwan@google.com>
9334 * arm-reloc-property.cc
9335 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9337 * arm-reloc-property.h
9338 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9339 New method definition.
9340 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9342 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9344 (GOT_PREL): Change implemented to Y.
9345 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9346 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9347 (Arm_relocate_functions::movw_abs_nc): Remove method.
9348 (Arm_relocate_functions::movt_abs): Ditto.
9349 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9350 (Arm_relocate_functions::thm_movt_abs): Ditto.
9351 (Arm_relocate_functions::movw_rel_nc): Ditto.
9352 (Arm_relocate_functions::movw_rel): Ditto.
9353 (Arm_relocate_functions::movt_rel): Ditto.
9354 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9355 (Arm_relocate_functions:thm_movw_rel): Ditto.
9356 (Arm_relocate_functions:thm_movt_rel): Ditto.
9357 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9358 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9359 New method definitions.
9360 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9361 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9362 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9363 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9364 (Target_arm::Relocate::relocate): Check for non-static or
9365 unimplemented relocation code and exit early. Change calls to
9366 Target_arm::reloc_uses_thumb_bit and
9367 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9368 instead. Refactor code to handle similar relocations to increase
9369 code sharing. Remove check for unsupported relocation code in switch
9371 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9372 relocation property table to find out size. Change error message to
9373 print out the name of a relocation code instead of the numeric value.
9374 (Target_arm::scan_reloc_for_stub): Use relocation property table
9375 instead of calling Target_arm::reloc_uses_thumb_bit().
9377 2010-02-02 Doug Kwan <dougkwan@google.com>
9379 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9380 types of relaxed input section.
9382 2010-02-02 Doug Kwan <dougkwan@google.com>
9384 * Makefile.am (HFILES): Add arm-reloc-property.h.
9386 (TARGETSOURCES): Add arm-reloc-property.cc
9387 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9388 (libgold_a_SOURCES): $(DEFFILES)
9389 * Makefile.in: Regenerate.
9390 * arm-reloc-property.cc: New file.
9391 * arm-reloc-property.h: New file.
9392 * arm-reloc.def: New file.
9393 * arm.cc: Update comments.
9394 (arm-reloc-property.h): New included header.
9395 (arm_reloc_property_table): New global variable.
9396 (Target_arm::do_select_as_default_target): New method definition.
9397 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9398 arm-reloc-property to targ_extra_obj.
9399 * parameters.cc (set_parameters_target): Call
9400 Target::select_as_default_target().
9401 * target.h (Target::select_as_default_target): New method definition.
9402 (Target::do_select_as_default_target): Same.
9404 2010-02-01 Doug Kwan <dougkwan@google.com>
9406 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9407 first_output_text_section_.
9408 (Arm_exidx_fixup::first_output_text_section): New method definition.
9409 (Arm_exidx_fixup::first_output_text_section_): New data member.
9410 (Arm_exidx_fixup::process_exidx_section): Record the first text
9411 output section seen.
9412 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9413 and entsize in output section header.
9415 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9417 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9418 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9419 (Arm_relocate_functions::thm_alu11): New Method.
9420 (Arm_relocate_functions::thm_pc8): New Method.
9421 (Arm_relocate_functions::thm_pc12): New Method.
9422 (Target_arm::Scan::local): Handle the relocations.
9423 (Target_arm::Scan::global): Likewise.
9424 (Target_arm::Relocate::relocate): Likewise.
9425 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9427 2010-01-29 Doug Kwan <dougkwan@google.com>
9429 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9430 of relocation types as ld.
9432 2010-01-29 Doug Kwan <dougkwan@google.com>
9434 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9436 (Arm_relocate_functions::thumb_branch_common): Ditto.
9437 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9438 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9439 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9440 Arm_relocate_functions::jump24): Remove.
9441 (Target_arm::Relocate::relocate): Adjust code to call
9442 Arm_relocation_functions::arm_branch_common and
9443 Arm_relocation_functions::thumb_branch_common instead of their removed
9444 wrappers. Merge switch-cases together to reduce source code size.
9446 2010-01-29 Doug Kwan <dougkwan@google.com>
9448 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9449 output_local_symbol_count_needs_update_.
9450 (Arm_relobj::output_local_symbol_count_needs_update,
9451 Arm_relobj::set_output_local_symbol_count_needs_update,
9452 Arm_relobj::update_output_local_symbol_count): New methods.
9453 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9455 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9456 of pointed function as in a R_ARM_PREL31 relocation.
9457 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9458 for output local symbol count updating.
9459 (Target_arm::do_relax): Update output local symbol counts in objects
9461 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9463 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9465 * arm.cc: Added support for the ARM relocations:
9466 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9467 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9468 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9470 (Arm_relocate_functions::movw_rel): New method.
9471 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9472 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9474 (Arm_relocate_functions::thm_movw_rel): New method.
9475 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9477 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9479 (Target_arm::Scan::global): Likewise.
9480 (Target_arm::Relocate::relocate): Likewise.
9481 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9484 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9486 * arm.cc: Added support for ARM group relocations.
9487 (Target_arm::reloc_needs_sym_origin): New method.
9488 (Arm_relocate_functions::calc_grp_kn): New method.
9489 (Arm_relocate_functions::calc_grp_residual): New method.
9490 (Arm_relocate_functions::calc_grp_gn): New method.
9491 (Arm_relocate_functions::arm_grp_alu): New Method.
9492 (Arm_relocate_functions::arm_grp_ldr): New Method.
9493 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9494 (Arm_relocate_functions::arm_grp_ldc): New Method.
9495 (Target_arm::Scan::local): Handle the ARM group relocations.
9496 (Target_arm::Scan::global): Likewise.
9497 (Target_arm::Relocate::relocate): Likewise.
9498 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9501 2010-01-26 Doug Kwan <dougkwan@google.com>
9503 * arm.cc (set): Include.
9504 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9506 (Arm_output_section::Text_section_list): New type.
9507 (Arm_output_section::append_text_sections_to_list): New method.
9508 (Arm_output_section::fix_exidx_coverage): Ditto.
9509 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9510 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9511 Relobj::set_section_offset() instead of
9512 Sized_relobj::invalidate_section_offset().
9513 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9514 parameter for section headers. Ignore relocation sections for
9515 unallocated sections and EXIDX sections.
9516 (Target_arm::fix_exidx_coverage): New method.
9517 (Target_arm::output_section_address_less_than): New type.
9518 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9519 linked text section instead of the EXIDX section.
9520 (Arm_output_section::create_stub_group): Add an assertion to check
9521 that this is not an EXIDX output section.
9522 (Arm_output_section::append_text_sections_to_list): New method.
9523 (Arm_output_section::fix_exidx_coverage): Ditto.
9524 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9525 Arm_relobj::section_needs_reloc_stub_scanning.
9526 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9528 (Target_arm::fix_exidx_coverage): New method.
9529 * object.h (Relobj::set_output_section): New method.
9530 (Sized_relobj::invalidate_section_offset): Remove method.
9531 (Sized_relobj::do_invalidate_section_offset): Remove method.
9532 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9534 2010-01-25 Doug Kwan <dougkwan@google.com>
9536 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9537 Fix warning due to signed and unsigned comparison on a 32-bit host.
9539 2010-01-22 Doug Kwan <dougkwan@google.com>
9541 * arm.cc (Target_arm::do_relax): Record an output section for section
9542 offset adjustment it contains any stub table that has changed.
9543 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9544 offsets in an output section if necessary.
9545 * output.cc (Output_section::Output_section): Initialize
9546 section_offsets_need_adjustments_.
9547 (Output_section::add_input_section_for_script): Renamed to
9548 Output_section::add_simple_input_section.
9549 (Output_section::save_states): Add a comment.
9550 (Output_section::discard_states): New method defintion.
9551 (Output_section::adjust_section_offsets): Same.
9552 * output.h (Output_section::add_input_section_for_script): Renamed to
9553 Output_section::add_simple_input_section.
9554 (Output_section::discard_states): New method declaration.
9555 (Output_section::adjust_section_offsets): Same.
9556 (Output_section::section_offsets_need_adjustment,
9557 Output_section::set_section_offsets_need_adjustment): New method
9559 (Output_section::section_offsets_need_adjustment_): New data member.
9560 * script-sections.cc
9561 (Output_section_element_input::set_section_address): Adjust code for
9562 renaming of Output_section::add_input_section_for_script.
9563 (Orphan_output_section::set_section_address): Same.
9565 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9567 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9568 Fix_v4bx enum values .
9569 * gold/options.h (General_options): New option definitions.
9570 (General_options::fix_v4bx): New method.
9571 (General_options::Fix_v4bx): New enum.
9572 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9573 (General_options::parse_fix_v4bx_interworking): New method.
9575 2010-01-22 Doug Kwan <dougkwan@google.com>
9577 * arm.cc (Arm_exidx_fixup): New class.
9579 2010-01-21 Doug Kwan <dougkwan@google.com>
9581 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9583 (Arm_exidx_section_offset_map): New type.
9585 2010-01-21 Doug Kwan <dougkwan@google.com>
9587 * arm.cc (Arm_exidx_input_section): New class.
9588 (Arm_relobj::exidx_input_section_by_link,
9589 Arm_relobj::exidx_input_section_by_shndx,
9590 Arm_relobj::make_exidx_input_section): New methods.
9591 (read_arm_attributes_section): Remove.
9592 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9593 information about them.
9594 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9597 2010-01-20 Doug Kwan <dougkwan@google.com>
9599 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9600 Input_section_specifier to Section_id.
9601 (Target_arm::new_arm_input_section: Adjust code for change of key
9603 (Target_arm::find_arm_input_section): Ditto.
9604 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9605 (Section_id): Remove.
9606 (Garbage_collection::Section_id_hash): Remove.
9607 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9608 (Section_id): Remove.
9609 (Icf::Section_id_hash): Remove.
9610 * object.h (Section_id, Const_section_id, Section_id_hash,
9611 Const_section_id_hash): New type definitions.
9612 * output.cc (Output_section::add_relaxed_input_section): Change to
9613 use Const_section_id instead of Input_section_specifier as key type.
9614 (Output_section::add_merge_input_section): Ditto.
9615 (Output_section::build_relaxation_map): Change to use Section_id
9616 instead of Input_section_specifier as key type.
9617 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9619 (Output_section::convert_input_sections_to_relaxed_sections): Change
9620 to use Const_section_id instead of Input_section_specifier as key type.
9621 (Output_section::find_merge_section): Ditto.
9622 (Output_section::find_relaxed_input_section): Ditto.
9623 * output.h (Input_section_specifier): Remove class.
9624 (Output_section::Output_section_data_by_input_section_map): Change
9625 key type to Const_section_id.
9626 (Output_section::Output_relaxed_input_section_by_input_section_map):
9628 (Output_section::Relaxation_map): Change key type to Section_id.
9630 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9632 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9633 (class Arm_v4bx_stub): New class.
9634 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9635 (Stub_factory::make_arm_v4bx_stub): New method.
9636 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9637 (Stub_table::empty): Handle v4bx stubs.
9638 (Stub_table::add_arm_v4bx_stub): New method.
9639 (Stub_table::find_arm_v4bx_stub): New method.
9640 (Arm_relocate_functions::v4bx): New method.
9641 (Target_arm::fix_v4bx): New method.
9642 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9643 (Stub_table::relocate_stubs): Likewise.
9644 (Stub_table::do_write): Likewise.
9645 (Stub_table::update_data_size_and_addralign): Likewise.
9646 (Stub_table::finalize_stubs): Likewise.
9647 (Target_arm::Scan::local): Likewise.
9648 (Target_arm::Scan::global): Likewise.
9649 (Target_arm::do_finalize_sections): Likewise.
9650 (Target_arm::Relocate::relocate): Likewise.
9651 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9653 (Target_arm::scan_reloc_for_stub): Likewise.
9654 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9656 2010-01-19 Ian Lance Taylor <iant@google.com>
9658 * output.cc (Output_section_headers::do_sized_write): Write large
9659 segment count to sh_info field.
9660 (Output_file_header::do_sized_write): For large segment count,
9661 write PN_XNUM to e_phnum field.
9663 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9665 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9666 (Arm_relocate_functions::thm_jump8): New function.
9667 (Arm_relocate_functions::thm_jump11): New function.
9668 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9670 (Target_arm::Scan::global): Likewise.
9671 (Target_arm::Relocate::relocate): Likewise.
9672 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9675 2010-01-14 Doug Kwan <dougkwan@google.com>
9677 * arm.cc (map, utility): Include headers.
9678 (Target_arm::apply_cortex_a8_workaround): New method.
9679 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9680 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9681 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9682 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9683 the --[no-]fix-cortex-a8 command line options.
9684 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9685 (Target_arm::relocate_stub): Use addend in instruction template.
9686 * options.h (DEFINE_bool): Set the user-set flag.
9687 (General_options): Add --[no-]-fix-cortex options.
9688 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9689 : Update fast look-up map after conversion.
9691 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9693 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9694 in the first pass of do_layout.
9696 2010-01-13 Doug Kwan <dougkwan@google.com>
9698 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9699 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9700 apparent compiler problem of not folding static constant integral
9701 data members of elfcpp::Elf_sizes<32>.
9703 2010-01-13 Doug Kwan <dougkwan@google.com>
9705 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9706 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9707 Arm_relobj::scan_section_for_cortex_a8_erratum,
9708 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9709 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9710 sections to scan for relocation stubs into a new method
9711 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9712 relocation and Cortex-A8 stub scanning.
9713 (Target_arm::do_relax): Force stubs to be after stubbed sections
9714 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9715 the beginning of a new relaxation pass. Update a comment.
9716 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9718 2010-01-12 Ian Lance Taylor <iant@google.com>
9720 * target-reloc.h (visibility_error): New inline function.
9721 (relocate_section): Call visibility_error.
9722 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9723 (MOSTLYCLEANFILES): Likewise.
9724 (protected_4_pic.o, protected_3.err): New targets.
9725 * testsuite/protected_4.cc: New file.
9727 2010-01-12 Doug Kwan <dougkwan@google.com>
9729 * arm.cc (Cortex_a8_reloc): New class.
9730 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9731 and cortex_a8_relocs_info_.
9732 (Target_arm::fix_cortex_a8): New method definition.
9733 (Target_arm::Cortex_a8_relocs_info): New type.
9734 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9735 New data member declarations.
9736 (Target_arm::scan_reloc_for_stub): Record information about
9737 relocations for THUMB branches that might be exempted from the
9738 Cortex-A8 workaround.
9739 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9740 at the beginning of a relaxation pass.
9742 2010-01-12 Doug Kwan <dougkwan@google.com>
9744 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9745 (Arm_relobj::Mapping_symbol_position,
9746 Arm_reloj::Mapping_symbol_position_less,
9747 Arm_relobj::Mapping_symbols_info): New types.
9748 (Target_arm::is_mapping_symbol_name): New method definition.
9749 (Arm_relobj::do_count_local_symbols): Save information about mapping
9752 2010-01-11 Doug Kwan <dougkwan@google.com>
9754 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9755 Arm_relocate_functions::thumb32_branch_upper,
9756 Arm_relocate_functions::thumb32_branch_lower,
9757 Arm_relocate_functions::thumb32_cond_branch_offset,
9758 Arm_relocate_functions::thumb32_cond_branch_upper,
9759 Arm_relocate_functions::thumb32_cond_branch_lower,
9760 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9761 branch offset encoding.
9762 (Arm_relocate_functions::thumb_branch_common): Use new branch
9763 offset encoding methods to avoid code duplication.
9764 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9765 (Stub_addend_reader::operator()): Use new branch encoding method
9766 to avoid code duplication.
9768 2010-01-11 Doug Kwan <dougkwan@google.com>
9770 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9771 (Target_arm::do_finalize_sections): Define special EXIDX section
9772 symbols only if referenced.
9773 * gc.h (Garbage_collection::add_reference): New method.
9774 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9777 2010-01-11 Ian Lance Taylor <iant@google.com>
9779 * script.cc (Version_script_info::build_expression_list_lookup):
9780 Change complaing about duplicate wildcard match from error to
9783 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9785 (Version_script_info::Version_script_info): Initialize globs_,
9786 default_version_, default_is_global_, and exact_. Don't
9787 initialize globals_ or locals_.
9788 (Version_script_info::build_lookup_tables): Build local symbols
9790 (Version_script_info::unquote): New function.
9791 (Version_script_info::add_exact_match): New function.
9792 (Version_script_info::build_expression_list_lookup): Remove lookup
9793 parameter. Add is_global parameter. Change all callers. Handle
9794 wildcard pattern specially. Unquote pattern. Call
9796 (Version_script_info::get_name_to_match): New function.
9797 (Version_script_info::get_symbol_version): New function.
9798 (Version_script_info::get_symbol_version_helper): Remove.
9799 (Version_script_info::check_unmatched_names): Call unquote.
9800 * script.h (class Version_script_info): Change get_symbol_version
9801 to be non-inline and add is_global parameter; change all callers.
9802 Rewrite symbol_is_local. Update declarations. Define struct
9803 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9804 Remove globals_ and locals_ members. Add exact_, globs_,
9805 default_version_, is_global_.
9806 (Version_script_info::Glob): Remove pattern, add expression and
9807 is_global. Update constructor. Change all callers.
9808 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9810 (Versions::symbol_section_contents): If a symbol is undefined, or
9811 defined in a dynamic object, set the version index to
9813 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9815 (Symbol_table::add_from_pluginobj): Likewise.
9816 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9818 2010-01-11 Doug Kwan <dougkwan@google.com>
9820 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9821 (incremental_dump_LDADD): Add linking option for libintl.
9822 * Makefile.in: Regenerate.
9824 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9827 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9829 * testsuite/Makefile.in: Regenerated.
9831 2010-01-10 Doug Kwan <dougkwan@google.com>
9833 * options.h (DEFINE_var): Use parentheses around argument varname__
9834 in macro body to avoid any unintended subsequent substitutions.
9836 2010-01-10 Ian Lance Taylor <iant@google.com>
9838 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9839 candidates before doing symbol resolution.
9841 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9842 ODR candidates if only one is weak.
9844 2010-01-08 Ian Lance Taylor <iant@google.com>
9846 * script.cc (Version_script_info::build_expression_list_lookup):
9847 Don't warn about ambiguous version, just record the ambiguity.
9848 (Version_script_info::get_symbol_version_helper): Give error if
9849 version is ambiguous.
9851 2010-01-08 Doug Kwan <dougkwan@google.com>
9853 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9854 prev_data_size_ and prev_addralign_. Remove initializer for
9855 deleted data member has_been_changed_.
9856 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9857 to determine if the table is empty.
9858 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9860 (Stub_table::add_reloc_stub): Define method in class definition
9861 instead of just declaring it there.
9862 (Stub_table::add_cortex_a8_stub): New method definition.
9863 (Stub_table::update_data_size_and_addralign): Ditto.
9864 (Stub_table::finalize_stubs): Ditto.
9865 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9866 (Stub_table::do_addralign_): Return address alignment in the
9867 (Stub_table::do_reset_address_and_file_offset): Define method in
9868 class definition instead of declaring it there. Set current data
9869 size to be the data size of the previous pass.
9870 (Stub_table::set_final_data_size): Use current data size as the
9872 (Stub_table::relocate_stub): Change parameter type of stub from
9873 Reloc_stub pointer to Stub pointer.
9874 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9875 (Stub_table::Cortex_a8_stub_list): New typedef.
9876 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9877 Stub_table::prev_addralign_): New data member.
9878 (Arm_relobj::Arm_relobj): Initialize data member
9879 section_has_cortex_a8_workaround_.
9880 (Arm_relobj::section_has_cortex_a8_workaround,
9881 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9883 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9885 (Target_arm::relocate_stub): Change parameter type of stub from
9886 Reloc_stub pointer to Stub pointer.
9887 (Insn_template::size, Insn_template::alignment): Handle
9888 THUMB16_SPECIAL_TYPE.
9889 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9890 Stub_table::update_data_size_and_addralign,
9891 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9893 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9894 (Stub_table::do_write): Ditto.
9895 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9897 2010-01-08 Ian Lance Taylor <iant@google.com>
9900 * symtab.h (class Symbol): Remove fields is_target_special_ and
9901 has_plt_offset_. Add field is_defined_in_discarded_section_.
9902 (Symbol::is_defined_in_discarded_section): New function.
9903 (Symbol::set_is_defined_in_discarded_section): New function.
9904 (Symbol::has_plt_offset): Rewrite.
9905 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9906 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9907 Don't initialize is_target_special_ or has_plt_offset_.
9908 Initialize is_defined_in_discarded_section_.
9909 (Symbol_table::add_from_relobj): If appropriate, set
9910 is_defined_in_discarded_section.
9911 * resolve.cc (Symbol::override_base_with_special): Don't test
9912 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9913 * target-reloc.h (relocate_section): Do special handling for
9914 symbols defined in discarded sections for global symbols as well
9917 2010-01-08 Ian Lance Taylor <iant@google.com>
9919 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9920 the SHT_SYMTAB case.
9922 2010-01-08 Ian Lance Taylor <iant@google.com>
9924 * object.cc (Sized_relobj::do_layout): Don't get confused if
9925 layout_eh_frame returns NULL.
9927 2010-01-08 Ian Lance Taylor <iant@google.com>
9930 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9931 dynamic symbol table, use the normal symbol table.
9932 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9935 2010-01-08 Ian Lance Taylor <iant@google.com>
9938 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9941 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9943 * version.cc (print_version): Change to "Copyright 2010".
9945 2010-01-08 Ian Lance Taylor <iant@google.com>
9949 * i386.cc (class Target_i386): Change return type of plt_section
9951 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9952 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9953 tls_desc_rel_ field.
9954 (Output_data_plt_i386::rel_tls_desc): New function.
9955 (Target_i386::rel_tls_desc_section): New function.
9956 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9957 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9958 R_386_TLS_DESC reloc in rel_tls_desc_section.
9959 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9960 Define struct Tlsdesc_info.
9961 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9962 (Target_x86_64::do_reloc_symbol_index): New function.
9963 (Target_x86_64::add_tlsdesc_info): New function.
9964 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9965 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9967 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9969 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9970 (Target_x86_64::rela_tlsdesc_section): New function.
9971 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9973 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9974 (Target_x86_64::do_reloc_addend): New function.
9975 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9976 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9977 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9978 (Output_reloc::type): New function.
9979 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9980 (Output_reloc::is_target_specific): New function.
9981 (Output_reloc::target_arg): New function.
9982 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9983 absolute relocs and target specific relocs.
9984 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9985 add_target_specific.
9986 (class Output_data_reloc) [SHT_RELA]: Likewise.
9987 * output.cc (Output_reloc::Output_reloc): Add four new versions
9988 for absolute relocs and target specific relocs.
9989 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9990 (Output_reloc::get_symbol_index): Likewise.
9991 (Output_reloc::local_section_offset): Check that local_sym_index_
9992 is not TARGET_CODE or 0.
9993 (Output_reloc::symbol_value): Likewise.
9994 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9996 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9997 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9999 * layout.cc (add_target_dynamic_tags): Use output section for
10000 DT_PLTRELSZ and DT_JMPREL.
10002 2010-01-07 Ian Lance Taylor <iant@google.com>
10005 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10007 (class Output_data_reloc_generic): Define.
10008 (class Output_data_reloc_base): Change base class to
10009 Output_data_reloc_generic. Change add() method to call
10010 bump_relative_reloc_count for a relative reloc. Remove
10011 sort_relocs_ field.
10012 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10014 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10015 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
10017 * layout.h (class Layout): Update declaration.
10019 2010-01-07 Ian Lance Taylor <iant@google.com>
10021 * output.h (class Output_data): Add const version of
10022 output_section and do_output_section.
10023 (class Output_section_data): Add const version of
10025 (class Output_section): Likewise.
10026 * layout.cc (Layout::add_target_dynamic_tags): New function.
10027 * layout.h (class Layout): Update declarations.
10028 * arm.cc (Target_arm::do_finalize_sections): Use
10029 add_target_dynamic_tags.
10030 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10031 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10032 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10033 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10035 2010-01-07 Ian Lance Taylor <iant@google.com>
10038 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10041 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
10042 Ian Lance Taylor <iant@google.com>
10045 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10046 Xindex::read_symtab_xindex.
10048 2010-01-07 Doug Kwan <dougkwan@google.com>
10050 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10051 (Insn_template::thumb16_bcond_insn): New method declaration.
10052 (Insn_template): Fix spelling.
10053 (Stub::thumb16_special): New method declaration.
10054 (Stub::do_write): Define virtual method which was previously pure
10056 (Stub::do_thumb16_special): New method declaration.
10057 (Stub::do_fixed_endian_write): New template member.
10058 (Reloc_stub::do_write): Remove.
10059 (Reloc_stub::do_fixed_endian_write): Remove.
10060 (Cortex_a8_stub): New class definition.
10061 (Stub_factory::make_cortex_a8_stub): New method definition.
10062 (Stub_factory::Stub_factory): Add missing static storage class
10063 qualifier for elf32_arm_stub_a8_veneer_blx.
10065 2010-01-07 Ian Lance Taylor <iant@google.com>
10068 * options.h (class General_options): Add --warn-unresolved-symbols
10069 and --error-unresolved-symbols.
10070 * errors.cc (Errors::undefined_symbol): Implement
10071 --warn-unresolved-symbols.
10073 * options.h (class General_options): Add -z text and -z textoff.
10074 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10076 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10078 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10079 (Garbage_collection::cident_sections): New function.
10080 (Garbage_collection::add_cident_section): New function.
10081 (Garbage_collection::cident_sections_): New member.
10082 (gc_process_relocs): Add references to sections whose names are C
10084 * gold.h (cident_section_start_prefix): New constant.
10085 (cident_section_stop_prefix): New constant.
10086 (is_cident): New function.
10087 * layout.cc (Layout::define_section_symbols): Replace string constants
10088 with the newly defined constants.
10089 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10091 * testsuite/Makefile.am: Add gc_orphan_section_test.
10092 * testsuite/Makefile.in: Regenerate.
10093 * testsuite/gc_orphan_section_test.cc: New file.
10094 * testsuite/gc_orphan_section_test.sh: New file.
10096 2010-01-06 Ian Lance Taylor <iant@google.com>
10099 * options.h (class General_options): Add --warn-shared-textrel.
10100 * layout.cc (Layout::finish_dynamic_section): Implement
10101 --warn-shared-textrel.
10104 * options.h (class General_options): Add --warn-multiple-gp.
10106 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10108 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10109 $(THREADSLIB) and $(LIBDL).
10110 * Makefile.in: Rebuild.
10112 2010-01-06 Ian Lance Taylor <iant@google.com>
10115 * options.cc (General_options::parse_section_start): New function.
10116 (General_options::section_start): New function.
10117 (General_options::General_options): Initialize all members.
10118 * options.h: Include <map>
10119 (class General_options): Add --section-start. Add section_starts_
10121 * layout.cc (Layout::attach_allocated_section_to_segment): If
10122 --section-start was used, set the address of the segment. Remove
10123 local sort_sections.
10124 (Layout::relaxation_loop_body): If the address of the load segment
10125 has been set by --section-start, don't use it.
10126 * output.h (Output_segment::update_flags_for_output_section): New
10128 * output.cc (Output_segment::add_output_section): Call
10129 update_flags_for_output_section.
10131 2010-01-05 Ian Lance Taylor <iant@google.com>
10134 * options.h (class General_options): Add --undefined-version.
10135 * script.cc (struct Version_expression): Add was_matched_by_symbol
10137 (Version_script_info::matched_symbol): New function.
10138 (Version_script_info::get_symbol_version_helper): Call
10140 (Version_script_info::check_unmatched_names): New function.
10141 * script.h (class Version_script_info): Update declarations.
10142 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10144 * options.h (class General_options): Use DEFINE_bool_alias for
10145 allow_multiple_definition.
10146 * resolve.cc (Symbol_table::should_override): Don't test
10147 allow_multiple_definition.
10150 * options.h (class General_options): Add --cref.
10151 * main.cc (main): Print cref table if --cref. Don't close mapfile
10152 until after printing cref table.
10153 * cref.cc: Include "symtab.h".
10154 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10155 (Cref_table_compare::operator()): New function.
10156 (Cref_inputs::gather_cref): New function.
10157 (filecol): New static const.
10158 (Cref_inputs::print_cref): New function.
10159 (Cref::print_cref): New function.
10160 * cref.h: Include <cstdio>.
10161 (class Cref): Update declarations.
10162 * mapfile.h (Mapfile::file): New function.
10163 * object.h (class Object): Define Symbols. Declare virtual
10164 do_get_global_symbols.
10165 (Object::get_global_symbols): New function.
10166 * object.cc (Input_objects::add_object): Pass object to cref_ if
10168 (Input_objects::archive_start): Likewise.
10169 (Input_objects::archive_stop): Likewise.
10170 (Input_objects::print_cref): New function.
10171 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10172 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10174 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10176 * plugin.h (class Sized_pluginobj): Update declarations.
10178 2010-01-05 Ian Lance Taylor <iant@google.com>
10180 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10181 to is_default_version. Rename insdef to insdefault.
10182 (Symbol_table::add_from_relobj): Rename def to is_default_version
10183 and local to is_forced_local.
10184 (Symbol_table::add_from_pluginobj): Likewise.
10185 (Symbol_table::add_from_dynobj): Likewise.
10186 (Symbol_table::define_special_symbol): Rename insdef to
10189 2010-01-04 Ian Lance Taylor <iant@google.com>
10192 * options.h (class General_options): Add
10193 --allow-multiple-definition and -z muldefs.
10194 * resolve.cc (Symbol_table::should_override): Don't warn about a
10195 multiple symbol definition if --allow-multiple-definition or -z
10199 * options.h (class General_options): Add --add-needed and
10200 --copy-dt-needed-entries. Tweak --as-needed help entry.
10201 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10202 error if --copy-dt-needed-entries aka --add-needed is used and
10203 would cause a change in behaviour.
10206 * options.h (class General_options): Add -G as a short version of
10207 --shared. Add no-op options -assert, -g, and -i.
10209 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10211 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10212 check for .text or .gnu.linkonce.t sections.
10213 * icf.cc (Icf::find_identical_sections): Ditto.
10214 Change the detection for mangled function name within the section
10216 * icf.h (is_section_foldable_candidate): New function.
10218 2009-12-30 Ian Lance Taylor <iant@google.com>
10221 * options.h (class General_options): Permit two dashes with
10222 --retain-symbols-file.
10224 2009-12-30 Ian Lance Taylor <iant@google.com>
10227 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10228 don't put the file header and segment headers in the text
10232 * common.cc (Sort_commons::operator()): Stabilize sort when both
10234 (Symbol_table::do_allocate_commons_list): When allocating common
10235 symbols, skip a symbol which is no longer common.
10236 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10237 an object before checking its type.
10238 * testsuite/common_test_2.c: New file.
10239 * testsuite/common_test_3.c: New file.
10240 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10241 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10242 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10243 (common_test_2_pic.o, common_test_2.so): New targets.
10244 (common_test_3_pic.o, common_test_3.so): New targets.
10245 * testsuite/Makefile.in: Rebuild.
10248 * script.cc (read_input_script): If we see a new SECTIONS clause,
10249 and we have added an input section, give an error.
10250 * layout.h (class Layout): Add have_added_input_section function.
10251 Add have_added_input_section_ field.
10252 * layout.cc (Layout::Layout): Initialize
10253 have_added_input_section_.
10254 (Layout::layout): Set have_added_input_section_.
10255 (Layout::layout_eh_frame): Likewise.
10257 2009-12-30 Ian Lance Taylor <iant@google.com>
10260 * options.h (class General_options): Add --sort-common option.
10261 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10262 * common.cc (Sort_common): Add sort_order parameter to
10263 constructor. Add sort_order_ field.
10264 (Sort_commons::operator): Check sort_order_.
10265 (Symbol_table::allocate_commons): Determine the sort order.
10266 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10267 Change all callers.
10268 (Symbol_table::do_allocate_commons_list): Likewise.
10270 2009-12-30 Ian Lance Taylor <iant@google.com>
10273 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10274 symbols from this object, don't change the visibility of an
10276 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10278 2009-12-30 Ian Lance Taylor <iant@google.com>
10281 * script.h (class Version_script_info): Define Language enum.
10282 Update declarations. Define Glob, Exact, and Lookup types. Add
10283 new fields globals_, locals_, and is_finalized_.
10284 * script.cc: Various formatting fixes.
10285 (class Parser_closure): Change language_stack_ from a vector of
10286 std::string to one of Version_script_info::Language. Adjust all
10288 (class Lazy_demangler): Remove.
10289 (struct Version_expression): Change language from std::string to
10290 Version_script_info::Language.
10291 (Version_script_info::Version_script_info): New function.
10292 (Version_script_info::~Version_script_info): Don't call clear.
10293 (Version_script_info::finalize): New function.
10294 (Version_script_info::build_lookup_tables): New function.
10295 (Version_script_info::build_expression_list_lookup): New
10297 (Version_script_info::get_symbol_version_helper): Rewrite to use
10299 (Version_script_info::print_expression_list): Adjust to use
10300 Version_script_info::Language.
10301 (script_push_lex_into_version_mode): Check that the version script
10302 has not been finalized.
10303 (version_script_push_lang): Change language string to
10304 Version_script_info::Language.
10305 * options.cc (Command_line::version_script): New function.
10306 * options.h (class General_options): Add finalize_dynamic_list
10307 function. Change version_script from declaration to definition.
10308 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10309 * testsuite/version_script.map: Remove duplicate def of foo.
10310 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10311 version_script.map.
10312 * testsuite/Makefile.in: Rebuild.
10314 2009-12-30 Ian Lance Taylor <iant@google.com>
10317 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10318 if the input symbol index is 0, make the output symbol index 0.
10320 2009-12-30 Ian Lance Taylor <iant@google.com>
10323 * options.h (class General_options): Add -x/--discard-all.
10324 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10325 --discard-all. If the local symbol needs a dynamic entry, check
10326 that before handling --discard-locals.
10328 2009-12-30 Ian Lance Taylor <iant@google.com>
10331 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10333 (Output_segment::add_output_section): Don't change the flags if
10334 the type is PT_TLS.
10337 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10338 GNU hash table if they need a dynamic value. Otherwise, don't add
10339 them if they are defined in a dynamic object or are forced local.
10341 2009-12-29 Ian Lance Taylor <iant@google.com>
10344 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10345 .gnu.hash table for a 32-bit target.
10348 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10349 regular and a dynamic object only needs a dynamic symbol table
10350 entry if it is externally visible.
10353 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10354 constructor. Add global_offset_table_ field.
10355 (Target_i386::got_section): Set global_offset_table_.
10356 (Target_i386::do_finalize_sections): Set global_offset_table_
10358 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10359 in constructor. Add global_offset_table_ field.
10360 (Target_x86_64::got_section): Set global_offset_table_.
10361 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10364 * layout.cc (Layout::Layout): Initialize increase_relro_.
10365 (Layout::get_output_section): Add is_relro, is_last_relro, and
10366 is_first_non_relro parameters. Change all callers.
10367 (Layout::choose_output_section): Likewise.
10368 (Layout::add_output_section_data): Likewise.
10369 (Layout::make_output_section): Likewise.
10370 (Layout::set_segment_offsets): Clear increase_relro when using a
10372 * layout.h (class Layout): Add increase_relro method. Add
10373 increase_relro_ field. Update declarations.
10374 * output.cc (Output_section::Output_section): Initialize
10375 is_last_relro_ and is_first_non_relro_.
10376 (Output_segment::add_output_section): Group relro sections is
10377 do_sort is true. Handle is_last_relro and is_first_non_relro.
10378 (Output_segment::maximum_alignment): Remove relro handling.
10379 (Output_segment::set_section_addresses): Add increase_relro
10380 parameter. Change all callers. Add initial alignment to align
10381 relro sections on separate page. Remove old relro handling.
10382 (Output_segment::set_section_list_addresses): Remove in_relro
10383 parameter. Change all callers.
10384 (Output_segment::set_offset): Add increase parameter. Change all
10385 callers. Remove old relro handling.
10386 * output.h (class Output_section): Add new methods: is_last_relro,
10387 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10388 Add is_last_relro_ and is_first_non_relro_ fields.
10389 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10390 Create separate .got.plt section. Call increase_relro.
10391 * x86_64.cc (Target_x86_64::got_section): Likewise.
10392 * testsuite/relro_script_test.t: Add .got.plt.
10395 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10396 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10397 (Layout::finalize): Call set_dynamic_symbol_size.
10398 (Layout::set_dynamic_symbol_size): New function.
10399 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10400 set_dynamic_symbol_size.
10403 * output.h (class Output_section): Add is_entsize_zero_ field.
10404 * output.cc (Output_section::Output_section): Initialize
10406 (Output_section::set_entsize): If two different entsizes are
10407 requested, force it to zero.
10408 (Output_section::add_input_section): Set flags for .debug_str
10409 before updating section flags. Set entsize.
10410 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10411 and SHF_STRING if all input sections have those flags.
10413 2009-12-29 Rafael Espindola <espindola@google.com>
10415 * main.cc (main): Fix the sys time reporting.
10416 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10419 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10421 * options.cc (General_options::parse_version): Allow -v to exit
10422 without an error if there is nothing to link.
10424 2009-12-29 Ian Lance Taylor <iant@google.com>
10426 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10427 using a version of gcc before 4.1.
10428 * configure: Rebuild.
10430 2009-12-28 Chris Demetriou <cgd@google.com>
10432 * attributes.cc (Output_attributes_section_data::do_write): Use
10433 std::vector::front rather than std::vector::data.
10435 2009-12-28 Ian Lance Taylor <iant@google.com>
10437 * symtab.h (class Symbol_table): Add enum Defined.
10438 * resolve.cc (Symbol_table::should_override): Add defined
10439 parameter. Change all callers. Test whether object is NULL
10440 before calling a method on it.
10441 (Symbol_table::report_resolve_problem): Add defined parameter.
10442 Change all callers.
10443 (Symbol_table::should_override_with_special): Likewise.
10444 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10445 parameter. Change all callers.
10446 (Symbol_table::do_define_in_output_data): Likewise.
10447 (Symbol_table::define_in_output_segment): Likewise.
10448 (Symbol_table::do_define_in_output_segment): Likewise.
10449 (Symbol_table::define_as_constant): Likewise.
10450 (Symbol_table::do_define_as_constant): Likewise.
10451 * script.h (class Symbol_assignment): Add is_defsym parameter to
10452 constructor; change all callers.
10453 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10454 parameter. Change all callers. Add is_defsym_ field.
10455 (class Parser_closure): Add parsing_defsym parameter to
10456 constructor; change all callers. Add parsing_defsym accessor
10457 function. Add parsing_defsym_ field.
10459 2009-12-28 Ian Lance Taylor <iant@google.com>
10461 * gold.cc (queue_middle_tasks): Fix formatting.
10462 * object.cc (Relobj::is_section_name_included): Likewise.
10464 2009-12-23 Ian Lance Taylor <iant@google.com>
10466 * i386.cc (Target_i386::do_calls_non_split): Recognize
10467 -fsplit-stack prologue for a function with a static chain.
10468 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10469 -fsplit-stack prologue when using %r11.
10471 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10473 * options.cc (General_options::parse_version): Make -v continue and do
10474 the link like GNU ld does.
10476 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10478 * Makefile.am (CCFILES): Add timer.cc.
10479 (HFILES): Add timer.h.
10480 * configure.ac: Check for sysconf and times.
10481 * main.cc: include timer.h.
10482 (main): Use Timer instead of get_run_time.
10485 * workqueue.cc: include timer.h.
10486 (Workqueue::find_and_run_task):
10487 Report user, sys and wall time.
10488 * Makefile.in: Regenerate.
10489 * config.in: Regenerate.
10490 * configure: Regenerate.
10492 2009-12-16 Doug Kwan <dougkwan@google.com>
10494 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10496 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10497 relaxed input sections.
10498 * output.cc (Output_section::find_relaxed_input_section): Change
10499 return type to Output_relaxed_input_section pointer. Adjust code
10500 for new type of relaxed_input_section_map_.
10501 * output.h (Output_section::find_relaxed_input_section): Change
10502 return type to Output_relaxed_input_section pointer.
10503 (Output_section::Output_relaxed_input_section_by_input_section_map):
10505 (Output_section::relaxed_input_section_map_): Change type to
10506 Output_section::Output_relaxed_input_section_by_input_section_map.
10507 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10510 2009-12-15 Ian Lance Taylor <iant@google.com>
10512 * layout.cc (Layout::create_shstrtab): Only write out after input
10513 sections if we are compressing debug sections.
10515 2009-12-15 Ian Lance Taylor <iant@google.com>
10517 * archive.cc (Archive::add_symbols): Only look up a symbol without
10518 a version if there is, in fact, a version.
10520 2009-12-14 Ian Lance Taylor <iant@google.com>
10522 Revert -Wshadow changes, all changes from:
10523 2009-12-11 Doug Kwan <dougkwan@google.com>
10524 2009-12-11 Nick Clifton <nickc@redhat.com>
10525 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10527 2009-12-11 Doug Kwan <dougkwan@google.com>
10529 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10531 * attributes.cc (Object_attribute::size): Ditto.
10532 (Attributes_section_data::size): Ditto.
10533 (Attributes_section_data::Attributes_section_data): Ditto.
10534 (Output_attributes_section_data::do_write): Ditto.
10535 * attributes.h (Object_attribute::set_type): Ditto.
10536 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10538 2009-12-11 Nick Clifton <nickc@redhat.com>
10540 * archive.cc: Fix shadowed variable warnings.
10541 * arm.cc: Likewise.
10542 * compressed_output.cc: Likewise.
10543 * compressed_output.h: Likewise.
10544 * configure: Likewise.
10545 * dwarf_reader.cc: Likewise.
10546 * dynobj.cc: Likewise.
10547 * dynobj.h: Likewise.
10548 * ehframe.cc: Likewise.
10549 * ehframe.h: Likewise.
10550 * errors.cc: Likewise.
10551 * expression.cc: Likewise.
10552 * fileread.cc: Likewise.
10553 * fileread.h: Likewise.
10554 * freebsd.h: Likewise.
10555 * i386.cc: Likewise.
10556 * icf.cc: Likewise.
10557 * incremental.h: Likewise.
10558 * layout.cc: Likewise.
10559 * layout.h: Likewise.
10560 * mapfile.cc: Likewise.
10561 * merge.cc: Likewise.
10562 * merge.h: Likewise.
10563 * object.cc: Likewise.
10564 * object.h: Likewise.
10565 * options.h: Likewise.
10566 * output.cc: Likewise.
10567 * output.h: Likewise.
10568 * parameters.cc: Likewise.
10569 * plugin.cc: Likewise.
10570 * powerpc.cc: Likewise.
10571 * reduced_debug_output.cc: Likewise.
10572 * reduced_debug_output.h: Likewise.
10573 * reloc.cc: Likewise.
10574 * reloc.h: Likewise.
10575 * resolve.cc: Likewise.
10576 * script-sections.cc: Likewise.
10577 * script.cc: Likewise.
10578 * script.h: Likewise.
10579 * sparc.cc: Likewise.
10580 * symtab.cc: Likewise.
10581 * symtab.h: Likewise.
10582 * target-select.cc: Likewise.
10583 * target-select.h: Likewise.
10584 * token.h: Likewise.
10585 * workqueue.cc: Likewise.
10586 * workqueue.h: Likewise.
10587 * x86_64.cc: Likewise.
10589 2009-12-10 Doug Kwan <dougkwan@google.com>
10591 * arm.cc (attributes.h): New include.
10592 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10593 (Arm_relobj::~Arm_relobj): Delete object pointed by
10594 attributes_section_data_.
10595 (Arm_relobj::attributes_section_data): New method definition.
10596 (Arm_relobj::attributes_section_data_): New data member declaration.
10597 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10598 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10599 attributes_section_data_.
10600 (Arm_dynobj::attributes_section_data): New method definition.
10601 (Arm_dynobj::attributes_section_data_): New data member declaration.
10602 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10603 initialization value of may_use_blx_ to false.
10604 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10605 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10606 object attributes to compute results instead of hard-coding.
10607 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10608 Target_arm::get_secondary_compatible_arch,
10609 Target_arm::set_secondary_compatible_arch
10610 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10611 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10612 New method declarations.
10613 (Target_arm::get_aeabi_object_attribute): New method definition.
10614 (Target_arm::attributes_section_data_): New data member declaration.
10615 (read_arm_attributes_section): New template definition.
10616 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10617 (Arm_dynobj::do_read_symbols): Ditto.
10618 (Target_arm::do_finalize_sections): Merge attributes sections from
10619 input. Check for BLX use after attributes section merging.
10620 Fix __exidx_start and __exidx_end visibility. Create an
10621 .ARM.attributes section if necessary.
10622 (Target_arm::get_secondary_compatible_arch,
10623 Target_arm::set_secondary_compatible_arch,
10624 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10625 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10626 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10627 New method definitions.
10629 2009-12-09 Ian Lance Taylor <iant@google.com>
10631 * plugin.cc (Plugin::load): Don't cast from void* to a function
10634 2009-12-09 Ian Lance Taylor <iant@google.com>
10636 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10637 information fields.
10639 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10641 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10642 Replace two_file_shared_1.so with two_file_shared_2.so.
10643 * testsuite/Makefile.in: Regenerated.
10645 2009-12-08 Doug Kwan <dougkwan@google.com>
10647 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10648 (HFILES): Add attributes.h and int_encoding.h.
10649 * Makefile.in: Regenerate.
10650 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10651 function definitions to int_encoding.cc
10652 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10653 prototypes to int_encoding.h
10654 * reduced_debug_output.cc (int_encoding.h): New include.
10655 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10656 function definitions to int_encoding.cc
10657 (insert_into_vector, read_from_pointer): Move template definitions to
10659 * attributes.cc: New file.
10660 * attributes.h: New file.
10661 * int_encoding.cc: New file.
10662 * int_encoding.h: New file.
10664 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10667 * incremental-dump.cc (dump_incremental_inputs): New.
10668 (main): Use dump_incremental_inputs.
10670 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10673 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10674 checking elfcpp::STT_FUNC.
10675 (Target_i386::Relocate::relocate): Likewise.
10676 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10678 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10679 symbols from shared libraries into normal FUNC symbols.
10681 * symtab.h (Symbol): Add is_func and use it.
10683 2009-12-05 Doug Kwan <dougkwan@google.com>
10685 * arm.cc (Target_arm::arm_info): Initialize new fields
10686 attributes_section and attributes_vendor.
10687 * i386.cc (Target_i386::i386_info): Same.
10688 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10689 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10690 fields attributes_section and attributes_vendor.
10691 * sparc.cc (Target_sparc::sparc_info): Same.
10692 * target.h (Target::attributes_section, Target::attributes_vendor,
10693 Target::is_attributes_section, Target::attribute_arg_type,
10694 Target::attributes_order): New method definitions.
10695 (Target::Target_info::attributes_section,
10696 Target::Target_info::attributes_vendor): New fields.
10697 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10698 virtual method definitions.
10699 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10700 attributes_section and attributes_vendor.
10701 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10703 2009-12-05 Doug Kwan <dougkwan@google.com>
10705 * arm.cc: Update comments about interworking and stub generation.
10706 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10707 considered as non-PIC.
10708 (Arm_relocate_functions::base_abs): Fix formatting.
10709 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10710 of function to use GOT entry address instead of offset.
10711 (Target_arm::Scan::global): Issue an error if a symbol would need a
10712 PLT does not get one because it is untyped. Remove code to create
10713 dynamic symbols for relative branches.
10714 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10715 takes unsigned integer instead of boolean.
10717 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10719 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10720 (two_file_test_LDADD): Likewise.
10721 (common_test_1_LDADD): Likewise.
10722 (exception_test_LDADD) Likewise.
10723 (weak_test_LDADD): Likewise.
10724 (many_sections_test_LDADD): Likewise.
10725 (initpri1_LDADD): Likewise.
10726 (script_test_1_LDADD): Likewise.
10727 (script_test_2_LDADD): Likewise.
10728 (justsyms_LDADD): Likewise.
10729 (binary_test_LDADD): Likewise.
10730 (large_LDADD): Likewise.
10731 * testsuite/Makefile.in: Regenerated.
10733 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10735 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10736 (Symbol_table::override_with_special): Likewise.
10737 (Symbol_table::add_from_object): Likewise.
10739 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10741 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10742 Don't set the data_offset twice.
10744 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10746 * testsuite/Makefile.in: Regenerate.
10748 2009-12-03 Doug Kwan <dougkwan@google.com>
10750 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10751 (Target_arm::do_finalize_sections): Add parameter for symbol table
10752 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10753 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10754 parameter for symbol table pointer.
10755 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10756 an additional parameter for a pointer to symbol table.
10757 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10758 parameter for a symbol table pointer.
10759 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10760 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10762 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10763 parameter for a symbol table pointer.
10765 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10767 * incremental.cc (Incremental_inputs_header)
10768 (Incremental_inputs_header_write, Incremental_inputs_entry)
10769 (Incremental_inputs_entry_write): Move ...
10770 * incremental.h (Incremental_inputs_header)
10771 (Incremental_inputs_header_write, Incremental_inputs_entry)
10772 (Incremental_inputs_entry_write): here.
10774 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10776 * incremental.cc (make_sized_incremental_binary): Set the target.
10777 Error if it is incompatible.
10778 * output.h (Output_file): Add filename method.
10780 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10782 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10783 from the get_* methods.
10785 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10787 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10788 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10789 Write 0 for the data_offset of scripts.
10791 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10793 * testsuite/Makefile.am: Add the incremental_test.sh test.
10794 * testsuite/incremental_test.sh: New.
10795 * testsuite/incremental_test_1.c: New.
10796 * testsuite/incremental_test_2.c: New.
10798 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10800 * incremental-dump.cc (main): Fix typos.
10802 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10805 * incremental-dump.cc (main): Use llu to print 64 bit values.
10807 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10808 H.J. Lu <hongjiu.lu@intel.com>
10810 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10812 (incremental_dump_LDADD): Likewise.
10813 * Makefile.in: Regenerated.
10815 2009-11-25 Doug Kwan <dougkwan@google.com>
10819 2009-11-25 Doug Kwan <dougkwan@google.com>
10821 * arm.cc (Target_arm::Target_arm): Move method definition
10822 outside of class definition. Add code to handle
10823 --target1-rel, --target1-abs and --target2= options.
10824 (Target_arm::get_reloc_reloc_type): Change method to be
10825 non-static and const.
10826 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10827 New data member declaration.
10828 (Target_arm::Scan::local, Target_arm::Scan::global,
10829 Target_arm::Relocate::relocate,
10830 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10831 Adjust call to Target_arm::get_real_reloc_type.
10832 (Target_arm::get_real_reloc_type): Use command line options
10833 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10834 * options.h (--target1-rel, --target1-abs, --target2): New
10837 2009-11-25 Doug Kwan <dougkwan@google.com>
10839 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10840 class definition. Add code to handle --target1-rel, --target1-abs
10841 and --target2= options.
10842 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10844 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10845 member declaration.
10846 (Target_arm::Scan::local, Target_arm::Scan::global,
10847 Target_arm::Relocate::relocate,
10848 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10849 call to Target_arm::get_real_reloc_type.
10850 (Target_arm::get_real_reloc_type): Use command line options to
10851 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10852 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10855 2009-11-25 Doug Kwan <dougkwan@google.com>
10857 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10858 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10859 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10861 (Arm_relocate_functions::thm_call): Replace body with a call to
10862 Arm_relocate_functions::thumb_branch_common.
10863 (Arm_relocate_functions::thm_jump24,
10864 Arm_relocate_functions::thm_xpc22): New method definitions.
10865 (Arm_relocate_functions::thumb_branch_common): New method definition.
10866 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10868 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10869 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10871 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10873 * Makefile.am: Build incremental-dump
10874 * Makefile.in: Regenerate.
10875 * incremental-dump.cc: New.
10876 * incremental.cc (Incremental_inputs_header_data,
10877 Incremental_inputs_entry_data): Move to incremental.h
10878 * incremental.h: (Incremental_inputs_header_data,
10879 Incremental_inputs_entry_data): Move from incremental.cc
10881 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10883 * incremental.cc (Incremental_inputs_header,
10884 Incremental_inputs_header_write, Incremental_inputs_entry,
10885 Incremental_inputs_entry_write): Add a typedef with the data type.
10887 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10889 * incremental.cc (Incremental_inputs_header,
10890 Incremental_inputs_header_write, Incremental_inputs_entry,
10891 Incremental_inputs_entry_write): Update comment about which
10892 type has the filed descriptions.
10894 2009-11-15 Doug Kwan <dougkwan@google.com>
10896 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10897 (Arm_relocate_functions::arm_branch_common): Change method defintion
10898 in class definition to a method declaration and update list of formal
10900 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10901 Arm_relocation_functions::jump24): Adjust call to
10902 Arm_relocate_functions::arm_branch_common. Update list of formal
10904 (Arm_relocate_functions::xpc25): New method definition.
10905 (Arm_relocate_functions::arm_branch_common): Move method defintion
10906 out from class definition. Use stubs for mode-switching and extending
10908 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10909 specially. Change code to enable use of stubs in ARM branches.
10911 2009-11-10 Doug Kwan <dougkwan@google.com>
10913 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10914 in method declaration.
10915 (Target_arm::relocate_stub): New method declaration.
10916 (Target_arm::default_target): Change to return a pointer instead of
10918 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10919 Target_arm::default_target.
10920 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10922 (Target_arm::relocate_section): Adjust view.
10923 (Target_arm::relocate_stub): New method definition.
10925 2009-11-10 Doug Kwan <dougkwan@google.com>
10927 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10929 * incremental.cc (open_incremental_binary): Initialized local
10930 variables to avoid warnings.
10931 * object.cc (make_elf_object): Ditto.
10932 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10935 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10938 * testsuite/plugin_test.c: Include "config.h".
10940 2009-11-09 Doug Kwan <dougkwan@google.com>
10942 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10943 (arm_symbol_value): Remove.
10944 (Arm_relocate_functions::arm_branch_common,
10945 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10946 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10947 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10948 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10949 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10950 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10951 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10952 Arm_relocate_functions::thm_mobw_abs_nc,
10953 Arm_relocate_functions::thm_mov_abs,
10954 Arm_relocate_functions::movw_prel_nc,
10955 Arm_relocate_functions::thm_movt_abs,
10956 Arm_relocate_functions::movt_prel,
10957 Arm_relocate_functions::thm_movw_prel_nc,
10958 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10959 (Target_arm::Relocate::relocate): Only decompose address into two
10960 parts if relocation type uses the thumb-bit and pass the actual
10961 bit instead of a flag indicating that the thumb-bit is used. Adjust
10962 calls to methods in Arm_relocate_functions for this change.
10964 2009-11-08 Ian Lance Taylor <iant@google.com>
10967 * reloc.cc: Instantiate
10968 Sized_relobj::initialize_input_to_output_maps and
10969 Sized_relobj:free_input_to_output_maps.
10971 2009-11-06 Ian Lance Taylor <iant@google.com>
10974 * defstd.cc (in_segment): Set only_if_ref true for "end".
10976 2009-11-06 Doug Kwan <dougkwan@google.com>
10978 * arm.cc (class Reloc_stub): Correct a comment.
10979 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10980 (Target_arm::scan_section_for_stubs): New method declaration.
10981 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10982 Change methods from private to protected.
10983 (Target_arm::do_may_relax): New method definition.
10984 (Target_arm::do_relax, Target_arm::group_sections,
10985 Target_arm::scan_reloc_for_stub,
10986 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10987 (Target_arm::arm_input_section_map_): New data member declaration.
10988 (Target_arm::scan_reloc_for_stub,
10989 Target_arm::scan_reloc_section_for_stubs,
10990 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10991 Target_arm::do_relax): New method definitions.
10993 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10995 * configure.ac: Check for (struct stat)::st_mtim
10996 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10997 * config.in: Regenerate.
10998 * configure: Regenerate.
11000 2009-11-05 Ian Lance Taylor <iant@google.com>
11003 * output.cc (Output_segment::add_output_section): Add missing
11006 2009-11-04 Ian Lance Taylor <iant@google.com>
11009 * object.h (class Object): Add is_needed and set_is_needed
11010 methods. Add is_needed_ field. Make bool fields into bitfields.
11011 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11012 defined in a dynamic object and referenced by a regular object,
11013 set is_needed for the dynamic object.
11014 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11015 if the file is marked with as_needed and it is not needed.
11017 2009-11-04 Ian Lance Taylor <iant@google.com>
11020 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11021 tags if data is discarded by linker script.
11022 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11023 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11024 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11025 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11027 2009-11-04 Ian Lance Taylor <iant@google.com>
11029 * layout.cc (Layout::get_output_section): Add is_interp and
11030 is_dynamic_linker_section parameters. Change all callers.
11031 (Layout::choose_output_section): Likewise.
11032 (Layout::make_output_section): Likewise.
11033 (Layout::add_output_section_data): Add is_dynamic_linker_section
11034 parameter. Change all callers.
11035 * layout.h (class Layout): Update declarations.
11036 * output.h (class Output_section): Add is_interp, set_is_interp,
11037 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11038 Add is_interp_, is_dynamic_linker_section_ fields. Change
11039 generate_code_fills_at_write_ to a bitfield.
11040 * output.cc (Output_section::Output_sections): Initialize new
11042 (Output_segment::add_output_section): Add do_sort parameter.
11043 Change all callers.
11045 2009-11-03 Ian Lance Taylor <iant@google.com>
11048 * options.h (class General_options): Add --warn-common.
11049 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11050 merging two common symbols.
11051 (Symbol_table::should_override): Handle --warn-common when merging
11052 a common symbol with a defined symbol. Use report_resolve_problem
11053 for multiple definitions.
11054 (Symbol_table::report_resolve_problem): New function.
11055 * symtab.h (class Symbol_table): Declare report_resolve_problem.
11057 2009-11-03 Doug Kwan <dougkwan@google.com>
11059 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11061 (Target_arm::stub_factory): New method definition.
11062 (Target_arm::new_arm_input_section,
11063 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11064 Target_arm::reloc_uses_thumb_bit): New method declarations.
11065 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11066 New type definitions.
11067 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11068 member declarations.
11069 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11070 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11071 New method definitions.
11073 2009-11-03 Ian Lance Taylor <iant@google.com>
11075 * options.h (class General_options): Add --warn_constructors.
11077 2009-11-03 Ian Lance Taylor <iant@google.com>
11080 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11081 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11083 2009-11-03 Ian Lance Taylor <iant@google.com>
11086 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11087 --msgid-bugs-address.
11088 (install-pdf): New target.
11089 (install-data_yes): Look up one directory to find mkinstalldirs.
11091 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11093 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11096 2009-10-30 Doug Kwan <dougkwan@google.com>
11098 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11100 2009-10-30 Doug Kwan <dougkwan@google.com>
11102 * arm.cc (Stub_addend_reader): New struct template definition
11103 and partial specializations.
11104 (Stub_addend_reader::operator()): New method definition for a
11105 partially specialized template.
11107 2009-10-30 Doug Kwan <dougkwan@google.com>
11109 * arm.cc (Arm_relobj::processor_specific_flags): New method
11111 (Arm_relobj::do_read_symbols): New method declaration.
11112 (Arm_relobj::processor_specific_flags_): New data member declaration.
11113 (Arm_dynobj): New class definition.
11114 (Target_arm::do_finalize_sections): Add input_objects parameter.
11115 (Target_arm::do_adjust_elf_header): New method declaration.
11116 (Target_arm::are_eabi_versions_compatible,
11117 (Target_arm::merge_processor_specific_flags): New method declaration.
11118 (Target_arm::do_make_elf_object): New overloaded method definitions
11120 (Arm_relobj::do_read_symbols): New method definition.
11121 (Arm_dynobj::do_read_symbols): Ditto.
11122 (Target_arm::do_finalize_sections): Add input_objects parameters.
11123 Merge processor-specific flags from all input objects.
11124 (Target_arm::are_eabi_versions_compatible,
11125 Target_arm::merge_processor_specific_flags,
11126 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11127 New method definitions.
11128 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11129 Input_objects pointer type parameter.
11130 * layout.cc (Layout::finalize): Pass input objects to target's.
11131 finalize_sections function.
11132 * output.cc (Output_file_header::do_sized_write): Set ELF file
11133 header's processor-specific flags.
11134 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11135 Input_objects pointer type parameter.
11136 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11137 * target.h (Input_objects): New forward class declaration.
11138 (Target::processor_specific_flags,
11139 Target::are_processor_specific_flags_sect): New method definitions.
11140 (Target::finalize_sections): Add input_objects parameter.
11141 (Target::Target): Initialize processor_specific_flags_ and
11142 are_processor_specific_flags_set_.
11143 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11145 (Target::set_processor_specific_flags): New method definition.
11146 (Target::processor_specific_flags_,
11147 Target::are_processor_specific_flags_set_): New data member
11149 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11150 Input_objects pointer type parameter.
11152 2009-10-30 Doug Kwan <dougkwan@google.com>
11154 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11156 2009-10-28 Ian Lance Taylor <iant@google.com>
11158 * object.h (class Relobj): Drop options parameter from
11159 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11160 do_scan_relocs, do_relocate. Change all callers.
11161 (class Sized_relobj): Drop options parameters from
11162 do_gc_process_relocs, do_scan_relocs, do_relocate,
11163 do_relocate_sections, relocate_sections, emit_relocs_scan,
11164 emit_relocs_scan_reltype. Change all callers.
11165 (struct Relocate_info): Remove options field and all references to
11167 * reloc.h (class Read_relocs): Remove options constructor
11168 parameter and options_ field. Change all callers.
11169 (class Gc_process_relocs, class Scan_relocs): Likewise.
11170 (class Relocate_task): Likewise.
11171 * target-reloc.h (scan_relocs): Remove options parameter. Change
11173 (scan_relocatable_relocs): Likewise.
11174 * target.h (class Sized_target): Remove options parameter from
11175 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11177 * gc.h (gc_process_relocs): Remove options parameter. Change all
11179 * arm.cc: Update functions to remove options parameters.
11180 * i386.cc: Likewise.
11181 * powerpc.cc: Likewise.
11182 * sparc.cc: Likewise.
11183 * x86_64.cc: Likewise.
11184 * testsuite/testfile.cc: Likewise.
11186 2009-10-28 Doug Kwan <dougkwan@google.com>
11188 * arm.cc (Arm_relobj): New class definition.
11189 (Arm_relobj::scan_sections_for_stubs,
11190 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11191 New method definitions.
11193 2009-10-28 Cary Coutant <ccoutant@google.com>
11195 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11196 (Plugin::cleanup_done_): New member.
11197 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11198 (Plugin_manager::cleanup_done_): Remove.
11199 (Plugin_manager::add_input_file): Edit error message.
11200 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11201 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11203 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11205 * fileread.cc: (File_read::View::~View): Use the new
11206 data_ownership_ filed.
11207 (File_read::~File_read): Dispose the new whole_file_view_.
11208 (File_read::open): Mmap the whole file if needed.
11209 (File_read::open): Use whole_file_view_ instead of contents_.
11210 (File_read::find_view): Use whole_file_view_ if applicable.
11211 (File_read::do_read): Use whole_file_view_ instead of contents_.
11212 (File_read::make_view): Use whole_file_view_ instead of contents_,
11213 update File_read::View::View call.
11214 (File_read::find_or_make_view): Update File_read::View::View
11216 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11218 (File_read::View::Data_ownership): New enum.
11219 (File_read::View::View): Replace bool mapped_ with Data_ownership
11221 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11222 (File_read::View::data_ownership_): New field.
11223 (File_read::contents_): Remove (replaced by whole_file_view_).
11224 (File_read::whole_file_view_): New field.
11225 * options.h (class General_options): Add --keep-files-mapped.
11227 2009-10-27 Cary Coutant <ccoutant@google.com>
11229 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11230 * testsuite/Makefile.am (plugin_test_5): New test case.
11231 * testsuite/Makefile.in: Regenerate.
11233 2009-10-25 Doug Kwan <dougkwan@google.com>
11235 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11236 from private to protected to allow access by child class.
11237 (Sized_relobj::do_relocate_sections): New method declaration.
11238 (Sized_relobj::relocate_sections): Virtualize.
11239 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11240 Sized_relobj::relocate_sections. Instantiate template explicitly
11241 for different target sizes and endianity.
11243 2009-10-24 Doug Kwan <dougkwan@google.com>
11245 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11246 (Arm_input_section::as_arm_input_section): New method.
11247 (Arm_output_section): New class definition.
11248 (Arm_output_section::create_stub_group,
11249 Arm_output_section::group_sections): New method definitions.
11251 2009-10-22 Doug Kwan <dougkwan@google.com>
11253 * arm.cc (Arm_input_section): New class definition.
11254 (Arm_input_section::init, Arm_input_section:do_write,
11255 Arm_input_section::set_final_data_size,
11256 Arm_input_section::do_reset_address_and_file_offset): New method
11259 2009-10-21 Doug Kwan <dougkwan@google.com>
11261 * arm.cc (Stub_table, Arm_input_section): New forward class
11263 (Stub_table): New class defintion.
11264 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11265 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11266 New method definition.
11268 2009-10-21 Doug Kwan <dougkwan@google.com>
11270 * arm.cc: Update copyright comments.
11271 (Target_arm): New forward class template declaration.
11272 (Arm_address): New type.
11273 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11274 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11275 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11277 (Insn_template): Same.
11278 (DEF_STUBS): New macro.
11279 (Stub_type): New enum type.
11280 (Stub_template): New class definition.
11282 (Reloc_stub): Same.
11283 (Stub_factory): Same.
11284 (Target_arm::Target_arm): Initialize may_use_blx_ and
11285 should_force_pic_veneer_.
11286 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11287 Target_arm::should_force_pic_veneer,
11288 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11289 Target_arm::using_thumb_only, Target_arm:;default_target): New
11291 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11292 New data member declarations.
11293 (Insn_template::size, Insn_template::alignment): New method defintions.
11294 (Stub_template::Stub_template): New method definition.
11295 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11296 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11297 (Stub_factory::Stub_factory): New method definition.
11298 * gold.h (string_hash): New template.
11299 * output.h (Input_section_specifier::hash_value): Use
11301 (Input_section_specifier::string_hash): Remove.
11302 * stringpool.cc (Stringpool_template::string_hash): Use
11305 2009-10-20 Doug Kwan <dougkwan@google.com>
11307 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11308 symbols of relaxed input sections.
11309 * output.h (Output_section::find_relaxed_input_section): Make
11312 2009-10-16 Doug Kwan <dougkwan@google.com>
11314 * dynobj.cc (Versions::Versions): Initialize version_script_.
11315 Only insert base version symbol definition for a shared object
11316 if version script defines any version versions.
11317 (Versions::define_base_version): New method definition.
11318 (Versions::add_def): Check that base version is not needed.
11319 (Versions::add_need): Define base version lazily.
11320 * dynobj.h (Versions::define_base_version): New method declaration.
11321 (Versions::needs_base_version_): New data member declaration.
11322 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11323 (check_DATA): Add no_version_test.stdout.
11324 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11326 * testsuite/Makefile.in: Regenerate.
11327 * testsuite/no_version_test.c: New file.
11328 * testsuite/no_version_test.sh: Ditto.
11330 2009-10-16 Doug Kwan <dougkwan@google.com>
11332 * expression.cc (class Segment_start_expression): New class definition.
11333 (Segment_start_expression::value): New method definition.
11334 (script_exp_function_segment_start): Return a new
11335 Segment_start_expression.
11336 * gold/script-c.h (script_saw_segment_start_expression): New function
11338 * script-sections.cc (Script_sections::Script_sections): Initialize
11339 SAW_SEGMENT_START_EXPRESSION_ to false.
11340 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11341 and -Tbbs options to specify section addresses if given in
11342 command line and no SEGMENT_START expression is seen in a script.
11343 * script-sections.h (Script_sections::saw_segment_start_expression,
11344 Script_sections::set_saw_segment_start_expression): New method
11346 (Script_sections::saw_segment_start_expression_): New data member
11348 * script.cc (script_saw_segment_start_expression): New function.
11349 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11350 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11351 script_test_7.sh and script_test_8.sh.
11352 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11353 script_test_8.stdout.
11354 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11355 (script_test_6, script_test_6.stdout, script_test_7,
11356 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11357 * Makefile.in: Regenerate.
11358 * testsuite/script_test_6.sh: New file.
11359 * testsuite/script_test_6.t: Same.
11360 * testsuite/script_test_7.sh: Same.
11361 * testsuite/script_test_7.t: Same.
11362 * testsuite/script_test_8.sh: Same.
11364 2009-10-16 Doug Kwan <dougkwan@google.com>
11366 * output.cc (Output_segment::set_section_list_address): Cast
11367 expressions to unsigned long long type to avoid format warnings.
11369 2009-10-15 Ian Lance Taylor <iant@google.com>
11371 * script.cc (Script_options::add_symbol_assignment): Always add a
11372 dot assignment to script_sections_.
11373 * script-sections.cc (Script_sections::add_dot_assignment):
11374 Initialize if necessary.
11376 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11377 program headers with no load segment if there is a linker script.
11379 * layout.cc (Layout::set_segment_offsets): Align the file offset
11380 to the segment aligment for -N or -n with no load segment.
11381 * output.cc (Output_segment::add_output_section): Don't crash if
11382 the first section is a TLS section.
11383 (Output_segment::set_section_list_addresses): Print an error
11384 message if the address moves backward in a linker script.
11385 * script-sections.cc
11386 (Output_section_element_input::set_section_addresses): Don't
11387 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11388 (Orphan_output_section::set_section_addresses): Likewise.
11390 2009-10-15 Doug Kwan <dougkwan@google.com>
11392 * layout.cc (Layout::finish_dynamic_section): Generate tags
11393 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11394 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11395 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11397 2009-10-14 Ian Lance Taylor <iant@google.com>
11399 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11401 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11402 data_shdr fields of relinfo.
11403 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11404 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11405 R_386_TLS_LDO_32, adjust based on section flags.
11406 (Target_i386::Relocate::fix_up_ldo): Remove.
11408 2009-10-13 Ian Lance Taylor <iant@google.com>
11410 Add support for -pie.
11411 * options.h (class General_options): Add -pie and
11413 (General_options::output_is_position_independent): Test -pie.
11414 (General_options::output_is_executable): Return true if not shared
11415 and not relocatable.
11416 (General_options::output_is_pie): Remove.
11417 * options.cc (General_options::finalize): Reject incompatible uses
11419 * gold.cc (queue_middle_tasks): A -pie link is not static.
11420 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11421 * symtab.cc (Symbol::final_value_is_known): Return false if
11422 output_is_position_independent.
11423 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11424 output_is_position_independent.
11425 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11426 output_is_position_independent.
11427 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11428 output_is_position_independent.
11429 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11431 (basic_pie_test.o, basic_pie_test): New targets.
11432 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11433 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11434 (two_file_pie_test): New target.
11435 * testsuite/Makefile.in: Rebuild.
11436 * README: Remove note saying that -pie is not supported.
11438 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11440 * options.h (class General_options): Add -init and -fini.
11441 * layout.cc (Layout::finish_dynamic_section): Emit
11442 given init and fini functions.
11444 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11446 * gc.h (gc_process_relocs): Check if icf is enabled using new
11448 * gold.cc (queue_initial_tasks): Likewise.
11449 (queue_middle_tasks): Likewise.
11450 * object.cc (do_layout): Likewise.
11451 * symtab.cc (is_section_folded): Likewise.
11452 * main.cc (main): Likewise.
11453 * reloc.cc (Read_relocs::run): Likewise.
11454 (Sized_relobj::do_scan_relocs): Likewise.
11455 * icf.cc (is_function_ctor_or_dtor): New function.
11456 (Icf::find_identical_sections): Check if function is ctor or dtor when
11457 safe icf is chosen.
11458 * options.h (General_options::icf): Change option to be an enum.
11459 (Icf_status): New enum.
11460 (icf_enabled): New method.
11461 (icf_safe_folding): New method.
11462 (set_icf_status): New method.
11463 (icf_status_): New variable.
11464 * (options.cc) (General_options::finalize): Set icf_status_.
11465 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11466 icf_test and icf_keep_unique_test to use the --icf enum flag.
11467 * testsuite/icf_safe_test.sh: New file.
11468 * testsuite/icf_safe_test.cc: New file.
11470 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11472 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11473 includes to gc.h and icf.h.
11474 * arm.cc: Include gc.h.
11475 * gold.cc: Likewise.
11476 * i386.cc: Likewise.
11477 * powerpc.cc: Likewise.
11478 * sparc.cc: Likewise.
11479 * x86_64.cc: Likewise.
11480 * gc.h: Include icf.h.
11482 2009-10-11 Ian Lance Taylor <iant@google.com>
11484 * plugin.cc: Include "gold.h" before other header files.
11486 2009-10-10 Chris Demetriou <cgd@google.com>
11488 * options.h (Input_file_argument::Input_file_type): New enum.
11489 (Input_file_argument::is_lib_): Replace with...
11490 (Input_file_argument::type_): New member.
11491 (Input_file_argument::Input_file_argument): Take Input_file_type
11492 'type' rather than boolean 'is_lib' as second argument.
11493 (Input_file_argument::is_lib): Use type_.
11494 (Input_file_argument::is_searched_file): New function.
11495 (Input_file_argument::may_need_search): Handle is_searched_file.
11496 * options.cc (General_options::parse_library): Support -l:filename.
11497 (General_options::parse_just_symbols): Update for Input_file_argument
11499 (Command_line::process): Likewise.
11500 * archive.cc (Archive::get_file_and_offset): Likewise.
11501 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11502 * script.cc (read_script_file, script_add_file): Likewise.
11503 * fileread.cc (Input_file::Input_file): Likewise.
11504 (Input_file::will_search_for): Handle is_searched_file.
11505 (Input_file::open): Likewise.
11506 * readsyms.cc (Read_symbols::get_name): Likewise.
11507 * testsuite/Makefile.am (searched_file_test): New test.
11508 * testsuite/Makefile.in: Regenerate.
11509 * testsuite/searched_file_test.cc: New file.
11510 * testsuite/searched_file_test_lib.cc: New file.
11512 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11513 Ian Lance Taylor <iant@google.com>
11515 * descriptor.cc: Include <cstdio> and "binary-io.h".
11516 (Descriptors::open): Open the files in binary mode always.
11517 * script.cc (Lex::get_token): Treat \r as whitespace.
11519 2009-10-09 Ian Lance Taylor <iant@google.com>
11521 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11523 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11524 Ian Lance Taylor <iant@google.com>
11526 * configure.ac: Check for readv function also.
11527 * fileread.cc (readv): Define if not HAVE_READV.
11528 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11530 * config.in: Regenerate.
11531 * configure: Regenerate.
11533 2009-10-09 Doug Kwan <dougkwan@google.com>
11535 * layout.cc (Layout::make_output_section): Call target hook to make
11536 ordinary output section.
11537 (Layout::finalize): Adjust parameter list of call the
11538 Target::may_relax().
11539 * layout.h (class Layout::section_list): New method.
11540 * merge.h (Output_merge_base::entsize): Change visibility to public.
11541 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11543 (Output_merge_string::do_is_string): New method.
11544 * object.cc (Sized_relobj::do_setup): renamed from
11545 Sized_relobj::set_up.
11546 * object.h (Sized_relobj::adjust_shndx,
11547 Sized_relobj::initializ_input_to_output_maps,
11548 Sized_relobj::free_input_to_output_maps): Change visibilities to
11550 (Sized_relobj::setup): Virtualize.
11551 (Sized_relobj::do_setup): New method declaration.
11552 (Sized_relobj::invalidate_section_offset,
11553 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11554 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11555 * options.cc (parse_int): New function.
11556 * options.h (parse_int): New declaration.
11557 (DEFINE_int): New macro.
11558 (stub_group_size): New option.
11559 * output.cc (Output_section::Output_section): Initialize memebers
11560 merge_section_map_, merge_section_by_properties_map_,
11561 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11562 (Output_section::add_input_section): Handled deferred code-fill
11563 generation and remove an old comment.
11564 (Output_section::add_relaxed_input_section): New method definition.
11565 (Output_section::add_merge_input_section): Use merge section by
11566 properties map to speed to search. Update merge section maps
11568 (Output_section::build_relaxation_map): New method definition.
11569 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11571 (Output_section::relax_input_section): Renamed to
11572 Output_section::convert_input_sections_to_relaxed_sections and change
11573 interface to take a vector of pointers to relaxed sections.
11574 (Output_section::find_merge_section,
11575 Output_section::find_relaxed_input_section): New method definitions.
11576 (Output_section::is_input_address_mapped,
11577 Output_section::output_offset, Output_section::output_address):
11578 Use output section data maps to speed up searching.
11579 (Output_section::find_starting_output_address): Add comments.
11580 (Output_section::do_write,
11581 Output_section::write_to_postprocessing_buffer): Do code-fill
11582 generation as appropriate.
11583 (Output_section::get_input_sections): Invalidate relaxed input section
11585 (Output_section::restore_states): Adjust type of checkpoint .
11586 Invalidate relaxed input section map.
11587 * output.h (Output_merge_base): New class declaration.
11588 (Input_section_specifier): New class defintion.
11589 (class Output_relaxed_input_section) Change base class to
11590 Output_section_data_build.
11591 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11592 base class initializer.
11593 (Output_section::add_relaxed_input_section): New method declaration.
11594 (Output_section::Input_section): Change visibility to protected.
11595 (Output_section::Input_section::relobj,
11596 Output_section::Input_section::shndx): Handle relaxed input sections.
11597 Output_section::input_sections) Change visibility to protected. Also
11598 define overload to return a non-const pointer.
11599 (Output_section::Merge_section_properties): New class defintion.
11600 (Output_section::Merge_section_by_properties_map,
11601 Output_section::Output_section_data_by_input_section_map,
11602 Output_section::Relaxation_map): New types.
11603 (Output_section::relax_input_section): Rename method to
11604 Output_section::convert_input_sections_to_relaxed_sections and change
11605 interface to take a vector of relaxed section pointers.
11606 (Output_section::find_merge_section,
11607 Output_section::find_relaxed_input_section,
11608 Output_section::build_relaxation_map,
11609 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11610 New method declarations.
11611 (Output_section::merge_section_map_
11612 Output_section::merge_section_by_properties_map_,
11613 Output_section::relaxed_input_section_map_,
11614 Output_section::is_relaxed_input_section_map_valid_,
11615 Output_section::generate_code_fills_at_write_): New data members.
11616 * script-sections.cc
11617 (Output_section_element_input::set_section_addresses): Call
11618 current_data_size and addralign methods of relaxed input sections.
11619 (Orphan_output_section::set_section_addresses): Call current_data_size
11620 and addralign methods of relaxed input sections.
11621 * symtab.cc (Symbol_table::compute_final_value): Extract template
11622 from the body of Symbol_table::sized_finalize_symbol.
11623 (Symbol_table::sized_finalized_symbol): Call
11624 Symbol_table::compute_final_value.
11625 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11626 (Symbol_table::compute_final_value): New templated method declaration.
11627 * target.cc (Target::do_make_output_section): New method defintion.
11628 * target.h (Target::make_output_section): New method declaration.
11629 (Target::relax): Add more parameters for input objects, symbol table
11630 and layout. Adjust call to do_relax.
11631 (Target::do_make_output_section): New method declaration.
11632 (Target::do_relax): Add parameters for input objects, symbol table
11635 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11637 * pread.c: Include stdio.h.
11639 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11641 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11644 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11646 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11647 Change read_shndx type to unsigned int.
11648 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11650 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11651 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11652 Change read_shndx type to unsigned int.
11653 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11655 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11656 * layout.cc (Layout::create_symtab_sections): Cast the result of
11657 local_symcount * symsize to off_t in the gold_assert.
11659 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11661 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11662 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11664 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11665 (Arm_relocate_functions::thm_abs5): New function.
11666 (Arm_relocate_functions::abs12): New function.
11667 (Arm_relocate_functions::abs16): New function.
11668 (Arm_relocate_functions::base_abs): New function.
11669 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11670 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11671 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11673 (Scan::global): Likewise.
11674 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11675 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11676 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11677 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11680 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11682 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11683 (Arm_relocate_functions::movt_prel): New function.
11684 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11685 (Arm_relocate_functions::thm_movt_prel): New function.
11686 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11687 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11688 (Scan::global, Relocate::relocate): Likewise.
11689 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11691 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11693 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11694 Incremental_checker.
11695 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11697 (class Incremental_inputs_header): New class.
11698 (Incremental_inputs_header_writer): Edit comment.
11699 (Incremental_inputs_entry): New class.
11700 (Incremental_inputs_entry_writer): Edit comment.
11701 (Sized_incremental_binary::do_find_incremental_inputs_section):
11702 Add *strtab_shndx parameter, fill it.
11703 (Sized_incremental_binary::do_check_inputs): New method.
11704 (Incremental_checker::can_incrementally_link_output_file): Use
11705 Sized_incremental_binary::check_inputs.
11706 (Incremental_inputs::report_command_line): Save command line in
11709 (Incremental_binary::find_incremental_inputs_section): New
11711 (Incremental_binary::do_find_incremental_inputs_section): Add
11712 strtab_shndx parameter.
11713 (Incremental_binary::do_check_inputs): New pure virtual method.
11714 (Sized_incremental_binary::do_check_inputs): Declare.
11715 (Incremental_checker::Incremental_checker): Add incremental_inputs
11716 parameter, use it to initialize incremental_inputs_.
11717 (Incremental_checker::incremental_inputs_): New field.
11718 (Incremental_checker::command_line): New method.
11719 (Incremental_checker::inputs): New method.
11720 (Incremental_checker::command_line_): New field.
11722 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11724 * incremental.cc: Include <cstdarg> and "target-select.h".
11725 (vexplain_no_incremental): New function.
11726 (explain_no_incremental): New function.
11727 (Incremental_binary::error): New method.
11728 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11730 (make_sized_incremental_binary): New function.
11731 (open_incremental_binary): New function.
11732 (can_incrementally_link_file): Add checks if output is ELF and has
11734 * incremental.h: Include "elfcpp_file.h" and "output.h".
11735 (Incremental_binary): New class.
11736 (Sized_incremental_binary): New class.
11737 (open_incremental_binary): Declare.
11738 * object.cc (is_elf_object): Use
11739 elfcpp::Elf_recognizer::is_elf_file.
11740 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11741 * output.h (Output_file::filesize): New method.
11743 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11745 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11747 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11748 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11750 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11752 (Arm_relocate_functions::movw_abs_nc): New function.
11753 (Arm_relocate_functions::movt_abs): New function.
11754 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11755 (Arm_relocate_functions::thm_movt_abs): New function.
11756 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11757 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11758 (Scan::global): Likewise.
11759 (Relocate::relocate): Likewise.
11760 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11762 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11764 * arm.cc (Arm_relocate_functions::got_prel) New function.
11765 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11766 (Relocate::relocate): Likewise.
11767 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11769 2009-10-06 Ian Lance Taylor <iant@google.com>
11771 * options.h (class General_options): Define
11772 split_stack_adjust_size parameter.
11773 * object.h (class Object): Add uses_split_stack_ and
11774 has_no_split_stack_ fields. Add uses_split_stack and
11775 has_no_split_stack accessor functions. Declare
11776 handle_split_stack_section.
11777 (class Reloc_symbol_changes): Define.
11778 (class Sized_relobj): Define Function_offsets. Declare
11779 split_stack_adjust, split_stack_adjust_reltype, and
11781 * object.cc (Object::handle_split_stack_section): New function.
11782 (Sized_relobj::do_layout): Call handle_split_stack_section.
11783 * dynobj.cc (Sized_dynobj::do_layout): Call
11784 handle_split_stack_section.
11785 * reloc.cc (Sized_relobj::relocate_sections): Call
11786 split_stack_adjust for executable sections in split_stack
11787 objects. Pass reloc_map to relocate_section.
11788 (Sized_relobj::split_stack_adjust): New function.
11789 (Sized_relobj::split_stack_adjust_reltype): New function.
11790 (Sized_relobj::find_functions): New function.
11791 * target-reloc.h: Include "object.h".
11792 (relocate_section): Add reloc_symbol_changes parameter. Change
11794 * target.h (class Target): Add calls_non_split method. Declare
11795 do_calls_non_split virtual method. Declare match_view and
11797 * target.cc: Include "elfcpp.h".
11798 (Target::do_calls_non_split): New function.
11799 (Target::match_view): New function.
11800 (Target::set_view_to_nop): New function.
11801 * gold.cc (queue_middle_tasks): Give an error if mixing
11802 split-stack and non-split-stack objects with -r.
11803 * i386.cc (Target_i386::relocate_section): Add
11804 reloc_symbol_changes parameter.
11805 (Target_i386::do_calls_non_split): New function.
11806 * x86_64.cc (Target_x86_64::relocate_section): Add
11807 reloc_symbol_changes parameter.
11808 (Target_x86_64::do_calls_non_split): New function.
11809 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11811 * powerpc.cc (Target_powerpc::relocate_section): Add
11812 reloc_symbol_changes parameter.
11813 * sparc.cc (Target_sparc::relocate_section): Add
11814 reloc_symbol_changes parameter.
11815 * configure.ac: Call AM_CONDITIONAL for the default target.
11816 * configure: Rebuild.
11817 * testsuite/Makefile.am (TEST_AS): New variable.
11818 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11819 (check_DATA): Add split_i386 and split_x86_64 files.
11820 (SPLIT_DEFSYMS): Define.
11821 (split_i386_[1234n].o): New targets.
11822 (split_i386_[124]): New targets.
11823 (split_i386_[1234r].stdout): New targets.
11824 (split_x86_64_[1234n].o): New targets.
11825 (split_x86_64_[124]): New targets.
11826 (split_x86_64_[1234r].stdout): New targets.
11827 (MOSTLYCLEANFILES): Add new executables.
11828 * testsuite/split_i386.sh: New file.
11829 * testsuite/split_x86_64.sh: New file.
11830 * testsuite/split_i386_1.s: New file.
11831 * testsuite/split_i386_2.s: New file.
11832 * testsuite/split_i386_3.s: New file.
11833 * testsuite/split_i386_4.s: New file.
11834 * testsuite/split_i386_n.s: New file.
11835 * testsuite/split_x86_64_1.s: New file.
11836 * testsuite/split_x86_64_2.s: New file.
11837 * testsuite/split_x86_64_3.s: New file.
11838 * testsuite/split_x86_64_4.s: New file.
11839 * testsuite/split_x86_64_n.s: New file.
11840 * testsuite/testfile.cc (Target_test): Update relocation_section
11842 * testsuite/Makefile.in: Rebuild.
11844 2009-10-06 Ian Lance Taylor <iant@google.com>
11846 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11847 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11848 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11849 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11850 the address on ldo_addrs_.
11851 (Target_i386::Relocate::fix_up_ldo): New function.
11853 2009-10-06 Rafael Espindola <espindola@google.com>
11855 * plugin.cc (add_input_library): New.
11856 (Plugin::load): Add add_input_library to tv.
11857 (Plugin_manager::add_input_file): Add the is_lib argument.
11858 (add_input_file): Update call to Plugin_manager::add_input_file.
11859 (add_input_library): New.
11860 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11862 2009-09-30 Doug Kwan <dougkwan@google.com>
11864 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11865 symbol and call Symbol::may_need_copy_reloc to determine if
11866 a copy reloc is needed.
11867 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11868 nocopyreloc is given in command line.
11869 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11870 given in command line.
11871 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11872 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11873 of the removed Target_i386::may_need_copy_reloc.
11874 * options.h (copyreloc): New option with default value false.
11875 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11876 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11877 instead of the removed Target_powerpc::may_need_copy_reloc.
11878 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11879 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11880 instead of the removed Target_sparc::may_need_copy_reloc.
11881 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11882 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11883 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11884 instead of the removed Target_x86_64::may_need_copy_reloc.
11886 2009-09-30 Ian Lance Taylor <iant@google.com>
11888 * object.h (class Object): Remove target_ field, and target,
11889 sized_target, and set_target methods.
11890 (Object::sized_target): Remove.
11891 (class Sized_relobj): Update declarations. Remove sized_target.
11892 * object.cc (Sized_relobj::setup): Remove target parameter.
11893 Change all callers.
11894 (Input_objects::add_object): Don't do anything with the target.
11895 (make_elf_sized_object): Add punconfigured parameter. Change all
11896 callers. Set or test parameter target.
11897 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11898 Change all callers.
11899 * parameters.cc (Parameters::set_target): Change parameter type to
11901 (Parameters::default_target): Remove.
11902 (set_parameters_target): Change parameter type to be non-const.
11903 (parameters_force_valid_target): New function.
11904 (parameters_clear_target): New function.
11905 * parameters.h (class Parameters): Update declarations. Remove
11906 default_target method. Add sized_target and clear_target
11907 methods. Change target_ to be non-const.
11908 (set_parameters_target): Update declaration.
11909 (parameters_force_valid_target): Declare.
11910 (parameters_clear_target): Declare.
11911 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11912 as NULL if we aren't searching.
11913 (Add_symbols::run): Don't check for compatible target.
11914 * fileread.cc (Input_file::open_binary): Call
11915 parameters_force_valid_target.
11916 * gold.cc (queue_middle_tasks): Likewise.
11917 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11918 set_target on object.
11919 * dynobj.h (class Sized_dynobj): Update declarations.
11920 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11921 make_elf_object returns NULL.
11922 (Archive::include_member): Don't check whether object target is
11924 * output.cc (Output_section::add_input_section): Get target from
11926 (Output_section::relax_input_section): Likewise.
11927 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11929 (Sized_relobj::do_scan_relocs): Likewise.
11930 (Sized_relobj::relocate_sections): Likewise.
11931 * resolve.cc (Symbol_table::resolve): Likewise.
11932 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11933 parameter. Change all callers.
11934 (Symbol_table::add_from_object): Get target from parameters.
11935 (Symbol_table::add_from_relobj): Don't check object target.
11936 (Symbol_table::add_from_dynobj): Likewise.
11937 (Symbol_table::define_special_symbol): Get target from
11939 * symtab.h (class Symbol_table): Update declaration.
11940 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11941 parameter. Change all callers. Clear parameter target.
11942 (Binary_test): Test target here.
11943 * testsuite/object_unittest.cc (gold_testsuite): Remove
11944 target_test_pointer parameter. Change all callers.
11945 (Object_test): Test target here.
11947 2009-09-26 Ian Lance Taylor <iant@google.com>
11949 * testsuite/initpri1.c: Don't try to use constructor priorities if
11950 compiling with gcc before 4.3.
11952 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11954 * testsuite/retain_symbols_file_test.sh (check_present): Change
11955 output file name to retain_symbols_file_test.stdout.
11956 (check_absent): Likewise.
11958 2009-09-18 Craig Silverstein <csilvers@google.com>
11960 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11961 * options.cc: Include <cerrno> and <fstream>.
11962 (General_options::finalize): Parse -retain-symbols-file tag.
11963 * options.h: New flag.
11964 (General_options): New method should_retain_symbol, new
11965 variable symbols_to_retain.
11966 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11967 should_retain_symbol map.
11968 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11969 * testsuite/Makefile.in: Regenerate.
11970 * testsuite/retain_symbols_file_test.sh: New file.
11972 2009-09-18 Nick Clifton <nickc@redhat.com>
11974 * po/es.po: Updated Spanish translation.
11976 2009-09-17 Doug Kwan <dougkwan@google.com>
11978 * debug.h (DEBUG_RELAXATION): New constant.
11979 (DEBUG_ALL): Add DEBUG_RELAXATION.
11980 (debug_string_to_enum): Add relaxation debug option.
11982 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11983 Layout::Relaxation_debug_check::read_sections,
11984 Layout::Relaxation_debug_check::read_sections): New method definitions.
11985 (Layout::Layout): Initialize data members
11986 record_output_section_data_from_scrips_,
11987 script_output_section_data_list_ and relaxation_debug_check_.
11988 (Layout::save_segments, Layout::restore_segments,
11989 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11990 Layout::relaxation_loop_body): New method definitions.
11991 (Layout::finalize): Support relaxation. Move section layout code to
11992 Layout::relaxation_loop_body.
11993 (Layout::set_asection_address_from_script): Move code for orphan
11994 section placement out.
11995 (Layout::place_orphan_sections_in_script): New method definition.
11996 * layout.h (Output_segment_headers, Output_file_header):
11997 New forward class declarations.
11998 (Layout::~Layout): Define.
11999 (Layout::new_output_section_data_from_script): New method definition.
12000 (Layout::place_orphan_sections_in_script): New method declaration.
12001 (Layout::Segment_states): New type declaration.
12002 (Layout::save_segments, Layout::restore_segments,
12003 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12004 Layout::relaxation_loop_body): New method declarations.
12005 (Layout::Output_section_data_list): New type declaration.
12006 (Layout::Relaxation_debug_check): New class definition.
12007 (Layout::record_output_section_data_from_script_,
12008 Layout::script_output_section_data_list_, Layout::segment_states_,
12009 Layout::relaxation_debug_check_): New data members.
12010 * output.cc: (Output_section_headers::do_size): New method definition.
12011 (Output_section_headers::Output_section_headers): Move size
12012 computation to Output_section_headers::do_size.
12013 (Output_segment_headers::do_size): New method definition.
12014 (Output_file_header::Output_file_header): Move size computation to
12015 Output_file_header::do_size and call it.
12016 (Output_file_header::do_size): New method definition.
12017 (Output_data_group::Output_data_group): Adjust call to
12018 Output_section_data.
12019 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12020 (Output_symtab_xindex::do_write): Add array bound check.
12021 (Output_section::Input_section::print_to_mapfile): Handle
12022 RELAXED_INPUT_SECTION_CODE.
12023 (Output_section::Output_section): Initialize data member checkpoint_.
12024 (Output_section::~Output_section): Delete checkpoint object pointed
12026 (Output_section::add_input_section): Always add an Input_section if
12028 (Output_section::add_merge_input_section): Add assert.
12029 (Output_section::relax_input_section): New method definition.
12030 (Output_section::set_final_data_size): Set load address to zero for
12031 an unallocated section.
12032 (Output_section::do_address_and_file_offset_have_reset_values):
12033 New method definition.
12034 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12035 Handle relaxed input section.
12036 (Output_section::sort_attached_input_sections): Checkpoint input
12037 section list lazily.
12038 (Output_section::get_input_sections): Change type of input_sections to
12039 list of Simple_input_section pointers. Checkpoint input section list
12040 lazily. Also handle relaxed input sections.
12041 (Output_section::add_input_section_for_script): Take a reference to
12042 a Simple_input_section object instead of Relobj pointer and section
12043 index as parameter. Handle relaxed input sections.
12044 (Output_section::save_states, Output_section::restore_states): New
12045 method definitions.
12046 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12047 (Output_data::is_data_size_fixed): New method definition.
12048 (Output_data::reset_addresss_and_file_offset): Do not reset data size
12050 (Output_data::address_and_file_offset_have_reset_values): New method
12052 (Output_data::do_address_and_file_offset_have_reset_values): New method
12054 (Output_data::set_data_size): Check that data size is not fixed.
12055 (Output_data::fix_data_size): New method definition.
12056 (Output_data::is_data_size_fixed_): New data member.
12057 (Output_section_headers::set_final_data_size): New method definition.
12058 (Output_section_headers::do_size): New method declaration.
12059 (Output_segment_headers::set_final_data_size): New method definition.
12060 (Output_segment_headers::do_size): New method declaration.
12061 (Output_file_header::set_final_data_size)::New method definition.
12062 (Output_file_header::do_size)::New method declaration.
12063 (Output_section_data::Output_section_data): Add new parameter
12064 is_data_size_fixed and use it to fix data size.
12065 (Output_data_const::Output_data_const): Adjust call to base class
12066 constructor and fix data size.
12067 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12068 base class constructor and fix data size.
12069 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12070 base class constructor and fix data size.
12071 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12072 class constructor and fix data size.
12073 (Output_data_group::set_final_data_size): New method definition.
12074 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12075 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12076 class constructor and fix data size.
12077 (Output_relaxed_input_section): New class definition.
12078 (Output_section::Simple_input_section): New class definition.
12079 (Output_section::get_input_sections): Adjust parameter list.
12080 (Output_section::add_input_section_for_script): Same.
12081 (Output_section::save_states, Output_section::restore_states,
12082 Output_section::do_address_and_file_offset_have_reset_values,
12083 (Output_section::Input_section::Input_section): Handle
12084 RELAXED_INPUT_SECTION_CODE. Add new overload for
12085 Output_relaxed_input_section.
12086 (Output_section::Input_section::is_input_section,
12087 Output_section::Input_section::set_output_section): Handle relaxed
12089 (Output_section::Input_section::is_relaxed_input_section,
12090 Output_section::Input_section::output_section_data,
12091 Output_section::Input_section::relaxed_input_section): New method
12093 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12095 (Output_section::Input_section::u1_): Update comments.
12096 (Output_section::Input_section::u2_): Add new union member poris.
12097 (Output_section::Checkpoint_output_section): New classs definition.
12098 (Output_section::relax_input_section): New method declaration.
12099 (Output_section::checkpoint_): New data member.
12100 (Output_segment): Update comments.
12101 (Output_segment::Output_segment): Un-privatize copy constructor.
12102 (Output_segment::operator=): Un-privatize.
12103 * script-sections.cc (Output_section_element::Input_section_list):
12104 Change element type to Output_section::Simple_input_section.
12105 (Output_section_element_dot_assignment::set_section_addresses):
12106 Register output section data for relaxation clean up.
12107 (Output_data_exression::Output_data_expression): Adjust call to base
12108 constructor to fix data size.
12109 (Output_section_element_data::set_section_addresses): Register
12110 Output_data_expression object for relaxation clean up.
12111 (struct Input_section_info): Replace Relobj pointer and section index
12112 pair with Output_section::Simple_input_section and Convert struct to a
12114 (Input_section_sorter::operator()): Adjust access to
12115 Input_section_info data member to use accessors.
12116 (Output_section_element_input::set_section_addresses): Use layout
12117 parameter. Adjust code to use Output_section::Simple_input_section
12118 and Input_secction_info classes. Register filler for relaxation
12120 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12121 and section index pair with Output_section::Simple_input_section
12122 class. Adjust code accordingly.
12123 (Phdrs_element::release_segment): New method definition.
12124 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12126 (Script_sections::release_segments): New method definition.
12127 * gold/script-sections.h (Script_sections::release_segments): New
12128 method declaration.
12129 * gold/target.h (Target::may_relax, Target::relax,
12130 Target::do_may_relax, Target::do_relax): New method definitions.
12132 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12134 * arm.cc (has_signed_unsigned_overflow): New function.
12135 (Arm_relocate_functions::abs8): New function.
12136 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12137 (Target_arm::Scan::global): Likewise.
12138 (Target_arm::relocate::relocate): Likewise.
12139 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12142 2009-09-16 Cary Coutant <ccoutant@google.com>
12144 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12145 * testsuite/Makefile.in: Regenerate.
12147 2009-09-11 Nick Clifton <nickc@redhat.com>
12149 * po/gold.pot: Updated by the Translation project.
12151 2009-09-08 Cary Coutant <ccoutant@google.com>
12153 * output.cc (Output_file::open): Add execute permission to empty file.
12154 * testsuite/Makefile.am (permission_test): New test.
12155 * testsuite/Makefile.in: Regenerate.
12157 2009-09-02 Ian Lance Taylor <iant@google.com>
12159 * output.cc (Output_file::resize): Call map_no_anonymous rather
12162 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12164 * gold.cc: Include "incremental.h".
12165 (queue_initial_tasks): Call Incremental_checker methods.
12166 * incremental.cc: Include "output.h".
12167 (Incremental_checker::can_incrementally_link_output_file): New
12169 * incremental.h (Incremental_checker): New class.
12171 * output.cc (Output_file::open_for_modification): New method.
12172 (Output_file::map_anonymous): Changed return type to bool. Record
12173 map in base_ field.
12174 (Output_file::map_no_anonymous): New method, broken out of map.
12175 (Output_file::map): Use map_no_anonymous and map_anonymous.
12176 * output.h (class Output_file): Update declarations.
12178 2009-08-24 Cary Coutant <ccoutant@google.com>
12180 * options.h (Command_line::Pre_options): New class.
12181 (Command_line::pre_options): New member.
12182 * options.cc (gold::options::ready_to_register): New variable.
12183 (One_option::register_option): Do nothing if not registering options.
12184 Assert if same short option registered twice.
12185 (General_options::General_options): Turn off option registration when
12187 (Command_line::Pre_options::Pre_options): New constructor.
12189 2009-08-24 Cary Coutant <ccoutant@google.com>
12191 * options.h (General_options::no_keep_memory): Remove incorrect
12194 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12196 * Makefile.am (am__skiplex, am__skipyacc): New.
12197 * Makefile.in: Regenerate.
12199 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12201 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12202 (INCLUDES): ... this.
12203 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12204 (AM_CPPFLAGS): Renamed from ...
12205 (INCLUDE): ... this.
12206 * Makefile.in, testsuite/Makefile.in: Regenerate.
12208 * Makefile.in: Regenerate.
12209 * aclocal.m4: Likewise.
12210 * config.in: Likewise.
12211 * configure: Likewise.
12212 * testsuite/Makefile.in: Likewise.
12214 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12215 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12216 * Makefile.in: Regenerate.
12217 * testsuite/Makefile.in: Regenerate.
12219 2009-08-19 Cary Coutant <ccoutant@google.com>
12221 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12222 symbols in shared libraries overridden by hidden or internal symbols
12223 in the main program.
12225 2009-08-19 Chris Demetriou <cgd@google.com>
12227 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12228 checking source file names in error messages.
12230 2009-08-18 Doug Kwan <dougkwan@google.com>
12232 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12233 an elcpp::Ehdr as parameter. Adjust call to set_target.
12234 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12235 an elfcpp::Ehdr as parameter.
12236 * object.cc (Object::set_target): Remove the version that looks up
12237 a target and sets it.
12238 (Sized_relobj::setup): Take a Target object instead of
12239 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12240 (make_elf_sized_object): Find target and ask target to
12241 make an ELF object.
12242 * object.h: (Object::set_target): Remove the version that looks up
12243 a target and sets it.
12244 (Sized_relobj::setup): Take a Target object instead of
12245 an elfcpp:Ehdr as parameter.
12246 * target.cc: Include dynobj.h.
12247 (Target::do_make_elf_object_implementation): New.
12248 (Target::do_make_elf_object): New.
12249 * target.h (Target::make_elf_object): New template declaration.
12250 (Target::do_make_elf_object): New method declarations.
12251 (Target::do_make_elf_object_implementation): New template declaration.
12253 2009-08-14 Ian Lance Taylor <iant@google.com>
12255 * gold.h (FUNCTION_NAME): Define.
12256 (gold_unreachable): Use FUNCTION_NAME.
12258 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12260 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12261 symbol in the --keep-unique list is not found.
12263 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12265 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12266 been maked as --keep-unique.
12267 (Icf::unfold_section): New function.
12268 * icf.h (Icf::unfold_section): New function.
12269 * options.h (General_options::keep_unique): New option.
12270 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12271 * testsuite/Makefile.in: Regenerate.
12272 * testsuite/icf_keep_unique_test.sh: New file.
12273 * testsuite/icf_keep_unique_test.cc: New file.
12275 2009-08-12 Cary Coutant <ccoutant@google.com>
12278 * resolve.cc (Symbol_table::resolve): Check for references from
12279 dynamic objects to hidden and internal symbols.
12280 * testsuite/Makefile.am (hidden_test.sh): New test.
12281 * testsuite/Makefile.in: Regenerate.
12282 * testsuite/hidden_test.sh: New script.
12283 * testsuite/hidden_test_1.c: New test source.
12284 * testsuite/hidden_test_main.c: New test source.
12286 2009-08-11 Doug Kwan <dougkwan@google.com>
12288 * arm.cc: Update comments.
12289 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12290 segment to locate the .ARM.exidx section if present.
12292 2009-08-09 Doug Kwan <dougkwan@google.com>
12294 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12297 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12298 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12301 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12303 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12304 valid tls_segment only for non-debug-section relocations.
12305 * testsuite/Makefile.am: Add gc_tls_test.
12306 * testsuite/Makefile.in: Regenerate.
12307 * testsuite/gc_tls_test.cc: New file.
12308 * testsuite/gc_tls_test.sh: New file.
12310 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12312 * icf.cc: New file.
12314 * Makefile.am (CCFILES): Add icf.cc.
12315 (HFILES): Add icf.h
12316 * Makefile.in: Regenerate.
12317 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12318 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12319 section, symbol and addend information for the relocs.
12320 * gold.cc (queue_middle_tasks): Call identical code folding.
12321 * gold.h: Add defines for multimap.
12322 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12323 to the call of finalize_local_symbols.
12324 * main.cc (main): Create object of class Icf.
12325 * object.cc (Sized_relobj::do_layout): Allow this function to be
12326 called twice during icf.
12327 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12328 to sections marked as identical by icf.
12329 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12331 (Sized_relobj::do_section_entsize): New function.
12332 * object.h (Object::section_entsize): New function.
12333 (Object::do_section_entsize): New pure virtual function.
12334 (Relobj::finalize_local_symbols): Add new parameter.
12335 (Relobj::do_section_entsize): New function.
12336 * options.h (General_options::icf): New option.
12337 (General_options::icf_iterations): New option.
12338 (General_options::print_icf_sections): New option.
12339 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12340 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12341 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12343 * symtab.cc (Symbol_table::is_section_folded): New function.
12344 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12345 to sections marked as identical by icf.
12346 * symtab.h (Symbol_table::set_icf): New function.
12347 (Symbol_table::icf): New function.
12348 (Symbol_table::is_section_folded): New function.
12349 (Symbol_table::icf_): New data member.
12350 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12351 * testsuite/Makefile.am: Add commands to build icf_test.
12352 * testsuite/Makefile.in: Regenerate.
12353 * testsuite/icf_test.sh: New file.
12354 * testsuite/icf_test.cc: New file.
12356 2009-07-24 Chris Demetriou <cgd@google.com>
12358 * layout.cc (is_compressible_debug_section): Fix incorrect
12359 comment about compressed section names.
12361 2009-07-20 Ian Lance Taylor <ian@airs.com>
12364 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12366 2009-07-16 Ian Lance Taylor <iant@google.com>
12369 * layout.h: #include <map>.
12370 (class Kept_section): Change from struct to class. Add accessors
12371 and setters. Add section size to Comdat_group mapping. Change
12372 Comdat_group to std::map. Add is_comdat_ field. Add
12373 linkonce_size field in union.
12374 (class Layout): Update declaration of find_or_add_kept_section.
12375 Don't declare find_kept_object.
12376 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12377 parameter. Add object, shndx, is_comdat, and is_group_name
12378 parameters. Change all callers. Adjust for new Kept_section.
12379 (Layout::find_kept_object): Remove.
12380 * object.cc (Sized_relobj::include_section_group): Update use of
12381 Kept_section. Rename secnum to shndx. Only record
12382 Kept_comdat_section if sections are the same size.
12383 (Sized_relobj::include_linkonce_section): Update use of
12384 Kept_section. Only record Kept_comdat_section if sections are the
12385 same size. Set size of linkonce section.
12386 (Sized_relobj::map_to_kept_section): Update call to
12387 get_kept_comdat_section.
12388 * object.h (class Sized_relobj): Rename fields in
12389 Kept_comdat_section to drop trailing underscores; change object
12390 field to Relobj*. Change Kept_comdat_section_table to store
12391 struct rather than pointer.
12392 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12393 Add kept_object and kept_shndx parameters. Change all callers.
12394 (Sized_relobj::get_kept_comdat_section): Change return type to
12395 bool. Add kept_object and kept_shndx parameters. Change all
12397 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12398 Layout::find_or_add_kept_section.
12400 2009-07-09 Ian Lance Taylor <iant@google.com>
12402 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12403 Reserve space in the hash table.
12405 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12407 * fileread.cc (File_read::get_mtime): New method.
12408 * fileread.h (Timespec): New structure.
12409 (File_read::get_mtime): New method.
12410 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12411 Renamed from timestamp_nsec.
12412 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12414 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12416 (Incremental_inputs::report_archive): Save mtime; style fix.
12417 (Incremental_inputs::report_obejct): Save mtime; style fix.
12418 (Incremental_inputs::report_script): Save mtime; style fix.
12419 (Incremental_inputs::finalize_inputs): Style fix.
12420 (Incremental_inputs::finalize): Style fix.
12421 (Incremental_inputs::create_input_section_data): Store inputs
12423 * incremental.h (Incremental_inputs::report_script): Add mtime
12425 (Incremental_inputs::Input_info::Input_info): Intialize only one
12427 (Incremental_inputs::Input_info::archive): Move to nameless
12429 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12430 (Incremental_inputs::Input_info::script): Move to nameless union.
12431 (Incremental_inputs::mtime): New field.
12432 * script.cc (read_input_script): Pass file mtime to
12434 * script.h (Script_info::inputs): Style fix.
12436 2009-07-01 Ian Lance Taylor <ian@airs.com>
12438 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12441 2009-06-24 Ian Lance Taylor <iant@google.com>
12444 * layout.cc (Layout::choose_output_section): If we find an
12445 existing section, update the flags.
12446 (Layout::create_notes): New function, broken out of
12448 (Layout::finalize): Don't create note sections.
12449 (Layout::create_note): Don't crash if linker script discards
12451 (Layout::create_gold_note): Likewise.
12452 (Layout::create_build_id): Likewise. Don't set
12453 after_input_sections on the section.
12454 (Layout::create_executable_stack_info): Remove target parameter.
12456 * layout.h (class Layout): Declare create_notes. Update
12457 declaration of create_executable_stack_info.
12458 * gold.cc (queue_middle_tasks): Call create_notes.
12459 * output.cc (Output_section::update_flags_for_input_section): Move
12460 here from output.h. If SHF_ALLOC flag is newly set, mark address
12462 * output.h (Output_data::mark_address_invalid): New function.
12463 (class Output_section): Only declare, not define,
12464 update_flags_for_input_section. Remove set_flags.
12466 2009-06-24 Ian Lance Taylor <iant@google.com>
12468 * script-sections.cc (Output_section_definition::
12469 set_section_addresses): Rename shadowing local load_address to
12472 2009-06-24 Ian Lance Taylor <iant@google.com>
12475 * reloc.cc (relocate_sections): Skip empty relocation sections.
12477 2009-06-23 Ian Lance Taylor <iant@google.com>
12480 * layout.cc (Layout::create_note): Use choose_output_section
12481 rather than make_output_section.
12483 2009-06-23 Ian Lance Taylor <iant@google.com>
12486 * options.cc (General_options::parse_V): Set printed_version_.
12487 (General_options::General_options): Initialize printed_version_.
12488 * options.h (class General_options): Add printed_version_ field.
12489 * gold.cc (queue_initial_tasks): If there are no input files,
12490 don't give a fatal error if we printed the version information.
12491 (queue_middle_tasks): If using -r with a shared object, give a
12492 fatal error rather than an ordinary error.
12494 2009-06-23 Ian Lance Taylor <iant@google.com>
12497 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12498 (Layout::make_output_section): Set have_stabstr_section_ if we see
12499 a .stab*str section.
12500 (Layout::finalize): Call link_stabs_sections.
12501 (Layout::link_stabs_sections): New file.
12502 * layout.h (class Layout): Add have_stabstr_section_ field.
12503 Declare link_stabs_sections.
12505 2009-06-23 Doug Kwan <dougkwan@google.com>
12507 * Makefile.am (libgold_a_LIBADD): New.
12508 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12509 * Makefile.in: Regenerate.
12510 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12511 * configure: Regenerate.
12512 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12513 * fileread.cc: Include sys/state.h
12514 * gold.h: Declare memmem and strndup if found missing.
12515 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12517 2009-06-23 Ian Lance Taylor <iant@google.com>
12519 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12520 * configure: Rebuild.
12522 2009-06-23 Ian Lance Taylor <iant@google.com>
12525 * object.cc (Object::section_contents): Don't try to get a view if
12526 the section has length zero.
12527 (Object::handle_gnu_warning_section): If the section is empty, use
12528 the name of the section as the warning.
12530 2009-06-23 Ian Lance Taylor <iant@google.com>
12533 * stringpool.h (class Stringpool_template): Add optimize_ field.
12534 (Stringpool_template::set_optimize): New function.
12535 * stringpool.cc (Stringpool_template::Stringpool_template):
12536 Initialize optimize_ field.
12537 (Stringpool_template::set_string_offsets): Test local optimize
12538 fild rather than parameter.
12539 * layout.cc (Layout::Layout): Call set_optimize on the section
12542 2009-06-22 Ian Lance Taylor <iant@google.com>
12545 * yyscript.y: Parse TARGET.
12546 * script.cc (script_set_target): New function.
12547 * script-c.h (script_set_target): Declare.
12548 * options.cc (General_options::string_to_object_format): Rename
12549 from string_to_object_format in anonymous namespace. Change
12551 * options.h (class General_options): Declare
12552 string_to_object_format.
12554 2009-06-22 Ian Lance Taylor <iant@google.com>
12556 * script-sections.cc (Script_sections::create_segments): Don't put
12557 program headers in a PT_LOAD segment if -n or -N.
12559 2009-06-22 Ian Lance Taylor <iant@google.com>
12562 * options.h (class General_options): Add -z lazy and -z now. Sort
12563 -z options into alphabetical order.
12564 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12566 2009-06-21 Ian Lance Taylor <iant@google.com>
12568 * layout.cc (Layout::make_output_section): Call
12569 Target::new_output_section.
12570 (Layout::attach_allocated_section_to_segment): Put large section
12571 sections in a separate load segment with the large segment flag
12573 (Layout::segment_precedes): Sort large data segments after other
12575 (align_file_offset): New static function.
12576 (Layout::set_segment_offsets): Use align_file_offset.
12577 * output.h (class Output_section): Add is_small_section_ and
12578 is_large_section_ fields.
12579 (Output_section::is_small_section): New function.
12580 (Output_section::set_is_small_section): New function.
12581 (Output_section::is_large_section): New function.
12582 (Output_section::set_is_large_section): New function.
12583 (Output_section::is_large_data_section): New function.
12584 (class Output_segment): Add is_large_data_segment_ field.
12585 (Output_segment::is_large_data_segment): New function.
12586 (Output_segment::set_is_large_data_segment): New function.
12587 * output.cc (Output_section::Output_section): Initialize new
12589 (Output_segment::Output_segment): Likewise.
12590 (Output_segment::add_output_section): Add assertion that large
12591 data sections always go in large data segments. Force small data
12592 sections to the end of the list of data sections. Force small BSS
12593 sections to the start of the list of BSS sections. For large BSS
12594 sections to the end of the list of BSS sections.
12595 * symtab.h (class Symbol): Declare is_common_shndx.
12596 (Symbol::is_defined): Check Symbol::is_common_shndx.
12597 (Symbol::is_common): Likewise.
12598 (class Symbol_table): Define enum Commons_section_type. Update
12599 declarations. Add small_commons_ and large_commons_ fields.
12600 * symtab.cc (Symbol::is_common_shndx): New function.
12601 (Symbol_table::Symbol_table): Initialize new fields.
12602 (Symbol_table::add_from_object): Put small and large common
12603 symbols in the right list.
12604 (Symbol_table::sized_finalized_symbol): Check
12605 Symbol::is_common_shndx.
12606 (Symbol_table::sized_write_globals): Likewise.
12607 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12608 common symbol lists. Don't call do_allocate_commons_list if the
12610 (Symbol_table::do_allocate_commons_list): Remove is_tls
12611 parameter. Add comons_section_type parameter. Change all
12612 callers. Handle small and large common symbols.
12613 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12614 Symbol::is_common_shndx.
12615 * resolve.cc (symbol_to_bits): Likewise.
12616 * target.h (Target::small_common_shndx): New function.
12617 (Target::small_common_section_flags): New function.
12618 (Target::large_common_shndx): New function.
12619 (Target::large_common_section_flags): New function.
12620 (Target::new_output_section): New function.
12621 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12622 small_common_section_flags, and large_common_section_flags
12624 (Target::do_new_output_section): New virtual function.
12625 * arm.cc (Target_arm::arm_info): Initialize new fields.
12626 * i386.cc (Target_i386::i386_info): Likewise.
12627 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12629 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12630 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12631 (Target_x86_64::do_new_output_section): New function.
12632 * configure.ac: Define conditional MCMODEL_MEDIUM.
12633 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12634 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12635 (large_LDFLAGS): Define.
12636 * testsuite/large.c: New file.
12637 * testsuite/testfile.cc (Target_test::test_target_info):
12638 Initialize new fields.
12639 * configure, testsuite/Makefile.in: Rebuild.
12641 2009-06-05 Doug Kwan <dougkwan@google.com>
12643 * Makefile.am (CCFILES): Add target.cc.
12644 * Makefile.in: Regenerate.
12645 * i386.cc (class Target_i386): Define new virtual method to
12646 override do_is_local_label_name in parent.
12647 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12648 local symbols if --discard-locals or -X is given.
12649 * options.h (class General_options): Declare new options
12650 '--discard-locals' and '-X' for discarding locals.
12651 * target.h (class Target): Define new methods is_local_label_name.
12652 Declare new virtual method do_is_local_label_name.
12653 * target.cc: New file.
12654 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12655 (check_SCRIPTS): Add discard_locals_test.sh.
12656 (check_DATA): Add discard_local_tests.syms.
12657 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12658 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12659 * testsuite/Makefile.in: Regenerate.
12660 * testsuite/discard_locals_test.c: New file.
12661 * testsuite/discard_locals_test.sh: Same.
12663 2009-06-05 Doug Kwan <dougkwan@google.com>
12665 * object.cc (Sized_relobj::Sized_relobj): Initialize
12666 discarded_eh_frame_shndx_ to -1U.
12667 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12669 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12670 a discarded .eh_frame section.
12671 (Sized_relobj::do_finalize_local_symbols): Ditto.
12672 * object.h (class Sized_relobj): Declare new member
12673 discarded_eh_frame_shndx_.
12674 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12675 (local_labels_test.o, local_labels_test): New rules.
12676 * testsuite/Makefile.in: Regenerate.
12678 2009-06-04 Doug Kwan <dougkwan@google.com>
12680 * layout.cc (Layout::section_name_mapping): Add mapping for
12681 special ARM sections.
12683 2009-06-03 Doug Kwan <dougkwan@google.com>
12685 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12686 (utils::has_overflow): Same.
12688 2009-06-03 Ian Lance Taylor <iant@google.com>
12690 * layout.cc (Layout::section_name_mapping): New array, replacing
12691 Layout::linkonce_mapping.
12692 (Layout::section_name_mapping_count): New variable, replacing
12693 Layout::linkonce_mapping_count.
12694 (Layout::linkonce_output_name): Remove.
12695 (Layout::output_section_name): Rewrite.
12696 * layout.h (class Layout): Rename Linkonce_mapping to
12697 Section_name_mapping, linkonce_mapping to section_name_mapping,
12698 linkonce_mapping_count to section_name_mapping_count. Don't
12699 declare linkonce_output_name.
12701 2009-06-03 Doug Kwan <dougkwan@google.com>
12703 * gold/arm.cc (namespace utils): New.
12704 (Target_arm::reloc_is_non_pic): Define new method.
12705 (class Arm_relocate_functions): New.
12706 (Target_arm::Relocate::relocate): Handle relocation types used by
12709 2009-06-03 Ian Lance Taylor <iant@google.com>
12711 * arm.cc (Target_arm::scan::global): Use || instead of |.
12713 2009-06-02 Doug Kwan <dougkwan@google.com>
12715 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12716 issued_non_pic_error_.
12717 (class Target_arm::Scan): Declare new method check_non_pic.
12718 Define new method symbol_needs_plt_entry.
12719 Declare new data member issued_non_pic_error_.
12720 (class Target_arm::Relocate): Declare new method
12721 should_apply_static_reloc.
12722 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12723 (Target_arm::Scan::check_non_pic): Define new method.
12724 (Target_arm::Scan::local): Handle a small subset of reloc types used
12726 (Target_arm::Scan::local): Same.
12727 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12729 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12731 * incremental.cc (Incremental_inputs::report_command_line): Filter
12732 out --incremental-* options.
12734 2009-05-29 Doug Kwan <dougkwan@google.com>
12736 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12738 (class Target_arm): Update comment.
12739 (Target_arm::Target_arm): Initialize new data members GOT_,
12740 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12741 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12742 and Target_arm::rel_dyn_section.
12743 Declare new_enum Target_arm::Got_type.
12744 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12746 Update commments for member do_dynsym_value.
12747 (Target_arm::got_size, Target_arm::plt_section,
12748 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12749 new methods inside class defintion.
12750 (Target_arm::got_section): Define new method.
12751 (Target_arm::rel_dyn_section): Same.
12752 (Output_data_plt_arm): New template class.
12753 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12754 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12755 (Output_data_plt_arm::add_entry): Same.
12756 (Output_data_plt_arm::first_plt_entry): Define new
12757 static data member for PLT instruction template.
12758 (Output_data_plt_arm::plt_entry): Same.
12759 (Output_data_plt_arm::do_write): Define new method.
12760 (Target_arm::make_plt_entry): Same.
12761 (Target_arm::do_finalize_sections): Same.
12762 (Target_arm::do_dynsym_value): Same.
12764 2009-05-28 Doug Kwan <dougkwan@google.com>
12766 * Makefile.am (TARGETSOURCES): Add arm.cc.
12767 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12768 * Makefile.in: Regenerate.
12769 * arm.cc: New file.
12770 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12772 2009-05-26 Doug Kwan <dougkwan@google.com>
12774 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12775 (General_options::check_excluded_libs): Strip off directories in
12776 archive name before matching like GNU ld does.
12777 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12778 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12779 (exclude_libs_test_LDFLAGS): Add linker option
12780 -Wl,--exclude-libs,libexclude_libs_test_3
12781 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12782 an explicit archive without using -l.
12783 (alt/libexclude_libs_test_3.a): New make rule.
12784 * testsuite/Makefile.in: Regenerate.
12785 * testsuite/exclude_libs_test.c : Declare lib3_default().
12787 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12788 * exclude_libs_test_3.c: New file.
12790 2009-05-26 Nick Clifton <nickc@redhat.com>
12792 * po/id.po: New Indonesian translation.
12793 * po/gold.pot: Updated template file.
12795 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12797 * testsuite/Makefile.am: Add -ffunction-sections to compile
12798 gc_comdat_test files. Add -Wl,--gc-sections to build
12800 * testsuite/Makefile.in: Regenerate.
12801 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12803 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12805 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12806 kept comdat section was garbage collected.
12807 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12808 * testsuite/Makefile.in: Regenerate.
12809 * testsuite/gc_comdat_test.sh: New file.
12810 * testsuite/gc_comdat_test_1.cc: New file.
12811 * testsuite/gc_comdat_test_2.cc: New file.
12813 2009-05-19 Doug Kwan <dougkwan@google.com>
12815 * archive.cc (Archive::Archive): Move constructor from archive.h
12816 to here. Initialize no_export_.
12817 (Archive::get_elf_object_for_member): Set no_export flag of object.
12818 * archive.h (Archive::Archive): Move constructor body to
12820 (Archive::no_export): New method.
12821 (Archive::no_export_): New field.
12822 * object.h (Object::Object): Initialize no_export_ to false.
12823 (Object::no_export, Object::set_no_export): New methods.
12824 (Object::no_export_): New field.
12825 * options.cc (General_options::parse_exclude_libs): New method.
12826 (General_options::check_excluded_libs) Same.
12827 * options.h (exclude_libs): New option.
12828 (General_options::check_excluded_libs): New method declaration.
12829 (General_options::excluded_libs_): New field.
12830 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12831 default or protected visibility if an object has no-export flag set.
12832 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12833 (check_SCRIPTS): Add exclude_libs_test.sh.
12834 (check_DATA): Add exclude_libs_test.syms.
12835 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12836 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12837 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12838 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12839 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12840 libexclude_libs_test_2.a): New rules.
12841 * testsuite/Makefile.in: Regenerate.
12842 * testsuite/exclude_libs_test.c: New file.
12843 * testsuite/exclude_libs_test.sh: Ditto.
12844 * testsuite/exclude_libs_test_1.c: Ditto.
12845 * testsuite/exclude_libs_test_2.c: Ditto.
12847 2009-05-15 Ian Lance Taylor <iant@google.com>
12849 * configure.ac: Check for declarations for cases where libiberty.h
12850 checks HAVE_DECL_xxx.
12851 * configure, config.in: Rebuild.
12853 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12855 * gold.h (Incremental_argument_list): Remove (invalid) forward
12857 * incremental.cc (Incremental_inputs::report_achive): New method.
12858 (Incremental_inputs::report_object): New method.
12859 (Incremental_inputs::report_script): New method.
12860 (Incremental_inputs::finalize_inputs): New method.
12861 (Incremental_inputs::finalize): Call finalize_inputs().
12862 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12863 Create inputs entries.
12864 * incremental.h (Incremental_input_type): New enum.
12865 (Incremental_inputs::Incremental_input): Initialize new fields.
12866 (Incremental_inputs::report_inputs): New method.
12867 (Incremental_inputs::report_achive): New method.
12868 (Incremental_inputs::report_object): New method.
12869 (Incremental_inputs::report_script): New method.
12870 (Incremental_inputs::finalize_inputs): New method.
12871 (Incremental_inputs::Input_info): New struct.
12872 (Incremental_inputs::Input_info_map): New typedef.
12873 (Incremental_inputs::lock_): New field.
12874 (Incremental_inputs::Inputs_): New field.
12875 (Incremental_inputs::Inputs_map): New field.
12876 * main.cc (main): Call Incremental_input::report_inputs.
12877 * options.h (Input_argument_list): Typedef moved from
12879 (Input_file_group::Files): Remove, use ::Input_argument_list.
12880 (Input_file_group::Input_argument_list): Remove, use
12881 ::Input_argument_list.
12882 * plugin.cc (Plugin_manager::add_input_file): Add error in
12884 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12886 * script.cc (read_input_script): Call
12887 Incremental_input::report_script.
12888 * script.h (Script_info): New class.
12890 2009-04-27 Ian Lance Taylor <iant@google.com>
12892 * x86_64.cc (do_adjust_output_section): Set entsize to
12895 2009-04-23 Elliott Hughes <enh@google.com>
12897 * output.cc (Output_file::close): After short writes, continue
12898 writing from the correct offset in the buffer being written.
12900 2009-04-23 Chris Demetriou <cgd@google.com>
12902 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12903 * configure: Regenerate.
12904 * config.in: Regenerate.
12905 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12906 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12908 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12910 * incremental.cc (Incremental_inputs_header_data): Renamed from
12911 Incremental_input_header_data.
12912 (Incremental_inputs_header_data::data_size): New field.
12913 (Incremental_inputs_header_data::put_input_file_count): Renamed
12914 from input_file_count.
12915 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12916 from command_line_offset.
12917 (Incremental_inputs_header_data::put_reserved): Renamed from
12919 (Incremental_inputs_entry_data): Renamed from
12920 Incremental_input_entry_data.
12921 (Incremental_inputs_entry_data::data_size): New field.
12922 (Incremental_inputs::report_command_line): New method.
12923 (Incremental_inputs::finalize): New method.
12924 (Incremental_inputs::create_incremental_inputs_data): New method.
12925 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12926 * incremental.h: New file.
12927 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12928 (Layout::finalize): Create incremental inputs section in
12929 incremental builds.
12930 (Layout::create_incremental_info_sections): New method.
12931 * layout.h (Layout::incremental_inputs): New method.
12932 (Layout::create_incremental_info_sections): New method.
12933 (Layout::incremental_inputs_): New field.
12934 * main.cc (main): Notify Incremental_input of the command line.
12936 2009-04-01 Ian Lance Taylor <iant@google.com>
12937 Mikolaj Zalewski <mikolajz@google.com>
12939 * gold.h (reserve_unordered_map): Define, three versions, one for
12940 each version of Unordered_map.
12941 * layout.cc (Layout::Layout): Remove options parameter. Add
12942 number_of_input_files parameter. Don't initialize options_.
12943 Initialize number_of_input_files_ and resized_signatures_. Move
12944 sections_are_attached_.
12945 (Layout::layout_group): Reserve space for group_signatures_.
12946 (Layout::find_or_add_kept_section): Change name parameter to be a
12947 reference. Resize signatures_ map when it gets large enough.
12948 (Layout::layout_eh_frame): Use parameters->options() instead of
12950 (Layout::make_output_section): Likewise.
12951 (Layout::attach_allocated_section_to_segment): Likewise.
12952 (Layout::finalize, Layout::create_executable_stack): Likewise.
12953 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12954 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12955 * layout.h (class Layout): Update declarations. Remove options_
12956 field. Add number_of_input_files_ and resized_signatures_
12957 fields. Move sections_are_attached_ field.
12958 * main.cc (main): Pass number of input files to Layout
12959 constructor. Don't pass options.
12961 2009-03-30 Ian Lance Taylor <iant@google.com>
12963 * ffsll.c (ffsll): Correct implementation.
12965 2009-03-27 Ian Lance Taylor <iant@google.com>
12967 * ffsll.c: New file.
12968 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12969 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12970 * ftruncate.c (ftruncate): Declare before definition.
12971 * mremap.c (mremap): Likewise.
12972 * pread.c (pread): Likewise.
12973 * configure, Makefile.in, config.in: Rebuild.
12975 * mremap.c: New file.
12976 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12977 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12978 (mremap): Declare if HAVE_MREMAP is not defined.
12979 * configure, Makefile.in, config.in: Rebuild.
12981 2009-03-27 Cary Coutant <ccoutant@google.com>
12983 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12984 position independent.
12985 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12986 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12988 2009-03-24 Cary Coutant <ccoutant@google.com>
12990 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12992 (needs_dynamic_reloc): Likewise.
12994 2009-03-24 Ian Lance Taylor <iant@google.com>
12996 * yyscript.y (file_cmd): Recognize EXTERN.
12997 (extern_name_list, extern_name_list_body): New nonterminals.
12998 * script.cc (script_add_extern): Define.
12999 * script-c.h (script_add_extern): Declare.
13001 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
13003 * object.cc (is_elf_object): Define.
13004 * object.h (is_elf_object): Declare.
13005 * archive.cc (Archive::get_elf_object_for_member): Call
13007 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13009 2009-03-24 Elliott Hughes <enh@google.com>
13011 * output.cc (Output_file::map_anonymous): Define.
13012 (Output_file::map): Use map_anonymous. If the regular mmap fails,
13013 try an anonymous one. Report the size if the mmap fails.
13014 * output.h (class Output_file): Declare map_anonymous.
13016 2009-03-24 Ian Lance Taylor <iant@google.com>
13018 * target-select.cc (instantiate_target): Don't acquire the lock if
13019 the instantiated_target_ field has already been set.
13021 2009-03-23 Ian Lance Taylor <iant@google.com>
13023 * gold-threads.h (class Initialize_lock): Define.
13024 * gold-threads.cc (class Initialize_lock_once): Define.
13025 (initialize_lock_control): New static variable.
13026 (initialize_lock_pointer): New static variable.
13027 (initialize_lock_once): New static function.
13028 (Initialize_lock::Initialize_lock): Define.
13029 (Initialize_lock::initialize): Define.
13030 * target-select.h: Include "gold-threads.h".
13031 (class Target_selector): Add lock_ and initialize_lock_ fields.
13032 Don't define instantiate_target, just declare it.
13033 * target-select.cc (Target_selector::Target_selector): Initialize
13035 (Target_selector::instantiate_target): Define.
13036 * descriptors.h: Include "gold-threads.h".
13037 (class Descriptors): Add initialize_lock_ field.
13038 * descriptors.cc (Descriptors::Descriptors): Initialize new
13040 (Descriptors::open): Use initialize_lock_ field
13041 * errors.h (class Errors): Add initialize_lock_ field.
13042 * errors.cc (Errors::Errors): Initialize new field.
13043 (Errors::initialize_lock): Use initialize_lock_ field.
13044 * powerpc.cc (class Target_selector_powerpc): Remove
13045 instantiated_target_ field. In do_recognize call
13046 instantiate_target rather than do_instantiate_target. In
13047 do_instantiate_target just allocate a new target.
13048 * sparc.cc (class Target_selector_sparc): Likewise.
13050 * freebsd.h: New file.
13051 * i386.cc: Include "freebsd.h".
13052 (Target_i386): Derive from Target_freebsd rather than
13054 (Target_selector_i386): Derive from Target_selector_freebsd rather
13055 than Target_selector.
13056 * x86_64.cc: Include "freebsd.h".
13057 (Target_x86_64): Derive from Target_freebsd rather than
13059 (Target_selector_x86_64): Derive from Target_selector_freebsd
13060 rather than Target_selector.
13061 * target.h (class Target): Add adjust_elf_header and
13062 do_adjust_elf_header.
13063 * output.cc (Output_file_header:: do_sized_write): Call target
13064 adjust_elf_header routine.
13065 * configure.tgt: Set targ_osabi.
13066 * configure.ac: Define GOLD_DEFAULT_OSABI.
13067 * parameters.cc (Parameters::default_target): Pass
13068 GOLD_DEFAULT_OSABI to select_target.
13069 * target-select.h (class Target_selector): Make instantiate_target
13070 protected rather than private.
13071 * Makefile.am (HFILES): Add freebsd.h.
13072 * configure, Makefile.in, config.in: Rebuild.
13074 * merge.cc (do_add_input_section): Correct pend value. Change
13075 message about last entry not being null terminated from error to
13078 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13080 * incremental.cc: New file.
13081 * Makefile.am (CCFILES): Add incremental.cc.
13082 * Makefile.in: Rebuild.
13084 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13086 * layout.cc (Layout::output_section_name): Preserve names
13087 of '.note.' sections.
13089 2009-03-19 Ian Lance Taylor <iant@google.com>
13091 * descriptors.cc (Descriptors::open): Check that the options are
13092 valid before using them.
13094 2009-03-18 Ian Lance Taylor <iant@google.com>
13096 * script-sections.h: Include <list>.
13097 (class Script_sections): Change Sections_elements from std::vector
13098 to std::list. Typedef public Elements_iterator. Add
13099 orphan_section_placement_, data_segment_align_start_, and
13100 saw_data_segment_align_ fields. Remove data_segment_align_index_
13102 * script-sections.cc (class Orphan_section_placement): New class.
13103 (class Sections_element): Add virtual functions is_relro and
13104 orphan_section_init. Remove virtual function place_orphan_here.
13105 (class Output_section_definition): Add is_relro and
13106 orphan_section_init. Remove place_orphan_here.
13107 (class Orphan_output_section): Likewise.
13108 (Script_sections::Script_sections): Update for field changes.
13109 (Script_sections::data_segment_align): Set saw_data_segment_align_
13110 and data_segment_align_start_, not data_segment_align_index.
13111 (Script_sections::data_segment_relro_end): Check
13112 saw_data_segment_align_. Use data_segment_align_start_ rather
13113 than data_segment_align_index_.
13114 (Script_sections::place_orphan): Rewrite to use
13115 Orphan_section_placement.
13117 2009-03-17 Ian Lance Taylor <iant@google.com>
13119 * archive.cc (Archive::add_symbols): Check for a version attached
13120 to the symbol name in the archive map.
13121 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13122 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13123 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13124 (ver_test_11.a): New target.
13125 * testsuite/Makefile.in: Rebuild.
13127 * configure.ac: Check for chsize and posix_fallocate. Replace
13129 * ftruncate.c: New file, from gnulib.
13130 * output.cc (posix_fallocate): Define dummy version if not
13131 HAVE_POSIX_FALLOCATE.
13132 (Output_file::map): Call posix_fallocate rather than lseek and
13134 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13135 * configure, Makefile.in, config.in: Rebuild.
13137 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13139 * layout.h (Layout::create_note): Add section_name parameter.
13140 * layout.cc (Layout::create_note): Likewise.
13141 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13143 2009-03-17 Ian Lance Taylor <iant@google.com>
13145 * descriptors.cc: Include "options.h".
13146 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13147 (Descriptors::open): Always use O_CLOEXEC when opening a new
13148 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13149 then set FD_CLOEXEC.
13151 * sparc.cc (class Target_sparc): Add has_got_section.
13152 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13153 make sure we have a GOT section.
13155 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13156 (Target_sparc::Scan::local): Likewise.
13157 (Target_sparc::Scan::global): Likewise.
13158 (Target_sparc::Relocate::relocate): Likewise.
13159 (Target_sparc::Relocate::relocate_tls): Likewise.
13161 * symtab.cc (Symbol_table::define_default_version): New function,
13162 broken out of add_from_object.
13163 (Symbol_table::add_from_object): Call define_default_version.
13164 (Symbol_table::define_special_symbol): Add resolve_oldsym
13165 parameter. Change all callers. If the version for a symbol comes
13166 from a version script, resolve it with the symbol with the same
13167 name with no version. Also add the symbol without a version if
13169 (do_define_in_output_data): If resolving with oldsym, don't delete
13171 (do_define_in_output_segment): Likewise.
13172 (do_define_as_constant): Likewise.
13173 * symtab.h (class Symbol_table): Update declarations.
13175 2009-03-13 Ian Lance Taylor <iant@google.com>
13177 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13178 (Read_symbols::requeue): New function.
13179 (Read_symbols::do_read_symbols): If make_elf_object fails because
13180 the target type is not configured, and the file was searched for,
13181 issue a warning and retry with the next directory.
13182 (Add_symbols::run): If the file has an incompatible format, and
13183 it was searched for, requeue the Read_symbols task. On error,
13184 release the object.
13185 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13186 dirindex parameter to constructor. Change all callers. Declare
13187 incompatible_warning and requeue.
13188 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13189 input_argument_ and input_group_ fields. Add them to
13190 constructor. Change all callers.
13191 (class Read_script): Add dirindex_ field. Add it to constructor.
13192 Change all callers.
13193 * archive.cc (Archive::setup): Remove input_objects parameter.
13194 Change all callers.
13195 (Archive::get_file_and_offset): Likewise.
13196 (Archive::read_all_symbols): Likewise.
13197 (Archive::read_symbols): Likewise.
13198 (Archive::get_elf_object_for_member): Remove input_objects
13199 parameter. Add punconfigured parameter. Change all callers.
13200 (Archive::add_symbols): Change return type to bool. Check return
13201 value of include_member.
13202 (Archive::include_all_members): Likewise.
13203 (Archive::include_member): Change return type to bool. Return
13204 false if first included object has incompatible target. Set
13205 included_member_ field.
13206 (Add_archive_symbols::run): If add_symbols returns false, requeue
13208 * archive.h (class Archive): Add included_member_ field.
13209 Initialize it in constructor. Add input_file and searched_for
13210 methods. Update declarations.
13211 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13212 input_argument_ fields. Add them to constructor. Change all
13214 * script.cc: Include "target-select.h".
13215 (class Parser_closure): Add skip_on_incompatible_target_ and
13216 found_incompatible_target_ fields. Add
13217 skip_on_incompatible_target parameter to constructor. Change all
13218 callers. Add methods skip_on_incompatible_target,
13219 clear_skip_on_incompatible_target, found_incompatible_target, and
13220 set_found_incompatible_target.
13221 (read_input_script): Add dirindex parameter. Change all callers.
13222 If parser finds an incompatible target, requeue Read_symbols
13224 (script_set_symbol): Clear skip_on_incompatible_target in
13226 (script_add_assertion, script_parse_option): Likewise.
13227 (script_start_sections, script_add_phdr): Likewise.
13228 (script_check_output_format): New function.
13229 * script.h (read_input_script): Update declaration.
13230 * script-c.h (script_check_output_format): Declare.
13231 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13232 (ignore_cmd): Remove OUTPUT_FORMAT.
13233 * fileread.cc (Input_file::Input_file): Add explicit this.
13234 (Input_file::will_search_for): New function.
13235 (Input_file::open): Add pindex parameter. Change all callers.
13236 * fileread.h (class Input_file): Add input_file_argument method.
13237 Declare will_search_for. Update declarations.
13238 * object.cc (make_elf_object): Add punconfigured parameter.
13239 Change all callers.
13240 * object.h (class Object): Make input_file public. Add
13241 searched_for method.
13242 (make_elf_object): Update declaration.
13243 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13245 * dirsearch.h (class Dirsearch): Update declaration.
13246 * options.h (class General_options): Add --warn-search-mismatch.
13247 * parameters.cc (Parameters::is_compatible_target): New function.
13248 * parameters.h (class Parameters): Declare is_compatible_target.
13249 * workqueue.cc (Workqueue::add_blocker): New function.
13250 * workqueue.h (class Workqueue): Declare add_blocker.
13252 * fileread.cc (Input_file::open): Remove options parameter.
13253 Change all callers.
13254 (Input_file::open_binary): Likewise.
13255 * script.cc (read_input_script): Likewise.
13256 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13257 options parameter from constructor. Change all callers.
13258 (class Read_script): Likewise.
13259 * fileread.h (class Input_file): Update declarations.
13260 * script.h (read_input_script): Update declaration.
13262 2009-03-10 Nick Clifton <nickc@redhat.com>
13264 * po/es.po: New Spanish translation.
13266 2009-03-06 Cary Coutant <ccoutant@google.com>
13268 * options.cc (parse_short_option): Keep dash_z from registering itself.
13270 2009-03-03 Ian Lance Taylor <iant@google.com>
13273 * target-reloc.h (relocate_section): Pass output_section to
13275 * i386.cc (Target_i386::should_apply_static_reloc): Add
13276 output_section parameter. Change all callers.
13277 (Target_i386::Relocate::relocate): Add output_section parameter.
13278 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13279 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13280 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13281 * testsuite/two_file_shared.sh: New script.
13282 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13283 (check_DATA): Add two_file_shared.dbg.
13284 (two_file_shared.dbg): New target.
13285 * testsuite/Makefile.in: Rebuild.
13287 2009-03-01 Ian Lance Taylor <iant@google.com>
13289 * configure.ac: Check for byteswap.h.
13290 * configure: Rebuild.
13291 * config.in: Rebuild.
13293 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13295 * layout.cc (Layout::find_or_add_kept_section): New function.
13296 (Layout::add_comdat): Removed.
13297 * layout.h (struct Kept_section): Move out of class Layout.
13298 Remove trailing underscores from field names. Add group_sections
13299 field. Rename group_ field to is_group. Change all uses.
13300 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13301 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13302 comdat_groups_ field.
13303 (Sized_relobj::include_section_group): Use
13304 find_or_add_kept_section and Kept_section::group_sections.
13305 (Sized_relobj::include_linkonce_section): Likewise.
13306 * object.cc (class Sized_relobj): Don't define Comdat_group or
13307 Comdat_group_table. Remove find_comdat_group and
13308 add_comdat_group. Remove comdat_groups_ field.
13309 * plugin.cc (include_comdat_group): Use
13310 Layout::find_or_add_kept_section.
13312 2009-02-28 Ian Lance Taylor <iant@google.com>
13314 * README: --gc-sections and map files are now supported. Document
13315 some build requirements.
13318 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13319 relocatable link set the value of the section symbol to zero.
13320 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13321 relocatable link don't include the section address in the local
13324 2009-02-27 Ian Lance Taylor <iant@google.com>
13327 * options.h (class Search_directory): Add is_system_directory.
13328 (class General_options): Declare is_in_system_directory.
13329 * options.cc (get_relative_sysroot): Make static.
13330 (get_default_sysroot): Make static.
13331 (General_optoins::is_in_system_directory): New function.
13332 * fileread.cc (Input_file::is_in_system_directory): New function.
13333 * fileread.h (class Input_file): Declare is_in_system_directory.
13334 * object.h (class Object): Add is_in_system_directory.
13335 (class Input_objects): Remove system_library_directory_ field.
13336 * object.cc (Input_objects::add_object): Don't set
13337 system_library_directory_.
13338 (input_objects::found_in_system_library_directory): Remove.
13339 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13340 parameter. Change all callers.
13341 (Symbol_table::sized_write_globals): Likewise.
13342 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13343 Call Object::is_in_system_directory.
13344 * symtab.h (class Symbol_table): Update declarations.
13347 * descriptors.h (Open_descriptor): Add is_on_stack field.
13348 * descriptors.cc (Descriptors::open): If the descriptor is on the
13349 top of the stack, remove it. Initialize is_on_stack field.
13350 (Descriptors::release): Only add pod to stack if it is not on the
13352 (Descriptors::close_some_descriptor): Clear stack_next and
13353 is_on_stack fields.
13356 * output.cc (Output_section::find_starting_output_address): Rename
13357 from starting_output_address; add PADDR parameter; change return
13359 * output.h (class Output_section): Declare
13360 find_starting_output_address instead of starting_output_address.
13361 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13362 section symbol for which we can't find a merge section.
13365 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13366 hidden or internal, force the symbol to be local.
13367 * resolve.cc (Symbol::override_visibility): Define.
13368 (Symbol::override_base): Use override_visibility.
13369 (Symbol_table::resolve): Likewise.
13370 (Symbol::override_base_with_special): Likewise.
13371 (Symbol_table::override_with_special): If the visibility is hidden
13372 or internal, force the symbol to be local.
13373 * symtab.h (class Symbol): Add set_visibility and
13374 override_visibility.
13375 * testsuite/ver_test_1.sh: New file.
13376 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13377 (check_DATA): Add ver_test_1.syms.
13378 (ver_test_1.syms): New target.
13379 * testsuite/Makefile.in: Rebuild.
13381 2009-02-25 Cary Coutant <ccoutant@google.com>
13383 * layout.cc (Layout::choose_output_section): Don't rename sections
13384 when using a linker script that has a SECTIONS clause.
13385 * Makefile.in: Regenerate.
13387 * testsuite/Makefile.am (script_test_5.sh): New test case.
13388 * testsuite/Makefile.in: Regenerate.
13389 * testsuite/script_test_5.cc: New file.
13390 * testsuite/script_test_5.sh: New file.
13391 * testsuite/script_test_5.t: New file.
13393 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13395 * archive.cc (Archive::include_member): Update calls to add_symbols.
13396 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13397 the Layout argument.
13398 * dynobj.h (do_add_symbols): Add the Layout argument.
13399 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13401 * object.h (Object::add_symbols): Add the Layout argument.
13402 (Object::do_add_symbols): Add the Layout argument.
13403 (Sized_relobj::do_add_symbols): Add the Layout argument.
13404 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13405 Unify the two versions.
13406 (Add_plugin_symbols): Remove.
13407 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13408 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13409 (Add_plugin_symbols): Remove.
13410 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13411 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13412 (Add_symbols::run): Make it work with Pulginobj.
13414 2009-02-06 Ian Lance Taylor <iant@google.com>
13416 * object.cc (Sized_relobj::do_layout): Make info message start
13417 with lower case letter.
13419 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13421 * binary.cc: Fix file comment.
13423 * options.h (enum Incremental_disposition): Define.
13424 (class General_options): Add new options: --incremental,
13425 --incremental_changed, --incremental_unchanged,
13426 --incremental_unknown. Add incremental_disposition_ and
13427 implicit_incremental_ fields.
13428 (General_options::incremental_disposition): New function.
13429 (class Position_dependent_options): Add incremental_disposition
13431 (Position_dependent_options::copy_from_options): Set incremental
13433 * options.cc (General_options::parse_incremental_changed): New
13435 (General_options::parse_incremental_unchanged): New function.
13436 (General_options::parse_incremental_unknown): New function.
13437 (General_options::General_options): Initialize new fields
13438 incremental_disposition_ and implicit_incremental_.
13439 (General_options::finalize): Check for uasge of --incremental-*
13440 without --incremental.
13442 2009-02-06 Chris Demetriou <cgd@google.com>
13444 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13445 pointer and to report location as the file name associated with
13447 (gold_undefined_symbol_at_location): New function to replace the
13448 old gold_undefined_symbol functionality.
13449 * target-reloc.h (relocate_section): Update to use
13450 gold_undefined_symbol_at_location.
13451 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13452 Call gold_undefined_symbol function rather than gold_error.
13453 * errors.h (Errors::undefined_symbol): Take location as a
13454 string, rather than calculating it from a relocation.
13455 * errors.cc (Errors::fatal): Print "fatal error:" before the
13457 (Errors::error, Errors::error_at_location): Print "error: "
13458 before the formatted message.
13459 (Errors::undefined_symbol): Take location as a string, rather
13460 than calculating it from a relocation.
13461 (gold_undefined_symbol_at_location): New function akin to
13462 old gold_undefined_symbol, calculates location from relocation.
13463 (gold_undefined_symbol): Change to take only a Symbol pointer
13464 and to report location as the file name associated with the symbol.
13465 * testsuite/debug_msg.sh: Update for changed error messages.
13466 * testsuite/undef_symbol.sh: Likewise.
13468 2009-02-04 Duncan Sands <baldrick@free.fr>
13471 * reduced_debug_output.h
13472 (Output_reduced_debug_abbrev_section::failed): Use format for
13474 (Output_reduced_debug_info_section::faild): Likewise.
13476 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13478 * script.cc (Lazy_demangler): New class.
13479 (Version_script_info::get_symbol_version_helper): Demangle a
13482 2009-01-29 Cary Coutant <ccoutant@google.com>
13484 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13486 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13488 2009-01-28 Ian Lance Taylor <iant@google.com>
13490 * version.cc (version_string): Bump to 1.9.
13492 * gold.h: Include <cstring> and <stdint.h>.
13493 * version.cc: Include <cstdio>.
13494 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13496 * reduced_debug_output.cc (insert_into_vector): Rename from
13497 Insert_into_vector; change all callers. Use Swap_unaligned to
13498 avoid aliasing issue; remove union since it is unnecessary.
13500 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13502 * Makefile.am (CCFILES): Add gc.cc.
13503 (HFILES): Add gc.h.
13504 * Makefile.in: Regenerate.
13505 * gold.cc (Gc_runner): New class.
13506 (queue_initial_tasks): Call garbage collection related tasks
13507 when corresponding options are invoked.
13508 (queue_middle_gc_tasks): New function.
13509 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13510 processed early before laying out sections during garbage collection.
13511 * gold.h (queue_middle_gc_tasks): New function.
13512 (is_prefix_of): Move from "layout.cc".
13513 * i386.cc (Target_i386::gc_process_relocs): New function.
13514 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13515 * main.cc (main): Create object of class "Garbage_collection".
13516 * object.cc (Relobj::copy_symbols_data): New function.
13517 (Relobj::is_section_name_included): New function.
13518 (Sized_relobj::do_layout): Allow this function to be called twice
13519 during garbage collection and defer layout of section during the
13521 * object.h (Relobj::get_symbols_data): New function.
13522 (Relobj::is_section_name_included): New function.
13523 (Relobj::copy_symbols_data): New function.
13524 (Relobj::set_symbols_data): New function.
13525 (Relobj::get_relocs_data): New function.
13526 (Relobj::set_relocs_data): New function.
13527 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13528 (Relobj::gc_process_relocs): New function.
13529 (Relobj::do_gc_process_relocs): New pure virtual function.
13530 (Relobj::sd_): New data member.
13531 (Sized_relobj::is_output_section_offset_invalid): New function.
13532 (Sized_relobj::do_gc_process_relocs): New function.
13533 * options.h (General_options::gc_sections): Modify to not be a no-op.
13534 (General_options::print_gc_sections): New option.
13535 * plugin.cc (Plugin_finish::run): Remove function call to
13536 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13537 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13538 * reloc.cc (Read_relocs::run): Add task to process relocs and
13539 determine unreferenced sections when doing garbage collection.
13540 (Gc_process_relocs): New class.
13541 (Sized_relobj::do_gc_process_relocs): New function.
13542 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13543 sections that are garbage collected.
13544 * reloc.h (Gc_process_relocs): New class.
13545 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13546 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13547 symbols whose corresponding sections are garbage collected.
13548 (Symbol_table::Symbol_table): Add new parameter for the garbage
13550 (Symbol_table::gc_mark_undef_symbols): New function.
13551 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13552 (Symbol_table::gc_mark_dyn_syms): New function.
13553 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13555 (Symbol_table::add_from_object): Likewise.
13556 (Symbol_table::add_from_relobj): When building shared objects, do not
13557 treat externally visible symbols as garbage.
13558 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13559 table information for static and relocatable links.
13560 * symtab.h (Symbol_table::set_gc): New function.
13561 (Symbol_table::gc): New function.
13562 (Symbol_table::gc_mark_undef_symbols): New function.
13563 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13564 (Symbol_table::gc_mark_dyn_syms): New function.
13565 (Symbol_table::gc_): New data member.
13566 * target.h (Sized_target::gc_process_relocs): New pure virtual
13568 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13569 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13571 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13573 * options.h (General_options::gc_sections): Define as a no-op for now.
13574 (General_options::no_keep_memory): Ditto.
13575 (General_options::Bshareable): Define.
13576 * options.cc (General_options::finalize): Honor -Bshareable.
13578 2009-01-20 Andreas Schwab <schwab@suse.de>
13580 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13581 read the value in the contents, since we don't use it. Use the
13582 template endianness when writing.
13583 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13585 2009-01-19 Andreas Schwab <schwab@suse.de>
13587 * configure.tgt (powerpc64-*): Fix targ_obj.
13589 2009-01-15 Ian Lance Taylor <iant@google.com>
13591 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13592 local symbols when stripping all symbols.
13594 2009-01-14 Cary Coutant <ccoutant@google.com>
13596 * output.cc (Output_reloc): Add explicit instantiations.
13598 2009-01-14 Cary Coutant <ccoutant@google.com>
13600 * archive.cc (Archive::get_elf_object_for_member): Remove call
13601 to File_read::claim_for_plugin.
13602 * descriptors.cc (Descriptors::open): Remove reference to
13604 (Descriptors::claim_for_plugin): Remove.
13605 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13606 (Descriptors::is_claimed): Remove.
13607 (claim_descriptor_for_plugin): Remove.
13608 * fileread.cc (File_read::claim_for_plugin): Remove.
13609 * fileread.h (File_read::claim_for_plugin): Remove.
13610 (File_read::descriptor): Reopen descriptor if necessary.
13611 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13612 (Plugin_manager::all_symbols_read): Add task parameter. Change
13614 (Plugin_manager::get_input_file): New function.
13615 (Plugin_manager::release_input_file): New function.
13616 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13617 corresponding data member.
13618 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13619 and pass to base constructor. Change all callers.
13620 (get_input_file, release_input_file): New functions.
13621 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13622 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13623 (Plugin_manager::all_symbols_read): Add task parameter.
13624 (Plugin_manager::get_input_file): New function.
13625 (Plugin_manager::release_input_file): New function.
13626 (Plugin_manager::task_): New data member.
13627 (Pluginobj::Pluginobj): Add filesize parameter.
13628 (Pluginobj::filename): New function.
13629 (Pluginobj::descriptor): New function.
13630 (Pluginobj::filesize): New function.
13631 (Pluginobj::filesize_): New data member.
13632 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13633 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13634 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13636 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13637 with archive libraries.
13638 * testsuite/Makefile.in: Regenerate.
13639 * testsuite/plugin_test.c (struct sym_info): New type.
13640 (get_input_file, release_input_file): New static variables.
13641 (onload): Capture new transfer vector entries.
13642 (claim_file_hook): Stop reading at end of file according to filesize.
13643 Factor out parsing of readelf output into separate function.
13644 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13645 APIs and get the source file name from the symbol table. Convert
13646 source file name to corresponding object file name. Print info
13647 message when adding new input files.
13648 (parse_readelf_line): New function.
13649 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13650 * testsuite/plugin_test_2.sh: Likewise.
13651 * testsuite/plugin_test_3.sh: Likewise.
13652 * testsuite/plugin_test_4.sh: New test case.
13654 2009-01-07 Ian Lance Taylor <iant@google.com>
13656 * version.cc (version_string): Bump to 1.8.
13658 2008-12-23 Cary Coutant <ccoutant@google.com>
13660 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13661 * plugin.cc (Plugin_manager::finish): Rename as
13662 layout_deferred_objects. Move cleanup to separate function.
13663 (Plugin_manager::cleanup): New function.
13664 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13666 * plugin.h (Plugin_manager::finish): Rename as
13667 layout_deferred_objects.
13668 (Plugin_manager::cleanup): New function.
13669 (Plugin_manager::cleanup_done): New field.
13671 2008-12-23 Cary Coutant <ccoutant@google.com>
13673 * plugin.cc (is_visible_from_outside): New function.
13674 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13675 so we don't return "IR only" status for exported symbols or -r links.
13677 * testsuite/Makefile.am (plugin_test_3): New test case.
13678 * testsuite/Makefile.in: Regenerate.
13679 * testsuite/plugin_test_3.sh: New file.
13681 2008-12-22 Cary Coutant <ccoutant@google.com>
13683 * object.cc (Sized_relobj::layout_section): New function.
13684 (Sized_relobj::do_layout): Defer layout of input sections until after
13685 plugin has provided replacement files.
13686 (Sized_relobj::do_layout_deferred_sections): New function.
13687 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13688 (Relobj::layout_deferred_sections): New function.
13689 (Relobj::do_layout_deferred_sections): New function.
13690 (Sized_relobj::do_layout_deferred_sections): New function.
13691 (Sized_relobj::layout_section): New function.
13692 (Sized_relobj::Deferred_layout): New structure.
13693 (Sized_relobj::deferred_layout_): New field.
13694 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13695 Change all callers. Layout deferred sections.
13696 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13698 (Plugin_hook::run): Move code from do_plugin_hook inline.
13699 (Plugin_hook::do_plugin_hook): Remove.
13700 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13701 (Plugin_manager::finish): Renamed, was cleanup.
13702 (Plugin_manager::should_defer_layout): New function.
13703 (Plugin_manager::add_deferred_layout_object): New function.
13704 (Plugin_manager::Deferred_layout_list): New type.
13705 (Plugin_manager::deferred_layout_objects_): New field.
13706 (Plugin_hook::do_plugin_hook): Remove.
13708 2008-12-17 Ian Lance Taylor <iant@google.com>
13710 * options.h (class General_options): Add --no case for
13713 2008-12-16 Cary Coutant <ccoutant@google.com>
13715 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13717 (Plugin_manager::claim_file): Create plugin object even if
13718 plugin did not call the add_symbols callback.
13719 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13720 asking for more symbols than were added.
13721 * testsuite/Makefile.am (plugin_test_1): Add test case with
13723 (empty.syms): New target.
13724 * testsuite/Makefile.in: Regenerate.
13725 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13726 message. Don't call add_symbols if no globals.
13727 (all_symbols_read_hook): Don't provide replacement for empty
13730 2008-12-12 Ian Lance Taylor <iant@google.com>
13732 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13733 r_type == 0 for a local symbol with r_sym == 0.
13734 (scan_relocatable_relocs): Pass r_sym to
13735 local_non_section_strategy.
13736 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13739 * configure.ac: Update test for TLS descriptors: they are
13740 supported as of glibc 2.9.
13741 * configure: Rebuild.
13743 2008-12-11 Ian Lance Taylor <iant@google.com>
13746 * target-reloc.h (Default_scan_relocatable_relocs): For each
13747 function, map r_type == 0 to RELOC_DISCARD.
13749 2008-12-10 Cary Coutant <ccoutant@google.com>
13751 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13752 object to override a kept COMDAT group from a plugin object.
13754 2008-12-09 Ian Lance Taylor <iant@google.com>
13757 * yyscript.y (file_cmd): Handle INPUT.
13759 * testsuite/initpri1.c: Change all declarations to be full
13760 prototypes by adding void, to avoid compiler warnings.
13762 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13764 * options.cc (General_options::parse_plugin_opt): New.
13765 (General_options::add_plugin): The argument now is just the filename.
13766 (General_options::add_plugin_option): New.
13767 * options.h (plugin_opt): New.
13768 (add_plugin): Change argument name.
13769 (add_plugin_option): New.
13770 * plugin.cc (Plugin::load): Don't parse the plugin option.
13771 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13772 (Plugin::add_option): New.
13773 (Plugin::args_): Change type.
13774 (Plugin::filename_): New.
13775 (Plugin_manager::add_plugin_option): New.
13776 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13777 * testsuite/Makefile.in: Regenerate.
13779 2008-12-05 Cary Coutant <ccoutant@google.com>
13781 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13782 Handle --strip-lto-sections option.
13783 * options.h (strip_lto_sections): New option.
13785 2008-12-01 Cary Coutant <ccoutant@google.com>
13787 * plugin.cc (ld_plugin_message): Change format parameter to const.
13788 Fix mismatch between new[] and delete.
13790 2008-11-14 Cary Coutant <ccoutant@google.com>
13792 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13795 2008-11-05 Craig Silverstein <csilvers@google.com>
13797 * options.cc (General_options::parse_dynamic_list): New function.
13798 * options.h (General_options): New flags dynamic_list,
13799 dynamic_list_data, dynamic_list_cpp_new, and
13800 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13801 (General_options::in_dynamic_list): New function.
13802 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13803 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13804 (Lex::can_continue_name): Likewise.
13806 (read_script_file): New parameter script_options.
13807 (read_dynamic_list): New function.
13808 (Script_options::define_dynamic_list): New function.
13809 (dynamic_list_keyword_parsecodes): New variable.
13810 (dynamic_list_keywords): New variable.
13811 * script.h (Script_options::define_dynamic_list): New function
13813 (read_dynamic_list): New function prototype.
13814 * symtab.cc (strprefix): New macro.
13815 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13816 dynamic_list_data, dynamic_list_cpp_new, and
13817 dynamic_list_cpp_typeinfo.
13818 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13819 (dynamic_list_expr): New rule.
13820 (dynamic_list_nodes): Likewise.
13821 (dynamic_list_node): Likewise.
13822 * testsuite/Makefile.am (dynamic_list): New test.
13823 * testsuite/Makefile.in: Regenerated.
13824 * testsuite/dynamic_list.t: New file.
13825 * testsuite/dynamic_list.sh: New file.
13827 2008-11-05 Craig Silverstein <csilvers@google.com>
13829 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13830 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13831 (t11_last): Likewise.
13832 * testsuite/ver_test_6.c (main): Likewise.
13834 2008-10-07 Cary Coutant <ccoutant@google.com>
13836 * options.c (General_options::finalize): Add check for -static and
13838 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13841 2008-10-02 Cary Coutant <ccoutant@google.com>
13843 * plugin.cc (make_sized_plugin_object): Fix conditional
13844 compilation to work when not all targets are enabled.
13846 2008-09-29 Cary Coutant <ccoutant@google.com>
13848 * archive.cc (Archive::get_file_and_offset): Use filename instead
13849 of name to get library path.
13850 (Archive::include_member): Unlock external member of a thin archive.
13852 * testsuite/Makefile.am (TEST_AR): New variable.
13853 (thin_archive_test_1): New test.
13854 (thin_archive_test_2): New test.
13855 * testsuite/Makefile.in: Regenerate.
13856 * testsuite/thin_archive_main.cc: New file.
13857 * testsuite/thin_archive_test_1.cc: New file.
13858 * testsuite/thin_archive_test_2.cc: New file.
13859 * testsuite/thin_archive_test_3.cc: New file.
13860 * testsuite/thin_archive_test_4.cc: New file.
13862 2008-09-29 Cary Coutant <ccoutant@google.com>
13864 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13865 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13867 (Sized_relobj::do_finalize_local_symbols): Likewise.
13868 (Sized_relobj::map_to_kept_section): Likewise.
13869 * object.h (Sized_relobj::invalid_address): New constant.
13870 (Sized_relobj::do_output_section_offset): Check for invalid_address
13872 * output.cc (Output_reloc::local_section_offset): Use constant
13873 invalid_address instead of -1U.
13874 (Output_reloc::get_address): Likewise.
13875 (Output_section::output_address): Change -1U to -1ULL.
13876 * output.h (Output_reloc::invalid_address): New constant.
13877 * reloc.cc (Sized_relobj::write_sections): Use constant
13878 invalid_address instead of -1U.
13879 (Sized_relobj::relocate_sections): Likewise.
13880 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13881 values for merge sections.
13882 * target-reloc.h (relocate_for_relocatable): Use constant
13883 invalid_address instead of -1U.
13885 2008-09-19 Cary Coutant <ccoutant@google.com>
13887 Add plugin functionality for link-time optimization (LTO).
13888 * configure.ac (plugins): Add --enable-plugins option.
13889 * configure: Regenerate.
13890 * config.in: Regenerate.
13891 * Makefile.am (LIBDL): New variable.
13892 (CCFILES): Add plugin.cc.
13893 (HFILES): Add plugin.h.
13894 (ldadd_var): Add LIBDL.
13895 * Makefile.in: Regenerate.
13897 * archive.cc: Include "plugin.h".
13898 (Archive::setup): Don't preread archive symbols when using a plugin.
13899 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13900 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13902 (Archive::include_member): Add symbols from plugin objects.
13903 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13904 * descriptors.cc (Descriptors::open): Check for file descriptors
13905 abandoned by plugins.
13906 (Descriptors::claim_for_plugin): New function.
13907 * descriptors.h (Descriptors::claim_for_plugin): New function.
13908 (Open_descriptor::is_claimed): New field.
13909 (claim_descriptor_for_plugin): New function.
13910 * fileread.cc (File_read::claim_for_plugin): New function.
13911 * fileread.h (File_read::claim_for_plugin): New function.
13912 (File_read::descriptor): New function.
13913 * gold.cc: Include "plugin.h".
13914 (queue_initial_tasks): Add task to call plugin hooks for generating
13916 * main.cc: Include "plugin.h".
13917 (main): Load plugin libraries.
13918 * object.h (Pluginobj): Declare.
13919 (Object::pluginobj): New function.
13920 (Object::do_pluginobj): New function.
13921 (Object::set_target): New function.
13922 * options.cc: Include "plugin.h".
13923 (General_options::parse_plugin): New function.
13924 (General_options::General_options): Initialize plugins_ field.
13925 (General_options::add_plugin): New function.
13926 * options.h (Plugin_manager): Declare.
13927 (General_options): Add --plugin option.
13928 (General_options::has_plugins): New function.
13929 (General_options::plugins): New function.
13930 (General_options::add_plugin): New function.
13931 (General_options::plugins_): New field.
13932 * plugin.cc: New file.
13933 * plugin.h: New file.
13934 * readsyms.cc: Include "plugin.h".
13935 (Read_symbols::do_read_symbols): Check for archive before checking
13936 for ELF file. Call plugin hooks to claim files.
13937 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13938 from a real object file; force override when processing replacement
13940 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13941 (Symbol::init_base_object): Likewise.
13942 (Symbol::init_base_output_data): Likewise.
13943 (Symbol::init_base_output_segment): Likewise.
13944 (Symbol::init_base_constant): Likewise.
13945 (Symbol::init_base_undefined): Likewise.
13946 (Symbol::output_section): Assert that object is not a plugin.
13947 (Symbol_table::add_from_pluginobj): New function.
13948 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13950 (Symbol_table::sized_write_globals): Likewise.
13951 (Symbol_table::add_from_pluginobj): Instantiate template.
13952 * symtab.h (Sized_pluginobj): Declare.
13953 (Symbol::in_real_elf): New function.
13954 (Symbol::set_in_real_elf): New function.
13955 (Symbol::in_real_elf_): New field.
13956 (Symbol_table::add_from_pluginobj): New function.
13958 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13959 (LIBDL): New variable.
13960 (LDADD): Add LIBDL.
13961 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13962 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13963 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13964 (MOSTLYCLEANFILES): Likewise.
13965 * testsuite/Makefile.in: Regenerate.
13966 * testsuite/plugin_test.c: New file.
13967 * testsuite/plugin_test_1.sh: New file.
13968 * testsuite/plugin_test_2.sh: New file.
13970 2008-09-16 Ian Lance Taylor <iant@google.com>
13972 * target-reloc.h (relocate_section): Check whether a symbol is
13973 defined by the ABI before reporting an undefined symbol error.
13974 * target.h (Target::is_defined_by_abi): Make parameter const.
13975 (Target::do_is_defined_by_abi): Likewise.
13976 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13977 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13978 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13979 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13980 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13981 * testsuite/Makefile.in: Rebuild.
13983 * fileread.cc (make_view): Add casts to avoid warning.
13985 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13987 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13988 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13990 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13992 * options.h (General_options::output_is_executable): New.
13993 (General_options::output_is_pie): New.
13994 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13995 for shared libraries.
13996 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13998 2008-09-11 Chris Demetriou <cgd@google.com>
14000 * options.h (origin): New -z option.
14001 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14002 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14005 2008-09-05 Cary Coutant <ccoutant@google.com>
14007 * fileread.cc (File_read::make_view): Add check for attempt to map
14008 beyond end of file.
14010 2008-09-05 Cary Coutant <ccoutant@google.com>
14012 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14013 explicit instantiations.
14015 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
14018 * options.cc (General_options::finalize): Allow undefined symbols
14019 in shlibs if linking -shared.
14022 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14023 symbols as not needing a dynsym entry.
14025 2008-08-20 Craig Silverstein <csilvers@google.com>
14027 * fileread.cc (File_read::open): Do not lock the file unless it
14028 was successfully opened.
14030 2008-08-14 Cary Coutant <ccoutant@google.com>
14032 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14033 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14034 * testsuite/tls_test.cc (struct int128): 128-bit struct
14035 for testing TLS relocs with non-zero addend.
14036 (v12): New TLS variable.
14038 (t_last): Add check for v12.
14039 * testsuite/tls_test.h (t12): New function.
14040 * testsuite/tls_test_main.cc (thread_routine): Call new test.
14042 2008-08-13 Ian Lance Taylor <iant@google.com>
14044 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14045 set tls_segment_ or relro_segment_.
14046 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14048 * output.h (Output_section::clear_is_relro): New function.
14049 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14050 sections specially even when output_data_ is empty.
14051 (Output_segment::maximum_alignment): When first section is relro,
14052 only force alignment for PT_LOAD segments.
14053 * script.cc (script_data_segment_align): New function.
14054 (script_data_segment_relro_end): New function.
14055 * script-c.h (script_data_segment_align): Declare.
14056 (script_data_segment_relro_end): Declare.
14057 * script-sections.h (class Script_sections): Declare
14058 data_segment_align and data_segment_relro_end. Add fields
14059 segment_align_index_ and saw_relro_end_.
14060 * script-sections.cc (class Sections_element): Add set_is_relro
14061 virtual function. Add new bool* parameter to place_orphan_here.
14062 Add get_output_section virtual function.
14063 (class Output_section_definition): Add set_is_relro. Add new
14064 bool* parameter to place_orphan_here. Add get_output_section.
14065 Add is_relro_ field.
14066 (Output_section_definition::Output_section_definition): Initialize
14067 evaluated_address_, evaluated_load_address, evaluated_addralign_,
14068 and is_relro_ fields.
14069 (Output_section_definition::place_orphan_here): Add is_relro
14071 (Output_section_definition::set_section_addresses): Set relro for
14073 (Output_section_definition::alternate_constraint): Likewise.
14074 (class Orphan_output_section): Add new bool* parameter to
14075 place_orphan_here. Add get_output_section.
14076 (Orphan_output_section::place_orphan_here): Add is_relro
14078 (Script_sections::Script_sections): Initialize
14079 data_segment_align_index_ and saw_relro_end_.
14080 (Script_sections::data_segment_align): New function.
14081 (Script_sections::data_segment_relro_end): New function.
14082 (Script_sections::place_orphan): Set or clear is_relro.
14083 (Script_sections::set_section_addresses): Force alignment of first
14085 * yyscript.y (exp): Call script_data_segment_align and
14086 script_data_segment_relro_end.
14087 * testsuite/relro_script_test.t: New file.
14088 * testsuite/relro_test.cc (using_script): Declare.
14089 (t1, t2): Test using_script.
14090 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14091 (relro_script_test_SOURCES): Define.
14092 (relro_script_test_DEPENDENCIES): Define.
14093 (relro_script_test_LDFLAGS): Define.
14094 (relro_script_test_LDADD): Define.
14095 (relro_script_test.so): New target.
14096 * testsuite/Makefile.in: Rebuild.
14098 2008-08-06 Cary Coutant <ccoutant@google.com>
14100 * archive.cc (Archive::total_archives, Archive::total_members)
14101 (Archive::total_members_loaded): New variables.
14102 (Archive::setup): Add parameter. Add option to preread
14104 (Archive::read_armap): Add counter.
14105 (Archive::get_file_and_offset): New function.
14106 (Archive::get_elf_object_for_member): New function.
14107 (Archive::read_all_symbols): New function.
14108 (Archive::read_symbols): New function.
14109 (Archive::add_symbols): Add counters.
14110 (Archive::include_all_members): Use armap to find members if it's
14112 (Archive::include_member): Skip reading symbols if already read.
14113 Factored code into Archive::get_file_and_offset and
14114 Archive::get_elf_object_for_member. Changed call to
14115 Mapfile::report_include_archive_member.
14116 (Archive::print_stats): New function.
14117 * archive.h: Declare Object and Read_symbols_data classes.
14118 (Archive::Archive): Add initializers for new members.
14119 (Archive::setup): Add parameter.
14120 (Archive::print_stats): New function.
14121 (Archive::total_archives, Archive::total_members)
14122 (Archive::total_members_loaded): New variables.
14123 (Archive::get_file_and_offset): New function.
14124 (Archive::get_elf_object_for_member): New function.
14125 (Archive::read_all_symbols): New function.
14126 (Archive::read_symbols): New function.
14127 (Archive::Archive_member): New class.
14128 (Archive::members_): New member.
14129 (Archive::num_members_): New member.
14130 * main.cc: Include archive.h.
14131 (main): Call Archive::print_stats.
14132 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14133 archive parameter; member_name is now the fully-decorated name.
14134 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14135 * options.h: (General_options): Add --preread-archive-symbols option.
14136 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14139 2008-08-04 Ian Lance Taylor <iant@google.com>
14141 * symtab.h (Symbol::use_plt_offset): New function.
14142 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14143 * powerpc.cc (Relocate::relocate): Likewise.
14144 * sparc.cc (Relocate::relocate): Likewise.
14145 * x86_64.cc (Relocate::relocate): Likewise.
14146 * testsuite/weak_plt.sh: New test.
14147 * testsuite/weak_plt_main.cc: New test.
14148 * testsuite/weak_plt_shared.cc: New test.
14149 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14150 (check_PROGRAMS): Add weak_plt.
14151 (check_DATA): Add weak_plt_shared.so.
14152 (weak_plt_main_pic.o, weak_plt): New targets.
14153 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14154 * testsuite/Makefile.in: Rebuild.
14156 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14158 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14159 * testsuite/Makefile.in: Rebuild.
14161 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14163 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14164 * Makefile.in: Regenerate.
14165 * po/POTFILES.in: Regenerate.
14167 2008-07-29 Ian Lance Taylor <iant@google.com>
14169 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14170 symbols before other symbols.
14171 * testsuite/script_test_2.cc (test_addr): Declare.
14172 (test_addr_alias): Declare.
14173 (main): Check that test_addr and test_addr_alias have the right
14175 * testsuite/script_test_2.t: Define test_addr_alias and
14178 2008-07-24 Ian Lance Taylor <iant@google.com>
14181 * descriptors.cc: New file.
14182 * descriptors.h: New file.
14183 * gold-threads.h (class Hold_optional_lock): New class.
14184 * fileread.cc: Include "descriptors.h".
14185 (File_read::~File_read): Release descriptor rather than closing
14187 (File_read::open) [file]: Call open_descriptor rather than open.
14188 Set is_descriptor_opened_.
14189 (File_read::open) [memory]: Assert that descriptor is not open.
14190 (File_read::reopen_descriptor): New function.
14191 (File_read::release): Release descriptor.
14192 (File_read::do_read): Make non-const. Reopen descriptor.
14193 (File_read::read): Make non-const.
14194 (File_read::make_view): Reopen descriptor.
14195 (File_read::do_readv): Likewise.
14196 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14197 Update declarations.
14198 * layout.cc: Include "descriptors.h".
14199 (Layout::create_build_id): Use open_descriptor rather than open.
14200 * output.cc: Include "descriptors.h".
14201 (Output_file::open): Use open_descriptor rather than open.
14202 * archive.cc (Archive::const_iterator): Change Archive to be
14204 (Archive::begin, Archive::end): Make non-const.
14205 (Archive::count_members): Likewise.
14206 * archive.h (class Archive): Update declarations.
14207 * object.h (Object::read): Make non-const.
14208 * Makefile.am (CCFILES): Add descriptors.cc.
14209 (HFILES): Add descriptors.h.
14210 * Makefile.in: Rebuild.
14213 * gold.h: Always include <clocale>. Add Solaris workarounds
14214 following code in binutils/sysdep.h.
14217 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14218 this->eh_frame_hdr_ is NULL before using it.
14220 * dynobj.cc (Versions::Versions): Update comment.
14222 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14223 the base version name.
14225 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14226 array size plus one.
14227 (Stringpool_template::set_string_offsets): Subtract one from key
14228 before using it as an array index.
14229 (Stringpool_template::get_offset_with_length): Likewise.
14230 (Stringpool_template::write_to_buffer): Likewise.
14231 * stringpool.h (Stringpool_template::get_offset_from_key):
14234 2008-07-23 Ian Lance Taylor <iant@google.com>
14237 * object.h (Merged_symbol_value::value): Do our best to handle a
14241 * script.cc (Version_script_info::get_versions): Don't add empty
14242 version tag to return value.
14243 (Version_script_info::get_symbol_version_helper): Change return
14244 type to bool. Add pversion parameter. Change all callers.
14245 (script_register_vers_node): Don't require a non-NULL tag.
14246 * script.h (class Version_script_info): Update declarations.
14247 (Version_script_info::get_symbol_version): Change return type to
14248 bool. Add version parameter. Change all callers.
14249 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14250 handling. Handle an empty version from a version script.
14251 (Symbol_table::define_special_symbol): Likewise.
14252 * testsuite/ver_test_10.script: New file.
14253 * testsuite/ver_test_10.sh: New file.
14254 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14255 (check_DATA): Add ver_test_10.syms.
14256 (ver_test_10.syms, ver_test_10.so): New target.
14257 * testsuite/Makefile.in: Rebuild.
14259 2008-07-23 Simon Baldwin <simonb@google.com>
14261 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14262 to zero for undefined symbols from dynamic libraries.
14264 2008-07-23 Ian Lance Taylor <iant@google.com>
14266 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14267 Change all callers.
14268 * symtab.h (class Symbol_table): Update declaration.
14269 * testsuite/ver_test_9.cc: New file.
14270 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14271 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14272 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14273 (ver_test_9.so, ver_test_9.o): New targets.
14274 * testsuite/Makefile.in: Rebuild.
14276 2008-07-22 Ian Lance Taylor <iant@google.com>
14278 * options.h (class General_options): Define --check-sections.
14279 * layout.cc (Layout::set_segment_offsets): Handle
14282 * options.h (class General_options): Define -n/--nmagic and
14284 * options.cc (General_options::finalize): For -n/--nmagic or
14285 -N/--omagic, set -static.
14286 * layout.cc (Layout::attach_allocated_section_to_segment): If
14287 -N/--omagic, don't put read-only and read-write sections in
14288 different segments.
14289 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14290 finding a read-only segment.
14291 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14292 don't set the minimum segment alignment to the common page size,
14293 and don't set the file offset to the address modulo the page size.
14294 * script-sections.cc (Script_sections::create_segments): If
14295 -n/--omagic, don't put read-only and read-write sections in
14296 different segments.
14298 * cref.cc: New file.
14299 * cref.h: New file.
14300 * options.h (class General_options): Add --print-symbol-counts.
14301 * main.cc (main): Issue defined symbol report if requested.
14302 * archive.cc (Archive::interpret_header): Make into a const member
14304 (Archive::add_symbols): Call Input_objects::archive_start and
14306 (Archive::const_iterator): Define new class.
14307 (Archive::begin, Archive::end): New functions.
14308 (Archive::include_all_members): Rewrite to use iterator.
14309 (Archive::count_members): New function.
14310 * archive.h (class Archive): Update declarations.
14311 (Archive::filename): New function.
14312 * object.cc: Include "cref.h".
14313 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14314 (Sized_relobj::do_get_global_symbol_counts): New function.
14315 (Input_objects::add_object): Add object to cross-referencer.
14316 (Input_objects::archive_start): New function.
14317 (Input_objects::archive_stop): New function.
14318 (Input_objects::print_symbol_counts): New function.
14319 * object.h: Declare Cref and Archive.
14320 (Object::get_global_symbol_counts): New function.
14321 (Object::do_get_global_symbol_counts): New pure virtual function.
14322 (class Sized_relobj): Add defined_count_ field. Update
14324 (class Input_objects): Add cref_ field. Update constructor.
14325 Update declarations.
14326 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14328 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14330 (Sized_dynobj::do_get_global_symbol_counts): New function.
14331 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14332 defined_count_. Update declarations. Define Symbols typedef.
14333 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14334 parameter. Change all callers.
14335 (Symbol_table::add_from_dynobj): Add sympointers and defined
14336 parameters. Change all callers.
14337 * symtab.h (class Symbol_table): Update declarations.
14338 * Makefile.am (CCFILES): Add cref.cc.
14339 (HFILES): Add cref.h.
14340 * Makefile.in: Rebuild.
14342 2008-07-22 Simon Baldwin <simonb@google.com>
14344 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14345 to zero when writing undefined symbols.
14347 2008-07-22 Ian Lance Taylor <iant@google.com>
14349 * output.cc (Output_section::add_input_section): Don't try to
14350 merge empty merge sections.
14352 2008-07-21 Craig Silverstein <csilvers@google.com>
14354 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14355 Include symbol version in error message.
14357 2008-07-20 Chris Demetriou <cgd@google.com>
14359 * configure.ac (gold_cv_c_random_seed): New configured variable.
14360 (RANDOM_SEED_CFLAGS): New substituted variable.
14361 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14362 * configure: Rebuild.
14363 * Makefile.in: Likewise.
14364 * testsuite/Makefile.in: Likewise.
14366 2008-07-18 Ian Lance Taylor <iant@google.com>
14368 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14369 where we see NAME/NULL and NAME/VERSION as separate symbols.
14370 * testsuite/ver_test_main.cc (main): Call t4.
14371 (t4, t4_2a): Define.
14372 * testsuite/ver_test_2.cc (t4_2): Define.
14373 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14374 * testsuite/ver_test_4.cc (t4_2a): Define.
14375 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14376 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14378 2008-07-17 Ian Lance Taylor <iant@google.com>
14380 * dynobj.cc (Versions::add_def): If we give an error about a
14381 missing version, go ahead and create the version anyhow.
14383 2008-07-10 Ian Lance Taylor <iant@google.com>
14385 Handle output sections with more than 0x7fffffff bytes.
14386 * object.h (class Relobj): Change map_to_output_ to
14387 output_sections_, and just keep a section pointer. Change all
14388 uses. Move comdat group support to Sized_relobj.
14389 (Relobj::is_section_specially_mapped): Remove.
14390 (Relobj::output_section): Remove poff parameter. Change all
14392 (Relobj::output_section_offset): New function.
14393 (Relobj::set_section_offset): Rewrite.
14394 (Relobj::map_to_output): Remove.
14395 (Relobj::output_sections): New function.
14396 (Relobj::do_output_section_offset): New pure virtual function.
14397 (Relobj::do_set_section_offset): Likewise.
14398 (class Sized_relobj): Add section_offsets_ field. Add comdat
14399 group support from Relobj. Update declarations.
14400 (Sized_relobj::get_output_section_offset): New function.
14401 (Sized_relobj::do_output_section_offset): New function.
14402 (Sized_relobj::do_set_section_offset): New function.
14403 * object.cc (Relobj::output_section_address): Remove.
14404 (Sized_relobj::Sized_relobj): Initialize new fields.
14405 (Sized_relobj::include_section_group): Cast find_kept_object to
14407 (Sized_relobj::include_linkonce_section): Likewise.
14408 (Sized_relobj::do_layout): Use separate arrays for output section
14410 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14412 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14413 output_sections and section_offsets.
14414 (Sized_relobj::write_local_symbols): Likewise.
14415 (map_to_kept_section): Compute output address directly.
14416 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14417 output_sections and section_offsets.
14418 (Sized_relobj::write_sections): Likewise.
14419 (Sized_relobj::relocate_sections): Likewise.
14420 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14421 * output.h (class Output_reloc): Update declarations. Change
14422 u2_.relobj to Sized_relobj*.
14423 (class Output_data_reloc): Change add functions to use
14425 * output.cc (Output_reloc::Output_reloc): Change relobj to
14427 (Output_reloc::local_section_offset): Change return type to
14428 Elf_Addr. Use get_output_section_offset.
14429 (Output_reloc::get_address): Likewise.
14430 (Output_section::is_input_address_mapped): Don't call
14431 is_section_specially_mapped.
14432 (Output_section::output_offset): Likewise.
14433 (Output_section::output_address): Likewise.
14434 (Output_section::starting_output_address): Likewise.
14435 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14436 parameter to Sized_relobj*.
14437 (Copy_relocs::need_copy_reloc): Likewise.
14438 (Copy_relocs::save): Likewise.
14439 * copy-relocs.h (class Copy_relocs): Update declarations.
14440 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14441 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14442 * target-reloc.h (relocate_for_relocatable): Change
14443 offset_in_output_section type to Elf_Addr. Change code that uses
14445 * layout.cc (Layout::layout): Always set *off.
14446 * mapfile.cc (Mapfile::print_input_section): Use
14447 output_section_offset.
14448 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14450 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14451 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14452 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14454 2008-07-03 Ian Lance Taylor <iant@google.com>
14456 * layout.cc (Layout::include_section): Do not discard unrecognized
14457 SHT_STRTAB sections.
14459 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14461 * script.cc (Lex::can_continue_name): Make '?' allowable in
14462 version-script names.
14463 * testsuite/version_script.map: Change glob pattern to use '?'
14465 2008-06-30 Manish Singh <yosh@gimp.org>
14468 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14471 2008-06-30 Ian Lance Taylor <iant@google.com>
14475 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14476 versions]: Don't try to read the value in the contents, since we
14477 don't use it. Use the template endianness when writing.
14479 2008-06-25 Cary Coutant <ccoutant@google.com>
14481 * fileread.cc (File_read::make_view): Assert on zero-length view.
14482 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14483 symbol table when there are no symbols to read.
14485 2008-06-23 Craig Silverstein <csilvers@google.com>
14487 * version.cc (version_string): Bump to 1.7
14489 2008-06-18 Craig Silverstein <csilvers@google.com>
14491 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14492 constant 0xFFFF to type Valtype.
14493 (Powerpc_relocate_functions::rel16_ha): Likewise.
14495 2008-06-17 Ian Lance Taylor <iant@google.com>
14497 * output.h (Output_section::Input_section): Initialize p2align_ to
14498 zero for Output_section_data constructors.
14499 (Output_section::Input_section::addralign): If not an input
14500 section, return the alignment of the Output_section_data.
14501 * testsuite/copy_test.cc: New file.
14502 * testsuite/copy_test_1.cc: New file.
14503 * testsuite/copy_test_2.cc: New file.
14504 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14505 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14506 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14507 (copy_test_1_pic.o, copy_test_1.so): New targets.
14508 (copy_test_2_pic.o, copy_test_2.so): New targets.
14509 * testsuite/Makefile.in: Rebuild.
14511 * script-sections.cc (Script_sections::place_orphan): Initialize
14512 local variable exact.
14514 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14516 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14518 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14519 David S. Miller <davem@davemloft.net>
14521 * powerpc.cc: New file.
14522 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14523 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14524 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14525 * Makefile.in: Rebuild.
14527 2008-06-09 Ian Lance Taylor <iant@google.com>
14529 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14531 (throwing, orig_terminate): New static variables.
14532 (terminate_handler): New static function.
14533 (t2): Set terminate handler.
14535 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14538 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14541 2008-05-30 Cary Coutant <ccoutant@google.com>
14543 * archive.cc (Archive::include_all_members) Correct to step
14544 over symbol table and extended name table in thin archives.
14546 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14549 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14552 2008-05-28 Caleb Howe <cshowe@google.com>
14554 * reduced_debug_output.cc: New file.
14555 * reduced_debug_output.h: New file.
14556 * options.h (class General_options): Add --strip-debug-non-line.
14557 * options.cc (General_options::finalize): Add strip_debug_non_line
14558 to the strip heirarchy.
14559 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14561 * layout.cc: Include "reduced_debug_output.h".
14562 (Layout::Layout): Initialize new fields.
14563 (line_only_debug_sections): New static array.
14564 (is_lines_only_debug_sections): New static inline function.
14565 (Layout::include_section): Handle --strip-debug-non-line.
14566 (Layout::make_output_section): If --strip-debug-non-line, build
14567 new output sections for .debug_abbrev and .debug_info.
14568 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14569 gold. Warn about possible overflow.
14570 (read_signed_LEB_128): Likewise.
14571 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14572 (read_signed_LEB_128): Declare.
14573 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14574 (HFILES): Add reduced_debug_output.h.
14575 * Makefile.in: Rebuild.
14577 2008-05-21 Ian Lance Taylor <iant@google.com>
14579 * mapfile.cc: New file.
14580 * mapfile.h: New file.
14581 * options.h (class General_options): Add -M/--print-map and -Map.
14582 * options.cc (General_options::finalize): Make -M equivalent to
14584 * main.cc: Include <cstdio> and "mapfile.h".
14585 (main): Open mapfile if requested.
14586 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14587 constructor. Change caller.
14588 (queue_initial_tasks): Add mapfile parameter. Change caller.
14589 (queue_middle_tasks): Likewise.
14590 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14592 * archive.cc: Include "mapfile.h".
14593 (Archive::add_symbols): Add mapfile parameter. Change all
14594 callers. Pass mapfile, symbol, and reason to include_member.
14595 (Archive::include_all_members): Add mapfile parameter. Change all
14597 (Archive::include_member): Add mapfile, sym, and why parameters.
14598 Change all callers. Report inclusion to map file.
14599 * archive.h: Include "fileread.h".
14600 (class Archive): Update declarations.
14601 (Archive::file): New const method.
14602 (class Add_archive_symbols): Add mapfile_ field. Update
14603 constructor. Change all callers.
14604 * readsyms.h (class Read_symbols): Likewise.
14605 (class Finish_group): Likewise.
14606 (class Read_script): Likewise.
14607 * common.cc: Include "mapfile.h".
14608 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14610 (Symbol_table::do_allocate_commons): Likewise.
14611 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14612 symbol allocation to mapfile.
14613 * common.h (class Allocate_commons_task): Add mapfile_ field.
14614 Update constructor. Change all callers.
14615 * symtab.h (class Symbol_table): Update declarations.
14616 * layout.cc: Include "mapfile.h".
14617 (Layout_task_runner::run): Print information to mapfile.
14618 (Layout::create_gold_note): Change Output_data_fixed_space to
14619 Output_data_zero_fill.
14620 (Layout::create_build_id): Likewise.
14621 (Layout::print_to_mapfile): New function.
14622 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14623 constructor. Change caller.
14624 (class Layout): Declare print_to_mapfile.
14625 * output.cc (Output_section::Input_section::print_to_mapfile): New
14627 (Output_section::add_input_section): If producing a map, always
14628 add to input_sections_ list.
14629 (Output_section::do_print_to_mapfile): New function.
14630 (Output_segment::print_sections_to_mapfile): New function.
14631 (Output_segment::print_section_list_to_mapfile): New function.
14632 * output.h: Include "mapfile.h".
14633 (Output_data::print_to_mapfile): New function.
14634 (Output_data::do_print_to_mapfile): New virtual function.
14635 (Output_segment_headers::do_print_to_mapfile): New function.
14636 (Output_file_header::do_print_to_mapfile): New function.
14637 (Output_data_const::do_print_to_mapfile): New function.
14638 (class Output_data_const_buffer): Add map_name_ field. Update
14639 constructor. Change all callers. Add do_print_to_mapfile
14641 (class Output_data_fixed_space): Likewise.
14642 (class Output_data_space): Likewise.
14643 (class Output_data_zero_fill): New class.
14644 (Output_data_strtab::do_print_to_mapfile): New function.
14645 (Output_data_reloc_base::do_print_to_mapfile): New function.
14646 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14647 (Output_data_group::do_print_to_mapfile): New function.
14648 (Output_data_got::do_print_to_mapfile): New function.
14649 (Output_data_dynamic::do_print_to_mapfile): New function.
14650 (Output_symtab_xindex::do_print_to_mapfile): New function.
14651 (class Output_section): Declare do_print_to_mapflie. Declare
14652 print_to_mapfile in Input_section.
14653 (class Output_segment): Declare new functions.
14654 * object.h (Sized_relobj::symbol_count): New function.
14655 * script-sections.cc
14656 (Output_section_element_dot_assignment::set_section_addresses):
14657 Change Output_data_fixed_space to Output_data_zero_fill.
14658 (Output_data_expression::do_print_to_mapfile): New function.
14659 * script.cc (read_input_script): Add mapfile parameter. Change
14661 * script.h (read_input_script): Update declaration.
14662 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14663 (Eh_frame::do_print_to_mapfile): New function.
14664 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14665 (Output_merge_string::do_print_to_mapfile): New function.
14666 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14668 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14670 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14672 * Makefile.am (CCFILES): Add mapfile.cc.
14673 (HFILES): Add mapfile.h.
14674 * Makefile.in: Rebuild.
14676 2008-05-19 Ian Lance Taylor <iant@google.com>
14678 * options.h (class General_options): Add -z relro.
14679 * layout.cc (Layout::Layout): Initialize relro_segment_.
14680 (Layout::add_output_section_data): Return the output section.
14681 (Layout::make_output_section): Rcognize relro sections and mark
14682 them appropriately.
14683 (Layout::attach_allocated_section_to_segment): Put relro sections
14684 in a PT_GNU_RELRO segment.
14685 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14687 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14689 (Layout::linkonce_mapping): Map d.rel.ro.local to
14690 .data.rel.ro.local.
14691 (Layout::output_section_name): Us .data.rel.ro.local for any
14692 section which begins with that.
14693 * layout.h (class Layout): Update add_output_section_data
14694 declaration. Add relro_segment_ field.
14695 * output.cc (Output_section::Output_section): Initialize is_relro_
14696 and is_relro_local_ fields.
14697 (Output_segment::add_output_section): Group relro sections.
14698 (Output_segment::is_first_section_relro): New function.
14699 (Output_segment::maximum_alignment): If there is a relro section,
14700 align the segment to the common page size.
14701 (Output_segment::set_section_addresses): Track whether we are
14702 looking at relro sections. If the last section is a relro
14703 section, align to the common page size.
14704 (Output_segment::set_section_list_addresses): Add in_relro
14705 parameter. Change all callers. Align to the page size when
14706 moving from relro to non-relro section.
14707 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14709 * output.h (class Output_section): Add is_relro_ and
14710 is_relro_local_ fields.
14711 (Output_section::is_relro): New function.
14712 (Output_section::set_is_relro): New function.
14713 (Output_section::is_relro_local): New function.
14714 (Output_section::set_is_relro_local): New function.
14715 (class Output_segment): Update declarations.
14716 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14717 * sparc.cc (Target_sparc::got_section): Likewise.
14718 * x86_64.cc (Target_x86_64::got_section): Likewise.
14719 * testsuite/relro_test_main.cc: New file.
14720 * testsuite/relro_test.cc: New file.
14721 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14722 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14723 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14724 (relro_test.so, relro_test_pic.o): New targets.
14725 * testsuite/Makefile.in: Rebuild.
14727 2008-05-16 Ian Lance Taylor <iant@google.com>
14729 * output.cc (Output_segment::add_output_section): Remove front
14731 * output.h (class Output_segment): Remove
14732 add_initial_output_section and overloaded add_output_section.
14733 Update declaration of remaining add_output_section.
14734 * layout.cc (Layout::create_interp): Call add_output_section
14735 rather than add_initial_output_section.
14736 (Layout::finish_dynamic_section): Likewise.
14738 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14739 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14740 know the dynamic type.
14741 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14742 field. Initialize it in constructor.
14743 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14744 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14745 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14748 * output.cc (Output_reloc::get_address): Change return type to
14750 * output.h (class Output_reloc): Update get_address declaration.
14751 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14752 for section addresses.
14754 2008-05-09 Ian Lance Taylor <iant@google.com>
14757 * gold.cc (gold_nomem): Use return value of write.
14759 2008-05-08 Ian Lance Taylor <iant@google.com>
14761 * symtab.c (Symbol::init_base_output_data): Add version
14762 parameter. Change all callers.
14763 (Symbol::init_base_output_segment): Likewise.
14764 (Symbol::init_base_constant): Likewise.
14765 (Symbol::init_base_undefined): Likewise.
14766 (Sized_symbol::init_output_data): Likewise.
14767 (Sized_symbol::init_output_segment): Likewise.
14768 (Sized_symbol::init_constant): Likewise.
14769 (Sized_symbol::init_undefined): Likewise.
14770 (Symbol_table::do_define_in_output_data): If the new symbol has a
14771 version, mark it as the default.
14772 (Symbol_table::do_define_in_output_segment): Likewise.
14773 (Symbol_table::do_define_as_constant): Likewise.
14774 * symtab.h (class Symbol): Update declarations.
14775 (class Sized_symbol): Likewise.
14776 * resolve.cc (Symbol::override_version): New function.
14777 (Symbol::override_base): Call override_version.
14778 (Symbol::override_base_with_special): Likewise.
14779 * testsuite/ver_script_8.script: New file.
14780 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14781 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14782 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14783 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14785 2008-05-06 Ian Lance Taylor <iant@google.com>
14788 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14790 (class General_options): Remove existing --undefined, and add
14791 --no-undefined instead. Add new --undefined as synonym for -u.
14792 * archive.cc (Archive::add_symbols): Check whether symbol was
14794 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14795 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14796 all uses. Add IS_UNDEFINED. Update declarations to split
14797 different versions of init_base. Declare init_base_undefined.
14798 (Symbol::is_defined): Handle IS_UNDEFINED.
14799 (Symbol::is_undefined): Likewise.
14800 (Symbol::is_weak_undefined): Call is_undefined.
14801 (Symbol::is_absolute): Handle IS_CONSTANT.
14802 (class Sized_symbol): Update declarations to split different
14803 versions of init. Declare init_undefined.
14804 (class Symbol_table): Declare new functions.
14805 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14806 Change all callers.
14807 (Symbol::init_base_output_data): Likewise.
14808 (Symbol::init_base_output_segment): Likewise.
14809 (Symbol::init_base_constant): Likewise.
14810 (Symbol::init_base_undefined): New function.
14811 (Sized_symbol::init_object): Rename from init. Change all
14813 (Sized_symbol::init_output_data): Likewise.
14814 (Sized_symbol::init_output_segment): Likewise.
14815 (Sized_symbol::init_constant): Likewise.
14816 (Sized_symbol::init_undefined): New function.
14817 (Symbol_table::add_undefined_symbols_from_command_line): New
14819 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14821 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14822 (Symbol::output_section): Likewise.
14823 (Symbol::set_output_section): Likewise.
14824 (Symbol_table::sized_finalize_symbol): Likewise.
14825 (Symbol_table::sized_write_globals): Likewise.
14826 * resolve.cc (Symbol_table::should_override): Likewise.
14827 (Symbol::override_base_with_special): Likewise.
14829 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14830 symbol, change it to have default visibility.
14831 * testsuite/protected_1.cc: New file.
14832 * testsuite/protected_2.cc: New file.
14833 * testsuite/protected_3.cc: New file.
14834 * testsuite/protected_main_1.cc: New file.
14835 * testsuite/protected_main_2.cc: New file.
14836 * testsuite/protected_main_3.cc: New file.
14837 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14838 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14839 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14840 (protected_1.so): New target.
14841 (protected_1_pic.o, protected_2_pic.o): New targets.
14842 (protected_3_pic.o): New target.
14843 (check_PROGRAMS): Add protected_2.
14844 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14845 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14846 * testsuite/Makefile.in: Rebuild.
14848 * options.h (DEFINE_var): Add set_user_set_##varname__.
14849 (DEFINE_bool_alias): New macro.
14850 (class General_options): Define -Bstatic using DEFINE_bool_alias
14851 rather than DEFINE_special. Add --undefined as an alias for -z
14853 * options.cc (General_options::parse_Bstatic): Remove.
14855 * options.h (class General_options): Add --fatal-warnings.
14856 * main.cc (main): Implement --fatal-warnings.
14857 * errors.h (Errors::warning_count): New function.
14859 * options.h (class General_options): Add -Bsymbolic-functions.
14860 * symtab.h (Symbol::is_preemptible): Check for
14861 -Bsymbolic-functions.
14863 2008-05-05 Ian Lance Taylor <iant@google.com>
14865 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14866 as noVARNAME rather than no-VARNAME.
14867 (class General_options): Add option -z combreloc.
14868 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14870 (Output_reloc::sort_before) [SHT_REL]: New function.
14871 (Output_reloc::sort_before) [SHT_RELA]: New function.
14872 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14873 Sort_relocs_comparison.
14874 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14875 parameter. Change all callers.
14876 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14877 sort_relocs parameter. Change all callers.
14878 * output.cc (Output_reloc::get_address): New function, broken out
14880 (Output_reloc::write_rel): Call it.
14881 (Output_reloc::compare): New function.
14882 (Output_data_reloc_base::do_write): Optionally sort relocs.
14884 * configure.ac: If targ_extra_obj is set, link it in.
14885 * configure.tgt: Initialize all variables.
14886 (x86_64*): Set targ_extra_obj and targ_extra_size.
14887 * configure: Rebuild.
14889 * object.cc (Sized_relobj::include_section_group): Adjust section
14890 indexes read from group data. Build vector to pass to
14892 * layout.cc (Layout::layout_group): Add flags and shndxes
14893 parameters. Remove contents parameter. Change caller. Update
14894 explicit instantiations.
14895 * layout.h (class Layout): Update layout_group declaration.
14896 * output.cc (Output_data_group::Output_data_group): Add flags and
14897 input_shndxes parameters. Remove contents parameter. Change
14899 (Output_data_group::do_write): Change input_sections_ to
14901 * output.h (class Output_data_group): Update constructor
14902 declaration. Rename input_sections_ to input_shndxes_.
14903 * testsuite/many_sections_test.cc: Add template.
14905 2008-04-30 Cary Coutant <ccoutant@google.com>
14907 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14909 * layout.cc (Layout::include_section): Refactored check for debug
14911 (Layout::add_comdat): Add new parameters. Change type
14912 of signature parameter. Add object and shndx to signatures table.
14913 (Layout::find_kept_object): New function.
14914 * layout.h: Include <cstring>.
14915 (Layout::is_debug_info_section): New function.
14916 (Layout::add_comdat): Add new parameters.
14917 (Layout::find_kept_object): New function.
14918 (Layout::Kept_section): New struct.
14919 (Layout::Signatures): Change type of map range.
14920 * object.cc (Relobj::output_section_address): New function.
14921 (Sized_relobj::include_section_group): Add new parameters. Change
14922 calls to Layout::add_comdat. Change to build table of kept comdat
14923 groups and table mapping discarded sections to kept sections.
14924 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14925 (Sized_relobj::do_layout): Change calls to include_section_group and
14926 include_linkonce_section.
14927 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14928 value to zero when section is discarded.
14929 (Sized_relobj::map_to_kept_section): New function.
14930 * object.h (Relobj::output_section_address): New function.
14931 (Relobj::Comdat_group): New type.
14932 (Relobj::find_comdat_group): New function.
14933 (Relobj::Comdat_group_table): New type.
14934 (Relobj::Kept_comdat_section): New type.
14935 (Relobj::Kept_comdat_section_table): New type.
14936 (Relobj::add_comdat_group): New function.
14937 (Relobj::set_kept_comdat_section): New function.
14938 (Relobj::get_kept_comdat_section): New function.
14939 (Relobj::comdat_groups_): New field.
14940 (Relobj::kept_comdat_sections_): New field.
14941 (Symbol_value::input_value): Update comment.
14942 (Sized_relobj::map_to_kept_section) New function.
14943 (Sized_relobj::include_linkonce_section): Add new parameter.
14944 * target-reloc.h (Comdat_behavior): New type.
14945 (get_comdat_behavior): New function.
14946 (relocate_section): Add code to map a discarded section to the
14947 corresponding kept section when applying a relocation.
14949 2008-04-30 Craig Silverstein <csilvers@google.com>
14951 * dwarf_reader.cc (next_generation_count): New static var.
14952 (Addr2line_cache_entry): New struct.
14953 (addr2line_cache): New static var.
14954 (Dwarf_line_info::one_addr2line): Added caching.
14955 (Dwarf_line_info::clear_addr2line_cache): New function.
14956 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14957 cache-size parameter.
14958 (Dwarf_line_info::one_addr2line_cache): New function.
14959 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14960 new cache-size argument to one_addr2line(), and clear cache.
14962 2008-04-28 Cary Coutant <ccoutant@google.com>
14964 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14965 R_386_PC8 relocations.
14967 2008-04-23 Ian Lance Taylor <iant@google.com>
14969 * object.cc (Sized_relobj::include_section_group): Check for
14970 invalid section group.
14972 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14975 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14976 than read for file header.
14977 * archive.cc (Archive::include_member): Likewise.
14979 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14981 * aclocal.m4: Regenerate.
14982 * configure: Regenerate.
14984 2008-04-19 Ian Lance Taylor <iant@google.com>
14986 * version.cc (version_string): Bump to 1.6.
14988 * testsuite/Makefile.am (many_sections_r_test): New target.
14989 (many_sections_r_test_SOURCES): Remove.
14990 (many_sections_r_test_DEPENDENCIES): Remove.
14991 (many_sections_r_test_LDFLAGS): Remove.
14992 (many_sections_r_test_LDADD): Remove.
14994 * object.cc (Sized_relobj::do_add_symbols): Always pass
14995 local_symbol_count_ to add_from_relobj.
14997 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14998 every thousand variables.
14999 * testsuite/Makefile.in: Rebuild.
15001 * object.cc (Xindex::initialize_symtab_xindex): New function.
15002 (Xindex::read_symtab_xindex): New function.
15003 (Xindex::sym_xindex_to_shndx): New function.
15004 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15006 (Sized_relobj::do_initialize_xindex): New function.
15007 (Sized_relobj::do_read_symbols): Adjust section links.
15008 (Sized_relobj::symbol_section_and_value): Add is_ordinary
15009 parameter. Change all callers.
15010 (Sized_relobj::include_section_group): Adjust section links and
15011 symbol section indexes.
15012 (Sized_relobj::do_layout): Adjust section links.
15013 (Sized_relobj::do_count_local_symbols): Adjust section links and
15014 symbol section indexes.
15015 (Sized_relobj::do_finalize_local_symbols): Distinguish between
15016 ordinary and special symbols.
15017 (Sized_relobj::write_local_symbols): Add symtab_xindex and
15018 dynsym_xindex parameters. Change all callers. Adjust section
15019 links. Use SHN_XINDEX when needed.
15020 (Sized_relobj::get_symbol_location_info): Adjust section links.
15021 Don't get fooled by special symbols.
15022 * object.h (class Xindex): Define.
15023 (class Object): Add xindex_ parameter. Declare virtual functoin
15024 do_initialize_xindex.
15025 (Object::adjust_sym_shndx): New function.
15026 (Object::set_xindex): New protected function.
15027 (class Symbol_value): Add is_ordinary_shndx_ field.
15028 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15029 (Symbol_value::value): Assert ordinary section.
15030 (Symbol_value::initialize_input_to_output_map): Likewise.
15031 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15032 Change all callers.
15033 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
15035 (class Sized_relobj): Update declarations.
15036 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15037 parameter. Change all callers.
15038 (Sized_relobj::adjust_shndx): New function.
15039 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15041 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15042 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
15043 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
15044 (Sized_dynobj::read_dynsym_section): Adjust section links.
15045 (Sized_dynobj::read_dynamic): Likewise.
15046 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
15048 (Sized_dynobj::do_initialize_xindex): New function.
15049 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
15050 do_initialize_xindex.
15051 (Sized_dynobj::adjust_shndx): New function.
15052 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15053 dynsym_xindex_ fields.
15054 (Layout::finalize): Add a call to set_section_indexes before
15055 creating the symtab sections.
15056 (Layout::set_section_indexes): Don't do anything if the section
15057 already has a section index.
15058 (Layout::create_symtab_sections): Add shnum parameter. Change
15059 caller. Create .symtab_shndx section if needed.
15060 (Layout::create_shdrs): Add shstrtab_section parameter. Change
15062 (Layout::allocated_output_section_count): New function.
15063 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15065 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15066 fields. Update declarations.
15067 (Layout::symtab_xindex): New function.
15068 (Layout::dynsym_xindex): New function.
15069 (class Write_symbols_task): Add layout_ field.
15070 (Write_symbols_task::Write_symbols_task): Add layout parameter.
15072 * output.cc (Output_section_headers::Output_section_headers): Add
15073 shstrtab_section parameter. Change all callers.
15074 (Output_section_headers::do_sized_write): Store overflow values
15075 for section count and section string table section index in
15076 section header zero.
15077 (Output_file_header::do_sized_write): Check for overflow of
15078 section count and section string table section index.
15079 (Output_symtab_xindex::do_write): New function.
15080 (Output_symtab_xindex::endian_do_write): New function.
15081 * output.h (class Output_section_headers): Add shstrtab_section_.
15082 Update declarations.
15083 (class Output_symtab_xindex): Define.
15084 (Output_section::has_out_shndx): New function.
15085 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15087 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15088 Change all callers.
15089 (Sized_symbol::init): Likewise.
15090 (Symbol::output_section): Check for ordinary symbol.
15091 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15092 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15094 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15095 Change all callers. Simplify handling of symbols from sections
15096 not included in the link.
15097 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15099 (Weak_alias_sorter::operator()): Assert that symbols are
15101 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15103 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15104 parameters. Change all callers.
15105 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15106 symbol distinction. Use SHN_XINDEX when needed.
15107 (Symbol_table::write_section_symbol): Add symtab_xindex
15108 parameter. Change all callers.
15109 (Symbol_table::sized_write_section_symbol): Likewise. Use
15110 SHN_XINDEX when needed.
15111 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15113 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15114 (Symbol::is_defined): Check is_ordinary.
15115 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15116 (Symbol::is_absolute, Symbol::is_common): Likewise.
15117 (class Sized_symbol): Update declarations.
15118 (class Symbol_table): Update declarations.
15119 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15120 parameters. Change all callers.
15121 (Sized_symbol::override): Likewise.
15122 (Symbol_table::override): Likewise.
15123 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15124 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15125 is_ordinary, and orig_st_shndx parameters. Change all callers.
15126 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15127 to be in an ordinary section.
15128 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15129 object and is_ordinary parameters. Change all callers.
15130 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15131 Change all callers. Don't add undefined or non-ordinary symbols
15133 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15134 Change all callers.
15135 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15137 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15138 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15139 (Sized_relobj::relocate_sections): Likewise.
15140 * target-reloc.h (scan_relocs): Adjust section symbol index.
15141 (scan_relocatable_relocs): Likewise.
15142 * i386.cc (Scan::local): Check for ordinary symbols.
15143 * sparc.cc (Scan::local): Likewise.
15144 * x86_64.cc (Scan::local): Likewise.
15145 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15146 to symbol_section_and_value.
15147 * testsuite/many_sections_test.cc: New file.
15148 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15149 (check_PROGRAMS): Add many_sections_test.
15150 (many_sections_test_SOURCES): Define.
15151 (many_sections_test_DEPENDENCIES): Define.
15152 (many_sections_test_LDFLAGS): Define.
15153 (BUILT_SOURCES): Add many_sections_define.h.
15154 (many_sections_define.h): New target.
15155 (BUILT_SOURCES): Add many_sections_check.h.
15156 (many_sections_check.h): New target.
15157 (check_PROGRAMS): Add many_sections_r_test.
15158 (many_sections_r_test_SOURCES): Define.
15159 (many_sections_r_test_DEPENDENCIES): Define.
15160 (many_sections_r_test_LDFLAGS): Define.
15161 (many_sections_r_test_LDADD): Define.
15162 (many_sections_r_test.o): New target.
15163 * testsuite/Makefile.in: Rebuild.
15165 2008-04-17 Cary Coutant <ccoutant@google.com>
15167 * errors.cc (Errors::info): New function.
15168 (gold_info): New function.
15169 * errors.h (Errors::info): New function.
15170 * gold.h (gold_info): New function.
15171 * object.cc (Input_objects::add_object): Print trace output.
15172 * options.cc (options::parse_set): New function.
15173 (General_options::parse_wrap): Deleted.
15174 (General_options::General_options): Deleted initializer.
15175 * options.h (options::String_set): New typedef.
15176 (options::parse_set): New function.
15177 (DEFINE_set): New macro.
15178 (General_options::wrap): Changed to use DEFINE_set. Changed
15179 callers of any_wrap_symbols and is_wrap_symbol.
15180 (General_options::trace, General_options::trace_symbol):
15182 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15183 (General_options::wrap_symbols_): Deleted.
15184 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15186 2008-04-17 David S. Miller <davem@davemloft.net>
15188 * options.cc (General_options::parse_V): New function.
15189 * options.h: Add entries for -V and -Qy.
15191 2008-04-17 Ian Lance Taylor <iant@google.com>
15193 * common.cc (Symbol_table::allocate_commons): Remove options
15194 parameter. Change caller.
15195 (Symbol_table::do_allocate_commons): Remove options parameter.
15196 Change caller. Just call do_allocate_commons_list twice.
15197 (Symbol_table::do_allocate_commons_list): New function, broken out
15198 of do_allocate_commons.
15199 * common.h (class Allocate_commons_task): Remove options_ field.
15200 Update constructor.
15201 * symtab.cc (Symbol_table::Symbol_table): Initialize
15203 (Symbol_table::add_from_object): Put TLS common symbols on
15205 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15206 which are IN_OUTPUT_DATA.
15207 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15208 allocate_commons and do_allocate_commons declarations. Declare
15209 do_allocate_commons_list.
15210 * gold.cc (queue_middle_tasks): Update creation of
15211 Allocate_commons_task to not pass options.
15212 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15213 (TLS_TEST_C_FLAGS): New variable.
15214 (tls_test_c_pic.o): New target.
15215 (tls_test_shared.so): Link in tls_test_c_pic.o.
15216 (tls_test_c_pic_ie.o): New target.
15217 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15218 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15219 (tls_test_c.o): New target.
15220 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15221 (tls_pic_test_LDADD): Likewise.
15222 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15223 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15224 (tls_test_c_gnu2.o): New target.
15225 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15227 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15228 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15229 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15230 * testsuite/tls_test.cc: Include "config.h".
15231 (t_last): Call t11_last.
15232 * testsuite/tls_test.h (t11, t11_last): Declare.
15233 * testsuite/tls_test_c.c: New file.
15234 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15235 * configure.ac: Check for OpenMP support.
15236 * configure, config.in, Makefile.in: Rebuild.
15237 * testsuite/Makefile.in: Rebuild.
15239 2008-04-16 Cary Coutant <ccoutant@google.com>
15241 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15242 (Target_i386::tls_base_symbol_defined_): New field.
15243 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15244 (Target_i386::Scan::global): Likewise.
15245 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15246 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15247 (Target_x86_64::tls_base_symbol_defined_): New field.
15248 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15249 (Target_x86_64::Scan::global): Likewise.
15251 2008-04-16 Cary Coutant <ccoutant@google.com>
15253 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15254 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15255 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15256 building shared libraries.
15257 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15258 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15259 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15260 * testsuite/Makefile.in: Rebuild.
15261 * testsuite/weak_undef.h: New file.
15262 * testsuite/weak_undef_file1.cc: Add extra test cases.
15263 * testsuite/weak_undef_file2.cc: Likewise.
15264 * testsuite/weak_undef_test.cc: Likewise.
15266 2008-04-16 David S. Miller <davem@davemloft.net>
15268 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15269 Add issued_non_pic_error_ field. Declare check_non_pic.
15270 (Target_sparc::Scan::check_non_pic): New function.
15271 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15272 (Target_sparc::Scan::global): Likewise.
15274 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15275 * configure: Rebuild.
15277 * options.h (DEFINE_enable): New macro.
15278 (new_dtags): New enable option.
15279 (initfirst, interpose, loadfltr, nodefaultlib,
15280 nodelete, nodlopen, nodump): New -z options.
15281 * layout.cc (Layout:finish_dynamic_section): If new
15282 dtags enabled, emit DT_RUNPATH. Also, emit a
15283 DT_FLAGS_1 containing any specified -z flags.
15285 2008-04-16 Ian Lance Taylor <iant@google.com>
15287 * copy-relocs.cc: New file.
15288 * copy-relocs.h: New file.
15289 * reloc.cc: Remove Copy_relocs code.
15290 * reloc.h: Likewise.
15291 * reloc-types.h (struct Reloc_types) [both versions]: Add
15292 get_reloc_addend_noerror.
15293 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15294 variants of add_global which take an addend which must be zero.
15295 * i386.cc: Include "copy-relocs.h".
15296 (class Target_i386): Change type of copy_relocs_ to variable,
15297 update initializer.
15298 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15299 Change all callers.
15300 (Target_i386::do_finalize_sections): Change handling of
15302 * sparc.cc: Include "copy-relocs.h".
15303 (class Target_sparc): Change type of copy_relocs_ to variable,
15304 update initializer.
15305 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15306 Change all callers.
15307 (Target_sparc::do_finalize_sections): Change handling of
15309 * x86_64.cc: Include "copy-relocs.h".
15310 (class Target_x86_64): Change type of copy_relocs_ to variable,
15311 update initializer.
15312 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15313 class. Change all callers.
15314 (Target_x86_64::do_finalize_sections): Change handling of
15316 * Makefile.am (CCFILES): Add copy-relocs.cc.
15317 (HFILES): Add copy-relocs.h.
15319 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15321 * testsuite/script_test_4.sh: Permit leading zeroes.
15323 2008-04-15 Ian Lance Taylor <iant@google.com>
15325 * script-sections.cc (Script_sections::create_segments): Use
15326 header_size_adjustment even when there is enough room for the
15328 * testsuite/script_test_4.sh: New file.
15329 * testsuite/script_test_4.t: New file.
15330 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15331 (check_DATA): Add script_test_4.stdout.
15332 (MOSTLYCLEANFILES): Likewise.
15333 (script_test_4): New target.
15334 (script_test_4.stdout): New target.
15335 * testsuite/Makefile.in: Rebuild.
15337 * sparc.cc: Add definitions for Output_data_plt_sparc class
15340 2008-04-14 David S. Miller <davem@davemloft.net>
15342 * sparc.cc: New file.
15343 * Makefile.am (TARGETSOURCES): Add sparc.cc
15344 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15345 * configure.tgt: Document targ_extra_size and
15346 targ_extra_big_endian. Add entries for sparc-* and
15348 * configure.ac: Handle targ_extra_size and
15349 targ_extra_big_endian.
15350 * Makefile.in: Rebuild.
15351 * configure: Likewise.
15352 * po/POTFILES.in: Likewise.
15353 * po/gold.pot: Likewise.
15355 2008-04-14 Ian Lance Taylor <iant@google.com>
15357 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15358 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15359 in the name/type/flags to section mapping. Don't call
15360 allocate_output_section.
15361 (Layout::choose_output_section): Change parameter from adjust_name
15362 to is_input_section. Don't permit input sections after sections
15363 are attached to segments. Don't call allocate_output_section.
15364 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15365 not write_enable_output_section.
15366 (Layout::make_output_section): Don't push to
15367 unattached_section_list_ nor call attach_to_segment. Call
15368 attach_section_to_segment if sections are attached.
15369 (Layout::attach_sections_to_segments): New function.
15370 (Layout::attach_section_to_segment): New function.
15371 (Layout::attach_allocated_section_to_segment): Rename from
15372 attach_to_segment. Remove flags parameter.
15373 (Layout::allocate_output_section): Remove function.
15374 (Layout::write_enable_output_section): Remove function.
15375 * layout.h (class Layout): Update for above changes. Add new
15376 field sections_are_attached_.
15377 * output.h (Output_section::update_flags_for_input_section): New
15379 * output.cc (Output_section::add_input_section): Call
15380 update_flags_for_input_section.
15381 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15383 2008-04-11 Cary Coutant <ccoutant@google.com>
15385 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15386 thought unnecessary.
15387 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15389 2008-04-11 Ian Lance Taylor <iant@google.com>
15391 * output.h (class Output_section_data): Remove inline definition
15393 * output.cc (Output_section_data::set_addralign): New function.
15395 2008-04-11 Cary Coutant <ccoutant@google.com>
15397 Add support for TLS descriptors for i386 and x86_64.
15398 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15399 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15400 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15402 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15403 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15404 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15406 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15407 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15408 Fix problem with initial-exec relocations.
15409 (Target_i386::Relocate::relocate_tls): Likewise.
15410 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15412 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15413 support for section-plus-offset dynamic table entries.
15414 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15415 (Output_data_dynamic::Dynamic_entry): Add support for
15416 section-plus-offset dynamic table entries.
15417 (Output_data_dynamic::Classification): Likewise.
15418 (Output_data_dynamic::classification_): Renamed offset_.
15419 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15420 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15421 (Target_x86_64::make_plt_section): New function.
15422 (Target_x86_64::reserve_tlsdesc_entries): New function.
15423 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15424 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15425 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15426 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15427 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15428 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15429 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15430 add extra PLT entry for TLS descriptors.
15431 (Output_data_plt_x86_64::got_): New field.
15432 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15433 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15435 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15437 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15438 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15439 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15440 R_386_TLS_DESC_CALL relocations.
15441 (Target_x86_64::Scan::global): Likewise.
15442 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15443 for TLS descriptors.
15444 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15445 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15446 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15447 GD-to-IE relaxation.
15448 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15449 and TLS_DESCRIPTORS.
15450 * Makefile.in: Rebuild.
15451 * configure: Rebuild.
15452 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15453 (tls_test_shared2.so): New target.
15454 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15455 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15456 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15457 (tls_shared_gd_to_ie_test_LDADD): New variable.
15458 (tls_shared_gnu2_gd_to_ie_test): New target.
15459 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15461 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15462 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15463 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15464 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15465 (tls_shared_gnu2_test): New target.
15466 (tls_test_gnu2_shared.so): New target.
15467 (tls_shared_gnu2_test_SOURCES): New variable.
15468 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15469 (tls_shared_gnu2_test_LDFLAGS): New variable.
15470 (tls_shared_gnu2_test_LDADD): New variable.
15471 * testsuite/Makefile.in: Rebuild.
15472 * testsuite/Makefile.
15474 2008-04-11 Ian Lance Taylor <iant@google.com>
15476 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15478 * testsuite/Makefile.in: Rebuild.
15480 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15482 * testsuite/script_test_2.cc (main): Adjust test.
15484 2008-04-11 David S. Miller <davem@davemloft.net>
15485 Ian Lance Taylor <iant@google.com>
15487 * options.h (General_options): Add entries for '-Y' and
15489 * options.cc (General_options:finalize): If -Y was used, add those
15490 entries to the library path instead of the default "/lib" and
15493 2008-04-11 David S. Miller <davem@davemloft.net>
15495 * testsuite/justsyms.t: Start at 0x100.
15496 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15497 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15499 * testsuite/script_test_2.cc: Adjust string and section length
15502 2008-04-09 Ian Lance Taylor <iant@google.com>
15505 * script-sections.cc (Sections_element::allocate_to_segment): Add
15507 (Output_section_definition::allocate_to_segment): Likewise.
15508 (Orphan_output_section::allocate_to_segment): Likewise.
15509 (Script_sections::attach_sections_using_phdrs_clause): Don't
15510 propagate non-PT_LOAD segments to orphan sections.
15511 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15512 readelf rather than objdump.
15513 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15514 .interp section and PT_INTERP segment are the same size.
15515 * testsuite/Makefile.in: Rebuild.
15517 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15518 aliases for symbols defined in the same object.
15519 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15520 (weak_alias_test_SOURCES): New variable.
15521 (weak_alias_test_DEPENDENCIES): New variable.
15522 (weak_alias_test_LDFLAGS): New variable.
15523 (weak_alias_test_LDADD): New variable.
15524 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15525 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15526 (weak_alias_test_3.o): New target.
15527 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15528 * testsuite/weak_alias_test_main.cc: New file.
15529 * testsuite/weak_alias_test_1.cc: New file.
15530 * testsuite/weak_alias_test_2.cc: New file.
15531 * testsuite/weak_alias_test_3.cc: New file.
15533 2008-04-08 Ian Lance Taylor <iant@google.com>
15535 * options.h (class General_options): Add --noinhibit-exec option.
15536 * main.cc (main): Check --noinhibit-exec.
15538 * options.h (class General_options): Define --wrap as a special
15539 option. Add wrap_symbols_ field.
15540 (General_options::any_wrap_symbols): New function.
15541 (General_options::is_wrap_symbol): New function.
15542 * options.cc (General_options::parse_wrap): New function.
15543 (General_options::General_options): Initialize wrap_symbols_.
15544 * symtab.cc (Symbol_table::wrap_symbol): New function.
15545 (Symbol_table::add_from_object): Handle --wrap.
15546 * symtab.h (class Symbol_table): Declare wrap_symbol.
15547 * target.h (Target::wrap_char): New function.
15548 (Target::Target_info): Add wrap_char field.
15549 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15550 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15551 * testsuite/testfile.cc (Target_test::test_target_info):
15554 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15557 * layout.h (class Layout): Add added_eh_frame_data_ field.
15558 * layout.cc (Layout::Layout): Initialize new field.
15559 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15560 output section until we find a section we merged successfully.
15561 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15562 that the size be non-zero.
15564 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15567 2008-04-08 Craig Silverstein <csilvers@google.com>
15569 * configure.ac: Export new conditional variable HAVE_ZLIB.
15570 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15572 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15573 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15575 2008-04-07 Ian Lance Taylor <iant@google.com>
15577 * version.cc (version_string): Set to "1.5".
15579 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15580 Add issued_non_pic_error_ field. Declare check_non_pic.
15581 (Target_x86_64::Scan::check_non_pic): New function.
15582 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15583 (Target_x86_64::Scan::global): Likewise.
15585 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15586 addend parameter. Change caller. Handle merge sections.
15587 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15588 Address to Addend. Don't add in the result of
15589 local_section_offset, pass down the addend and use the returned
15591 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15592 Update declarations of local_section_offset and symbol_value.
15593 * testsuite/two_file_test_1.cc (t18): New function.
15594 * testsuite/two_file_test_2.cc (f18): New function.
15595 * testsuite/two_file_test_main.cc (main): Call t18.
15596 * testsuite/two_file_test.h (t18, f18): Declare.
15598 * configure.ac: Don't test for objdump, c++filt, or readelf.
15599 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15601 (TEST_READELF): New variable.
15602 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15603 (check_PROGRAMS): Add two_file_strip_test.
15604 (two_file_strip_test): New target.
15605 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15606 (two_file_same_shared_strip_test_SOURCES): New variable.
15607 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15608 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15609 (two_file_same_shared_strip_test_LDADD): New variable.
15610 (two_file_shared_strip.so): New target.
15611 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15612 (ver_test_5.syms, ver_test_7.syms): Likewise.
15613 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15614 (strip_test_3.stdout): Use TEST_OBJDUMP.
15615 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15617 2008-04-04 Cary Coutant <ccoutant@google.com>
15619 * symtab.h (Symbol::is_weak_undefined): New function.
15620 (Symbol::is_strong_undefined): New function.
15621 (Symbol::is_absolute): New function.
15622 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15623 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15625 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15626 (weak_undef_test): New target.
15627 * testsuite/Makefile.in: Rebuild.
15628 * testsuite/weak_undef_file1.cc: New file.
15629 * testsuite/weak_undef_file2.cc: New file.
15630 * testsuite/weak_undef_test.cc: New file.
15632 2008-04-03 Craig Silverstein <csilvers@google.com>
15634 * compressed_output.h (class Output_compressed_section): Use
15636 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15638 (zlib_compressed_suffix): Removed.
15639 (Output_compressed_section::set_final_data_size): Use unsigned
15641 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15642 Fix linker invocation.
15643 (flagstest_o_specialfile_and_compress_debug_sections):
15645 * testsuite/Makefile.in: Regenerated.
15647 2008-04-02 David S. Miller <davem@davemloft.net>
15649 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15650 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15652 2008-04-02 Craig Silverstein <csilvers@google.com>
15656 2008-04-02 Ian Lance Taylor <iant@google.com>
15658 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15659 parameters. Update for new key type to views_. Change all
15661 (File_read::read): Adjust for byteshift in returned view.
15662 (File_read::add_view): New function, broken out of
15663 find_and_make_view.
15664 (File_read::make_view): New function, broken out of
15665 find_and_make_view.
15666 (File_read::find_or_make_view): Add offset and aligned
15667 parameters. Rewrite accordingly. Change all callers.
15668 (File_read::get_view): Add offset and aligned parameters. Adjust
15669 for byteshift in return value.
15670 (File_read::get_lasting_view): Likewise.
15671 * fileread.h (class File_read): Update declarations.
15672 (class File_read::View): Add byteshift_ field. Add byteshift to
15673 constructor. Add byteshift method.
15674 * archive.h (Archive::clear_uncached_views): New function.
15675 (Archive::get_view): Add aligned parameter. Change all callers.
15676 * object.h (Object::get_view): Add aligned parameter. Change all
15678 (Object::get_lasting_view): Likewise.
15680 * fileread.cc (File_read::release): Don't call clear_views if
15681 there are multiple objects.
15682 * fileread.h (File_read::clear_uncached_views): New function.
15683 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15686 2008-03-31 Cary Coutant <ccoutant@google.com>
15688 Add thin archive support.
15689 * archive.cc (Archive::armagt): New const.
15690 (Archive::setup): Remove task parameter and calls to unlock.
15691 (Archive::unlock_nested_archives): New function.
15692 (Archive::read_header): Add nested_off parameter. Change
15694 (Archive::interpret_header): Likewise.
15695 (Archive::include_all_members): Change to handle thin
15697 (Archive::include_member): Likewise.
15698 * archive.h (Archive::Archive): Add new parameters and
15700 (Archive::armagt): New const.
15701 (Archive::setup): Remove task parameter.
15702 (Archive::unlock_nested_archives): New function.
15703 (Archive::read_header): Add nested_off parameter.
15704 (Archive::interpret_header): Likewise.
15705 (Archive::Nested_archive_table): New typedef.
15706 (Archive::is_thin_archive_): New field.
15707 (Archive::nested_archives_): New field.
15708 (Archive::options_): New field.
15709 (Archive::dirpath_): New field.
15710 (Archive::task_): New field.
15711 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15712 for thin archives. Pass additional parameters to
15713 Archive::Archive. Unlock the archive file after calling
15716 2008-03-29 Ian Lance Taylor <iant@google.com>
15718 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15719 version symbol to be local.
15720 * testsuite/ver_test_4.sh: New file.
15721 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15722 (check_DATA): Add ver_test_4.syms.
15723 (ver_test_4.syms): New target.
15724 * testsuite/Makefile.in: Rebuild.
15727 (Output_section::Input_section_sort_entry::has_priority): New
15729 (Output_section::Input_section_sort_entry::match_file_name): New
15731 (Output_section::Input_section_sort_entry::match_section_name):
15733 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15735 (Output_section::Input_section_sort_entry::match_section_file):
15737 (Output_section::Input_section_sort_compare::operator()): Rewrite
15738 using new Input_section_sort_entry functions. Sort crtbegin and
15739 crtend first. Sort sections with no priority before sections with
15741 * testsuite/initpri1.c (d3): Check j != 4.
15742 (cd5): New constructor/destructor function.
15743 (main): Check j != 2.
15745 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15746 new symbol when resolving, don't call set_is_default.
15747 * testsuite/ver_test_7.cc: New file.
15748 * testsuite/ver_test_7.sh: New file.
15749 * testsuite/Makefile.am (ver_test_7.so): New target.
15750 (ver_test_7.o): New target.
15751 (check_SCRIPTS): Add ver_test_7.sh.
15752 (check_DATA): Add ver_test_7.syms.
15753 (ver_test_7.syms): New target.
15755 2008-03-28 Ian Lance Taylor <iant@google.com>
15757 * layout.cc (Layout::layout): If we see an input section with a
15758 name that needs sorting, set the must_sort flag for the output
15760 (Layout::make_output_section): If the name of the output section
15761 indicates that it might require sorting, set the may_sort flag.
15762 * output.h (Output_section::may_sort_attached_input_sections): New
15764 (Output_section::set_may_sort_attached_input_sections): New
15766 (Output_section::must_sort_attached_input_sections): New
15768 (Output_section::set_must_sort_attached_input_sections): New
15770 (class Output_section): Declare Input_section_sort_entry. Define
15771 Input_section_sort_compare. Declare
15772 sort_attached_input_sections. Add new fields:
15773 may_sort_attached_input_sections_,
15774 must_sort_attached_input_sections_,
15775 attached_input_sections_are_sorted_.
15776 * output.cc (Output_section::Output_section): Initialize new
15778 (Output_section::add_input_section): Add an entry to
15779 input_sections_ if may_sort or must_sort are true.
15780 (Output_section::set_final_data_size): Call
15781 sort_attached_input_sections if necessary.
15782 (Output_section::Input_section_sort_entry): Define new class.
15783 (Output_section::Input_section_sort_compare::operator()): New
15785 (Output_section::sort_attached_input_sections): New function.
15786 * configure.ac: Check whether the compiler supports constructor
15787 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15788 * testsuite/initpri1.c: New file.
15789 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15790 CONSTRUCTOR_PRIORITY.
15791 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15792 (initpri1_LDFLAGS): New variable.
15793 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15795 2008-03-27 Ian Lance Taylor <iant@google.com>
15797 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15798 * testsuite/common_test_1.c: New file.
15799 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15800 (common_test_1_SOURCES): New variable.
15801 (common_test_1_DEPENDENCIES): New variable.
15802 (common_test_1_LDFLAGS): New variable.
15804 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15805 and commons_ correctly when NAME/VERSION does not override
15807 * testsuite/ver_test_6.c: New file.
15808 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15809 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15810 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15812 2008-03-26 Ian Lance Taylor <iant@google.com>
15814 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15815 of an undefined symbol from a version script.
15816 * testsuite/Makefile.am (ver_test_5.so): New target.
15817 (ver_test_5.o): New target.
15818 (check_SCRIPTS): Add ver_test_5.sh.
15819 (check_DATA): Add ver_test_5.syms.
15820 (ver_test_5.syms): New target.
15821 * testsuite/ver_test_5.cc: New file.
15822 * testsuite/ver_test_5.script: New file.
15823 * testsuite/ver_test_5.sh: New file.
15824 * Makefile.in, testsuite/Makefile.in: Rebuild.
15827 Fix problems building gold with gcc 4.3.0.
15828 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15829 (gold_error_at_location, gold_warning_at_location): Use it.
15830 * configure.ac: Check whether we can compile and use a template
15831 function with a printf attribute.
15832 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15833 when jumping over bytes.
15834 * object.cc: Instantiate Object::read_section_data.
15835 * debug.h: Include <cstring>
15836 * dwarf_reader.cc: Include <algorithm>
15837 * main.cc: Include <cstring>.
15838 * options.cc: Include <cstring>.
15839 * output.cc: Include <cstring>.
15840 * script.cc: Include <cstring>.
15841 * script.h: Include <string>.
15842 * symtab.cc: Include <cstring> and <algorithm>.
15843 * target-select.cc: Include <cstring>.
15844 * version.cc: Include <string>.
15845 * testsuite/testmain.cc: Include <cstdlib>.
15846 * configure, config.in: Rebuild.
15848 2008-03-25 Ian Lance Taylor <iant@google.com>
15850 * options.cc: Include "../bfd/bfdver.h".
15851 (options::help): Print bug reporting address.
15853 * version.cc (print_version): Adjust output for current value of
15854 BFD_VERSION_STRING.
15858 * options.cc (options::help): Print list of supported targets.
15859 * target-select.h: Include <vector>.
15860 (class Target_selector): Make machine_, size_, and is_big_endian_
15861 fields const. Add bfd_name_ and instantiated_target_ fields.
15862 (Target_selector::Target_selector): Add bfd_name parameter.
15863 (Target_selector::recognize): Make non-virtual, call
15865 (Target_selector::recognize_by_name): Make non-virtual, call
15866 do_recognize_by_name.
15867 (Target_selector::supported_names): New function.
15868 (Target_selector::bfd_name): New function.
15869 (Target_selector::do_instantiate_target): New pure virtual
15871 (Target_selector::do_recognize): New virtual function.
15872 (Target_selector::do_recognize_by_name): New virtual function.
15873 (Target_selector::instantiate_target): New private function.
15874 (supported_target_names): Declare.
15875 * target-select.cc (Target_selector::Target_selector): Update for
15876 new parameter and fields.
15877 (select_target_by_name): Check that the name matches before
15878 calling recognize_by_name.
15879 (supported_target_names): New function.
15880 * i386.cc (class Target_selector_i386): Update Target_selector
15881 constructor call. Remove recognize and recognize_by_name. Add
15882 do_instantiate_target.
15883 * x86_64.cc (class Target_selector_x86_64): Likewise.
15884 * testsuite/testfile.cc (class Target_selector_test): Update for
15885 changes to Target_selector.
15887 * README: Rewrite, with some notes on unsupported features.
15889 2008-03-24 Cary Coutant <ccoutant@google.com>
15891 * i386.cc (Target_i386::Got_type): New enum declaration.
15892 (Target_i386::Scan::local): Updated callers of Output_data_got
15894 (Target_i386::Scan::global): Likewise.
15895 (Target_i386::Relocate::relocate): Likewise.
15896 (Target_i386::Relocate::relocate_tls): Likewise.
15897 * object.h (Got_offset_list): New class.
15898 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15899 (Sized_relobj::local_got_offset): Likewise.
15900 (Sized_relobj::set_local_got_offset): Likewise.
15901 (Sized_relobj::local_has_tls_got_offset): Removed.
15902 (Sized_relobj::local_tls_got_offset): Removed.
15903 (Sized_relobj::set_local_tls_got_offset): Removed.
15904 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15905 * output.cc (Output_data_got::add_global): Added got_type parameter.
15906 (Output_data_got::add_global_with_rel): Likewise.
15907 (Output_data_got::add_global_with_rela): Likewise.
15908 (Output_data_got::add_global_pair_with_rel): New function.
15909 (Output_data_got::add_global_pair_with_rela): New function.
15910 (Output_data_got::add_local): Added got_type parameter.
15911 (Output_data_got::add_local_with_rel): Likewise.
15912 (Output_data_got::add_local_with_rela): Likewise.
15913 (Output_data_got::add_local_pair_with_rel): New function.
15914 (Output_data_got::add_local_pair_with_rela): New function.
15915 (Output_data_got::add_global_tls): Removed.
15916 (Output_data_got::add_global_tls_with_rel): Removed.
15917 (Output_data_got::add_global_tls_with_rela): Removed.
15918 (Output_data_got::add_local_tls): Removed.
15919 (Output_data_got::add_local_tls_with_rel): Removed.
15920 (Output_data_got::add_local_tls_with_rela): Removed.
15921 * output.h (Output_data_got::add_global): Added got_type parameter.
15922 (Output_data_got::add_global_with_rel): Likewise.
15923 (Output_data_got::add_global_with_rela): Likewise.
15924 (Output_data_got::add_global_pair_with_rel): New function.
15925 (Output_data_got::add_global_pair_with_rela): New function.
15926 (Output_data_got::add_local): Added got_type parameter.
15927 (Output_data_got::add_local_with_rel): Likewise.
15928 (Output_data_got::add_local_with_rela): Likewise.
15929 (Output_data_got::add_local_pair_with_rel): New function.
15930 (Output_data_got::add_local_pair_with_rela): New function.
15931 (Output_data_got::add_global_tls): Removed.
15932 (Output_data_got::add_global_tls_with_rel): Removed.
15933 (Output_data_got::add_global_tls_with_rela): Removed.
15934 (Output_data_got::add_local_tls): Removed.
15935 (Output_data_got::add_local_tls_with_rel): Removed.
15936 (Output_data_got::add_local_tls_with_rela): Removed.
15937 * resolve.cc (Symbol::override_base_with_special): Removed
15938 reference to has_got_offset_ field.
15939 * symtab.cc (Symbol::init_fields): Replaced initialization
15940 of got_offset_ with got_offsets_. Removed initialization
15942 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15943 (Symbol::got_offset): Likewise.
15944 (Symbol::set_got_offset): Likewise.
15945 (Symbol::has_tls_got_offset): Removed.
15946 (Symbol::tls_got_offset): Removed.
15947 (Symbol::set_tls_got_offset): Removed.
15948 (Symbol::got_offset_): Removed.
15949 (Symbol::tls_mod_got_offset_): Removed.
15950 (Symbol::tls_pair_got_offset_): Removed.
15951 (Symbol::got_offsets_): New field.
15952 (Symbol::has_got_offset): Removed.
15953 (Symbol::has_tls_mod_got_offset): Removed.
15954 (Symbol::has_tls_pair_got_offset): Removed.
15955 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15956 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15958 (Target_x86_64::Scan::global): Likewise.
15959 (Target_x86_64::Relocate::relocate): Likewise.
15960 (Target_x86_64::Relocate::relocate_tls): Likewise.
15962 2008-03-25 Ben Elliston <bje@au.ibm.com>
15964 * yyscript.y: Fix spelling error in comment.
15966 2008-03-24 Ian Lance Taylor <iant@google.com>
15968 * options.h (class General_options): Define build_id option.
15969 * layout.h (class Layout): Declare write_build_id, create_note,
15970 create_build_id. Add build_id_note_ member.
15971 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15972 "libiberty.h", "md5.h", "sha1.h".
15973 (Layout::Layout): Initialize eh_frame_data_,
15974 eh_frame_hdr_section_, and build_id_note_.
15975 (Layout::finalize): Call create_build_id.
15976 (Layout::create_note): New function, broken out of
15977 Layout::create_gold_note.
15978 (Layout::create_gold_note): Call create_note.
15979 (Layout::create_build_id): New function.
15980 (Layout::write_build_id): New function.
15981 (Close_task_runner::run): Call write_build_id.
15983 * x86_64.cc: Correct license to GPLv3.
15985 2008-03-23 Ian Lance Taylor <iant@google.com>
15987 * options.cc: Include "demangle.h".
15988 (parse_optional_string): New function.
15989 (parse_long_option): Handle takes_optional_argument.
15990 (parse_short_option): Update dash_z initializer. Handle
15991 takes_optional_argument.
15992 (General_options::General_options): Initialize do_demangle_.
15993 (General_options::finalize): Set do_demangle_. Handle demangling
15995 * options.h (parse_optional_string): Declare.
15996 (struct One_option): Add optional_arg field. Update constructor.
15997 Update call constructor calls. Add takes_optional_argument
15999 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
16000 (DEFINE_optional_string): Define.
16001 (General_options::demangle): Change from DEFINE_bool to
16002 DEFINE_optional_string.
16003 (General_options::no_demangle): New function.
16004 (General_options::do_demangle): New function.
16005 (General_options::set_do_demangle): New function.
16006 (General_options::execstack_status_): Move definition to end of
16008 (General_options::static_): Likewise.
16009 (General_options::do_demangle_): New field.
16010 * object.cc (big_endian>::get_symbol_location_info): Call
16011 Options::do_demangle, not Options::demangle.
16012 * symtab.cc (demangle): Likewise.
16014 2008-03-22 Ian Lance Taylor <iant@google.com>
16016 * gold.h: Include <cstddef> and <sys/types.h>
16017 * options.h: Include <cstring>.
16019 2008-03-21 Ian Lance Taylor <iant@google.com>
16021 * Added source code to GNU binutils.
16023 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16025 Copying and distribution of this file, with or without modification,
16026 are permitted in any medium without royalty provided the copyright
16027 notice and this notice are preserved.
16033 version-control: never