1 2014-08-08 Jing Yu <jingyu@google.com>
2 Han Shen <shenhan@google.com>
4 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
5 (DEFFILES): add aarch64-reloc.def.
6 (TARGETSOURCES): Add aarch64-reloc-property.cc.
7 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
8 * Makefile.in: Regenerate.
9 * aarch64-reloc-property.cc: New file.
10 * aarch64-reloc-property.h: New file.
11 * aarch64-reloc.def: New file.
12 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
13 with tab to make the format consistent.
14 (Output_data_got_aarch64::symbol_table_): New method.
15 (Target_aarch64::do_plt_address_for_global): New method.
16 (Target_aarch64::do_plt_address_for_local): New method.
17 (Target_aarch64::do_select_as_default_target): New method.
18 (Target_aarch64::do_make_data_plt): New method.
19 (Target_aarch64::make_data_plt): New method.
20 (Output_data_plt_aarch64::has_irelative_section): New method.
21 (Output_data_plt_aarch64::address_for_global): New method.
22 (Output_data_plt_aarch64::address_for_local): New method.
23 (Output_data_plt_aarch64::irelative_rel_): New parameter.
24 (Output_data_plt_aarch64::add_entry): Implement contents.
25 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
26 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
27 the got_pov entry to plt0.
28 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
30 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
31 (AArch64_howto): New struct.
32 (aarch64_howto[]): New static const array.
33 (AArch64_relocate_functions): New class.
34 (Target_aarch64::Scan::get_reference_flags): Remove method.
35 (Target_aarch64::Scan::local): Implement to support a few relocations.
36 (Target_aarch64::Scan::global): Implement to support a few relocations.
37 (Target_aarch64::make_plt_section): Implement contents.
38 (Target_aarch64::make_plt_entry): Implement contents.
39 (Target_aarch64::do_finalize_sections): Implement contents.
40 (Target_aarch64::Relocate::relocate): Implement a few relocations.
41 (Target_aarch64::relocate_section): Implement contents.
43 2014-08-06 Alan Modra <amodra@gmail.com>
45 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
47 2014-08-06 Alan Modra <amodra@gmail.com>
50 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
52 2014-07-21 Sriraman Tallam <tmsriram@google.com>
54 * object.cc (Relobj::is_section_name_included): Add
55 ".rodata.nptl_version" to not garbage collect this section.
57 2014-07-08 Cary Coutant <ccoutant@google.com>
59 * expression.cc (struct Expression::Expression_eval_info): Add
60 new fields type_pointer, vis_pointer, and nonvis_pointer.
61 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
62 nonvis_pointer parameters. Adjust all calls.
63 (Symbol_expression::value): Update type, visibility, and nonvis bits
65 * script.cc (Symbol_assignment::sized_finalize): Update type,
66 visibility, and remaining st_other bits for new symbol.
67 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
68 vis_pointer, and nonvis_pointer parameters.
69 * symtab.h (Symbol::set_type): New method.
71 * testsuite/Makefile.am (defsym_test): New test.
72 * testsuite/Makefile.in: Regenerate.
73 * testsuite/defsym_test.c: New file.
74 * testsuite/defsym_test.sh: New file.
76 2014-07-08 Cary Coutant <ccoutant@google.com>
79 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
80 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
81 (Sized_dynobj::base_read_symbols): ...new method.
82 * object.h (Sized_relobj_file::base_read_symbols): New method.
83 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
84 (Sized_relobj_file::base_read_symbols): ...new method.
85 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
86 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
87 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
89 2014-07-04 Alan Modra <amodra@gmail.com>
91 * po/POTFILES.in: Regenerate.
93 2014-07-02 Jing Yu <jingyu@google.com>
95 * aarch64.cc: New file
96 * Makefile.am (TARGETSOURCES): Add aarch64.cc
97 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
98 * Makefile.in: Regenerate.
99 * configure.tgt: Add entries for aarch64*.
100 * configure.ac: Likewise.
101 * configure: Likewise.
103 2014-06-27 Alan Modra <amodra@gmail.com>
105 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
107 2014-06-24 Cary Coutant <ccoutant@google.com>
109 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
111 (Dwo_file::sized_read_unit_index): Likewise.
113 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
116 * Makefile.am (TARGETSOURCES): Add mips.cc
117 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
118 * configure.tgt: Add entries for mips*.
119 * configure.ac: Likewise.
120 * Makefile.in: Regenerate.
121 * configure: Likewise.
123 2014-06-09 Cary Coutant <ccoutant@google.com>
125 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
126 unit_length is within section bounds.
128 2014-06-09 Cary Coutant <ccoutant@google.com>
131 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
134 2014-06-07 Alan Modra <amodra@gmail.com>
136 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
138 2014-06-06 Cary Coutant <ccoutant@google.com>
140 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
141 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
142 (Dwarf_pubnames_table::read_header): Likewise.
143 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
146 2014-06-05 Joel Brobecker <brobecker@adacore.com>
148 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
149 * Makefile.in, configure: Regenerate.
151 2014-06-03 Alan Modra <amodra@gmail.com>
153 * powerpc.cc (addis_12_2): Define.
154 (Stub_table::do_write): Support fusion on ELFv2 stubs.
156 2014-06-03 Alan Modra <amodra@gmail.com>
158 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
161 2014-06-02 Alan Modra <amodra@gmail.com>
163 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
164 Only ignore relocs on ELFv1.
165 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
167 2014-05-30 Cary Coutant <ccoutant@google.com>
169 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
170 * testsuite/Makefile.in: Regenerate.
171 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
173 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
176 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
177 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
179 2014-05-15 Alan Modra <amodra@gmail.com>
181 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
182 Compare FDE contents with DW_CFA_nop rather than 0.
184 2014-05-13 Sriraman Tallam <tmsriram@google.com>
186 * symtab.h (may_need_copy_reloc): Remove check for position independent
188 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
189 position independence before pc absolute may_need_copy_reloc call.
190 Add check for executable output befor pc relative may_need_copy_reloc
196 * powerpc.cc: Add check for no position independence before
197 may_need_copy_reloc calls.
198 * testsuite/pie_copyrelocs_test.cc: New file.
199 * testsuite/pie_copyrelocs_shared_test.cc: New file.
200 * Makefile.am (pie_copyrelocs_test): New test.
201 * Makefile.in: Regenerate.
203 2014-05-08 Martin Liška <mliska@suse.cz>
205 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
207 2014-05-06 Cary Coutant <ccoutant@google.com>
210 * i386.cc (Output_data_got_plt_i386): New class.
211 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
212 parameter. Change all callers.
213 (Output_data_plt_i386::layout_): Remove.
214 (Output_data_plt_i386::got_plt_): Change type.
215 (Target_i386::got_plt_): Change type. Change all references.
216 (Target_i386::got_section): Create instance of new class.
217 (Output_data_got_plt_i386::do_write): New function.
218 * x86_64.cc (Output_data_got_plt_x86_64): New class.
219 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
220 parameter. Change all callers.
221 (Output_data_plt_x86_64::layout_): Remove.
222 (Output_data_plt_x86_64::got_plt_): Change type.
223 (Target_x86_64::got_plt_): Change type. Change all references.
224 (Target_x86_64::got_section): Create instance of new class.
225 (Output_data_got_plt_x86_64::do_write): New function.
226 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
227 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
230 2014-05-05 Cary Coutant <ccoutant@google.com>
232 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
233 if we have pubnames/pubtypes.
235 2014-05-02 Cary Coutant <ccoutant@google.com>
237 * defstd.cc (in_segment): Define __ehdr_start here...
238 * layout.cc (Layout::finalize): ...Instead of here. Set the
239 output segment when known.
240 * resolve.cc (Symbol::override_base_with_special): Remember
241 the original binding.
242 * symtab.cc (Symbol::set_output_segment): New function.
243 (Symbol::set_undefined): New function.
244 * symtab.h (Symbol::is_weak_undefined): Check original undef
246 (Symbol::is_strong_undefined): New function.
247 (Symbol::set_output_segment): New function.
248 (Symbol::set_undefined): New function.
249 * target-reloc.h (is_strong_undefined): Remove.
250 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
251 Check for hidden undefs.
252 (relocate_section): Call Symbol::is_strong_undefined.
254 * testsuite/Makefile.am (ehdr_start_test_1)
255 (ehdr_start_test_2, ehdr_start_test_3)
256 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
257 * testsuite/Makefile.in: Regenerate.
258 * testsuite/ehdr_start_def.cc: New source file.
259 * testsuite/ehdr_start_test.cc: New source file.
260 * testsuite/ehdr_start_test.t: New linker script.
261 * testsuite/ehdr_start_test_4.sh: New shell script.
263 2014-04-23 Cary Coutant <ccoutant@google.com>
266 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
268 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
270 * layout.cc (Layout::include_section): Allow a target to decide
271 whether to include a section.
272 * target.h (Target::should_include_section): New function.
273 (Target::do_should_include_section): New function.
275 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
277 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
279 (Copy_relocs::emit): ... here.
280 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
281 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
282 (Copy_reloc_entry::entries_): Change from private to protected.
284 2014-04-02 Sriraman Tallam <tmsriram@google.com>
286 * icf.cc (get_section_contents): Replace copies of reloc
287 vectors with const references.
289 2014-04-02 Cary Coutant <ccoutant@google.com>
291 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
292 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
293 * configure: Regenerate.
294 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
295 -fno-use-linker-plugin.
296 (LINK1, CXXLINK1): Add it to the link command.
297 * testsuite/Makefile.in: Regenerate.
299 2014-03-12 Alan Modra <amodra@gmail.com>
301 * Makefile.in: Regenerate.
303 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
305 * symtab.h (Symbol::set_nonvis): New function.
307 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
309 * symtab.cc (Sized_symbol<32>::init_output_data):
310 Instantiate the template.
311 (Sized_symbol<64>::init_output_data): Likewise.
313 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
315 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
316 adjust dynamic symbol value.
317 * target.h (Target::adjust_dyn_symbol): New function.
318 (Target::do_adjust_dyn_symbol): New function.
320 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
322 * output.cc (Output_data_dynamic::Dynamic_entry::write):
323 Get the value of DYNAMIC_CUSTOM dynamic entry.
324 * output.h (Output_data_dynamic::add_custom): New function.
325 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
327 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
328 * target.h (Target::dynamic_tag_custom_value): New function.
329 (Target::do_dynamic_tag_custom_value): New function.
331 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
333 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
335 * target.h (Target::has_custom_set_dynsym_indexes): New function.
336 (Target::do_has_custom_set_dynsym_indexes): New function.
337 (Target::set_dynsym_indexes): New function.
338 (Target::do_set_dynsym_indexes): New function.
340 2014-03-07 Alan Modra <amodra@gmail.com>
342 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
343 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
344 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
345 (Powerpc_relocate_functions::has_overflow_bitfield,
346 overflowed): Use the above.
347 (Target_powerpc::Relocate::relocate): Correct overflow checking
348 for a number of relocations. Modify overflow test for 16-bit
349 fields in instructions to signed/unsigned according to whether
350 the field takes a signed or unsigned value.
352 2014-03-05 Alan Modra <amodra@gmail.com>
354 Update copyright years.
356 2014-03-05 Alan Modra <amodra@gmail.com>
358 * powerpc.cc (Target_powerpc::Scan::local, global): Support
359 R_PPC64_ADDR64_LOCAL.
360 (Target_powerpc::Relocate::relocate): Likewise.
362 2014-03-03 Alan Modra <amodra@gmail.com>
364 * dwp.cc (print_version): Update copyright year to current.
366 2014-02-10 Alan Modra <amodra@gmail.com>
368 * po/gold.pot: Regenerate.
370 2014-02-06 Cary Coutant <ccoutant@google.com>
372 Fix problem where -u is ignored when a weak undef is seen.
374 * archive.cc (Library_base::should_include_member): Reorder
375 code to check for -u option if a weak undef has already been seen.
376 * testsuite/Makefile.am (weak_undef_test_2): New test case.
377 * testsuite/Makefile.in: Regenerate.
378 * testsuite/weak_undef_file3.cc: New file.
379 * testsuite/weak_undef_file4.cc: New file.
380 * testsuite/weak_undef_test_2.cc: New file.
382 2014-02-05 Cary Coutant <ccoutant@google.com>
384 Fix issues with gold undefined symbol diagnostics.
387 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
389 * target-reloc.h (is_strong_undefined): New function.
390 (relocate_section): Move undef vtable symbol check from here.
391 Check for is_strong_undefined.
393 2014-02-05 Cary Coutant <ccoutant@google.com>
395 Fix problems with the --dynamic-list option.
398 * options.cc (General_options::parse_dynamic_list):
399 Set have_dynamic_list_.
400 (General_options::General_options): Initialize have_dynamic_list_.
401 (General_options::finalize): Turn off -Bsymbolic and
402 -Bsymbolic-functions if --dynamic-list provided.
403 * options.h (General_options::have_dynamic_list): New function.
404 (General_options::have_dynamic_list_): New data member.
405 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
409 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
410 in --dynamic-list, mark it.
412 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
413 (dynamic_list_2): New test case.
414 * testsuite/Makefile.in: Regenerate.
415 * testsuite/dynamic_list_2.cc: New file.
416 * testsuite/dynamic_list_2.t: New file.
417 * testsuite/dynamic_list_lib1.cc: New file.
418 * testsuite/dynamic_list_lib2.cc: New file.
419 * testsuite/gc_dynamic_list_test.c: New file.
420 * testsuite/gc_dynamic_list_test.sh: New file.
421 * testsuite/gc_dynamic_list_test.t: New file.
423 2014-01-28 Cary Coutant <ccoutant@google.com>
425 Add .gdb_index version 7 support.
427 * gold/dwarf_reader.cc: include <utility> (for make_pair).
428 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
430 (Dwarf_ranges_table::read_ranges_table): Likewise.
431 (Dwarf_pubnames_table::read_section): Check for GNU-style
432 sections, and for compressed debug sections.
433 (Dwarf_pubnames_table::read_header): Compute end address of table.
434 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
435 for end of list by offset, not by offset == 0.
436 (Dwarf_info_reader::do_read_string_table): Check for compressed
438 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
439 Initialize new data members.
440 (Dwarf_pubnames_table::next_name): return flag_byte.
441 (Dwarf_pubnames_table::end_of_table_): New data member.
442 (Dwarf_pubnames_table::is_gnu_style_): New data member.
443 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
444 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
445 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
446 read skeleton type unit DIEs.
447 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
448 (Gdb_index::do_write): Write flag_byte.
449 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
450 (Gdb_index::Cu_vector): Store flags along with cu indexes.
451 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
452 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
454 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
456 * version.cc (print_version): Update copyright year to 2014.
458 2013-12-19 Dimitry Andric <dimitry@andric.com>
460 * stringpool.cc (Stringpool_template::reserve): Add
461 HAVE_UNORDERED_MAP case.
462 * stringpool.cc (Stringpool_template::print_stats): Likewise.
464 2013-12-18 Cary Coutant <ccoutant@google.com>
466 * configure.ac: Check for <unordered_set> and <unordered_map>.
467 * config.in: Regenerate.
468 * configure: Regenerate.
469 * system.h: Use <unordered_set> and <unordered_map> if available.
471 2013-12-10 Roland McGrath <mcgrathr@google.com>
473 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
474 with $(INSTALL_PROGRAM_ENV).
475 * Makefile.in: Regenerate.
477 2013-11-22 Cary Coutant <ccoutant@google.com>
479 * configure.ac: Add check for which library is needed for
481 * configure: Regenerate.
483 2013-11-22 Cary Coutant <ccoutant@google.com>
485 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
487 * testsuite/Makefile.in: Regenerate.
489 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
491 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
492 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
493 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
494 (Target_x86_64<size>::Scan::local): Likewise.
495 (Target_x86_64<size>::Scan::global): Likewise.
496 (Target_x86_64<size>::Relocate::relocate): Likewise.
497 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
499 (Target_x86_64<size>::Scan::check_non_pic(): Handle
502 * testsuite/Makefile.am (check_PROGRAMS): Add
503 exception_x86_64_bnd_test.
504 (exception_x86_64_bnd_test_SOURCES): New macro.
505 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
506 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
507 (exception_x86_64_bnd_test_LDADD): Likewise.
508 (exception_x86_64_bnd_1.o): New rule.
509 (exception_x86_64_bnd_2.o): Likewise.
510 * testsuite/Makefile.in: Regenerated.
512 2013-11-15 Alan Modra <amodra@gmail.com>
514 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
516 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
517 Only call ppc64_local_entry_offset for 64-bit. Restrict
518 symval_for_branch lookup to ELFv1.
519 (Stub_table::add_plt_call_entry): Use unsigned int off.
520 (Output_data_glink::Address, invalid_address): New.
521 (Output_data_glink::add_eh_frame): Move out of line. Add
523 (Output_data_glink::add_global_entry, find_global_entry,
524 global_entry_address): New functions.
525 (Output_data_glink::global_entry_stubs_, end_branch_table_,
526 ge_size): New variables.
527 (Output_data_glink::set_final_data_size): Add global entry
529 (Output_data_glink::do_write): Write global entry stubs.
530 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
531 parameter. Return true for ELFv2. Adjust callers.
532 (Target_powerpc::Scan::local, global): Restrict opd lookup to
533 ELFv1. Similarly for ifunc and dynamic relocation processing
534 specific to ELFv1. Recognize that symbols are defined on
535 their plt entries for ELFv2.
536 (Target_powerpc::symval_for_branch): Assert if called for
538 (Target_powerpc::Relocate::relocate): Use global entry plt
539 stub for symbol value if such exists on ELFv2.
540 (Target_powerpc::Relocate::relocate): Don't call
541 symval_for_branch when ELFv2. Do adjust for local entry
543 (Target_powerpc::do_dynsym_value): Set symbols to global entry
545 (Target_powerpc::do_plt_address_for_global): Similarly.
547 2013-11-14 Cary Coutant <ccoutant@google.com>
549 Revert patch -- this did not fix the problem, and there is
552 2013-11-14 Cary Coutant <ccoutant@google.com>
555 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
556 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
557 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
558 updating fde_offsets_.
559 (Eh_frame_hdr::lock_): New data member.
561 2013-11-14 Cary Coutant <ccoutant@google.com>
563 * dwp.cc (Dwo_file_entry): New type.
564 (File_list): Use Dwo_file_entry.
565 (Dwo_file::verify): New function.
566 (Dwo_file::verify_dwo_list): New function.
567 (Dwo_file::sized_verify_dwo_list): New function.
568 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
570 (Dwp_options): New enum type.
571 (dwp_options): Add --verify-only.
574 * dwp.h (gold_info): Add declaration.
576 2013-11-14 Cary Coutant <ccoutant@google.com>
579 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
580 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
581 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
582 updating fde_offsets_.
583 (Eh_frame_hdr::lock_): New data member.
585 2013-11-06 Cary Coutant <ccoutant@google.com>
588 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
589 before reloc sections.
591 2013-11-04 Alan Modra <amodra@gmail.com>
593 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
594 (Symbol::needs_dynamic_reloc): Test new flag.
595 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
596 (Target_powerpc::Scan::get_reference_flags): Add target param.
597 Return FUNC_DESC_ABI for 64-bit ELFv1.
598 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
600 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
601 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
603 2013-10-31 Cary Coutant <ccoutant@google.com>
605 Restore support for dwp v2 DWARF package file format.
607 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
608 tu_length parameter. Adjust all callers.
609 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
610 * dwp.cc: Include dwarf.h.
611 (Section_bounds): New struct type.
612 (Unit_set): New struct type.
613 (Dwo_file::Dwo_file): Initialize new data member.
614 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
615 Combine and rename to...
616 (Dwo_file::read_unit_index): ...this.
617 (Dwo_file::sized_read_compunit_index)
618 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
619 (Dwo_file::sized_read_unit_index): ...this.
620 (Dwo_file::copy_section): Remove section_name, is_str_offsets
621 parameters; add section_id parameter.
622 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
623 (Dwo_file::add_unit_set): ...this.
624 (Dwo_file::shndx_map_): Remove.
625 (Dwo_file::sect_offsets_): New data member.
626 (Dwp_output_file::Dwp_output_file): Initialize new data members.
627 (Dwp_output_file::add_section): Rename to...
628 (Dwp_output_file::add_contribution): ...this.
629 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
630 (Dwp_output_file::add_tu_set): Likewise.
631 (Dwp_output_file::Contribution): New type.
632 (Dwp_output_file::Section::contributions): New data member.
633 (Dwp_output_file::Cu_or_tu_set): Remove.
634 (Dwp_output_file::Section::Section): New ctor.
635 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
636 (Dwp_output_file::Dwp_index::Section_table): New type.
637 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
638 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
640 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
641 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
642 (Dwp_output_file::Dwp_index::section_table): New member function.
643 (Dwp_output_file::Dwp_index::section_table_end): New member function.
644 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
645 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
646 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
647 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
648 (Dwp_output_file::Dwp_index::section_table_): New data member.
649 (Dwp_output_file::Dwp_index::section_mask_): New data member.
650 (Dwp_output_file::add_output_section): New member function.
651 (Dwp_output_file::write_new_section): New member function.
652 (Dwp_output_file::write_contributions): New member function.
653 (Dwp_output_file::section_id_map_): New data member.
654 (class Dwo_id_info_reader): Remove.
655 (class Unit_reader): New class.
656 (get_dwarf_section_name): New function.
657 (Dwo_file::read_executable): Adjust initializations of class data.
658 (Dwo_file::read): Add support for v2 package file format.
659 (Dwo_file::read_unit_index): Likewise.
660 (Dwo_file::sized_read_unit_index): Likewise.
661 (Dwo_file::copy_section): Likewise.
662 (Dwo_file::add_unit_set): Likewise.
663 (Dwp_output_file::add_output_section): Likewise.
664 (Dwp_output_file::add_contribution): Likewise.
665 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
667 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
669 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
671 (Dwp_output_file::initialize): Remove unused function.
672 (Dwp_output_file::finalize): Add support for v2 package file format.
673 (Dwp_output_file::write_index): Likewise.
674 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
677 2013-10-31 Cary Coutant <ccoutant@google.com>
679 * configure.ac: Fix check for -fmerge-constants.
680 * configure.ac: Regenerate.
682 2013-10-30 Roland McGrath <mcgrathr@google.com>
684 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
685 Correct 9-byte nop sequence to match what the assembler generates.
687 2013-10-30 Alan Modra <amodra@gmail.com>
689 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
690 ppc64_local_entry_offset, ppc64_local_entry_offset,
691 do_read_symbols): New functions.
692 (Powerpc_relobj::e_flags_, st_other_): New vars.
693 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
694 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
695 (Powerpc_relobj::e_flags_): New var.
696 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
697 and adjust for ELFv2.
698 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
699 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
700 (Powerpc_dynobj::do_find_special_sections): Likewise.
701 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
702 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
703 to ELFv2 local entry.
704 (Target_powerpc::do_relax): No thread safe barriers needed for
706 (Output_data_plt_powerpc::initial_plt_entry_size_,
707 plt_entry_size): Delete. Replace all uses with
708 first_plt_entry_offset() and plt_entry_size().
709 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
710 reserved_size parm. Update callers.
711 (Output_data_plt_powerpc::entry_count): Update.
712 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
713 and use Target_powerpc::first_plt_entry_offset().
714 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
715 rename to plt_entry_size.
716 (Output_data_plt_powerpc::add_ifunc_entry,
717 add_local_ifunc_entry): Adjust reloc for ELFv2.
718 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
719 (glink_eh_frame_fde_64v2): New.
720 (Stub_table::plt_call_size): Support ELFv2 sizing.
721 (Output_data_glink::add_eh_frame): Use the new FDE.
722 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
723 (Stub_table::do_write): Write ELFv2 stubs and glink.
724 (Target_powerpc::Relocate::relocate): Replaces nop after call
725 with ld 2,24(1) and adjust local offset destination for ELFv2.
727 2013-10-30 Alan Modra <amodra@gmail.com>
729 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
730 (Target_powerpc::Scan::global, local): Likewise.
731 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
732 on all ppc64 @h and @ha relocs.
734 2013-10-14 Alan Modra <amodra@gmail.com>
736 * output.h (Output_data_got::add_constant): Tidy.
737 (Output_data_got::add_constant_pair): New function.
738 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
739 methods used so as to first call reserve_ent().
741 2013-10-11 Roland McGrath <mcgrathr@google.com>
743 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
744 add_got_entry and add_got_entry_pair.
746 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
747 (HAVE_PUBNAMES): Likewise.
748 * configure: Regenerate.
750 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
751 * testsuite/Makefile.in: Regenerate.
753 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
754 Remove const from declaration.
755 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
756 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
757 * output.h (Output_file_header): Remove const from member target_
758 and corresponding constructor argument.
759 * output.cc (Output_file_header::Output_file_header): Update prototype.
760 (Output_file_header::do_sized_write): Use this->target_ in place
761 of parameters()->target().
763 * testsuite/undef_symbol.cc (Foo::get_a): New method.
765 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
766 * configure: Regenerate.
767 * Makefile.in: Regenerate.
768 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
769 * testsuite/merge_string_literals_2.c: Likewise.
770 * testsuite/Makefile.am
771 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
772 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
773 literal -fmerge-constants.
774 * testsuite/Makefile.in: Regenerate.
776 * i386.cc (Target_i386): Remove unused member dynbss_.
777 * arm.cc (Target_arm): Likewise.
778 * powerpc.cc (Target_powerpc): Likewise.
779 * sparc.cc (Target_sparc): Likewise.
780 * tilegx.cc (Target_tilegx): Likewise.
781 * x86_64.cc (Target_x86_64): Likewise.
782 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
783 type_signature_, type_offset_.
784 * plugin.h (Plugin_hook): Remove unused member layout_.
785 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
787 (Read_member): Remove unused members input_objects_, symtab_,
789 (Check_library): Remove unused member symtab_.
790 * archive.h (Lib_group): Remove unused member lib_.
791 * archive.cc (Lib_group::Lib_group): Update initializer.
792 * incremental.h (Incremental_binary): Remove unused member target_.
793 (Incremental_script_entry): Removed unused member script_.
794 * layout.h (Write_symbols_task): Remove unused member input_objects_.
795 * icf.h (Icf): Remove unused member num_tracked_relocs.
797 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
798 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
800 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
802 * archive.h: Use struct rather than class for forward declaration
803 of Read_symbols_data.
805 2013-10-07 Cary Coutant <ccoutant@google.com>
808 * testsuite/Makefile.am (icf_test): Fix dependencies.
809 (icf_safe_test): Likewise.
810 (icf_safe_so_test): Likewise.
811 (large_symbol_alignment): Add empty _LDADD rule.
812 * testsuite/Makefile.in: Regenerate.
814 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
817 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
818 relocation for R_X86_64_32 on x32.
820 2013-08-27 Roland McGrath <mcgrathr@google.com>
822 * output.cc (Output_segment::set_section_addresses): Take new
823 Target* argument. If target->isolate_execinstr() and the segment
824 is executable and starts at a target->abi_pagesize() boundary,
825 pad its end out to a target->abi_pagesize() boundary with code fill.
826 * output.h (Output_segment::set_section_addresses): Update decl.
827 * layout.h (Layout::check_output_data_for_reset_values): Take new
828 argument RELAX_OUTPUTS.
829 (Layout): New member relax_output_list_.
830 (Layout::add_relax_output): New method.
831 * layout.cc (Layout::Layout): Update constructor.
832 (Layout::reset_relax_output): New method.
833 (Layout::clean_up_after_relaxation): Call it.
834 (Layout::prepare_for_relaxation): Update caller.
835 (Layout::set_segment_offsets): Update callers of set_section_addresses.
836 Call reset_relax_output before re-processing segments for
837 isolate_execinstr case.
838 (Layout::write_data): Handle relax_output_list_.
839 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
840 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
842 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
845 * object.h: Fix typos.
847 2013-08-16 Roland McGrath <mcgrathr@google.com>
849 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
850 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
852 2013-08-07 Cary Coutant <ccoutant@google.com>
854 Revert support for v2 DWP files:
856 2013-03-01 Cary Coutant <ccoutant@google.com>
858 Add dwp support for v2 DWARF package file format.
859 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
860 tu_length parameter. Adjust all callers.
861 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
862 * dwp.cc: Include dwarf.h.
863 (Section_bounds): New struct type.
864 (Unit_set): New struct type.
865 (Dwo_file::Dwo_file): Initialize new data member.
866 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
867 Combine and rename to...
868 (Dwo_file::read_unit_index): ...this.
869 (Dwo_file::sized_read_compunit_index)
870 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
871 (Dwo_file::sized_read_unit_index): ...this.
872 (Dwo_file::copy_section): Remove section_name, is_str_offsets
873 parameters; add section_id parameter.
874 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
875 (Dwo_file::add_unit_set): ...this.
876 (Dwo_file::shndx_map_): Remove.
877 (Dwo_file::sect_offsets_): New data member.
878 (Dwp_output_file::Dwp_output_file): Initialize new data members.
879 (Dwp_output_file::add_section): Rename to...
880 (Dwp_output_file::add_contribution): ...this.
881 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
882 (Dwp_output_file::add_tu_set): Likewise.
883 (Dwp_output_file::Contribution): New type.
884 (Dwp_output_file::Section::contributions): New data member.
885 (Dwp_output_file::Cu_or_tu_set): Remove.
886 (Dwp_output_file::Section::Section): New ctor.
887 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
888 (Dwp_output_file::Dwp_index::Section_table): New type.
889 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
890 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
892 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
893 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
894 (Dwp_output_file::Dwp_index::section_table): New member function.
895 (Dwp_output_file::Dwp_index::section_table_end): New member function.
896 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
897 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
898 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
899 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
900 (Dwp_output_file::Dwp_index::section_table_): New data member.
901 (Dwp_output_file::Dwp_index::section_mask_): New data member.
902 (Dwp_output_file::add_output_section): New member function.
903 (Dwp_output_file::write_new_section): New member function.
904 (Dwp_output_file::write_contributions): New member function.
905 (Dwp_output_file::section_id_map_): New data member.
906 (class Dwo_id_info_reader): Remove.
907 (class Unit_reader): New class.
908 (get_dwarf_section_name): New function.
909 (Dwo_file::read_executable): Adjust initializations of class data.
910 (Dwo_file::read): Add support for v2 package file format.
911 (Dwo_file::read_unit_index): Likewise.
912 (Dwo_file::sized_read_unit_index): Likewise.
913 (Dwo_file::copy_section): Likewise.
914 (Dwo_file::add_unit_set): Likewise.
915 (Dwp_output_file::add_output_section): Likewise.
916 (Dwp_output_file::add_contribution): Likewise.
917 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
919 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
921 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
923 (Dwp_output_file::initialize): Remove unused function.
924 (Dwp_output_file::finalize): Add support for v2 package file format.
925 (Dwp_output_file::write_index): Likewise.
926 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
929 2013-07-31 Cary Coutant <ccoutant@google.com>
931 * object.cc (Sized_relobj::do_output_section_address): New function.
932 (Sized_relobj): Instantiate explicitly.
933 * object.h (Object::output_section_address): New function.
934 (Object::do_output_section_address): New function.
935 (Sized_relobj::do_output_section_address): New function.
936 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
938 2013-07-30 Cary Coutant <ccoutant@google.com>
939 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
941 * parameters.cc (Parameters::entry): Return target-specific entry
943 * target.h (Target::entry_symbol_name): New function.
944 (Target_info::entry_symbol_name): New data member.
946 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
947 * i386.cc (Target_i386::i386_info): Likewise.
948 (Target_i386_nacl::i386_nacl_info): Likewise.
949 * sparc.cc (Target_sparc::sparc_info): Likewise.
950 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
951 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
952 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
953 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
955 2013-07-22 Sterling Augustine <saugustine@google.com>
957 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
958 Convert parameter shndx to local variable. Add parameters symtab
959 and symtab_size. Scan over section names. Find relocation
960 section corresponding to current section. Create and initialize
961 reloc_mapper_ and reloc_type_.
962 (Dwarf_pubnames_table::read_header): Add assertion. Change
963 unit_length to off_t. Initialize member unit_length_. Fill in field
965 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
966 Initialize new fields unit_length_ and cu_offset_.
967 (Dwarf_pubnames_table::read_section): Update prototype.
968 (Dwarf_pubnames_table::cu_offset): New member function.
969 (Dwarf_pubnames_table::subsection_size): Likewise.
970 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
972 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
973 member functions public.
974 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
975 Update comment. Rework logic. Move repeated parts to...
976 (Gdb_index_info_reader::read_pubtable): ...here. New function.
977 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
978 pubtypes_table_, and stmt_list_offset.
979 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
980 Gdb_index::find_pubtype_offset,
981 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
982 (Gdb_index::pubnames_read): Update prototype and rework logic.
983 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
985 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
986 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
987 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
988 Gdb_index::map_pubtable_to_dies):
990 (Gdb_index::pubnames_read): Update declaration.
991 (Gdb_index::Pubname_offset_map): New type.
992 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
993 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
994 Gdb_index::stmt_list_offset): Declare.
995 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
996 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
997 Gdb_index::pubtypes_offset_): Remove.
999 2013-07-19 Roland McGrath <mcgrathr@google.com>
1001 * options.h (General_options): Add -Trodata-segment option.
1002 * parameters.cc (Parameters::check_rodata_segment): New function.
1003 (Parameters::set_target_once): Call it.
1004 * parameters.h (Parameters): Declare it (private member function).
1005 * layout.cc (load_seg_unusable_for_headers): New function, broken
1006 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1007 then validate rodata segment rather than text segment.
1008 (relaxation_loop_body): Call that.
1009 (is_text_segment): New function. Don't admit a non-executable
1010 segment if TARGET->isolate_execinstr().
1011 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1013 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1016 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1017 * nacl.h (Sniff_file::View::View): Request aligned view.
1019 2013-07-11 Cary Coutant <ccoutant@google.com>
1021 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1022 correct BRLT entry size.
1024 2013-07-03 Alan Modra <amodra@gmail.com>
1026 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1029 2013-07-01 Cary Coutant <ccoutant@google.com>
1031 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1033 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1034 (Dwarf_ranges_table::lookup_reloc): New function.
1035 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1037 (Dwarf_ranges_table::lookup_reloc): New function.
1038 (Dwarf_ranges_table::reloc_type_): New data member.
1040 2013-06-27 Jing Yu <jingyu@google.com>
1043 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1045 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1046 (Target_powerpc::do_relax): Call the above.
1048 2013-06-27 Cary Coutant <ccoutant@google.com>
1050 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1051 on garbage collected .opd section.
1053 2013-06-27 Alan Modra <amodra@gmail.com>
1055 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1057 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1058 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1060 2013-06-14 Cary Coutant <ccoutant@google.com>
1062 * resolve.cc (Symbol::override_base): Don't override st_type
1063 from plugin placeholder symbols.
1064 (Symbol_table::resolve): Likewise.
1065 (Symbol_table::should_override): Don't complain about TLS mismatch
1066 if the TO symbol is a plugin placeholder.
1067 * testsuite/Makefile.am (plugin_test_tls): New test.
1068 * testsuite/Makefile.in: Regenerate.
1069 * testsuite/plugin_test_tls.sh: New test script.
1070 * testsuite/two_file_test_2_tls.cc: New test source.
1071 * testsuite/two_file_test_tls.cc: New test source.
1073 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1075 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1076 the maximum segment alignment is larger than the page size.
1077 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1078 correctly aligns the symbols with large alignemnt.
1079 * testsuite/Makefile.in: Regenerate.
1080 * testsuite/large_symbol_alignment.cc: New file.
1082 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1083 Sriraman Tallam <tmsriram@google.com>
1085 * options.h (sort_section): New option.
1086 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1087 Rename from Input_section_sort_section_name_special_ordering_compare.
1088 (Input_section_sort_section_name_compare): New struct.
1089 * output.cc (Output_section::Input_section_sort_section_name_compare::
1090 operator()): New function.
1091 (Output_section::sort_attached_input_sections): Use new sort function
1092 for .text if --sort-section=name is specified.
1093 * layout.cc (Layout::make_output_section):
1094 Add sorting by name when --sort-section=name is specified.
1095 * testsuite/Makefile.am (text_section_grouping): Test option
1096 --sort-section=name.
1097 * testsuite/Makefile.in: Regenerate.
1098 * testsuite/section_sorting_name.cc: New file.
1099 * testsuite/section_sorting_name.sh: New file.
1101 2013-05-21 Cary Coutant <ccoutant@google.com>
1103 * symtab.h (Symbol::is_cxx_vtable): New function.
1104 * target-reloc.h (relocate_section): Check for vtable symbol.
1105 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1106 * testsuite/Makefile.in: Regenerate.
1107 * testsuite/missing_key_func.cc: New test source.
1108 * testsuite/missing_key_func.sh: New test script.
1110 2013-05-21 Cary Coutant <ccoutant@google.com>
1112 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1113 type of enclosing symbol.
1114 (Relocate_info::location): Check symbol type when describing symbol.
1115 * object.h (Symbol_location_info): Remove unused line_number;
1116 add enclosing_symbol_type.
1117 * testsuite/debug_msg.sh: Adjust expected output.
1119 2013-05-13 Cary Coutant <ccoutant@google.com>
1121 * configure.ac: Export DEFAULT_TARGET.
1122 * configure: Regenerate.
1123 * Makefile.in: Regenerate.
1124 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1125 * testsuite/Makefile.in: Regenerate.
1126 * testsuite/debug_msg.sh: Delete duplicate tests.
1127 Don't check undef_int error message match for powerpc where the
1128 source file and line number aren't available.
1130 2013-05-10 Roland McGrath <mcgrathr@google.com>
1132 * options.h (General_options): Add --rosegment-gap option.
1133 * options.cc (finalize): --rosegment-gap implies --rosegment.
1134 * layout.cc (set_segment_offsets): Let user option override
1135 target->rosegment_gap().
1137 2013-05-10 Roland McGrath <mcgrathr@google.com>
1139 * options.h (General_options): Remove leading space from help
1140 messages for -nostdlib and --rosegment.
1142 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1145 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1147 2013-05-03 Alan Modra <amodra@gmail.com>
1149 * merge.cc (Output_merge_string::do_add_input_section): Correct
1150 scan for number of strings. Rename vars to avoid shadowing.
1151 Include missing terminator in input_size_.
1153 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1155 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1156 Restore empty string handling.
1158 2013-05-01 Cary Coutant <ccoutant@google.com>
1160 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1161 uninitialized warning.
1163 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1165 * output.cc (Output_section::add_merge_input_section): Allow
1166 to merge sections if the alignment is more than character size.
1167 * merge.h (Output_merge_string::Output_merge_string): Remove
1169 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1170 only not-null strings. Check the alignment of strings.
1172 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1173 alignment as the argument.
1174 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1175 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1176 Align non-zero length strings according to the addralign_.
1177 (Stringpool_template<Stringpool_char>::set_string_offsets):
1178 Updating offsets according to the given alignment.
1179 * testsuite/Makefile.am (text_section_grouping): Test if string
1180 literals are getting merged.
1181 * testsuite/Makefile.in: Regenerate.
1182 * testsuite/merge_string_literals_1.c: New file.
1183 * testsuite/merge_string_literals_2.c: Ditto.
1184 * testsuite/merge_string_literals.sh: Ditto.
1186 2013-04-26 Ian Lance Taylor <iant@google.com>
1188 * target-reloc.h (relocate_section): If the reloc offset is out of
1189 range, pass VIEW as NULL to relocate.relocate.
1190 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1191 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1192 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1193 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1194 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1195 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1197 2013-04-26 Geoff Pike <gpike@chromium.org>
1199 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1200 * layout.cc (Hash_task): New class.
1201 (Layout::queue_build_id_tasks): New function.
1202 (Layout::write_build_id): Handle single-thread portion of build ID
1203 computation. (In some cases, all of it is single-threaded.) Replace
1204 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1205 functionality in fewer lines of code.
1206 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1207 * options.h (General_options): make "--build-id" default to tree
1208 rather than sha1. Add two new options related to --build-id=tree:
1209 --build-id-chunk-size-for-treehash and
1210 --build-id-min-file-size-for-treehash.
1211 * Makefile.am: add testing of --build-id=tree and related new options
1212 (these tests will be invoked by "make check").
1213 * Makefile.in: Regenerate.
1215 2013-04-25 Alan Modra <amodra@gmail.com>
1217 * configure.tgt: Add powerpcle and powerpc64le.
1219 2013-04-22 Alan Modra <amodra@gmail.com>
1222 * layout.cc (Layout::segment_precedes): Allow more than one
1223 segment with the same type and flags.
1225 2013-04-15 Cary Coutant <ccoutant@google.com>
1227 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1228 allocate space in file for BSS sections.
1230 2013-04-15 Cary Coutant <ccoutant@google.com>
1232 * script-sections.cc (Orphan_output_section): Reset address
1233 to zero after each orphaned section for relocatable links.
1235 2013-04-15 Cary Coutant <ccoutant@google.com>
1237 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1238 section starting address for relocatable link.
1239 * testsuite/Makefile.am (script_test_11): New test.
1240 * testsuite/Makefile.in: Regenerate.
1241 * testsuite/script_test_11.c: New source file.
1242 * testsuite/script_test_11.t: New linker script.
1244 2013-04-13 Alan Modra <amodra@gmail.com>
1246 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1247 owner when sections are not adjacent and exceed group size.
1248 (Target_powerpc::group_sections): Handle corner case.
1249 (Target_powerpc::Branch_info::make_stub): Handle case where
1250 stub table doesn't exist due to branches in non-exec sections.
1251 (Target_powerpc::Relocate::relocate): Likewise.
1253 2013-04-11 Alan Modra <amodra@gmail.com>
1256 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1257 .branch_lt to match bfd ld. Adjust comments throughout file.
1259 2013-04-04 Ian Lance Taylor <iant@google.com>
1262 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1263 sections before checking whether they are included in the link.
1265 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1267 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1268 object before calling the plugin claim_file handler. Pass the elf
1269 object of the archive to the plugin. Delete the elf object if the
1270 plugin claims the file.
1272 2013-03-21 Alan Modra <amodra@gmail.com>
1274 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1275 segment when omagic.
1277 2013-03-21 Alan Modra <amodra@gmail.com>
1279 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1281 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1282 uninitialized" warning.
1284 2013-03-20 Alan Modra <amodra@gmail.com>
1286 * symtab.h (Symbol::clear_version): New function.
1287 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1288 is_needed by weak references. Clear version for symbols defined
1289 in as-needed objects that are not needed.
1291 2013-03-15 Alan Modra <amodra@gmail.com>
1293 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1294 static and public. Add report_err param. Return false for data refs.
1295 (Target_powerpc::rela_dyn_section): New overloaded function.
1296 (Target_powerpc::plt_, iplt_): Elucidate.
1297 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1298 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1299 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1300 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1301 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1302 push_branch and make_plt_entry for ifunc syms when
1303 reloc_needs_plt_for_ifunc.
1304 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1305 for ifunc unless reloc_needs_plt_for_ifunc.
1307 2013-03-15 Alan Modra <amodra@gmail.com>
1309 * gc.h (gc_process_relocs): Don't look through function descriptors.
1310 * icf.cc (get_section_contents): Do so here instead.
1312 2013-03-13 Alan Modra <amodra@gmail.com>
1314 * powerpc.cc (is_branch_reloc): Forward declare.
1315 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1316 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1317 false for 64-bit, true for 32-bit non-branch relocs.
1318 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1319 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1321 (icf_safe_test): Generate linker map file as well as nm output.
1322 (icf_safe_so_test): Likewise.
1323 * testsuite/Makefile.in: Regenerate.
1324 * testsuite/icf_test.sh: Parse linker map file to determine
1326 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1327 * testsuite/icf_safe_so_test.sh: Likewise.
1328 (X86_32_or_ARM_specific_safe_fold): Merge into..
1329 (arch_specific_safe_fold): ..this.
1330 (X86_64_specific_safe_fold): Delete unused function.
1332 2013-03-12 Alan Modra <amodra@gmail.com>
1334 * gc.h (gc_process_relocs): Look through function descriptors
1335 to determine shndx, symvalue and addend used by ICF. Tidy
1336 variable duplication.
1338 2013-03-11 Alan Modra <amodra@gmail.com>
1340 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1341 * layout.cc (Layout_task_runner::run): ..to here.
1342 * symtab.h (struct Symbol_location): Extract from..
1343 (class Symbol_table): ..here.
1344 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1345 * target.h (class Target): Add function_location and
1346 do_function_location functions.
1347 (class Sized_target): Add do_function_location.
1348 * object.h (class Sized_relobj_file): Move find_shdr..
1349 (class Object): ..to here.
1350 * object.cc: Likewise. Update to suit. Instantiate.
1351 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1352 * powerpc.cc (class Powerpc_dynobj): New.
1353 (Target_powerpc::do_function_location): New function.
1354 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1355 (Powerpc_dynobj::do_read_symbols): New function.
1356 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1358 2013-03-08 Ian Lance Taylor <iant@google.com>
1360 * options.cc (General_options::string_to_object_format): Accept
1363 2013-03-08 Alan Modra <amodra@gmail.com>
1365 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1366 pointer to Post_fde.
1367 (struct Post_fde): Move definition to here..
1368 * ehframe.cc (struct Post_fde): ..from here.
1369 (Cie::write): Don't alloc Post_fde.
1370 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1372 2013-03-07 Alan Modra <amodra@gmail.com>
1374 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1375 relocation referencing .LC0.
1376 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1378 2013-03-07 Alan Modra <amodra@gmail.com>
1380 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1381 always_inline. Add assembly for powerpc to avoid GOT.
1383 2013-03-07 Alan Modra <amodra@gmail.com>
1385 * testsuite/script_test_10.sh: Don't test .bss section
1388 2013-03-06 Alan Modra <amodra@gmail.com>
1390 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1391 (Target_powerpc::symval_for_branch): Add symtab param. Update
1392 all callers. Handle folded sections.
1393 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1395 (Global_symbol_visitor_opd::operator()): Likewise.
1397 2013-03-04 Alan Modra <amodra@gmail.com>
1399 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1400 * testsuite/Makefile.in: Regenerate.
1402 2013-03-01 Cary Coutant <ccoutant@google.com>
1404 Add dwp support for v2 DWARF package file format.
1405 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1406 tu_length parameter. Adjust all callers.
1407 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1408 * dwp.cc: Include dwarf.h.
1409 (Section_bounds): New struct type.
1410 (Unit_set): New struct type.
1411 (Dwo_file::Dwo_file): Initialize new data member.
1412 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1413 Combine and rename to...
1414 (Dwo_file::read_unit_index): ...this.
1415 (Dwo_file::sized_read_compunit_index)
1416 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1417 (Dwo_file::sized_read_unit_index): ...this.
1418 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1419 parameters; add section_id parameter.
1420 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1421 (Dwo_file::add_unit_set): ...this.
1422 (Dwo_file::shndx_map_): Remove.
1423 (Dwo_file::sect_offsets_): New data member.
1424 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1425 (Dwp_output_file::add_section): Rename to...
1426 (Dwp_output_file::add_contribution): ...this.
1427 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1428 (Dwp_output_file::add_tu_set): Likewise.
1429 (Dwp_output_file::Contribution): New type.
1430 (Dwp_output_file::Section::contributions): New data member.
1431 (Dwp_output_file::Cu_or_tu_set): Remove.
1432 (Dwp_output_file::Section::Section): New ctor.
1433 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1434 (Dwp_output_file::Dwp_index::Section_table): New type.
1435 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1436 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1438 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1439 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1440 (Dwp_output_file::Dwp_index::section_table): New member function.
1441 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1442 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1443 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1444 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1445 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1446 (Dwp_output_file::Dwp_index::section_table_): New data member.
1447 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1448 (Dwp_output_file::add_output_section): New member function.
1449 (Dwp_output_file::write_new_section): New member function.
1450 (Dwp_output_file::write_contributions): New member function.
1451 (Dwp_output_file::section_id_map_): New data member.
1452 (class Dwo_id_info_reader): Remove.
1453 (class Unit_reader): New class.
1454 (get_dwarf_section_name): New function.
1455 (Dwo_file::read_executable): Adjust initializations of class data.
1456 (Dwo_file::read): Add support for v2 package file format.
1457 (Dwo_file::read_unit_index): Likewise.
1458 (Dwo_file::sized_read_unit_index): Likewise.
1459 (Dwo_file::copy_section): Likewise.
1460 (Dwo_file::add_unit_set): Likewise.
1461 (Dwp_output_file::add_output_section): Likewise.
1462 (Dwp_output_file::add_contribution): Likewise.
1463 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1465 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1467 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1469 (Dwp_output_file::initialize): Remove unused function.
1470 (Dwp_output_file::finalize): Add support for v2 package file format.
1471 (Dwp_output_file::write_index): Likewise.
1472 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1475 2013-03-01 Cary Coutant <ccoutant@google.com>
1477 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1478 function into class definition in header file.
1479 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1480 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1482 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1484 2013-02-28 Alan Modra <amodra@gmail.com>
1486 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1487 * target.cc (Target::do_plt_fde_location): New function.
1488 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1489 accessor function, and constructor param.
1490 (struct Post_fde, Post_fdes): Declare.
1491 (Cie::write): Add post_fdes param.
1492 * ehframe.cc (Fde::write): Use plt_fde_location.
1493 (struct Post_fde): Define.
1494 (Cie::write): Stash FDEs added post merge mapping.
1495 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1496 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1497 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1499 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1500 (Target_powerpc::has_glink): New function.
1501 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1502 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1503 glink_eh_frame_fde_32, default_fde): New data.
1504 (Stub_table::eh_frame_added_): New var.
1505 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1507 (Stub_table::add_eh_frame): New function.
1508 (Output_data_glink::add_eh_frame): New function.
1509 (Target_powerpc::make_glink_section): Call add_eh_frame.
1511 2013-02-15 Ian Lance Taylor <iant@google.com>
1513 * options.h (DEFINE_uint64_alias): Define.
1514 (class General_options): Add -Ttext-segment as an alias for
1517 2013-02-15 Alan Modra <amodra@gmail.com>
1519 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1520 (Stub_table::do_write): ..here, two places.
1521 (Stub_table::plt_call_size): Use it here too.
1523 2013-02-11 Ian Lance Taylor <iant@google.com>
1525 * descriptors.cc (Descriptors::close_all): New function.
1526 * descriptors.h (class Descriptors): Declare close_all.
1527 (close_all_descriptors): New inline function.
1528 * plugin.cc: Include "descriptors.h".
1529 (Plugin_manager::cleanup): Call close_all_descriptors.
1531 2013-02-06 Alan Modra <amodra@gmail.com>
1533 * README: Update coding style link.
1535 2013-01-28 Cary Coutant <ccoutant@google.com>
1537 * dwp.cc (File_list): New typedef.
1538 (Dwo_name_info_reader): New class.
1539 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1540 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1541 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1542 (Dwo_file::read_executable): New function.
1543 (Dwo_file::read): Move common setup code to ...
1544 (Dwo_file::make_object): ... here.
1545 (dwp_options): Add --exec/-e.
1549 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1551 * layout.cc (Layout::layout): Check for option text_reorder.
1552 (Layout::make_output_section): Ditto.
1553 * options.h (text_reorder): New option.
1554 * output.cc (Input_section_sort_compare): Remove special ordering
1557 Input_section_sort_section_name_special_ordering_compare::
1558 operator()): New function.
1559 (Output_section::sort_attached_input_sections): Use new sort function
1561 * output.h (Input_section_sort_section_name_special_ordering_compare):
1563 * testsuite/Makefile.am (text_section_grouping): Test option
1565 * testsuite/Makefile.in: Regenerate.
1566 * testsuite/text_section_grouping.sh: Check order of functions without
1567 default text reordering.
1569 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1571 * options.h (General_options): Change default to true for new_dtags.
1573 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1575 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1576 when enable_new_dtags is false. Only add DT_RUNPATH when
1577 enable_new_dtags is true.
1579 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1581 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1582 used in declaration and definition consistent.
1583 (Target_powerpc::symval_for_branch): Ditto.
1585 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1587 * testsuite/plugin_final_layout.cc: Fix comment.
1589 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1591 * layout.cc (Layout::layout): Do not do default sorting for
1592 text sections when section ordering is specified.
1593 (make_output_section): Ditto.
1594 * testsuite/plugin_final_layout.cc: Name the function sections
1595 to catch reordering issues.
1597 2013-01-15 Alan Modra <amodra@gmail.com>
1599 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1602 2013-01-15 Alan Modra <amodra@gmail.com>
1604 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1605 * testsuite/Makefile.in: Regenerate.
1607 2013-01-14 Alan Modra <amodra@gmail.com>
1609 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1610 * testsuite/Makefile.in: Regenerate.
1612 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1615 Fix mingw gold build with plugins enabled
1616 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1617 * configure.ac: Export DLOPEN_LIBS and add headers check.
1618 * plugin.cc: Handle non-dlfcn case.
1619 * Makefile.in: Regenerate.
1620 * config.in: Regenerate.
1621 * configure: Regenerate.
1622 * testsuite/Makefile.in: Regenerate.
1624 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1626 * output.h (sort_attached_input_sections): Change to be public.
1627 * script-sections.cc
1628 (Output_section_definition::set_section_addresses): Sort
1629 attached input sections according to section order before linker
1630 script assigns section addresses.
1631 (Orphan_output_section::set_section_addresses): Sort
1632 attached input sections according to section order before linker
1633 script assigns section addresses.
1634 * Makefile.am (final_layout.sh): Use a simple linker script to
1635 check if section ordering still works.
1636 * Makefile.in: Regenerate.
1638 2013-01-09 Ben Cheng <bccheng@google.com>
1640 * arm.cc (Target_arm::attributes_accept_div): New function.
1641 (Target_arm::attributes_forbid_div): New function.
1642 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1643 attribute using the same new functions as what bfd/elf32_arm.c
1646 2013-01-07 Cary Coutant <ccoutant@google.com>
1649 * output.cc (Output_section::add_input_section): For incremental
1650 updates, don't track input sections that are allocated from patch
1653 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1654 Ian Lance Taylor <iant@google.com>
1657 * configure.ac (--enable-ld): Removed.
1658 (install_as_default): Set to yes only for --enable-gold=default
1660 * configure: Regenerated.
1662 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1664 * options.h (General_options): Add -fuse-ld= for GCC linker
1665 option compatibility.
1667 2013-01-04 Cary Coutant <ccoutant@google.com>
1669 * configure.ac: Fix typo restoring CXXFLAGS.
1670 * configure: Regenerate.
1672 2013-01-04 Cary Coutant <ccoutant@google.com>
1674 * testsuite/Makefile.am (CXXLINK_S): New macro.
1675 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1676 * testsuite/Makefile.in: Regenerate.
1678 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1680 * version.cc (print_version): Update copyright year to 2013.
1682 2012-12-20 Ian Lance Taylor <iant@google.com>
1684 * layout.cc (Layout::special_ordering_of_input_section): New
1686 (Layout::layout): If input section requires special ordering, must
1687 sort input sections.
1688 (Layout::make_output_section): May sort .text input sections.
1689 (Layout::is_section_name_prefix_grouped): Remove.
1690 * layout.h (class Layout): Declare
1691 special_ordering_of_input_section. Don't declare
1692 is_section_name_prefix_grouped.
1693 * output.cc (Output_section::add_input_section): Revert last
1695 (Output_section::Input_section_sort::match_file_name): Don't crash
1696 if called on output section data.
1697 (Output_section::Input_section_sort_compare): Sort based on
1699 (Output_section::Input_section_sort_section_order_index_compare):
1701 (Output_section::sort_attached_input_sections): Likewise.
1703 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1705 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1706 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1707 * output.cc (Output_section::add_input_section): Check if section
1708 name contains special prefix. Keep input sections to sort such
1710 (Output_section::Input_section_sort_section_order_index_compare
1711 ::operator()): Group sections according to prefixes.
1712 (Output_section::sort_attached_input_sections): Add condition to
1713 Input_section_entry constructor call.
1714 * testsuite/Makefile.am (text_section_grouping): New test.
1715 * testsuite/Makefile.in: Regenerate.
1716 * testsuite/text_section_grouping.cc: New file.
1717 * testsuite/text_section_grouping.sh: New file.
1719 2012-12-17 Nick Clifton <nickc@redhat.com>
1721 * Makefile.am: Add copyright notice.
1724 * configure.ac: Likewise.
1725 * ftruncate.c: Likewise.
1726 * Makefile.in: Regenerate.
1728 2012-12-14 Cary Coutant <ccoutant@google.com>
1730 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1731 --no-as-needed flag.
1732 (exception_separate_shared_12_test): Likewise.
1733 (incremental_copy_test): Likewise.
1734 * testsuite/Makefile.in: Regenerate.
1736 2012-12-14 Cary Coutant <ccoutant@google.com>
1738 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1739 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1741 2012-12-12 Alan Modra <amodra@gmail.com>
1743 * powerpc.cc (class Track_tls): New.
1744 (class Relocate, class Scan): Inherit Track_tls.
1745 (Target_powerpc::Scan::local, global): Track tls optimization
1746 and avoid creating plt entry for __tls_get_addr if all uses
1748 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1750 2012-12-12 Alan Modra <amodra@gmail.com>
1752 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1753 Replace no_toc_optimize with toc_optimize.
1754 * output.h (Output_section::input_sections): Provide non-const variant.
1755 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1756 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1758 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1759 (class Sort_toc_sections): New.
1760 (Target_powerpc::do_finalize_sections): Sort toc sections.
1761 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1763 2012-12-10 Roland McGrath <mcgrathr@google.com>
1765 * testsuite/binary_unittest.cc (read_all): New function.
1766 (Sized_binary_test): Use it instead of ::read.
1767 * fileread.cc (do_read): Don't assume pread always reads the whole
1768 amount in a single call.
1770 2012-12-10 Alan Modra <amodra@gmail.com>
1772 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1773 Set EM_PPC64 or EM_PPC here.
1774 (Target_selector_powerpc::do_recognize): Delete.
1776 2012-12-10 Alan Modra <amodra@gmail.com>
1778 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1780 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1782 2012-12-07 Roland McGrath <mcgrathr@google.com>
1784 * testsuite/binary_unittest.cc (Sized_binary_test):
1785 Use open_descriptor rather than ::open.
1787 2012-12-07 Alan Modra <amodra@gmail.com>
1789 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1790 typedef and invalid_address constant.
1791 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1792 instantiate constants.
1794 2012-12-06 Roland McGrath <mcgrathr@google.com>
1796 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1797 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1798 * aclocal.m4: Regenerate.
1799 * configure: Regenerate.
1800 * Makefile.in: Regenerate.
1801 * testsuite/Makefile.in: Regenerate.
1803 2012-12-07 Alan Modra <amodra@gmail.com>
1805 * options.h (General_options): Add no_toc_optimize.
1806 * powerpc.cc (ok_lo_toc_insn): New function.
1807 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1809 2012-12-06 Alan Modra <amodra@gmail.com>
1811 * options.h (General_options): Add plt_align, plt_static_chain,
1812 plt_thread_safe. Update stub_group_size help text.
1813 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1814 for new plt_thread_safe_ var.
1815 (use_plt_offset): Correct comments.
1816 (Target_powerpc::do_relax): Look for thread creation symbols to
1817 determine default plt_thread_safe value. Clear plt call stubs
1818 as well as branch stubs each iteration.
1819 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1821 (l, hi, ha, write_insn): Move earlier.
1822 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1823 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1825 (Stub_table::update_size): Adjust.
1826 (Stub_table::prev_size, set_prev_size): Delete.
1827 (Stub_table::stub_align): Let --plt-align affect result.
1828 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1829 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1830 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1831 (Stub_table::do_write): Support more stub variants.
1833 2012-12-04 Alan Modra <amodra@gmail.com>
1835 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1836 (Target_powerpc::do_define_standard_symbols): New function.
1838 2012-12-03 Alan Modra <amodra@gmail.com>
1840 * output.h: Formatting, whitespace.
1842 2012-12-03 Alan Modra <amodra@gmail.com>
1844 * layout.h (Layout::get_executable_sections): Declare.
1845 * layout.cc (Layout::get_executable_sections): New function.
1846 * arm.cc (Target_arm::group_sections): Use it.
1847 (Arm_output_section::group_sections): Delete now redundant test.
1848 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1849 param to handle relative relocs.
1850 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1851 (Output_data_reloc::add_absolute): Adjust.
1852 (Output_data_reloc::add_relative): New function.
1853 (Output_data::reset_data_size): New function.
1854 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1855 (Output_section::set_addralign): New function.
1856 (Output_section::checkpoint_set_addralign): New function.
1857 (Output_section::clear_section_offsets_need_adjustment): New function.
1858 (Output_section::input_sections): Make public.
1859 * powerpc.cc (class Output_data_brlt_powerpc): New.
1860 (class Stub_table, class Stub_control): New.
1861 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1862 stub_table_, set_stub_table, stub_table): New vectors and accessor
1864 (Target_powerpc::do_may_relax, do_relax, push_branch,
1865 new_stub_table, stub_tables, brlt_section, group_sections,
1866 add_branch_lookup_table, find_branch_lookup_table,
1867 write_branch_lookup_table, make_brlt_section): New functions.
1868 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1869 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1870 branch_info_): New vars.
1871 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1872 make call stubs here.
1873 (Output_data_glink): Remove all call stub handling from this class.
1874 (Target_powerpc::Scan::local, global): Save interesting branch
1875 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1876 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1877 functions on final link.
1878 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1879 Handle long branch destinations too.
1880 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1881 do_plt_address_for_local): Adjust lookup of plt call stubs.
1883 2012-11-30 Alan Modra <amodra@gmail.com>
1885 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1886 relocs against protected symbols when building 32-bit shared libs.
1888 2012-11-30 Alan Modra <amodra@gmail.com>
1890 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1891 param. Call got_section() to make .got. Update all callers
1892 and their callers and so on.
1894 2012-11-30 Alan Modra <amodra@gmail.com>
1896 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1897 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1898 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1899 value if it already exists.
1901 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1904 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1906 2012-11-14 Roland McGrath <mcgrathr@google.com>
1908 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1909 than bfc instruction for data sandboxing.
1911 2012-11-08 Alan Modra <amodra@gmail.com>
1913 * po/POTFILES.in: Regenerate.
1915 2012-11-05 Alan Modra <amodra@gmail.com>
1917 * configure.ac: Apply 2012-09-10 change to config.in here.
1918 * configure: Regenerate.
1920 2012-11-05 Alan Modra <amodra@gmail.com>
1922 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1923 (struct Opd_ent): Use "Address" rather than "Offset".
1924 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1925 (Target_powerpc::got_section): Make public.
1926 (Target_powerpc::scan_relocs): Move code setting symbols..
1927 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1928 Create _SDA_BASE_ only when referenced.
1930 2012-11-02 Roland McGrath <mcgrathr@google.com>
1932 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1935 2012-11-01 Roland McGrath <mcgrathr@google.com>
1937 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1938 for offset_in_output_section parameter.
1939 (Sized_target::relocate_special_relocatable): Likewise.
1940 * arm.cc (Target_arm::relocate_relocs): Likewise.
1941 (Target_arm::relocate_special_relocatable): Likewise.
1942 * i386.cc (Target_i386::relocate_relocs): Likewise.
1943 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1944 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1945 * target-reloc.h (relocate_relocs): Likewise.
1946 * testsuite/testfile.cc (Target_test): Likewise.
1947 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1948 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1950 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1951 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1953 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1954 parameter, which is unused in the [!F_SETFD] case.
1956 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1957 SYMNDX to off_t before comparing it to this->data_size().
1958 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1959 * incremental.cc (Output_section_incremental_inputs::do_write):
1960 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1962 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1964 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1966 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1967 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1970 2012-10-29 Cary Coutant <ccoutant@google.com>
1972 * dwp.cc (usage): Add file and exit status parameters;
1973 add --help and --version options.
1974 (print_version): New function.
1975 (main): Add --help and --version options.
1977 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1979 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1980 final_layout_sequence.txt.
1981 * testsuite/Makefile.in: Regenerated.
1983 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1985 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1986 COMPILE generated by automake.
1988 (CXXCOMPILE1): Likewise.
1989 (CXXLINK1): Likewise.
1990 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1992 (CXXCOMPILE): Likewise.
1993 (CXXLINK): Likewise.
1994 * testsuite/Makefile.in: Regenerated.
1996 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1998 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1999 on bad fwrite return.
2001 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2003 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2006 2012-10-23 Cary Coutant <ccoutant@google.com>
2008 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2009 * testsuite/Makefile.in: Regenerate.
2010 * testsuite/dwp_test.h: New source file.
2011 * testsuite/dwp_test_1.cc: New source file.
2012 * testsuite/dwp_test_1.s: New source file.
2013 * testsuite/dwp_test_1.sh: New source file.
2014 * testsuite/dwp_test_1b.cc: New source file.
2015 * testsuite/dwp_test_1b.s: New source file.
2016 * testsuite/dwp_test_2.cc: New source file.
2017 * testsuite/dwp_test_2.s: New source file.
2018 * testsuite/dwp_test_2.sh: New source file.
2019 * testsuite/dwp_test_main.cc: New source file.
2020 * testsuite/dwp_test_main.s: New source file.
2022 2012-10-23 Cary Coutant <ccoutant@google.com>
2024 * dwp.h: New header file.
2025 * dwp.cc: New source file.
2026 * gold.h: Move shared declarations to system.h.
2027 * system.h: New header file.
2028 * Makefile.am: Add dwp.
2029 * Makefile.in: Regenerate.
2031 2012-10-23 Cary Coutant <ccoutant@google.com>
2033 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2034 Dwarf_info_reader::read_from_pointer.
2035 (Dwarf_pubnames_table::read_header): Likewise.
2036 (Dwarf_pubnames_table::next_name): Likewise.
2037 (Dwarf_die::read_attributes): Likewise.
2038 (Dwarf_die::skip_attributes): Likewise.
2039 (Dwarf_info_reader::read_from_pointer): New function template.
2040 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2041 (Dwarf_pubnames_table): Likewise.
2042 (Dwarf_info_reader::read_from_pointer): New function template.
2043 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2044 Dwarf_pubnames_table ctor.
2046 2012-10-23 Cary Coutant <ccoutant@google.com>
2048 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2050 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2052 (Dwarf_info_reader::set_abbrev_shndx): New method.
2053 (Dwarf_info_reader::abbrev_shndx_): New data member.
2055 2012-10-23 Cary Coutant <ccoutant@google.com>
2057 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2058 from object, not parameters.
2059 (Dwarf_info_reader::parse): Likewise.
2060 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2061 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2062 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2065 2012-10-23 Cary Coutant <ccoutant@google.com>
2067 * fileread.cc (Input_file::Input_file): New constructor.
2068 * fileread.h (class Input_file): Add new constructor.
2070 2012-10-18 Alan Modra <amodra@gmail.com>
2073 * object.cc (Relobj::is_section_name_included): Also match
2074 .sdata personality section.
2076 2012-10-18 Alan Modra <amodra@gmail.com>
2078 * target-reloc.h (class Default_comdat_behavior): New, package up..
2079 (get_comdat_behaviour): ..this.
2080 (relocate_section): Add Relocate_comdat_behavior template arg,
2081 adjust code to suit.
2082 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2083 (Target_arm::scan_reloc_section): Likewise.
2084 * i386.cc (Target_i386::relocate_section): Likewise.
2085 * sparc.cc (Target_sparc::relocate_section): Likewise.
2086 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2087 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2088 * powerpc.cc (class Relocate_comdat_behavior): New.
2089 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2090 gold::relocate_section with new template arg.
2092 2012-10-18 Alan Modra <amodra@gmail.com>
2094 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2095 dynamic relocs for GOT_TPREL got entries, without symbol if
2097 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2098 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2099 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2101 2012-10-17 Alan Modra <amodra@gmail.com>
2104 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2106 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2108 * layout.cc (Layout::include_section): Keep sections marked
2109 SHF_EXCLUDE when doing relocatable links.
2111 2012-10-16 Alan Modra <amodra@gmail.com>
2113 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2114 (Target_powerpc::do_finalize_sections): Call it.
2115 (Output_data_save_res): New class and supporting functions.
2116 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2117 normal symbols defined in object files.
2119 2012-10-12 Alan Modra <amodra@gmail.com>
2121 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2122 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2123 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2124 section if scan_opd_relocs not yet called.
2125 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2127 2012-10-12 Alan Modra <amodra@gmail.com>
2129 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2130 add_local_ifunc_entry): Revert last change.
2131 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2133 2012-10-05 Alan Modra <amodra@gmail.com>
2135 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2136 do_plt_address_for_global): New functions.
2137 (Output_data_got_powerpc::do_write): Don't segfault when linking
2139 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2140 add_local_ifunc_entry): Return true on adding entry..
2141 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2142 glink->add_entry call. Remove unused symtab param. Adjust calls.
2143 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2144 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2145 set up symbols here.
2146 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2147 syms here. Do so even when no .iplt. Don't segfault when linking
2149 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2150 new variants without reloc param.
2151 (Glink_sym_ent::Glink_sym_ent): Likewise.
2152 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2153 reloc when refs will resolve to plt call stub.
2154 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2155 R_PPC_PLTREL24 to resolve locally.
2156 (Target_powerpc::Scan::global): Correct ifunc handling.
2157 (Target_powerpc::Relocate::relocate): Correct local sym glink
2158 lookup. Don't destroy "value" when we have a plt call stub,
2159 and when checking plt call validity.
2160 (Target_powerpc::do_dynsym_value): Simplify.
2162 2012-10-05 Alan Modra <amodra@gmail.com>
2164 * i386.cc (Output_data_plt_i386::address_for_global,
2165 address_for_local): Add plt offset to returned value. Adjust uses.
2166 * sparc.cc (Output_data_plt_sparc::address_for_global,
2167 address_for_local): Likewise.
2168 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2169 address_for_local): Likewise.
2170 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2171 address_for_local): Likewise.
2172 * target.h (Target::plt_address_for_global, plt_address_for_local):
2174 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2175 (Output_data_got::Got_entry::write): Nor here.
2176 * output.h: Comment fix.
2178 2012-10-02 Jiong Wang <jiwang@tilera.com>
2180 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2181 global_offset_table_ value for larget got.
2182 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2184 2012-09-29 Alan Modra <amodra@gmail.com>
2186 * powerpc.cc (Target_powerpc::iplt_): New output section.
2187 (Target_powerpc::iplt_section, make_iplt_section,
2188 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2189 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2190 Target_powerpc::plt_entry_count): Count iplt entries too.
2191 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2192 reloc section in constructor. New params.
2193 (Target_powerpc::make_plt_section): Create reloc section here instead.
2194 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2196 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2197 (Output_data_glink::add_entry, find_entry): New functions to
2198 deal with local syms.
2199 (Glink_sym_ent): Add support for local syms.
2200 (Output_data_glink::do_write): Handle ifunc plt entries.
2201 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2202 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2203 (Target_powerpc::Relocate::relocate): Likewise.
2204 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2206 2012-09-25 Alan Modra <amodra@gmail.com>
2208 * object.h (Sized_relobj_file::adjust_local_symbol,
2209 do_adjust_local_symbol): New functions.
2210 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2211 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2212 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2213 and irregular opd entry spacing.
2214 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2215 (Global_symbol_visitor_opd): New functor.
2216 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2217 on deleted opd entries.
2219 2012-09-15 Jiong Wang <jiwang@tilera.com>
2221 * tilegx.cc: New file.
2222 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2223 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2224 * configure.tgt: Add entries for tilegx*.
2225 * configure.ac: Likewise.
2226 * Makefile.in: Rebuild.
2227 * configure: Likewise.
2228 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2231 2012-09-13 Alan Modra <amodra@gmail.com>
2233 * target-reloc.h (scan_relocs): Call scan.local for relocs
2234 against symbols in discarded sections. Pass is_discarded
2236 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2237 Add is_discarded param.
2238 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2239 is_discarded to flag opd entry as discarded. Don't emit dyn
2240 relocs on such entries.
2241 (Target_powerpc::Scan::global): Similarly detect and handle
2243 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2244 opd_ent_. Update all uses.
2245 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2246 (Target_powerpc::relocate_section): Zero out discarded opd
2249 2012-09-12 Ian Lance Taylor <iant@google.com>
2252 * output.cc: Rename Output_data_got template parameter from size
2253 to got_size for all functions. Compile all variants of
2255 (Output_data_got::Got_entry::write): Correct use of size for
2256 symbol value. Use local_is_tls rather than casting to
2258 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2259 (class Sized_relobj_file): Add do_local_is_tls.
2260 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2262 2012-09-11 Alan Modra <amodra@gmail.com>
2265 * layout.cc (Layout::set_segment_offsets): When using
2266 common-page-size alignment, ensure we are on a new max-page-size
2268 * output.cc (Output_segment::set_section_addresses): Use
2269 abi_pagesize, not common_pagesize for relro boundary.
2270 (Output_segment::set_offset): Likewise.
2272 2012-09-11 Alan Modra <amodra@gmail.com>
2274 * output.h (Output_data_got::add_global_tls, add_local_tls,
2275 add_local_tls_pair): New functions.
2276 (Output_data_got::add_local_pair_with_rel): Remove second
2277 reloc param. Expand comment.
2278 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2279 use_plt_or_tls_offset_, similarly for constructor param.
2280 (Output_data_got::Got_entry::write): Add got_index param.
2281 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2282 add_local_tls_pair): New functions.
2283 (Output_data_got::Got_entry::write): Handle tls symbols
2284 with use_plt_or_tls_offset_ set specially.
2285 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2286 (Output_data_got::do_write): Replace iterator with index, pass
2287 index to entry write function.
2288 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2289 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2290 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2292 * i386.cc (Target_i386::Scan::local): Likewise.
2293 * sparc.cc (Target_sparc::Scan::local): Likewise.
2294 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2295 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2296 do_tls_offset_for_global): New functions.
2297 (Target_powerpc::Scan::local): Correct TLS relocations and got
2299 (Target_powerpc::Scan::global): Don't emit unnecessary
2300 dynamic relocations on TLS GOT entries.
2302 2012-09-10 Matthias Klose <doko@ubuntu.com>
2304 * config.in: Disable sanity check for kfreebsd.
2306 2012-09-10 Sterling Augustine <saugustine@google.com>
2308 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2309 (Gdb_index::pubtypes_read): New parameter.
2310 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2312 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2315 2012-09-09 Alan Modra <amodra@gmail.com>
2317 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2318 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2319 * gc.h (gc_process_relocs): Call target gc_add_reference.
2320 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2321 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2322 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2324 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2325 to cater for when we don't need code offset. Update use.
2326 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2327 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2328 set_opd_valid): New functions.
2329 (Target_powerpc::do_gc_add_reference): New function.
2330 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2332 (Target_powerpc::do_gc_mark_symbol): New function.
2334 2012-09-06 Cary Coutant <ccoutant@google.com>
2336 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2337 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2338 (Dwarf_die::skip_attributes): Likewise.
2339 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2340 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2342 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2344 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2346 * testsuite/script_test_3.t: Add .got.plt output section
2348 * testsuite/script_test_4.t: Likewise.
2350 2012-09-05 Alan Modra <amodra@gmail.com>
2352 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2353 update all uses and lose "enum" when using type.
2355 2012-09-05 Alan Modra <amodra@gmail.com>
2357 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2358 * configure: Regenerate.
2359 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2360 (plugin_final_layout.stdout): Likewise.
2361 (memory_test): Set page sizes to 0x1000.
2362 * testsuite/Makefile.in: Regenerate.
2363 * testsuite/discard_locals_test.sh: Add FIXME comment.
2364 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2365 * testsuite/pr14265.t: Add .got output section statement.
2366 * testsuite/script_test_2.t: Likewise.
2367 * testsuite/script_test_3.t: Likewise.
2368 * testsuite/script_test_4.t: Likewise.
2369 * testsuite/script_test_5.t: Likewise.
2370 * testsuite/script_test_6.t: Likewise.
2371 * testsuite/script_test_7.t: Likewise.
2372 * testsuite/script_test_9.t: Likewise.
2374 2012-09-05 Alan Modra <amodra@gmail.com>
2376 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2377 (Powerpc_relocate_functions::Status): New typedef.
2378 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2379 (Target_powerpc::Scan::local): Handle REL64.
2380 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2381 for REL32 and REL64.
2382 (Target_powerpc::symval_for_branch): New function, extracted from..
2383 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2384 checks. Report overflow errors.
2386 2012-09-05 Alan Modra <amodra@gmail.com>
2388 * object.h (Sized_relobj_file::emit_relocs): Delete.
2389 (Sized_relobj_file::emit_relocs_reltype): Delete.
2390 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2391 relocate_relocs for --emit-relocs.
2392 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2393 * output.h: Update comment.
2394 (Output_segment::first_section): New function.
2395 (Output_segment::first_section_load_address): Use first_section.
2396 * output.cc (Output_segment::first_section): New function extracted..
2397 (Output_segment::first_section_load_address): ..from here. Delete.
2398 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2399 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2400 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2401 adjust call to target.h function.
2402 * i386.cc (Target_i386): Likewise.
2403 * sparc.cc (Target_sparc): Likewise.
2404 * x86_64.cc (Target_x86_64): Likewise.
2405 * powerpc.cc (Target_powerpc): Likewise.
2406 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2407 first tls section has section symbol for optimised local dynamic
2409 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2410 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2412 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2413 Rename to relocate_relocs. Update error message.
2415 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2417 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2420 2012-08-31 Alan Modra <amodra@gmail.com>
2422 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2423 (Powerpc_relobj::toc_base_offset): New stub function.
2424 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2425 got_mod_index_offset to tlsld_got_offset. Update all refs.
2426 (Target_powerpc::Relocate::enum skip_tls): New.
2427 (Target_powerpc::call_tls_get_addr_): New var.
2428 (Target_powerpc::is_branch_reloc): Move to file scope.
2429 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2430 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2432 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2433 (powerpc_info): Correct common_pagesize for ppc64.
2434 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2435 (Powerpc_relocate_functions): Add overflow check enums and functions.
2436 Add non-shift version of rela, rela_ua. Delete all rel public
2437 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2438 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2439 addr16_ha3, addr14 functions.
2440 (Output_data_got_powerpc::add_constant_pair): New function.
2441 (Output_data_got_powerpc::got_base_offset): Likewise.
2442 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2443 (instruction constants): Sort, add some more.
2444 (Output_data_glink::do_write): Add and use Address typedef. Use
2445 object->toc_base_offset() stub for 64-bit.
2446 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2447 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2448 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2449 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2450 Always treat .opd relocs as against locally defined symbol.
2451 Correct condition for RELATIVE relocs.
2452 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2453 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2454 for 32-bit syms with a plt entry. Correct ppc64 toc base
2455 calculations. Handle TLS relocs, and more. Add overflow
2456 checking and adjust for Powerpc_relocate_functions changes.
2457 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2458 Reinstate --emit-relocs code with FIXME.
2460 2012-08-30 Alan Modra <amodra@gmail.com>
2462 * layout.cc (Layout::set_segment_offsets): Set p_align to
2463 abi_pagesize, not common_pagesize.
2464 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2465 to determine whether file header can go in segment.
2467 2012-08-30 Alan Modra <amodra@gmail.com>
2469 * output.h (Output_reloc::Output_reloc <output section>): Add
2470 is_relative param. Adjust calls.
2471 (Output_reloc::add_output_section_relative): New functions.
2472 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2474 (Output_reloc::symbol_value): Handle SECTION_CODE.
2476 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2478 * gold.cc (queue_middle_tasks): Call layout again when unique
2479 segments for sections is desired.
2480 * layout.cc (Layout::Layout): Initialize new members.
2481 (Layout::get_output_section_flags): New function.
2482 (Layout::choose_output_section): Call get_output_section_flags.
2483 (Layout::layout): Make output section for mapping to a unique segment.
2484 (Layout::insert_section_segment_map): New function.
2485 (Layout::attach_allocated_section_to_segment): Make unique segment for
2486 output sections marked so.
2487 (Layout::segment_precedes): Check for unique segments when sorting.
2488 * layout.h (Layout::Unique_segment_info): New struct.
2489 (Layout::Section_segment_map): New typedef.
2490 (Layout::insert_section_segment_map): New function.
2491 (Layout::get_output_section_flags): New function.
2492 (Layout::is_unique_segment_for_sections_specified): New function.
2493 (Layout::set_unique_segment_for_sections_specified): New function.
2494 (Layout::unique_segment_for_sections_specified_): New member.
2495 (Layout::section_segment_map_): New member.
2496 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2497 Rename is_gc_pass_one to is_pass_one.
2498 Rename is_gc_pass_two to is_pass_two.
2499 Rename is_gc_or_icf to is_two_pass.
2500 Check for which pass based on whether symbols data is present.
2501 Make it two pass when unique segments for sections is desired.
2502 * output.cc (Output_section::Output_section): Initialize new
2504 * output.h (Output_section::is_unique_segment): New function.
2505 (Output_section::set_is_unique_segment): New function.
2506 (Output_section::is_unique_segment_): New member.
2507 (Output_section::extra_segment_flags): New function.
2508 (Output_section::set_extra_segment_flags): New function.
2509 (Output_section::extra_segment_flags_): New member.
2510 (Output_section::segment_alignment): New function.
2511 (Output_section::set_segment_alignment): New function.
2512 (Output_section::segment_alignment_): New member.
2513 (Output_segment::Output_segment): Initialize is_unique_segment_.
2514 (Output_segment::is_unique_segment): New function.
2515 (Output_segment::set_is_unique_segment): New function.
2516 (Output_segment::is_unique_segment_): New member.
2517 * plugin.cc (allow_unique_segment_for_sections): New function.
2518 (unique_segment_for_sections): New function.
2519 (Plugin::load): Add new functions to transfer vector.
2520 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2521 * Makefile.in: Regenerate.
2522 * testsuite/plugin_final_layout.sh: Check if unique segment
2523 functionality works.
2524 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2526 (allow_unique_segment_for_sections): New global.
2527 (unique_segment_for_sections): New global.
2528 (claim_file_hook): Call allow_unique_segment_for_sections.
2529 (all_symbols_read_hook): Call unique_segment_for_sections.
2531 2012-08-22 Cary Coutant <ccoutant@google.com>
2533 * layout.cc (Layout::include_section): Don't assert on GROUP
2534 sections with --emit-relocs.
2536 2012-08-21 Cary Coutant <ccoutant@google.com>
2538 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2539 if --export-dynamic-symbol names an undef symbol.
2541 2012-08-18 Alan Modra <amodra@gmail.com>
2543 * powerpc.cc: Formatting and white space.
2544 (Powerpc_relobj): Rename got2_section_ to special_.
2545 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2546 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2547 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2548 (Target_powerpc): Add Address typedef and invalid_address. Use
2550 (Target_powerpc::is_branch_reloc): New function.
2551 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2552 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2553 for dst_mask, value and addend.
2554 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2555 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2556 (Output_data_glink::do_write): Correct toc base. Don't try to use
2557 uint16_t for 24-bit offset. Use get_output_section_offset and
2559 (Target_powerpc::Scan::local): Handle more relocs.
2560 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2561 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2562 Plug in toc restoring insn after plt calls. Translate branches
2563 to function descriptor symbols to corresponding entry point.
2564 (Target_powerpc::relocate_for_relocatable): Check return from
2565 get_output_section_offset.
2566 * symtab.h: Comment typo.
2568 2012-08-14 Ian Lance Taylor <iant@google.com>
2570 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2571 unsupported_relocal_local to call unsupported_reloc_global.
2573 2012-08-14 Nick Clifton <nickc@redhat.com>
2576 * script-sections.cc (Sections_element::output_section_name): Add
2577 keep return parameter.
2578 (Output_section_element::match_name): Add keep return parameter.
2579 Return the value of the keep_ member.
2580 * script-sections.h (class Output_section): Update
2581 output_section_name prototype.
2582 * layout.cc (Layout::keep_input_section): New public member
2584 (Layout::choose_output_section): Pass keep parameter to
2585 output_section_name.
2586 * layout.h (class Layout): Add keep_input_section.
2587 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2589 * testsuite/Makefile.am: Add a test.
2590 * testsuite/Makefile.in: Regenerate.
2591 * testsuite/pr14265.c: Source file for the test.
2592 * testsuite/pr14265.t: Linker script for the test.
2593 * testsuite/pr14265.sh: Shell script for the test.
2595 2012-08-14 Alan Modra <amodra@gmail.com>
2597 * target.h (Target::output_section_name): New function.
2598 (Target::do_output_section_name): New function.
2599 * layout.cc (Layout::choose_output_section): Call the above.
2600 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2602 2012-08-14 Alan Modra <amodra@gmail.com>
2604 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2605 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2606 for replace_constant call.
2607 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2608 (Output_data_glink::do_print_to_mapfile): New function.
2609 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2610 (Target_powerpc::Relocate::relocate): Likewise.
2612 2012-08-14 Alan Modra <amodra@gmail.com>
2614 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2615 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2616 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2617 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2618 all references to shndx_. Handle special case for R_PPC_PLTREL24
2620 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2621 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2622 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2624 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2625 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2627 2012-08-12 Alan Modra <amodra@gmail.com>
2629 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2630 (glink insn constants): Use uint32_t.
2631 (Output_data_glink::add_entry): Use insert, not [] operator.
2633 2012-08-11 Alan Modra <amodra@gmail.com>
2635 * object.h (Sized_relobj_file::find_shdr): New function.
2636 (Sized_relobj_file::find_special_sections): New function.
2637 * object.cc (Sized_relobj_file::find_shdr): New function.
2638 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2639 (Sized_relobj_file::find_special_sections): New function, split out..
2640 (Sized_relobj_file::do_read_symbols): ..from here.
2641 * output.h (Output_data_got::replace_constant): New function.
2642 (Output_data_got::num_entries): New function.
2643 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2644 (Output_data_got::got_offset): Protected rather than private.
2645 (Output_data_got::replace_got_entry): New function.
2646 * output.cc (Output_data_got::replace_got_entry): New function.
2647 * powerpc.cc (class Powerpc_relobj): New.
2648 (class Powerpc_relocate_functions): Delete all psymval variants or
2649 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2650 Implement _ha functions using corresponding _hi function.
2651 (Powerpc_relobj::find_special_sections): New function.
2652 (Target_powerpc::do_make_elf_object): New function.
2653 (class Output_data_got_powerpc): New.
2654 (class Output_data_glink): New.
2655 (class Powerpc_scan_relocatable_reloc): New.
2656 Many more changes througout file.
2658 2012-08-09 Nick Clifton <nickc@redhat.com>
2660 * po/vi.po: Updated Vietnamese translation.
2662 2012-08-07 Ian Lance Taylor <iant@google.com>
2664 * layout.cc (Layout::add_target_dynamic_tags): If
2665 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2668 2012-07-30 Nick Clifton <nickc@redhat.com>
2670 * po/gold.pot: Updated template.
2671 * po/es.po: Updated Spanish translation.
2673 2012-07-18 Cary Coutant <ccoutant@google.com>
2676 * configure.ac: Add check for -gpubnames support.
2677 * configure: Regenerate.
2678 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2679 support; force -gno-pubnames.
2680 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2682 (gdb_index_test_4): New test.
2683 * testsuite/Makefile.in: Regenerate.
2684 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2685 * testsuite/gdb_index_test_2.sh: Likewise.
2686 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2687 * testsuite/gdb_index_test_4.sh: New script.
2688 * testsuite/gdb_index_test_comm.sh: New script with common code;
2689 don't look for space after colon.
2691 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2693 * gold.cc (queue_middle_tasks): Update function order only after
2694 deferred objects due to plugins are processed.
2696 2012-07-11 Ian Lance Taylor <iant@google.com>
2698 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2699 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2700 (Target_arm::scan_reloc_for_stub): Likewise.
2701 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2702 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2703 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2704 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2705 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2707 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2708 Ian Lance Taylor <iant@google.com>
2711 * configure.ac: Test whether std::tr1::hash<off_t> works.
2712 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2714 * output.h (class Output_fill): Add virtual destructor.
2715 * configure, config.in: Rebuild.
2717 2012-06-22 Roland McGrath <mcgrathr@google.com>
2719 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2721 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2723 * plugin.cc (Plugin::load): Handle position independent executables.
2725 2012-06-06 Cary Coutant <ccoutant@google.com>
2727 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2729 (lines_only_debug_sections): Likewise.
2730 (gdb_fast_lookup_sections): New static array.
2731 (is_gdb_debug_section): Rename formal parameter.
2732 (is_lines_only_debug_section): Likewise.
2733 (is_gdb_fast_lookup_section): New function.
2734 (Layout::include_section): Check for ".zdebug_" prefix; pass
2735 section name suffix to is_gdb_debug_section, et al.; check for
2736 fast-lookup sections when building .gdb_index.
2737 * options.h (--strip-debug-gdb): Update GDB version number.
2739 2012-06-06 Cary Coutant <ccoutant@google.com>
2741 * configure.ac: Add check for fallocate.
2742 * configure: Regenerate.
2743 * config.in: Regenerate.
2745 * options.h (class General_options): Add --mmap-output-file and
2746 --posix-fallocate options.
2747 * output.cc: (posix_fallocate): Remove; replace with...
2748 (gold_fallocate): New function.
2749 (Output_file::map_no_anonymous): Call gold_fallocate.
2750 (Output_file::map): Check --mmap-output-file option.
2752 2012-06-05 Jing Yu <jingyu@google.com>
2754 * gold.h (textdomain): Add do {} to empty while(0).
2755 (bindtextdomain): Likewise.
2757 2012-06-04 Cary Coutant <ccoutant@google.com>
2759 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2762 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2764 * symtab.cc (Symbol_table::define_special_symbol):
2765 Initialize *poldsym to prevent uninitialized variable errors.
2767 2012-05-23 Cary Coutant <ccoutant@google.com>
2769 * layout.cc (Layout::section_name_mapping): Add rules to handle
2770 exact match on .data.rel.ro.local or .data.rel.ro.
2771 (Layout::output_section_name): Check for exact matches.
2773 2012-05-23 Cary Coutant <ccoutant@google.com>
2775 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2778 2012-05-22 Cary Coutant <ccoutant@google.com>
2780 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2781 object before exporting symbol.
2783 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2785 * testsuite/tls_test.cc: Include "config.h" first.
2786 * testsuite/tls_test_c.c: Likewise.
2788 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2789 Nick Clifton <nickc@redhat.com>
2792 * configure.in: Add check that sysdep.h has been included before
2793 any system header files.
2794 * configure: Regenerate.
2795 * config.in: Regenerate.
2797 2012-05-14 Cary Coutant <ccoutant@google.com>
2799 * layout.cc (Layout::make_output_section): Mark .tdata section
2801 * testsuite/relro_test.cc: Add a TLS variable.
2803 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2806 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2807 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2810 2012-05-08 Cary Coutant <ccoutant@google.com>
2812 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2813 (lines_only_debug_sections): Likewise.
2815 2012-05-02 Roland McGrath <mcgrathr@google.com>
2817 * nacl.cc: New file.
2819 * Makefile.am (CCFILES, HFILES): Add them.
2820 * Makefile.in: Regenerate.
2821 * i386.cc (Output_data_plt_i386_nacl): New class.
2822 (Output_data_plt_i386_nacl_exec): New class.
2823 (Output_data_plt_i386_nacl_dyn): New class.
2824 (Target_i386_nacl): New class.
2825 (Target_selector_i386_nacl): New class.
2826 (target_selector_i386): Use it instead of Target_selector_i386.
2827 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2828 (Target_x86_64_nacl): New class.
2829 (Target_selector_x86_64_nacl): New class.
2830 (target_selector_x86_64, target_selector_x32): Use it instead of
2831 Target_selector_x86_64.
2832 * arm.cc (Output_data_plt_arm_nacl): New class.
2833 (Target_arm_nacl): New class.
2834 (Target_selector_arm_nacl): New class.
2835 (target_selector_arm, target_selector_armbe): Use it instead of
2836 Target_selector_arm.
2838 * target-select.cc (select_target): Take new Input_file* and off_t
2839 arguments, pass them on to recognize method of selector.
2840 * object.cc (make_elf_sized_object): Update caller.
2841 * parameters.cc (parameters_force_valid_target): Likewise.
2842 * incremental.cc (make_sized_incremental_binary): Likewise.
2843 * target-select.h: Update decl.
2844 (Target_selector::recognize): Take new Input_file* argument,
2845 pass it on to do_recognize.
2846 (Target_selector::do_recognize): Take new Input_file* argument.
2847 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2848 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2849 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2850 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2852 * target.h (Target::Target_info): New members isolate_execinstr
2854 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2855 * arm.cc (Target_arm::arm_info): Update initializer.
2856 * i386.cc (Target_i386::i386_info): Likewise.
2857 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2858 * sparc.cc (Target_sparc::sparc_info): Likewise.
2859 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2860 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2861 * layout.cc (Layout::attach_allocated_section_to_segment):
2862 Take new const Target* argument. If target->isolate_execinstr(), act
2864 (Layout::find_first_load_seg): Take new const Target* argument;
2865 if target->isolate_execinstr(), reject PF_X segments.
2866 (Layout::relaxation_loop_body): Update caller.
2867 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2868 reset file offset to zero when we hit LOAD_SEG, and then do a second
2869 loop over the segments before LOAD_SEG to reassign offsets after
2870 addresses have been determined. Handle target->rosegment_gap().
2871 (Layout::attach_section_to_segment): Take new const Target* argument;
2872 pass it to attach_allocated_section_to_segment.
2873 (Layout::make_output_section): Update caller.
2874 (Layout::attach_sections_to_segments): Take new const Target* argument;
2875 pass it to attach_section_to_segment.
2876 * gold.cc (queue_middle_tasks): Update caller.
2877 * layout.h (Layout): Update method decls with new arguments.
2879 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2880 Target_info pointer to use.
2881 (Target_arm::do_make_data_plt): New virtual method.
2882 (Target_arm::make_data_plt): New method that calls it.
2883 (Target_arm::make_plt_entry): Use it.
2884 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2885 for the section alignment.
2886 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2888 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2889 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2891 (Output_data_plt_arm::get_plt_entry_size): Call it.
2892 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2893 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2894 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2896 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2897 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2898 method instead of sizeof(plt_entry).
2899 (Output_data_plt_arm::add_entry): Likewise.
2900 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2901 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2903 (Target_arm::plt_entry_size): Likewise.
2904 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2906 (Output_data_plt_arm_standard): ... here, new class.
2907 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2908 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2909 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2911 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2912 Take additional argument for the PLT entry size.
2913 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2914 Use get_plt_entry_size method rather than plt_entry_size variable.
2915 (Output_data_plt_x86_64::reserve_slot): Likewise.
2916 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2917 (Output_data_plt_x86_64::add_entry): Likewise.
2918 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2919 (Output_data_plt_x86_64::address_for_global): Likewise.
2920 (Output_data_plt_x86_64::address_for_local): Likewise.
2921 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2922 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2923 Make method non-static.
2924 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2926 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2927 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2928 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2929 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2931 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2932 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2934 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2935 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2937 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2938 (Output_data_plt_x86_64::plt_entry_size)
2939 (Output_data_plt_x86_64::first_plt_entry)
2940 (Output_data_plt_x86_64::plt_entry)
2941 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2942 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2943 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2944 (Output_data_plt_x86_64_standard): ... here, new class.
2945 (Target_x86_64::Target_x86_64): Take optional argument for the
2946 Target_info pointer to use.
2947 (Target_x86_64::do_make_data_plt): New virtual method.
2948 (Target_x86_64::make_data_plt): New method to call it.
2949 (Target_x86_64::init_got_plt_for_update): Use that.
2950 Call this->plt_->add_eh_frame method here.
2951 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2952 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2953 rather than static method.
2954 (Target_x86_64::plt_entry_size): Likewise.
2955 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2956 rather than plt_entry_size variable. Move guts of PLT filling to...
2957 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2958 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2959 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2961 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2962 additional argument for the section alignment.
2963 Don't do add_eh_frame_for_plt here.
2964 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2965 non-static. Use get_plt_entry_size method rather than plt_entry_size
2967 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2969 (Output_data_plt_i386::get_plt_entry_size): Call it.
2970 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2971 (Output_data_plt_i386::add_eh_frame): New method to call it.
2972 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2974 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2975 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2977 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2978 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2979 method instead of plt_entry_size.
2980 (Output_data_plt_i386::plt_entry_size)
2981 (Output_data_plt_i386::plt_eh_frame_fde_size)
2982 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2983 (Output_data_plt_i386_standard): ... here, new class.
2984 (Output_data_plt_i386_exec): New class.
2985 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2986 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2987 (Output_data_plt_i386::exec_plt_entry): Move to ...
2988 (Output_data_plt_i386_exec::plt_entry): ... here.
2989 (Output_data_plt_i386_dyn): New class.
2990 (Output_data_plt_i386::first_plt_entry): Move to ...
2991 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2992 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2993 (Output_data_plt_i386_dyn::plt_entry): ... here.
2994 (Target_i386::Target_i386): Take optional argument for the Target_info
2996 (Target_i386::do_make_data_plt): New virtual method.
2997 (Target_i386::make_data_plt): New method to call it.
2998 (Target_i386::make_plt_section): Use that.
2999 Call this->plt_->add_eh_frame method here.
3000 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3001 rather than plt_entry_size variable.
3002 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3003 (Output_data_plt_i386::address_for_local): Likewise.
3004 (Output_data_plt_i386::do_write): Likewise.
3005 Move guts of PLT filling to...
3006 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3007 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3008 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3009 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3011 2012-05-01 Cary Coutant <ccoutant@google.com>
3013 * dwarf_reader.cc (Dwarf_die::read_attributes)
3014 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3015 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3016 * reduced_debug_output.cc
3017 (Output_reduced_debug_info_section::get_die_end): Remove
3018 DW_FORM_GNU_ref_index. Add default case.
3020 2012-04-26 Mark Wielaard <mjw@redhat.com>
3022 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3023 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3024 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3025 DW_AT_high_pc as offset from DW_AT_low_pc.
3027 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3028 * testsuite/Makefile.in: Regenerate.
3029 * testsuite/gdb_index_test_3.c: New test source file.
3030 * testsuite/gdb_index_test_3.sh: New test source file.
3032 2012-04-25 Ian Lance Taylor <iant@google.com>
3034 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3036 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3037 as a class, not a struct.
3038 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3039 (Target_arm::apply_cortex_a8_workaround): Likewise.
3040 * gc.h: Declare Reloc_types as a struct, not a class.
3041 * object.h: Declare Symbols_data as a struct.
3042 * reloc.h: Declare Read_relocs_data as a struct.
3043 * target.h: Declare Relocate_info as a struct.
3045 2012-04-24 David S. Miller <davem@davemloft.net>
3047 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3048 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3051 2012-04-24 Cary Coutant <ccoutant@google.com>
3053 * incremental-dump.cc (find_input_containing_global): Replace
3054 magic number with symbolic constant.
3055 (dump_incremental_inputs): Update version number.
3056 * incremental.cc (Output_section_incremental_inputs): Update version
3057 number; import symbolic constants from Incremental_inputs_reader.
3058 (Incremental_inputs::create_data_sections): Align relocations
3059 section correctly for 64-bit targets.
3060 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3061 constants; add padding.
3062 (Output_section_incremental_inputs::write_header): Add assert for
3064 (Output_section_incremental_inputs::write_input_files): Add assert
3065 for input_entry_size.
3066 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3067 add assert for object_info_size, input_section_entry_size,
3068 global_sym_entry_size.
3069 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3070 for data structure sizes; use them.
3071 (Incremental_input_entry_reader): Import symbolic constants from
3072 Incremental_inputs_reader; use them.
3074 2012-04-23 David S. Miller <davem@davemloft.net>
3076 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3078 (Target_sparc::Target_sparc): Initialize new fields.
3079 (Target_sparc::do_make_elf_object): New function.
3080 (Target_sparc::do_adjust_elf_header): New function.
3082 2012-04-23 Cary Coutant <ccoutant@google.com>
3084 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3085 CU range table of gdb index.
3087 2012-04-20 David S. Miller <davem@davemloft.net>
3089 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3092 2012-04-16 David S. Miller <davem@davemloft.net>
3094 * sparc.cc (Target_sparc::got_address): New function.
3095 (Sparc_relocate_functions::gdop_hix22): New function.
3096 (Sparc_relocate_functions::gdop_lox10): New function.
3097 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3099 (Target_sparc::Scan::local): Likewise if the global symbol is not
3100 preemptible and is not IFUNC.
3101 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3102 transformations for local and non-preemptible non-IFUNC global
3105 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3106 writing out 64-bit part of ranges.
3108 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3109 -fpic and -fpie respectively.
3110 * Makefile.in: Regenerate.
3112 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3113 (Target_sparc::Target_sparc): Initialize new field.
3114 (Target_sparc::do_plt_section_for_global): New function.
3115 (Target_sparc::do_plt_section_for_local): New function.
3116 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3117 (Target_sparc::make_plt_section): New function, broken out of
3118 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3119 (Target_sparc::make_plt_entry): Call make_plt_section.
3120 (Target_sparc::make_local_ifunc_plt_entry): New function.
3121 (Target_sparc::rela_ifunc_section): New function.
3122 (Target_sparc::plt_section): Remove const.
3123 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3124 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3125 and ifunc_count_ fields.
3126 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3127 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3128 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3129 (Output_data_plt_sparc::rela_ifunc): New function.
3130 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3131 (Output_data_plt_sparc::has_ifunc_section): New function.
3132 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3133 (Output_data_plt_sparc::address_for_global): New function.
3134 (Output_data_plt_sparc::address_for_local): New function.
3135 (Output_data_plt_sparc::plt_index_to_offset): New function.
3136 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3138 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3140 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3141 R_SPARC_JMP_IREL to switch.
3142 (Target_sparc::Scan::check_non_pic): Likewise.
3143 (Target_sparc::Scan::local): Handle IFUNC symbols.
3144 (Target_sparc::Scan::local): Likewise.
3145 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3146 and plt_address_for_local.
3147 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3148 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3150 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3151 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3152 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3153 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3155 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3156 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3158 * sparc.cc (Target_sparc::Scan::global): Likewise.
3159 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3161 2012-04-16 Cary Coutant <ccoutant@google.com>
3163 * archive.cc (Library_base::should_include_member): Check for
3164 --export-dynamic-symbol.
3165 * options.h (class General_options): Add --export-dynamic-symbol.
3166 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3167 --export-dynamic-symbol.
3168 (Symbol_table::gc_mark_undef_symbols): Likewise.
3169 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3171 2012-04-12 David S. Miller <davem@davemloft.net>
3173 * sparc.cc (Reloc::wdisp10): New relocation method.
3174 (Reloc::h34): Likewise.
3175 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3176 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3178 (Target_sparc::Scan::local): Likewise.
3179 (Target_sparc::Scan::global): Likewise.
3180 (Target_sparc::Relocate::relocate): Likewise.
3182 2012-04-09 Cary Coutant <ccoutant@google.com>
3184 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3187 2012-04-06 Ian Lance Taylor <iant@google.com>
3189 * timer.cc: #include <unistd.h>.
3191 2012-04-06 Roland McGrath <mcgrathr@google.com>
3193 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3194 * config.in: Regenerate.
3195 * configure: Regenerate.
3197 2012-04-05 Nick Clifton <nickc@redhat.com>
3199 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3200 (AM_LC_MESSAGES): Add.
3201 * aclocal.m4: Regenerate.
3202 * config.in: Regenerate.
3203 * configure: Regenerate.
3205 2012-03-21 Cary Coutant <ccoutant@google.com>
3207 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3208 * Makefile.in: Regenerate.
3209 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3210 (Sized_elf_reloc_mapper::symbol_section): New function.
3211 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3212 (make_elf_reloc_mapper): New function.
3213 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3214 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3215 (Dwarf_abbrev_table::do_get_abbrev): New function.
3216 (Dwarf_ranges_table::read_ranges_table): New function.
3217 (Dwarf_ranges_table::read_range_list): New function.
3218 (Dwarf_pubnames_table::read_section): New function.
3219 (Dwarf_pubnames_table::read_header): New function.
3220 (Dwarf_pubnames_table::next_name): New function.
3221 (Dwarf_die::Dwarf_die): New function.
3222 (Dwarf_die::read_attributes): New function.
3223 (Dwarf_die::skip_attributes): New function.
3224 (Dwarf_die::set_name): New function.
3225 (Dwarf_die::set_linkage_name): New function.
3226 (Dwarf_die::attribute): New function.
3227 (Dwarf_die::string_attribute): New function.
3228 (Dwarf_die::int_attribute): New function.
3229 (Dwarf_die::uint_attribute): New function.
3230 (Dwarf_die::ref_attribute): New function.
3231 (Dwarf_die::child_offset): New function.
3232 (Dwarf_die::sibling_offset): New function.
3233 (Dwarf_info_reader::check_buffer): New function.
3234 (Dwarf_info_reader::parse): New function.
3235 (Dwarf_info_reader::do_parse): New function.
3236 (Dwarf_info_reader::do_read_string_table): New function.
3237 (Dwarf_info_reader::lookup_reloc): New function.
3238 (Dwarf_info_reader::get_string): New function.
3239 (Dwarf_info_reader::visit_compilation_unit): New function.
3240 (Dwarf_info_reader::visit_type_unit): New function.
3241 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3242 Sized_elf_reloc_mapper.
3243 (Sized_dwarf_line_info::symbol_section): Remove function.
3244 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3245 (Sized_dwarf_line_info::read_line_mappings): Remove object
3246 parameter, adjust callers.
3247 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3248 * dwarf_reader.h: Include <sys/types.h>.
3249 (class Track_relocs): Remove forward declaration.
3250 (class Elf_reloc_mapper): New class.
3251 (class Sized_elf_reloc_mapper): New class.
3252 (class Dwarf_abbrev_table): New class.
3253 (class Dwarf_range_list): New class.
3254 (class Dwarf_ranges_table): New class.
3255 (class Dwarf_pubnames_table): New class.
3256 (class Dwarf_die): New class.
3257 (class Dwarf_info_reader): New class.
3258 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3259 (Sized_dwarf_line_info::symbol_section): Remove member function.
3260 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3262 * gdb-index.cc: New source file.
3263 * gdb-index.h: New source file.
3264 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3265 and .debug_types sections, call Layout::add_to_gdb_index.
3266 (Sized_relobj_incr::do_section_name): Implement.
3267 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3268 return type; Implement.
3269 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3271 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3272 parameter list and return type.
3273 (Sized_incr_dynobj::do_section_contents): Likewise.
3274 * layout.cc: Include gdb-index.h.
3275 (Layout::Layout): Initialize gdb_index_data_.
3276 (Layout::init_fixed_output_section): Check for .gdb_index section.
3277 (Layout::add_to_gdb_index): New function. Instantiate.
3278 * layout.h: Add forward declaration for class Gdb_index.
3279 (Layout::add_to_gdb_index): New member function.
3280 (Layout::gdb_index_data_): New data member.
3281 * main.cc: Include gdb-index.h.
3282 (main): Print statistics for gdb index.
3283 * object.cc (Object::section_contents): Move code into
3284 do_section_contents.
3285 (need_decompressed_section): Check for sections needed when building
3287 (build_compressed_section_map): Likewise.
3288 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3290 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3291 sections; call Layout::add_to_gdb_index.
3292 (Sized_relobj_file::do_decompressed_section_contents): Call
3293 do_section_contents directly.
3294 * object.h (Object::do_section_contents): Adjust parameter list and
3296 (Object::do_decompressed_section_contents): Call do_section_contents
3298 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3300 * options.h (class General_options): Add --gdb-index option.
3301 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3302 list and return type.
3303 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3304 * reloc.h (Track_relocs::checkpoint): New function.
3305 (Track_relocs::reset): New function.
3307 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3309 * testsuite/Makefile.in: Regenerate.
3310 * testsuite/gdb_index_test.cc: New test source file.
3311 * testsuite/gdb_index_test_1.sh: New test source file.
3312 * testsuite/gdb_index_test_2.sh: New test source file.
3314 2012-03-19 Doug Kwan <dougkwan@google.com>
3316 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3317 (Target_arm::do_finalize_sections): Remove code which defines
3318 __exidx_start and __exidx_end. Make symbol table parameter
3319 anonymous as it is not used.
3320 * gold.cc (queue_middle_tasks): Call target hook to define any
3321 target-specific symbols.
3322 * target.h (Target::define_standard_symbols): New method.
3323 (Target::do_define_standard_symbols): Same.
3324 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3325 * testsuite/Makefile.in: Regenerate.
3326 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3328 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3329 relocations are generated for __exidx_start and __exidx_end.
3331 2012-03-16 Doug Kwan <dougkwan@google.com>
3333 * testsuite/Makefile.am: Disable test initpri3b.
3334 * testsuite/Makefile.in: Regenerate.
3336 2012-03-15 Doug Kwan <dougkwan@google.com>
3338 * arm.cc (Target_arm::got_section): Make .got section read-only
3341 2012-03-15 Ian Lance Taylor <iant@google.com>
3344 * layout.cc (Layout::make_output_section): Correctly mark
3345 SHT_INIT_ARRAY, et. al., as relro.
3347 2012-03-14 Doug Kwan <dougkwan@google.com>
3349 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3350 dynamic relocations for protected symbols in shared objects.
3352 2012-03-13 Ian Lance Taylor <iant@google.com>
3354 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3355 keep the larger alignment.
3357 2012-03-12 Cary Coutant <ccoutant@google.com>
3359 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3360 handling of DW_LNE_define_file.
3362 2012-03-12 Cary Coutant <ccoutant@google.com>
3364 * reduced_debug_output.cc
3365 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3368 2012-02-29 Cary Coutant <ccoutant@google.com>
3370 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3372 2012-02-29 Cary Coutant <ccoutant@google.com>
3374 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3375 Call Object::decompressed_section_contents.
3376 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3378 (Sized_dwarf_line_info::buffer_start_): New data member.
3379 * merge.cc (Output_merge_data::do_add_input_section): Call
3380 Object::decompressed_section_contents.
3381 (Output_merge_string::do_add_input_section): Likewise.
3382 * object.cc (need_decompressed_section): New function.
3383 (build_compressed_section_map): Decompress sections needed later.
3384 (Sized_relobj_file::do_decompressed_section_contents): New function.
3385 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3386 * object.h (Object::decompressed_section_contents): New function.
3387 (Object::discard_decompressed_sections): New function.
3388 (Object::do_decompressed_section_contents): New function.
3389 (Object::do_discard_decompressed_sections): New function.
3390 (Compressed_section_info): New type.
3391 (Compressed_section_map): Include decompressed section contents.
3392 (Sized_relobj_file::do_decompressed_section_contents): New function.
3393 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3395 2012-02-16 Cary Coutant <ccoutant@google.com>
3397 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3398 * testsuite/Makefile.in: Regenerate.
3400 2012-02-14 Cary Coutant <ccoutant@google.com>
3402 * options.cc (General_options::finalize): Disallow -pie and -static.
3404 2012-02-03 Doug Kwan <dougkwan@google.com>
3406 * arm.cc (Arm_relocate_functions::abs8,
3407 Arm_relocate_functions::abs16): Use
3408 Bits::has_signed_unsigned_overflow32.
3409 (Arm_relocate_functions::thm_abs8): Correct range of
3411 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3414 2012-02-02 Doug Kwan <dougkwan@google.com>
3416 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3417 position independent outputs, not just shared objects.
3419 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3421 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3422 * configure: Regenerated.
3424 2012-01-27 Ian Lance Taylor <iant@google.com>
3426 * reloc.h (Bits): New class with static functions, copied from
3427 namespace utils in arm.cc.
3428 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3431 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3433 * incremental.cc (write_info_blocks): Correct relocation offset.
3435 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3437 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3438 (Relocate::tls_gd_to_le): Likewise.
3440 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3442 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3444 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3446 * configure.ac: Check if -mcmodel=medium works.
3447 * configure: Regenerated.
3449 2012-01-24 Cary Coutant <ccoutant@google.com>
3451 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3453 (read_unsigned_LEB_128_x): ... this new function.
3454 (read_signed_LEB_128): Replaced with inline definition and ...
3455 (read_signed_LEB_128_x): ... this new function.
3456 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3457 (read_unsigned_LEB_128): Add inline definition.
3458 (read_signed_LEB_128_x): New function.
3459 (read_signed_LEB_128): Add inline definition.
3460 * testsuite/Makefile.am (leb128_unittest): New unit test.
3461 * testsuite/Makefile.in: Regenerate.
3462 * testsuite/leb128_unittest.cc: New unit test.
3464 2012-01-23 Ian Lance Taylor <iant@google.com>
3467 * i386.cc (Target_i386::do_code_fill): When using a jmp
3468 instruction, pad with nop instructions.
3469 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3471 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3473 * x86_64.cc (gc_process_relocs): Add typename on types used in
3475 (scan_relocs): Likewise.
3476 (relocate_section): Likewise.
3477 (apply_relocation): Likewise.
3479 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3481 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3482 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3485 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3487 * x86_64.cc: Initial support for x32.
3489 2012-01-03 Cary Coutant <ccoutant@google.com>
3491 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3492 Use abstract base class for GOT.
3493 * gold/output.h (class Output_data_got_base): New abstract base class.
3494 (class Output_data_got): Derive from new base class, adjust ctors.
3495 (Output_data_got::reserve_slot): Make virtual; rename to
3496 do_reserve_slot; Adjust callers.
3497 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3498 pointer to abstract base class.
3499 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3501 2011-12-18 Ian Lance Taylor <iant@google.com>
3503 * object.h (Relobj::local_symbol_value): New function.
3504 (Relobj::local_plt_offset): New function.
3505 (Relobj::local_has_got_offset): New function.
3506 (Relobj::local_got_offset): New function.
3507 (Relobj::set_local_got_offset): New function.
3508 (Relobj::do_local_symbol_value): New pure virtual function.
3509 (Relobj::do_local_plt_offset): Likewise.
3510 (Relobj::do_local_has_got_offset): Likewise.
3511 (Relobj::do_local_got_offset): Likewise.
3512 (Relobj::do_set_local_got_offset): Likewise.
3513 (Sized_relobj::do_local_has_got_offset): Rename from
3514 local_has_got_offset.
3515 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3516 (Sized_relobj::do_set_local_got_offset): Rename from
3517 set_local_got_offset.
3518 (Sized_relobj_file::do_local_plt_offset): Rename from
3520 (Sized_relobj_file::do_local_symbol_value): New function.
3521 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3523 * output.cc (Output_data_got::Got_entry::write): Change object to
3524 Relobj. Use local_symbol_value.
3525 (Output_data_got::add_global_with_rel): Change rel_dyn to
3526 Output_data_reloc_generic*. Use add_global_generic.
3527 (Output_data_got::add_global_with_rela): Remove. Change all
3528 callers to use add_global_with_rel.
3529 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3530 Output_data_reloc_generic*. Use add_global_generic.
3531 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3532 callers to use add_global_pair_with_rel.
3533 (Output_data_got::add_local): Change object to Relobj*.
3534 (Output_data_got::add_local_plt): Likewise.
3535 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3536 change rel_dyn to Output_data_reloc_generic*. Use
3538 (Output_data_got::add_local_with_rela): Remove. Change all
3539 callers to use all_local_with_rel.
3540 (Output_data_got::add_local_pair_with_rel): Change object to
3541 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3542 add_output_section_generic.
3543 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3544 callers to use add_local_pair_with_rel.
3545 (Output_data_got::reserve_local): Change object to Relobj*.
3546 * output.h: (class Output_data_reloc_generic): Add pure virtual
3547 declarations for add_global_generic, add_local_generic,
3548 add_output_section_generic.
3549 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3550 functions for Output_data_reloc_generic. Update declarations for
3551 changes listed in output.cc.
3552 (class Output_data_got): Change template parameter to got_size.
3553 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3554 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3556 (Sized_relobj_incr::do_local_plt_offset): New function.
3557 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3560 2011-12-17 Cary Coutant <ccoutant@google.com>
3562 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3563 * resolve.cc (Symbol_table::resolve): Likewise.
3564 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3566 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3568 2011-12-16 Ian Lance Taylor <iant@google.com>
3570 * output.h (Output_data_reloc_generic::add): Only call
3571 add_dynamic_reloc if this is a dynamic reloc section.
3573 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3576 * target-reloc.h (apply_relocation): Replace <64, false> with
3579 2011-11-25 Nick Clifton <nickc@redhat.com>
3581 * po/it.po: New Italian translation.
3583 2011-11-17 Sterling Augustine <saugustine@google.com>
3585 * script.cc (script_include_directive): Implement.
3586 (read_script_file): New local variables name and search_path. Update
3587 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3588 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3589 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3591 2011-11-11 Sterling Augustine <saugustine@google.com>
3593 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3594 (file_or_sections_cmd): Likewise.
3596 2011-11-11 Doug Kwan <dougkwan@google.com>
3598 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3599 if --just-symbols is given.
3601 2011-11-10 Doug Kwan <dougkwan@google.com>
3604 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3605 when processing data relocs.
3606 * reloc.h (Relocate_functions::rel_unaligned): New method.
3607 (Relocate_functions::pcrel_unaligned): Ditto.
3608 (Relocate_functions::rel32_unaligned): Ditto.
3609 (Relocate_functions::pcrel32_unaligned): Ditto.
3611 2011-11-09 Doug Kwan <dougkwan@google.com>
3614 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3615 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3616 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3617 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3618 (Relocate_functions::rel_unaligned): New.
3619 (Relocate_functions::rel32_unaligned): New.
3620 * target-reloc.h (relocate_for_relocatable): Add code to handle
3621 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3622 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3623 arm_unaligned_reloc_r): New targets.
3624 * testsuite/Makefile.in: Regenerate.
3625 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3628 2011-11-02 Ian Lance Taylor <iant@google.com>
3630 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3632 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3633 * options.cc (General_options::finalize): Use library search path
3634 from configure script if specified. If not native and no sysroot,
3635 only search TOOLLIBDIR.
3636 * options.h (Search_directory::Search_directory): Change name to
3638 (General_options::add_to_library_path_with_sysroot): Change arg to
3640 * configure, Makefile.in, config.in: Rebuild.
3642 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3644 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3645 we are working around the ARM1176 Erratum.
3646 * options.h (General_options::fix_arm1176): Add option.
3647 * testsuite/Makefile.am: Add testcases, and keep current ones
3649 * testsuite/Makefile.in: Regenerate.
3650 * testsuite/arm_fix_1176.s: New file.
3651 * testsuite/arm_fix_1176.sh: Likewise.
3653 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3655 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3657 (Target_arm::may_use_blx): Remove method.
3658 (Target_arm::set_may_use_blx): Likewise.
3659 (Target_arm::may_use_v4t_interworking): New method.
3660 (Target_arm::may_use_v5t_interworking): Likewise.
3661 (Target_arm::may_use_blx_): Remove member variable.
3662 (Arm_relocate_functions::arm_branch_common): Check for v5T
3664 (Arm_relocate_functions::thumb_branch_common): Likewise.
3665 (Reloc_stub::stub_type_for_reloc): Likewise.
3666 (Target_arm::do_finalize_sections): Correct interworking checks.
3667 * testsuite/Makefile.am: Add new tests.
3668 * testsuite/Makefile.in: Regenerate.
3669 * testsuite/arm_farcall_arm_arm.s: New test.
3670 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3671 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3672 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3673 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3674 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3675 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3676 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3678 2011-10-31 Cary Coutant <ccoutant@google.com>
3681 * expression.cc (Expression::eval_with_dot): Add
3682 is_section_dot_assignment parameter.
3683 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3684 absolute and assigning to dot within a section.
3685 * script-sections.cc
3686 (Output_section_element_assignment::set_section_addresses): Pass
3687 dot_section to set_if_absolute.
3688 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3689 as is_section_dot_assignment flag to eval_with_dot.
3690 (Output_section_element_dot_assignment::set_section_addresses):
3692 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3693 parameter. Also set value if relative to dot_section; set the
3694 symbol's output_section.
3695 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3696 parameter. Adjust all callers.
3697 (Expression::eval_maybe_dot): Likewise.
3698 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3700 * testsuite/script_test_2.t: Test assignment of an absolute value
3701 to dot within an output section element.
3703 2011-10-31 Cary Coutant <ccoutant@google.com>
3705 * options.h (class General_options): Add --[no-]gnu-unique options.
3706 * symtab.cc (Symbol_table::sized_write_globals): Convert
3707 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3709 2011-10-31 Cary Coutant <ccoutant@google.com>
3712 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3713 unnecessary assertion.
3714 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3716 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3718 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3720 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3722 Change to just keep the section associated with symbol.
3723 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3724 they are externally visible and --export-dynamic is turned on.
3725 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3727 2011-10-19 Ian Lance Taylor <iant@google.com>
3730 * script-sections.cc
3731 (Output_section_element_dot_assignment::needs_output_section): New
3734 2011-10-19 Ian Lance Taylor <iant@google.com>
3737 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3738 --section-start option was seen.
3739 * options.h (General_options::any_section_start): New function.
3741 2011-10-18 David S. Miller <davem@davemloft.net>
3744 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3745 member to track relocation locations that have moved during TLS
3746 reloc optimizations.
3747 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3748 (Target_sparc::Relocate::relocate): Adjust view down by 4
3749 bytes if it matches reloc_adjust_addr_.
3750 (Target_sparc::Relocate::relocate_tls): Always move the
3751 __tls_get_addr call delay slot instruction forward 4 bytes when
3752 performing relaxation.
3754 2011-10-18 Cary Coutant <ccoutant@google.com>
3756 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3757 (Output_file::map_no_anonymous): Check for non-zero
3758 return code from posix_fallocate.
3760 2011-10-17 Cary Coutant <ccoutant@google.com>
3763 * plugin.cc (is_visible_from_outside): Check for symbols
3764 referenced from dynamic objects.
3765 * resolve.cc (Symbol_table::resolve): Don't count references
3766 from dynamic objects as references from real ELF files.
3767 * testsuite/plugin_test_2.sh: Adjust expected result.
3769 2011-10-17 Cary Coutant <ccoutant@google.com>
3771 * gold.cc: Include timer.h.
3772 (queue_middle_tasks): Stamp time.
3773 (queue_final_tasks): Likewise.
3774 * main.cc (main): Store timer in parameters. Print timers
3776 * parameters.cc (Parameters::Parameters): Initialize timer_.
3777 (Parameters::set_timer): New function.
3778 (set_parameters_timer): New function.
3779 * parameters.h (Parameters::set_timer): New function.
3780 (Parameters::timer): New function.
3781 (Parameters::timer_): New data member.
3782 (set_parameters_timer): New function.
3783 * timer.cc (Timer::stamp): New function.
3784 (Timer::get_pass_time): New function.
3785 * timer.h (Timer::stamp): New function.
3786 (Timer::get_pass_time): New function.
3787 (Timer::pass_times_): New data member.
3789 2011-10-17 Cary Coutant <ccoutant@google.com>
3791 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3792 task for members of lib groups.
3794 2011-10-17 Cary Coutant <ccoutant@google.com>
3797 * fileread.cc (File_read::find_view): Add assert.
3798 (File_read::make_view): Move bounds check (replace with assert)...
3799 (File_read::find_or_make_view): ... to here.
3801 2011-10-12 Cary Coutant <ccoutant@google.com>
3803 * output.cc (Output_file::open_base_file): Handle case where
3804 ::read returns less than requested size.
3806 2011-10-10 Cary Coutant <ccoutant@google.com>
3808 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3809 Initialize defined_count_.
3810 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3811 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3812 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3813 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3814 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3815 * incremental.h (Sized_relobj_incr::defined_count_): New data
3817 (Sized_incr_dynobj::defined_count_): New data member.
3818 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3819 Return zeroes instead of internal error.
3821 2011-10-10 Cary Coutant <ccoutant@google.com>
3824 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3825 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3826 * output.h (class Output_reloc): Add use_plt_offset flag.
3827 (Output_reloc::type_): Adjust size of bit field.
3828 (Output_reloc::use_plt_offset_): New bit field.
3829 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3830 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3831 flag. Adjust all callers.
3832 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3833 creating RELATIVE relocations.
3835 2011-10-10 Nick Clifton <nickc@redhat.com>
3837 * po/es.po: Updated Spanish translation.
3838 * po/fi.po: Updated Finnish translation.
3840 2011-10-03 Diego Novillo <dnovillo@google.com>
3842 * options.cc (parse_uint): Fix dereference of RETVAL.
3844 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3846 * layout.h (section_order_map_): New member.
3847 (get_section_order_map): New member function.
3848 * output.cc (Output_section::add_input_section): Check for patterns
3849 only when --section-ordering-file is specified.
3850 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3851 output_sections have been formed.
3852 * layout.cc (Layout_Layout): Initialize section_order_map_.
3853 * plugin.cc (update_section_order): Store order in order_map. Do not
3855 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3856 * testsuite/Makefile.in: Regenerate.
3857 * testsuite/plugin_section_order.c: New file.
3858 * testsuite/plugin_final_layout.cc: New file.
3859 * testsuite/plugin_final_layout.sh: New file.
3861 2011-09-29 Cary Coutant <ccoutant@google.com>
3863 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3865 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3866 symbols during incremental update.
3867 (Symbol_table::add_from_dynobj): Likewise.
3869 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3870 Ian Lance Taylor <iant@google.com>
3872 * symtab.cc (Symbol_table::define_special_symbol): Always
3873 canonicalize version string.
3875 2011-09-26 Cary Coutant <ccoutant@google.com>
3877 * gold.cc (queue_initial_tasks): Move option checks ...
3878 * options.cc (General_options::finalize): ... to here. Disable
3879 some options; make others fatal.
3881 2011-09-26 Cary Coutant <ccoutant@google.com>
3884 * plugin.cc (get_symbols_v2): New function.
3885 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3886 (is_referenced_from_outside): New function.
3887 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3888 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3889 (get_symbols): Pass version parameter.
3890 (get_symbols_v2): New function.
3891 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3893 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3894 (onload): Add LDPT_GET_SYMBOLS_V2.
3895 (all_symbols_read_hook): Use get_symbols_v2; check for
3896 LDPR_PREVAILING_DEF_IRONLY_EXP.
3897 * testsuite/plugin_test_3.sh: Update expected results.
3899 2011-09-23 Simon Baldwin <simonb@google.com>
3901 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3902 configuration options.
3903 * configure: Regenerate.
3904 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3905 * Makefile.in: Regenerate.
3906 * testsuite/Makefile.in: Regenerate.
3908 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3910 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3912 2011-09-19 Cary Coutant <ccoutant@google.com>
3914 * incremental.cc (can_incremental_update): Fix typo in comment.
3915 * incremental.h (can_incremental_update): Likewise.
3917 2011-09-18 Cary Coutant <ccoutant@google.com>
3919 * incremental.cc (can_incremental_update): New function.
3920 * incremental.h (can_incremental_update): New function.
3921 * layout.cc (Layout::init_fixed_output_section): Call it.
3922 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3923 * object.cc (Sized_relobj_file::do_layout): Call
3924 can_incremental_update.
3926 2011-09-13 Cary Coutant <ccoutant@google.com>
3928 * configure.ac: Check for glibc support for gnu_indirect_function
3929 support with static linking, setting automake conditional
3931 * Makefile.in: Regenerate.
3932 * configure: Regenerate.
3934 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3935 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3937 * testsuite/Makefile.in: Regenerate.
3939 2011-09-13 Cary Coutant <ccoutant@google.com>
3941 * incremental.cc (Sized_relobj_incr::do_layout): Call
3942 report_comdat_group for kept comdat sections.
3943 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3944 * testsuite/Makefile.in: Regenerate.
3945 * testsuite/incr_comdat_test_1.cc: New source file.
3946 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3947 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3948 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3950 2011-09-13 Ian Lance Taylor <iant@google.com>
3952 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3953 variable external_symbols_offset.
3955 2011-09-12 Ian Lance Taylor <iant@google.com>
3957 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3958 triggered if object has no symbols.
3960 2011-09-09 David S. Miller <davem@davemloft.net>
3962 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3963 (Output_fill_debug_line::do_write): Likewise.
3965 2011-08-29 Cary Coutant <ccoutant@google.com>
3967 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3968 casts to match formatting specs.
3969 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3971 2011-08-26 Cary Coutant <ccoutant@google.com>
3973 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3974 remaining hole size when allocating.
3975 (Layout::make_output_section): Set fill methods for debug sections.
3976 * layout.h (Free_list::Free_list_node): Move from private to
3978 (Free_list::set_min_hole_size): New function.
3979 (Free_list::begin, Free_list::end): New functions.
3980 (Free_list::min_hole_): New data member.
3981 * output.cc: Include dwarf.h.
3982 (Output_fill_debug_info::do_minimum_hole_size): New function.
3983 (Output_fill_debug_info::do_write): New function.
3984 (Output_fill_debug_line::do_minimum_hole_size): New function.
3985 (Output_fill_debug_line::do_write): New function.
3986 (Output_section::Output_section): Initialize new data member.
3987 (Output_section::set_final_data_size): Ensure patch space is larger
3988 than minimum hole size.
3989 (Output_section::do_write): Fill holes in debug sections.
3990 * output.h (Output_fill): New class.
3991 (Output_fill_debug_info): New class.
3992 (Output_fill_debug_line): New class.
3993 (Output_section::set_free_space_fill): New function.
3994 (Output_section::free_space_fill_): New data member.
3995 * testsuite/Makefile.am (incremental_test_3): Add
3996 --incremental-patch option.
3997 (incremental_test_4): Likewise.
3998 (incremental_test_5): Likewise.
3999 (incremental_test_6): Likewise.
4000 (incremental_copy_test): Likewise.
4001 (incremental_common_test_1): Likewise.
4002 * testsuite/Makefile.in: Regenerate.
4004 2011-08-26 Nick Clifton <nickc@redhat.com>
4006 * po/es.po: Updated Spanish translation.
4008 2011-08-01 Cary Coutant <ccoutant@google.com>
4010 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4011 * gold/testsuite/Makefile.in: Regenerate.
4012 * gold/testsuite/justsyms_exec.c: New source file.
4013 * gold/testsuite/justsyms_lib.c: New source file.
4015 2011-08-01 Cary Coutant <ccoutant@google.com>
4017 * layout.cc (Layout::set_segment_offsets): Don't realign text
4018 segment if -Ttext was specified.
4019 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4021 * object.h (Sized_relobj_file::e_type): New function.
4022 (Sized_relobj_file::e_type_): New data member.
4023 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4024 base address for ET_EXEC files.
4025 * target.cc (Target::do_make_elf_object_implementation): Allow
4026 ET_EXEC files with --just-symbols option.
4028 2011-07-28 Cary Coutant <ccoutant@google.com>
4030 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4031 Add thread_number parameter.
4032 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4033 * workqueue-threads.cc
4034 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4035 current thread if its thread number is greater than desired thread
4037 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4038 Add thread_number parameter.
4039 (Workqueue::should_cancel_thread): Likewise.
4040 (Workqueue::find_runnable_or_wait): Pass thread_number to
4041 should_cancel_thread.
4042 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4045 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4047 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4048 only after checking if it cannot be forced local.
4049 * symtab.h (is_externally_visible): Check if the symbol is not forced
4052 2011-07-15 Ian Lance Taylor <iant@google.com>
4054 * options.h (class General_options): Add --print-output-format.
4055 Move -EL next to -EB, for better --help output.
4056 * target-select.cc: Include <cstdio>, "options.h", and
4058 (Target_selector::do_target_bfd_name): New function.
4059 (print_output_format): New function.
4060 * target-select.h (class Target_selector): Update declarations.
4061 (Target_selector::target_bfd_name): New function.
4062 (print_output_format): Declare.
4063 * main.cc: Include "target-select.h".
4064 (main): Handle --print-output-format.
4065 * gold.cc: Include "target-select.h".
4066 (queue_initial_tasks): Handle --print-output-format when there are
4068 * parameters.cc (parameters_force_valid_target): Give a better
4069 error message if -EB/-EL does not match target.
4070 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4073 2011-07-15 Ian Lance Taylor <iant@google.com>
4075 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4076 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4077 (Output_data_plt_i386::do_write): Write address of .dynamic
4078 section to first entry in .got.plt section.
4079 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4080 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4082 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4083 section to first entry in .got.plt section.
4084 * layout.h (Layout::dynamic_section): New function.
4086 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4088 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4090 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4091 input_section_position_, and input_section_glob_.
4092 (read_layout_from_file): Call function section_ordering_specified.
4093 * layout.h (is_section_ordering_specified): New function.
4094 (section_ordering_specified): New function.
4095 (section_ordering_specified_): New boolean member.
4096 * main.cc(main): Call load_plugins after layout object is defined.
4097 * output.cc (Output_section::add_input_section): Use
4098 function section_ordering_specified to check if section ordering is
4100 * output.cc (Output_section::add_relaxed_input_section): Use
4101 function section_ordering_specified to check if section ordering is
4103 (Output_section::update_section_layout): New function.
4104 (Output_section::sort_attached_input_sections): Check if input section
4106 * output.h (Output_section::update_section_layout): New function.
4107 * plugin.cc (get_section_count): New function.
4108 (get_section_type): New function.
4109 (get_section_name): New function.
4110 (get_section_contents): New function.
4111 (update_section_order): New function.
4112 (allow_section_ordering): New function.
4113 (Plugin::load): Add the new interfaces to the transfer vector.
4114 (Plugin_manager::load_plugins): New parameter.
4115 (Plugin_manager::all_symbols_read): New parameter.
4116 (Plugin_manager::claim_file): New parameter. Save the elf object for
4118 (Plugin_manager::get_elf_object): New function.
4119 (Plugin_manager::get_view): Change to directly use the bool to check
4120 if get_view is called from claim_file_hook.
4121 * plugin.h (input_objects): New function
4122 (Plugin__manager::load_plugins): New parameter.
4123 (Plugin_manager::claim_file): New parameter.
4124 (Plugin_manager::get_elf_object): New function.
4125 (Plugin_manager::in_claim_file_handler): New function.
4126 (Plugin_manager::in_claim_file_handler_): New member.
4127 (layout): New function.
4128 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4129 handler with an extra parameter. Make the elf object before calling
4131 * testsuite/plugin_test.c (get_section_count): New function pointer.
4132 (get_section_type): New function pointer.
4133 (get_section_name): New function pointer.
4134 (get_section_contents): New function pointer.
4135 (update_section_order): New function pointer.
4136 (allow_section_ordering): New function pointer.
4137 (onload): Check if the new interfaces exist.
4139 2011-07-13 Ian Lance Taylor <iant@google.com>
4141 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4143 * x86_64.cc (Target_x86_64::got_section): Likewise.
4144 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4145 (relro_now_test_SOURCES): New variable.
4146 (relro_now_test_DEPENDENCIES): New variable.
4147 (relro_now_test_LDFLAGS): New variable.
4148 (relro_now_test_LDADD): New variable.
4149 (relro_now_test.so): New target.
4150 * testsuite/Makefile.in: Rebuild.
4152 2011-07-12 Ian Lance Taylor <iant@google.com>
4155 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4156 GLOB_DAT relocation rather than a RELATIVE relocation for a
4157 protected symbol when creating a shared library.
4158 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4159 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4160 * testsuite/protected_main_1.cc (main): Test that protected
4161 function has same address.
4163 2011-07-11 Ian Lance Taylor <iant@google.com>
4166 * options.h (class General_options): Add -Bgroup.
4167 * options.cc (General_options::finalize): If -Bgroup is set,
4168 default to --unresolved-symbols=report-all.
4169 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4170 * target-reloc.h (issue_undefined_symbol_error): Handle
4171 --unresolved-symbols=report-all.
4173 2011-07-08 Ian Lance Taylor <iant@google.com>
4176 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4177 if linker script discards key sections.
4178 (Layout::create_dynamic_symtab): Likewise.
4179 (Layout::assign_local_dynsym_offsets): Likewise.
4180 (Layout::sized_create_version_sections): Likewise.
4181 (Layout::create_interp): Likewise.
4182 (Layout::finish_dynamic_section): Likewise.
4183 (Layout::set_dynamic_symbol_size): Likewise.
4185 2011-07-08 Ian Lance Taylor <iant@google.com>
4188 * options.h (class General_options): Add --unresolved-symbols.
4189 * target-reloc.h (issue_undefined_symbol_error): Check
4190 --unresolved-symbols. Add comments.
4192 2011-07-08 Ian Lance Taylor <iant@google.com>
4194 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4195 expression more complex.
4197 2011-07-08 Ian Lance Taylor <iant@google.com>
4200 * target-reloc.h (issue_undefined_symbol_error): New inline
4201 function, broken out of relocate_section.
4202 (relocate_section): Call issue_undefined_symbol_error.
4203 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4204 there is no TLS segment if we are about to issue an undefined
4206 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4208 2011-07-08 Ian Lance Taylor <iant@google.com>
4211 * resolve.cc (Symbol_table::should_override): Add fromtype
4212 parameter. Change all callers. Give error when linking together
4213 TLS and non-TLS symbol.
4214 (Symbol_table::should_override_with_special): Add fromtype
4215 parameter. Change all callers.
4216 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4217 there is no TLS segment if we have reported some errors.
4218 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4220 2011-07-08 Ian Lance Taylor <iant@google.com>
4223 * target.h (Target::plt_address_for_global): New function.
4224 (Target::plt_address_for_local): New function.
4225 (Target::plt_section_for_global): Remove.
4226 (Target::plt_section_for_local): Remove.
4227 (Target::do_plt_address_for_global): New virtual function.
4228 (Target::do_plt_address_for_local): New virtual function.
4229 (Target::do_plt_section_for_global): Remove.
4230 (Target::do_plt_section_for_local): Remove.
4231 (Target::register_global_plt_entry): Add Symbol_table and Layout
4233 * output.cc (Output_data_got::Got_entry::write): Use
4234 plt_address_for_global and plt_address_for_local.
4235 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4236 address of output section.
4237 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4238 got_irelative_, and irelative_count_ fields. Update
4240 (Output_data_plt_i386::has_irelative_section): New function.
4241 (Output_data_plt_i386::entry_count): Add irelative_count_.
4242 (Output_data_plt_i386::set_final_data_size): Likewise.
4243 (class Target_i386): Add got_irelative_ and rel_irelative_
4244 fields. Update declarations.
4245 (Target_i386::Target_i386): Initialize new fields.
4246 (Target_i386::do_plt_address_for_global): New function replacing
4247 do_plt_section_for_global.
4248 (Target_i386::do_plt_address_for_local): New function replacing
4249 do_plt_section_for_local.
4250 (Target_i386::got_section): Create got_irelative_.
4251 (Target_i386::rel_irelative_section): New function.
4252 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4253 fields. Don't define __rel_iplt_{start,end}.
4254 (Output_data_plt_i386::add_entry): Add symtab and layout
4255 parameters. Change all callers. Use different PLT and GOT for
4257 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4258 layout parameters. Change all callers. Use different PLT and
4260 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4261 (Output_data_plt_i386::rel_irelative): New function.
4262 (Output_data_plt_i386::address_for_global): New function.
4263 (Output_data_plt_i386::address_for_local): New function.
4264 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4265 IRELATIVE GOT when changing IFUNC GOT entries.
4266 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4268 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4269 if we didn't create an IRELATIVE GOT.
4270 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4271 plt_address_for_local.
4272 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4273 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4274 got_irelative_, and irelative_count_ fields. Update
4276 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4277 Initialize new fields. Remove symtab parameter. Change all
4279 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4281 (Output_data_plt_x86_64::has_irelative_section): New function.
4282 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4283 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4284 fields. Update declarations.
4285 (Target_x86_64::Target_x86_64): Initialize new fields.
4286 (Target_x86_64::do_plt_address_for_global): New function replacing
4287 do_plt_section_for_global.
4288 (Target_x86_64::do_plt_address_for_local): New function replacing
4289 do_plt_section_for_local.
4290 (Target_x86_64::got_section): Create got_irelative_.
4291 (Target_x86_64::rela_irelative_section): New function.
4292 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4293 all callers. Don't create __rel_iplt_{start,end}.
4294 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4295 parameters. Change all callers. Use different PLT and GOT for
4297 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4298 layout parameters. Change all callers. Use different PLT and
4300 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4301 parameters. Change all callers. Use different PLT and GOT for
4303 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4304 (Output_data_plt_x86_64::rela_irelative): New function.
4305 (Output_data_plt_x86_64::address_for_global): New function.
4306 (Output_data_plt_x86_64::address_for_local): New function.
4307 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4308 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4309 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4310 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4312 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4314 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4315 symbols if we didn't create an IRELATIVE GOT.
4316 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4317 plt_address_for_local.
4318 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4319 * testsuite/ifuncvar1.c: New test file.
4320 * testsuite/ifuncvar2.c: New test file.
4321 * testsuite/ifuncvar3.c: New test file.
4322 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4323 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4324 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4325 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4326 * testsuite/Makefile.in: Rebuild.
4328 2011-07-07 Cary Coutant <ccoutant@google.com>
4330 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4331 (two_file_test_1_ndebug.o): Likewise.
4332 (two_file_test_1b_ndebug.o): Likewise.
4333 (two_file_test_2_ndebug.o): Likewise.
4334 (two_file_test_main_ndebug.o): Likewise.
4335 (incremental_test_2): Link with no-debug versions.
4337 2011-07-06 Cary Coutant <ccoutant@google.com>
4339 * gold/incremental.cc
4340 (Output_section_incremental_inputs::write_info_blocks): Check for
4341 hidden and internal symbols.
4343 2011-07-06 Cary Coutant <ccoutant@google.com>
4345 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4346 Check disposition for startup file.
4347 (Incremental_inputs::report_command_line): Ignore
4348 --incremental-startup-unchanged option.
4349 * options.cc (General_options::parse_incremental_startup_unchanged):
4351 (General_options::General_options): Initialize new data member.
4352 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4353 (General_options): Add --incremental-startup-unchanged option.
4354 (General_options::incremental_startup_disposition): New function.
4355 (General_options::incremental_startup_disposition_): New data member.
4357 2011-07-06 Cary Coutant <ccoutant@google.com>
4359 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4360 input file index to Script_info ctor.
4361 (Sized_incremental_binary::do_file_has_changed): Find the
4362 command-line argument for files named in scripts.
4363 * incremental.h (Script_info::Script_info): New ctor
4364 with input file index.
4365 (Script_info::input_file_index): New function.
4366 (Script_info::input_file_index_): New data member.
4367 (Incremental_binary::get_library): Add const.
4368 (Incremental_binary::get_script_info): Add const.
4369 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4370 * testsuite/Makefile.am (incremental_test_5): New test case.
4371 (incremental_test_6): New test case.
4372 * testsuite/Makefile.in: Regenerate.
4374 2011-07-06 Cary Coutant <ccoutant@google.com>
4376 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4377 debug output when command lines differ.
4379 2011-07-06 Cary Coutant <ccoutant@google.com>
4381 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4382 --incremental-patch option.
4383 * layout.cc (Free_list::allocate): Extend allocation beyond original
4385 (Layout::make_output_section): Mark sections that should get
4387 * options.cc (parse_percent): New function.
4388 * options.h (parse_percent): New function.
4389 (DEFINE_percent): New macro.
4390 (General_options): Add --incremental-patch option.
4391 * output.cc (Output_section::Output_section): Initialize new data
4393 (Output_section::add_input_section): Print section name when out
4395 (Output_section::add_output_section_data): Likewise.
4396 (Output_section::set_final_data_size): Add patch space when
4397 doing --incremental-full.
4398 (Output_section::do_reset_address_and_file_offset): Remove patch
4400 (Output_segment::set_section_list_addresses): Print debug output
4401 only if --incremental-update.
4402 * output.h (Output_section::set_is_patch_space_allowed): New function.
4403 (Output_section::is_patch_space_allowed_): New data member.
4404 (Output_section::patch_space_): New data member.
4405 * parameters.cc (Parameters::incremental_full): New function.
4406 * parameters.h (Parameters::incremental_full): New function
4407 * testsuite/Makefile.am (incremental_test_2): Add test for
4408 --incremental-patch option.
4409 * testsuite/Makefile.in: Regenerate.
4410 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4411 (t18): Remove function body.
4413 2011-07-05 Doug Kwan <dougkwan@google.com>
4416 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4417 Arm_Address type for relocation result.
4418 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4420 (Arm_relocate_functions::abs32): Use unaligned access.
4421 (Arm_relocate_functions::rel32): Ditto.
4422 (Arm_relocate_functions::prel31): Ditto.
4423 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4424 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4425 static data relocations.
4426 * testsuite/Makefile.in: Regnerate.
4427 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4429 2011-07-05 Ian Lance Taylor <iant@google.com>
4432 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4433 symbols if necessary.
4434 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4436 2011-07-05 Ian Lance Taylor <iant@google.com>
4439 * resolve.cc (Symbol::override_base_with_special): Simply override
4440 version with special symbol version, ignoring previous version.
4442 2011-07-05 Ian Lance Taylor <iant@google.com>
4444 * object.cc (Sized_relobj_file::include_section_group): Add
4445 information to comment about signature location.
4447 2011-07-02 Ian Lance Taylor <iant@google.com>
4450 * options.h (class General_options): Add -f and -F.
4451 * options.cc (General_options::finalize): Fatal error if -f/-F
4452 are used without -shared.
4453 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4455 2011-07-02 Ian Lance Taylor <iant@google.com>
4457 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4459 2011-07-01 Ian Lance Taylor <iant@google.com>
4463 * resolve.cc (Symbol::override_base_with_special): Don't override
4464 the version if the overriding symbol has a different name.
4465 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4466 all callers. If we give an error about an undefined version,
4467 define the base version if necessary.
4468 * dynobj.h (class Versions): Update declaration.
4469 * testsuite/weak_alias_test_5.cc: New file.
4470 * testsuite/weak_alias_test.script: New file.
4471 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4472 and versioned_alias have the right value, and call t2.
4473 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4474 weak_alias_test_5.so.
4475 (weak_alias_test_LDADD): Likewise.
4476 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4477 * testsuite/Makefile.in: Rebuild.
4479 2011-07-01 Ian Lance Taylor <iant@google.com>
4482 * options.h (class General_options): Support -z notext.
4483 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4485 (two_file_shared_nonpic.so): Likewise.
4486 (two_file_shared_mixed.so): Likewise.
4487 (two_file_shared_mixed_1.so): Likewise.
4488 (weak_undef_lib_nonpic.so): Likewise.
4489 (alt/weak_undef_lib_nonpic.so): Likewise.
4490 (tls_test_shared_nonpic.so): Likewise.
4491 * testsuite/Makefile.in: Rebuild.
4493 2011-07-01 Ian Lance Taylor <iant@google.com>
4496 * configure.ac: Test whether static linking works, setting
4497 the automake conditional HAVE_STATIC.
4498 * testsuite/Makefile.am: Disable tests using -static if
4499 HAVE_STATIC is not true.
4500 * configure, testsuite/Makefile.in: Rebuild.
4502 2011-07-01 Ian Lance Taylor <iant@google.com>
4505 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4506 Assert if we see DW_EH_PE_indirect.
4507 * target.h (Target::ehframe_datarel_base): New function.
4508 (Target::do_ehframe_datarel_base): New target function.
4509 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4510 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4513 2011-07-01 Ian Lance Taylor <iant@google.com>
4516 * options.h (class General_options): Add
4517 --ld-generated-unwind-info.
4518 * ehframe.cc (Fde::write): Add address parameter. Change all
4519 callers. If associated with PLT, fill in address and size.
4520 (Cie::set_output_offset): Only add merge mapping if there is an
4522 (Cie::write): Add address parameter. Change all callers.
4523 (Eh_frame::add_ehframe_for_plt): New function.
4524 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4525 input_offset_ fields into union u_, with new plt field.
4526 (Fde::Fde): Adjust for new union field.
4527 (Fde::Fde) [Output_data version]: New constructor.
4528 (Fde::add_mapping): Only add merge mapping if there is an object.
4529 (class Cie): Update declarations.
4530 (class Eh_frame): Declare add_ehframe_for_plt.
4531 * layout.cc (Layout::layout_eh_frame): Break out code into
4532 make_eh_frame_section, and call it.
4533 (Layout::make_eh_frame_section): New function.
4534 (Layout::add_eh_frame_for_plt): New function.
4535 * layout.h (class Layout): Update declarations.
4536 * merge.cc (Merge_map::add_mapping): Add assertion.
4537 * i386.cc: Include "dwarf.h".
4538 (class Output_data_plt_i386): Make first_plt_entry,
4539 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4540 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4541 and plt_eh_frame_fde.
4542 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4543 boundary. Call add_eh_frame_for_plt if appropriate.
4544 * x86_64.cc: Include "dwarf.h".
4545 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4546 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4547 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4548 and plt_eh_frame_fde.
4549 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4552 2011-06-29 Ian Lance Taylor <iant@google.com>
4555 * object.cc (Sized_relobj_file::layout_section): Change shdr
4556 parameter to be const.
4557 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4559 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4560 appropriate. Call layout_eh_frame_section.
4561 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4563 * object.h (class Sized_relobj_file): Update declarations.
4565 2011-06-29 Ian Lance Taylor <iant@google.com>
4568 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4570 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4572 2011-06-29 Ian Lance Taylor <iant@google.com>
4575 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4577 * layout.cc (Layout::layout_eh_frame): Likewise.
4579 2011-06-29 Ian Lance Taylor <iant@google.com>
4582 * layout.cc (Layout::symtab_section_shndx): New function.
4583 * layout.h (class Layout): Declare symtab_section_shndx.
4584 * output.cc (Output_section::write_header): Call it.
4586 2011-06-29 Ian Lance Taylor <iant@google.com>
4589 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4590 symbols which are not used in a relocation.
4592 2011-06-28 Ian Lance Taylor <iant@google.com>
4595 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4596 script create indistinguishable segments.
4597 (Layout::set_segment_offsets): Use stable_sort when sorting
4598 segments. Pass this to Compare_segments constructor.
4599 * layout.h (class Layout): Make segment_precedes non-static.
4600 (class Compare_segments): Change from struct to class. Add
4601 layout_ field. Add constructor.
4602 * script-sections.cc
4603 (Script_sections::attach_sections_using_phdrs_clause): Rename
4604 local orphan to is_orphan. Don't report failure to put empty
4605 section in segment. On attachment failure, report name of
4606 section, and attach to first PT_LOAD segment.
4608 2011-06-28 Ian Lance Taylor <iant@google.com>
4611 * target-select.cc (Target_selector::Target_selector): Add
4612 emulation parameter. Change all callers.
4613 (select_target_by_bfd_name): Rename from select_target_by_name.
4615 (select_target_by_emulation): New function.
4616 (supported_emulation_names): New function.
4617 * target-select.h (class Target_selector): Add emulation_ field.
4618 Update declarations.
4619 (Target_selector::recognize_by_bfd_name): Rename from
4620 recognize_by_name. Change all callers.
4621 (Target_selector::supported_bfd_names): Rename from
4622 supported_names. Change all callers.
4623 (Target_selector::recognize_by_emulation): New function.
4624 (Target_selector::supported_emulations): New function.
4625 (Target_selector::emulation): New function.
4626 (Target_selector::do_recognize_by_bfd_name): Rename from
4627 do_recognize_by_name. Change all callers.
4628 (Target_selector::do_supported_bfd_names): Rename from
4629 do_supported_names. Change all callers.
4630 (Target_selector::do_recognize_by_emulation): New function.
4631 (Target_selector::do_supported_emulations): New function.
4632 (select_target_by_bfd_name): Change name in declaration.
4633 (select_target_by_emulation): Declare.
4634 (supported_emulation_names): Declare.
4635 * parameters.cc (parameters_force_valid_target): Try to find
4636 target based on emulation from -m option.
4637 * options.h (class General_options): Change doc string for -m.
4638 * options.cc (help): Print emulations.
4639 (General_options::parse_V): Likewise.
4640 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4641 Add emulation parameter. Change all callers.
4643 2011-06-28 Ian Lance Taylor <iant@google.com>
4645 * target.h (class Target): Add osabi_ field.
4646 (Target::osabi): New function.
4647 (Target::set_osabi): New function.
4648 (Target::Target): Initialize osabi_.
4649 (Target::do_adjust_elf_header): Make pure virtual.
4650 (Sized_target::do_adjust_elf_header): Declare.
4651 * target.cc (Sized_target::do_adjust_elf_header): New function.
4652 (class Sized_target): Instantiate all versions.
4653 * freebsd.h (class Target_freebsd): Remove.
4654 (Target_selector_freebsd::do_recognize): Call set_osabi on
4656 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4657 (Target_selector_freebsd::set_osabi): Remove.
4658 * i386.cc (class Target_i386): Inherit from Sized_target rather
4659 than Target_freebsd.
4660 * x86_64.cc (class Target_x86_64): Likewise.
4662 2011-06-28 Ian Lance Taylor <iant@google.com>
4664 * target.h (Target::can_check_for_function_pointers): Rewrite.
4666 (Target::can_icf_inline_merge_sections): Likewise.
4667 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4668 (Target::Target_info): Add can_icf_inline_merge_sections field.
4669 (Target::do_can_check_for_function_pointers): New virtual
4671 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4672 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4673 from can_check_for_function_pointers, move in file.
4674 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4675 section_may_have_icf_unsafe_poineters, move in file.
4676 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4677 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4678 Rename from can_check_for_function_pointers, move in file.
4679 (Target_i386::can_icf_inline_merge_sections): Remove.
4680 (Target_i386::i386_info): Initialize
4681 can_icf_inline_merge_sections.
4682 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4683 Initialize can_icf_inline_merge_sections.
4684 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4685 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4686 Rename from can_check_for_function_pointers, move in file.
4687 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4688 (Target_x86_64::x86_64_info): Initialize
4689 can_icf_inline_merge_sections.
4690 * testsuite/testfile.cc (Target_test::test_target_info):
4692 * icf.cc (get_section_contents): Correct formatting.
4694 2011-06-27 Ian Lance Taylor <iant@google.com>
4696 * symtab.cc (Symbol::versioned_name): New function.
4697 (Symbol_table::add_to_final_symtab): Use versioned_name when
4699 (Symbol_table::sized_write_symbol): Likewise.
4700 * symtab.h (class Symbol): Declare versioned_name.
4701 * stringpool.h (class Stringpool_template): Add variant of add
4702 which takes a std::basic_string.
4703 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4704 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4705 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4706 (ver_test_12.o): New target.
4707 * testsuite/Makefile.in: Rebuild.
4709 2011-06-27 Doug Kwan <dougkwan@google.com>
4711 * arm.cc (Arm_relocate_functions::thm_jump8,
4712 Arm_relocate_functions::thm_jump11): Use a wider signed
4713 type to compute offset.
4714 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4716 * testsuite/Makefile.in: Regenerate.
4717 * testsuite/arm_branch_in_range.sh: Check test results of
4718 arm_thm_jump11 and arm_thm_jump8.
4719 * testsuite/arm_thm_jump11.s: New test source file.
4720 * testsuite/arm_thm_jump11.t: New linker script.
4721 * testsuite/arm_thm_jump8.s: New test source file.
4722 * testsuite/arm_thm_jump8.t: New linker script.
4724 2011-06-24 Ian Lance Taylor <iant@google.com>
4726 * layout.cc: Include "object.h".
4727 (ctors_sections_in_init_array): New static variable.
4728 (Layout::is_ctors_in_init_array): New function.
4729 (Layout::layout): Add entry to ctors_sections_in_init_array if
4731 * layout.h (class Layout): Declare is_ctors_in_init_array.
4732 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4733 is_ctors_reverse_view is set.
4734 (Sized_relobj_file::write_sections): Add layout parameter. Change
4735 all callers. Set is_ctors_reverse_view field of View_size.
4736 (Sized_relobj_file::reverse_words): New function.
4737 * object.h (Sized_relobj_file::View_size): Add
4738 is_ctors_reverse_view field.
4739 (class Sized_relobj_file): Update declarations.
4740 * testsuite/initpri3.c: New test.
4741 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4743 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4744 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4745 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4746 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4747 * testsuite/Makefile.in: Rebuild.
4749 2011-06-24 Cary Coutant <ccoutant@google.com>
4751 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4752 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4753 (debug_msg_cdebug.err): New targets.
4754 * testsuite/Makefile.in: Regenerate.
4755 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4756 Fix checks for link with shared library.
4758 2011-06-24 Doug Kwan <dougkwan@google.com>
4760 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4761 skip empty text sections.
4762 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4764 2011-06-22 Ian Lance Taylor <iant@google.com>
4767 * options.h (class General_options): Add --ctors-in-init-array.
4768 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4769 friends as SHT_PROGBITS for merging sections.
4770 (Layout::layout): Remove special handling of .init_array and
4771 friends. Don't sort if doing relocatable link. Sort for .ctors
4772 and .dtors if ctors_in_init_array.
4773 (Layout::make_output_section): Force correct section types for
4774 .init_array and friends. Don't sort if doing relocatable link,
4775 Don't sort .ctors and .dtors if ctors_in_init_array.
4776 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4777 (Layout::output_section_name): Add relobj parameter. Change all
4778 callers. Handle .ctors. and .dtors. in code rather than table.
4779 Handle .ctors and .dtors if ctors_in_init_array.
4780 (Layout::match_file_name): New function, moved from output.cc.
4781 * layout.h (class Layout): Update declarations.
4782 * output.cc: Include "layout.h".
4783 (Input_section_sort_entry::get_priority): New function.
4784 (Input_section_sort_entry::match_file_name): Just call
4785 Layout::match_file_name.
4786 (Output_section::Input_section_sort_init_fini_compare::operator()):
4787 Handle .ctors and .dtors. Sort by explicit priority rather than
4789 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4790 * testsuite/initpri2.c: New test.
4791 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4792 (check_PROGRAMS): Add initpri2.
4793 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4794 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4795 * configure, testsuite/Makefile.in: Rebuild.
4797 2011-06-19 Ian Lance Taylor <iant@google.com>
4800 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4801 .interp section to a PT_INTERP segment even if we have seen a
4802 --dynamic-linker option. Don't do it if we have seen a PHDRS
4803 clause in a linker script.
4804 (Layout::finalize): Don't create a .interp section if we've
4805 already create a PT_INTERP segment.
4806 (Layout::create_interp): Always call choose_output_section (revert
4807 patch of 2011-06-17). Don't create PT_INTERP segment.
4808 * script-sections.cc
4809 (Script_sections::create_note_and_tls_segments): Add a .interp
4810 section to a PT_INTERP segment even if we have seen a
4811 --dynamic-linker option.
4813 2011-06-18 Ian Lance Taylor <iant@google.com>
4815 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4816 merely because a non-PT_LOAD segment has a dynamic reloc.
4818 2011-06-18 Ian Lance Taylor <iant@google.com>
4820 * layout.cc (Layout::finish_dynamic_section): Don't create
4821 DT_FLAGS entry if not needed.
4823 2011-06-18 Ian Lance Taylor <iant@google.com>
4826 * layout.cc (Layout::layout_eh_frame): Correct handling of
4827 writable .eh_frame section.
4829 2011-06-17 Ian Lance Taylor <iant@google.com>
4832 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4833 symbol is redefined with the exact same object and value.
4835 2011-06-17 Ian Lance Taylor <iant@google.com>
4838 * layout.h (class Layout): Add interp_segment_ field.
4839 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4840 (Layout::attach_allocated_section_to_segment): If making shared
4841 library, put .interp section in PT_INTERP segment.
4842 (Layout::finalize): Also call create_interp if -dynamic-linker
4844 (Layout::create_interp): Assert that there is no PT_INTERP
4845 segment. If not using a SECTIONS clause, use make_output_section.
4846 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4847 * script-sections.cc
4848 (Script_sections::create_note_and_tls_segments): If making shared
4849 library, put .interp section in PT_INTERP segment.
4851 2011-06-17 Ian Lance Taylor <iant@google.com>
4853 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4854 when making a shared library.
4856 2011-06-17 Ian Lance Taylor <iant@google.com>
4858 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4859 parameter. Change all callers. Don't issue warning about PC32
4860 against locally defined symbol.
4862 2011-06-16 Ian Lance Taylor <iant@google.com>
4864 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4865 occurs in same object.
4867 2011-06-14 Alan Modra <amodra@gmail.com>
4869 * po/POTFILES.in: Regenerate.
4871 2011-06-09 Ian Lance Taylor <iant@google.com>
4873 * script-sections.cc
4874 (Orphan_output_section::set_section_addresses): For a relocatable
4875 link set address to 0.
4877 2011-06-09 Cary Coutant <ccoutant@google.com>
4880 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4881 used with --compress-debug-sections.
4882 * gold/object.cc (Sized_relobj_file::do_layout): Report
4883 uncompressed size of compressed input sections.
4885 2011-06-08 Cary Coutant <ccoutant@google.com>
4888 * testsuite/two_file_test_2_v1.cc: Change initialization of
4889 v2 to keep it in .data.
4891 2011-06-07 Cary Coutant <ccoutant@google.com>
4893 * common.cc (Symbol_table::do_allocate_commons_list): Call
4895 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4896 (Errors::fallback): New function.
4897 (gold_fallback): New function.
4898 * errors.h (Errors::fallback): New function.
4899 * gold.cc (gold_exit): Change status parameter to enum; adjust
4901 (queue_initial_tasks): Call gold_fallback.
4902 * gold.h: Include cstdlib.
4903 (Exit_status): New enum type.
4904 (gold_exit): Change status parameter to enum.
4905 (gold_fallback): New function.
4906 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4907 (Layout::create_symtab_sections): Likewise.
4908 (Layout::create_shdrs): Likewise.
4909 * main.cc (main): Adjust call to gold_exit.
4910 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4911 (Output_data_got::add_got_entry_pair): Likewise.
4912 (Output_section::add_input_section): Likewise.
4913 (Output_section::add_output_section_data): Likewise.
4914 (Output_segment::set_section_list_addresses): Likewise.
4915 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4917 2011-06-07 Cary Coutant <ccoutant@google.com>
4919 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4920 for incremental links.
4921 * output.cc (Output_segment::set_section_list_addresses): Remove
4922 FIXME and test for TLS or BSS.
4924 2011-06-07 Cary Coutant <ccoutant@google.com>
4926 * testsuite/Makefile.am: Add incremental_copy_test,
4927 incremental_common_test_1.
4928 * testsuite/Makefile.in: Regenerate.
4929 * testsuite/common_test_1_v1.c: New source file.
4930 * testsuite/common_test_1_v2.c: New source file.
4931 * testsuite/copy_test_v1.cc: New source file.
4933 2011-06-07 Cary Coutant <ccoutant@google.com>
4935 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4936 update, allocate common from bss section's free list.
4937 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4938 linker-defined symbols.
4939 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4940 Skip GOT and PLT entries that are no longer referenced.
4941 (Output_section_incremental_inputs::write_info_blocks): Mark
4942 linker-defined symbols.
4943 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4944 * output.cc (Output_section::allocate): New function.
4945 * output.h (Output_section::allocate): New function.
4946 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4947 linker-defined symbols.
4948 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4949 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4950 (Symbol::init_base_output_data): Likewise.
4951 (Symbol::init_base_output_segment): Likewise.
4952 (Symbol::init_base_constant): Likewise.
4953 (Sized_symbol::init_output_data): Likewise.
4954 (Sized_symbol::init_output_segment): Likewise.
4955 (Sized_symbol::init_constant): Likewise.
4956 (Symbol_table::do_define_in_output_data): Likewise.
4957 (Symbol_table::do_define_in_output_segment): Likewise.
4958 (Symbol_table::do_define_as_constant): Likewise.
4959 * symtab.h (Symbol::is_predefined): New function.
4960 (Symbol::init_base_output_data): Add is_predefined parameter.
4961 (Symbol::init_base_output_segment): Likewise.
4962 (Symbol::init_base_constant): Likewise.
4963 (Symbol::is_predefined_): New data member.
4964 (Sized_symbol::init_output_data): Add is_predefined parameter.
4965 (Sized_symbol::init_output_segment): Likewise.
4966 (Sized_symbol::init_constant): Likewise.
4967 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4969 2011-06-07 Cary Coutant <ccoutant@google.com>
4971 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4972 instead of emit_copy_reloc.
4973 (Copy_relocs::emit_copy_reloc): Refactor.
4974 (Copy_relocs::make_copy_reloc): New function.
4975 (Copy_relocs::add_copy_reloc): Remove.
4976 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4978 (Copy_relocs::make_copy_reloc): New function.
4979 (Copy_relocs::add_copy_reloc): Remove.
4980 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4981 unchanged input files.
4982 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4983 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4984 Reserve BSS space for COPY relocations.
4985 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4986 (Output_section_incremental_inputs::write_info_blocks): Record
4987 whether a symbol is copied from a shared object.
4988 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4989 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4990 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4991 (Incremental_input_entry_reader::get_output_symbol_index): Add
4993 (Incremental_binary::emit_copy_relocs): New function.
4994 (Incremental_binary::do_emit_copy_relocs): New function.
4995 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4997 (Sized_incremental_binary::add_copy_reloc): New function.
4998 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4999 (Sized_incremental_binary::Copy_reloc): New struct.
5000 (Sized_incremental_binary::Copy_relocs): New typedef.
5001 (Sized_incremental_binary::copy_relocs_): New data member.
5002 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5003 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5004 * target.h (Sized_target::emit_copy_reloc): New function.
5005 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5007 2011-06-02 Cary Coutant <ccoutant@google.com>
5010 * gold/archive.cc (Archive::Archive): Initialize new data member.
5011 (Archive::include_all_members): Return if archive has already been
5013 * gold/archive.h (Archive::include_all_members_): New data member.
5015 2011-06-02 Nick Clifton <nickc@redhat.com>
5017 * dynobj.h: Fix spelling mistake in comment.
5018 * output.cc: Likewise.
5020 2011-05-31 Doug Kwan <dougkwan@google.com>
5024 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5025 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5026 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5027 redundant arm_exidx_test.so.
5028 * testsuite/Makefile.in: Regenerate.
5029 (check_SCRIPTS): Add pr12826.sh
5030 (check_DATA): Add pr12826.stdout
5031 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5032 * testsuite/pr12826.sh: New file.
5033 * testsuite/pr12826_1.s: Ditto.
5034 * testsuite/pr12826_1.s: Ditto.
5036 2011-05-30 Ian Lance Taylor <iant@google.com>
5038 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5041 2011-05-29 Ian Lance Taylor <iant@google.com>
5044 * testsuite/Makefile.am: Use different file name for two_file_test
5045 temporary file for each incremental test.
5046 * testsuite/Makefile.in: Rebuild.
5048 2011-05-29 Ian Lance Taylor <iant@google.com>
5050 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5051 binary input file is empty.
5053 2011-05-27 Ian Lance Taylor <iant@google.com>
5055 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5056 (ver_test_9.so): Likewise.
5057 * testsuite/Makefile.in: Rebuild.
5059 2011-05-26 Cary Coutant <ccoutant@google.com>
5061 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5062 * incremental.cc (Incremental_inputs::report_input_section): Fix
5063 comment, indentation.
5064 (Incremental_inputs::report_comdat_group): New function.
5065 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5066 of data for incremental input file entry.
5067 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5068 group count, COMDAT group signatures.
5069 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5070 an unchanged input file.
5071 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5072 Initialize new data member.
5073 (Incremental_object_entry::add_comdat_group): New function.
5074 (Incremental_object_entry::get_comdat_group_count): New function.
5075 (Incremental_object_entry::get_comdat_signature_key): New function.
5076 (Incremental_object_entry::groups_): New data member.
5077 (Incremental_inputs::report_comdat_group): New function.
5078 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5079 data for incremental input file entry.
5080 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5081 (Incremental_input_entry_reader::get_input_section): Adjust size of
5082 data for incremental input file entry.
5083 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5084 (Incremental_input_entry_reader::get_comdat_group_signature): New
5086 * object.cc (Sized_relobj::include_section_group): Report kept
5087 COMDAT groups for incremental links.
5089 2011-05-24 David Meyer <pdox@google.com>
5091 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5092 with name parameter. Add found_name parameter.
5093 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5094 * dirsearch.h (class Dirsearch): Update declaration.
5096 2011-05-24 Ian Lance Taylor <iant@google.com>
5098 * archive.cc (Library_base::should_include_member): Pull in object
5099 from archive if it defines the entry symbol.
5100 * parameters.cc (Parameters::entry): New function.
5101 * parameters.h (class Parameters): Declare entry.
5102 * output.h (class Output_file_header): Remove entry_ field.
5103 * output.cc (Output_file_header::Output_file_header): Remove entry
5104 parameter. Change all callers.
5105 (Output_file_header::entry): Use parameters->entry.
5106 * gold.cc (queue_middle_tasks): Likewise.
5107 * plugin.cc (Plugin_hook::run): Likewise.
5109 2011-05-24 Cary Coutant <ccoutant@google.com>
5111 * gold.cc (queue_initial_tasks): Pass incremental base filename
5112 to Output_file::open_base_file; don't print error message.
5113 * incremental-dump.cc (main): Adjust call to
5114 Output_file::open_for_modification.
5115 * incremental-dump.cc (main): Likewise.
5116 * incremental.cc (Incremental_inputs::report_command_line):
5117 Ignore --incremental-base option when comparing command lines.
5118 Ignore parameter when given as separate argument.
5119 * options.h (class General_options): Add --incremental-base.
5120 * output.cc (Output_file::Output_file):
5121 (Output_file::open_base_file): Add base_name and writable parameters;
5122 read base file into new file; print error message here.
5123 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5125 * output.h (Output_file::open_for_modification): Rename to...
5126 (Output_file::open_base_file): ...this; add base_name and
5127 writable parameters; adjust all callers.
5128 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5130 * testsuite/Makefile.am (incremental_test_4): Test
5132 * testsuite/Makefile.in: Regenerate.
5134 2011-05-24 Cary Coutant <ccoutant@google.com>
5136 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5138 * testsuite/Makefile.in: Regenerate.
5139 * testsuite/two_file_test_1_v1.cc: New test source file.
5140 * testsuite/two_file_test_1b_v1.cc: New test source file.
5141 * testsuite/two_file_test_2_v1.cc: New test source file.
5143 2011-05-24 Cary Coutant <ccoutant@google.com>
5145 * dynobj.h (Dynobj::do_dynobj): New function.
5146 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5147 flag and soname for shared objects.
5148 * incremental.cc (Incremental_inputs::report_object): Make
5149 either Incremental_object_entry or Incremental_dynobj_entry; add
5150 soname to string table.
5151 (Incremental_inputs::report_input_section): Add assertion.
5152 (Output_section_incremental_inputs::set_final_data_size): Adjust
5153 type of input file entry for shared libraries; adjust size of
5154 shared library info entry.
5155 (Output_section_incremental_inputs::write_input_files): Write
5156 as_needed flag for shared libraries.
5157 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5158 of input file entry for shared libraries; write soname.
5159 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5160 soname from incremental info.
5161 * incremental.h (enum Incremental_input_flags): Add
5162 INCREMENTAL_INPUT_AS_NEEDED.
5163 (Incremental_input_entry::Incremental_input_entry): Initialize new
5165 (Incremental_input_entry::set_as_needed): New function.
5166 (Incremental_input_entry::as_needed): New function.
5167 (Incremental_input_entry::do_dynobj_entry): New function.
5168 (Incremental_input_entry::as_needed_): New data member.
5169 (Incremental_object_entry::Incremental_object_entry): Don't check
5171 (Incremental_object_entry::do_type): Likewise.
5172 (class Incremental_dynobj_entry): New class.
5173 (Incremental_input_entry_reader::as_needed): New function.
5174 (Incremental_input_entry_reader::get_soname): New function.
5175 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5176 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5177 size of shared library info entry.
5178 * layout.cc (Layout::finish_dynamic_section): Don't test for
5179 incremental link when adding DT_NEEDED entries.
5180 * object.h (Object::Object): Initialize new data member.
5181 (Object::dynobj): New function.
5182 (Object::set_as_needed): New function.
5183 (Object::as_needed): New function.
5184 (Object::do_dynobj): New function.
5185 (Object::as_needed_): New data member.
5187 2011-05-24 Cary Coutant <ccoutant@google.com>
5189 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5190 info; adjust display of GOT entries.
5191 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5192 vector of input objects; remove file_status_.
5193 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5194 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5195 got_plt reader; call target hooks to reserve GOT entries.
5196 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5197 of input file info header and GOT info entry.
5198 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5200 (Got_plt_view_info::got_descriptor): Remove.
5201 (Got_plt_view_info::sym_index): New data member.
5202 (Got_plt_view_info::input_index): New data member.
5203 (Local_got_offset_visitor::visit): Write input file index.
5204 (Global_got_offset_visitor::visit): Write 0 for input file index.
5205 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5206 with sym_index and input_index.
5207 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5208 incremental info GOT entry; replace got_descriptor with input_index.
5209 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5210 map from input file index to object.
5211 (Sized_relobj_incr::do_layout): Replace direct data member reference
5212 with accessor function.
5213 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5214 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5215 Adjust size of input file info header.
5216 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5217 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5218 (Incremental_input_entry_reader::get_input_section): Adjust size of
5219 input file info header.
5220 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5221 of incremental info GOT entry.
5222 (Incremental_got_plt_reader::get_got_desc): Remove.
5223 (Incremental_got_plt_reader::get_got_symndx): New function.
5224 (Incremental_got_plt_reader::get_got_input_index): New function.
5225 (Sized_incremental_binary::Sized_incremental_binary): Remove
5226 file_status_; add input_objects_.
5227 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5228 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5229 (Sized_incremental_binary::file_is_unchanged): Remove.
5230 (Sized_incremental_binary::set_input_object): New function.
5231 (Sized_incremental_binary::input_object): New function.
5232 (Sized_incremental_binary::file_status_): Remove.
5233 (Sized_incremental_binary::input_objects_): New data member.
5234 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5236 (Sized_relobj_incr::invalid_address): Move to base class.
5237 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5239 (Sized_relobj_incr::do_output_section_offset): Likewise.
5240 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5241 (Sized_relobj_incr::section_offsets_): Likewise.
5242 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5244 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5245 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5246 with accessor function.
5247 (Sized_relobj_file::do_layout): Likewise.
5248 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5249 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5250 (Sized_relobj_file::compute_final_local_value): Replace refs to
5251 section_offsets_ with accessor function.
5252 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5253 * object.h (Relobj::Relobj): Initialize new data members.
5254 (Relobj::add_dyn_reloc): New function.
5255 (Relobj::first_dyn_reloc): New function.
5256 (Relobj::dyn_reloc_count): New function.
5257 (Relobj::first_dyn_reloc_): New data member.
5258 (Relobj::dyn_reloc_count_): New data member.
5259 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5261 (Sized_relobj::Address): New typedef.
5262 (Sized_relobj::invalid_address): Move here from child class.
5263 (Sized_relobj::Sized_relobj): Initialize new data members.
5264 (Sized_relobj::sized_relobj): New function.
5265 (Sized_relobj::is_output_section_offset_invalid): Move here from
5267 (Sized_relobj::get_output_section_offset): Likewise.
5268 (Sized_relobj::local_has_got_offset): Likewise.
5269 (Sized_relobj::local_got_offset): Likewise.
5270 (Sized_relobj::set_local_got_offset): Likewise.
5271 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5272 (Sized_relobj::clear_got_offsets): New function.
5273 (Sized_relobj::section_offsets): Move here from child class.
5274 (Sized_relobj::do_output_section_offset): Likewise.
5275 (Sized_relobj::do_set_section_offset): Likewise.
5276 (Sized_relobj::Local_got_offsets): Likewise.
5277 (Sized_relobj::local_got_offsets_): Likewise.
5278 (Sized_relobj::section_offsets_): Likewise.
5279 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5281 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5283 (Sized_relobj_file::sized_relobj): New function
5284 (Sized_relobj_file::local_has_got_offset): Move to base class.
5285 (Sized_relobj_file::local_got_offset): Likewise.
5286 (Sized_relobj_file::set_local_got_offset): Likewise.
5287 (Sized_relobj_file::get_output_section_offset): Likewise.
5288 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5289 (Sized_relobj_file::do_output_section_offset): Likewise.
5290 (Sized_relobj_file::do_set_section_offset): Likewise.
5291 (Sized_relobj_file::Local_got_offsets): Likewise.
5292 (Sized_relobj_file::local_got_offsets_): Likewise.
5293 (Sized_relobj_file::section_offsets_): Likewise.
5294 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5296 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5297 (Output_reloc::get_symbol_index): Likewise.
5298 (Output_reloc::local_section_offset): Likewise.
5299 (Output_reloc::get_address): Likewise.
5300 (Output_reloc::symbol_value): Likewise.
5301 (Output_data_got::reserve_slot): Move to class definition.
5302 (Output_data_got::reserve_local): New function.
5303 (Output_data_got::reserve_slot_for_global): Remove.
5304 (Output_data_got::reserve_global): New function.
5305 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5306 (all constructors, two instantiations).
5307 (Output_reloc::get_relobj): New function (two instantiations).
5308 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5309 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5310 (Output_data_reloc::add_global): Adjust type of relobj.
5311 (Output_data_reloc::add_global_relative): Likewise.
5312 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5313 (Output_data_reloc::add_local): Likewise.
5314 (Output_data_reloc::add_local_relative): Likewise.
5315 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5316 (Output_data_reloc::add_local_section): Likewise.
5317 (Output_data_reloc::add_output_section): Likewise.
5318 (Output_data_reloc::add_absolute): Likewise.
5319 (Output_data_reloc::add_target_specific): Likewise.
5320 (Output_data_got::reserve_slot): Move definition here.
5321 (Output_data_got::reserve_local): New function.
5322 (Output_data_got::reserve_global): New function.
5323 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5324 section_offsets_ with accessor function.
5325 (Sized_relobj_file::write_sections): Likewise.
5326 (Sized_relobj_file::do_relocate_sections): Likewise.
5327 * target.h (Sized_target::reserve_local_got_entry): New function.
5328 (Sized_target::reserve_global_got_entry): New function.
5329 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5330 (Target_x86_64::reserve_global_got_entry): New function.
5331 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5333 2011-05-23 Cary Coutant <ccoutant@google.com>
5335 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5336 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5337 bit when checking got_type.
5338 * incremental.cc (Sized_incremental_binary::setup_readers):
5339 Store symbol table and string table locations; initialize bit vector
5340 of file status flags.
5341 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5343 (Sized_incremental_binary::do_process_got_plt): New function.
5344 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5345 (Output_section_incremental_inputs::set_final_data_size): Record
5346 file index for each input file.
5347 (Output_section_incremental_inputs::write_got_plt): Store file index
5348 instead of input entry offset for each GOT entry.
5350 (Incremental_input_entry::Incremental_input_entry): Initialize new
5352 (Incremental_input_entry::set_offset): Store file index.
5353 (Incremental_input_entry::get_file_index): New function.
5354 (Incremental_input_entry::file_index_): New data member.
5355 (Incremental_binary::process_got_plt): New function.
5356 (Incremental_binary::do_process_got_plt): New function.
5357 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5359 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5360 (Sized_incremental_binary::set_file_is_unchanged): New function.
5361 (Sized_incremental_binary::file_is_unchanged): New function.
5362 (Sized_incremental_binary::do_process_got_plt): New function.
5363 (Sized_incremental_binary::file_status_): New data member.
5364 (Sized_incremental_binary::main_symtab_loc_): New data member.
5365 (Sized_incremental_binary::main_strtab_loc_): New data member.
5366 * output.cc (Output_data_got::Got_entry::write): Add case
5368 (Output_data_got::add_global): Call add_got_entry.
5369 (Output_data_got::add_global_plt): Likewise.
5370 (Output_data_got::add_global_with_rel): Likewise.
5371 (Output_data_got::add_global_with_rela): Likewise.
5372 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5373 (Output_data_got::add_global_pair_with_rela): Likewise.
5374 (Output_data_got::add_local): Call add_got_entry.
5375 (Output_data_got::add_local_plt): Likewise.
5376 (Output_data_got::add_local_with_rel): Likewise.
5377 (Output_data_got::add_local_with_rela): Likewise.
5378 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5379 (Output_data_got::add_local_pair_with_rela): Likewise.
5380 (Output_data_got::reserve_slot): New function.
5381 (Output_data_got::reserve_slot_for_global): New function.
5382 (Output_data_got::add_got_entry): New function.
5383 (Output_data_got::add_got_entry_pair): New function.
5384 (Output_section::add_output_section_data): Edit FIXME.
5386 (Output_section_data_build::Output_section_data_build): New
5387 constructor with size parameter.
5388 (Output_data_space::Output_data_space): Likewise.
5389 (Output_data_got::Output_data_got): Initialize new data member; new
5390 constructor with size parameter.
5391 (Output_data_got::add_constant): Call add_got_entry.
5392 (Output_data_got::reserve_slot): New function.
5393 (Output_data_got::reserve_slot_for_global): New function.
5394 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5395 (Output_data_got::add_got_entry): New function.
5396 (Output_data_got::add_got_entry_pair): New function.
5397 (Output_data_got::free_list_): New data member.
5398 * target.h (Sized_target::init_got_plt_for_update): New function.
5399 (Sized_target::register_global_plt_entry): New function.
5400 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5401 Initialize new data member; call init; add constructor with PLT count.
5402 (Output_data_plt_x86_64::init): New function.
5403 (Output_data_plt_x86_64::add_relocation): New function.
5404 (Output_data_plt_x86_64::reserve_slot): New function.
5405 (Output_data_plt_x86_64::free_list_): New data member.
5406 (Target_x86_64::init_got_plt_for_update): New function.
5407 (Target_x86_64::register_global_plt_entry): New function.
5408 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5409 incremental updates.
5410 (Output_data_plt_x86_64::add_relocation): New function.
5411 * testsuite/object_unittest.cc (Object_test): Set default options.
5413 2011-05-16 Ian Lance Taylor <iant@google.com>
5415 * options.h (class General_options): Make -i a synonym for -r.
5417 2011-05-16 Ian Lance Taylor <iant@google.com>
5419 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5421 2011-05-10 Cary Coutant <ccoutant@google.com>
5423 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5426 2011-05-06 Ian Lance Taylor <iant@google.com>
5428 * layout.cc (Layout::layout): If the output section flags change,
5429 update the ordering.
5431 2011-04-25 Cary Coutant <ccoutant@google.com>
5433 * incremental-dump.cc (dump_incremental_inputs): Print local
5434 symbol info for each input file.
5436 (Output_section_incremental_inputs::set_final_data_size): Add local
5437 symbol info to input file entries in incremental info.
5438 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5439 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5440 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5441 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5443 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5444 (Sized_incr_relobj::do_relocate): Write the local symbols.
5445 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5446 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5447 Adjust size of input file header.
5448 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5449 (Incremental_inputs_reader::get_local_symbol_count): New function.
5450 (Incremental_inputs_reader::get_input_section): Adjust size of input
5452 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5453 (Sized_incr_relobj::This): New typedef.
5454 (Sized_incr_relobj::sym_size): New const data member.
5455 (Sized_incr_relobj::Local_symbol): New struct.
5456 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5457 (Sized_incr_relobj::do_local_symbol_offset): New function.
5458 (Sized_incr_relobj::local_symbol_count_): New data member.
5459 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5460 (Sized_incr_relobj::local_symbol_index_): New data member.
5461 (Sized_incr_relobj::local_symbol_offset_): New data member.
5462 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5463 (Sized_incr_relobj::local_symbols_): New data member.
5464 * object.h (Relobj::output_local_symbol_count): New function.
5465 (Relobj::local_symbol_offset): New function.
5466 (Relobj::do_output_local_symbol_count): New function.
5467 (Relobj::do_local_symbol_offset): New function.
5468 (Sized_relobj::do_output_local_symbol_count): New function.
5469 (Sized_relobj::do_local_symbol_offset): New function.
5471 2011-04-22 Vladimir Simonov <sv@sw.ru>
5473 * descriptors.cc (set_close_on_exec): New function.
5474 (Descriptors::open): Use set_close_on_exec.
5475 * output.cc (S_ISLNK): Define if not defined.
5477 2011-04-22 Cary Coutant <ccoutant@google.com>
5479 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5481 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5482 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5483 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5485 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5486 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5487 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5489 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5491 (Incremental_binary::apply_incremental_relocs): New function.
5492 (Incremental_binary::do_apply_incremental_relocs): New function.
5493 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5495 (Sized_incremental_binary::add_global_symbol): New function.
5496 (Sized_incremental_binary::global_symbol): New function.
5497 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5498 (Sized_incremental_binary::symbol_map_): New data member.
5499 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5500 * target.h (Sized_target::apply_relocation): New function.
5501 * target-reloc.h (apply_relocation): New function.
5502 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5504 2011-04-22 Doug Kwan <dougkwan@google.com>
5506 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5507 flag of a SHT_ARM_EXIDX section.
5508 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5509 * testsuite/Makefile.in: Regenerate.
5510 * testsuite/arm_exidx_test.s: New file.
5511 * testsuite/arm_exidx_test.sh: Same.
5513 2011-04-20 Cary Coutant <ccoutant@google.com>
5516 * archive.h (Incremental_archive_entry::Archive_member):
5517 Initialize arg_serial_ (second constructor).
5519 2011-04-17 Ian Lance Taylor <iant@google.com>
5521 * object.cc (Relocate_info::location): Simplify location string.
5522 * errors.cc (Errors::error_at_location): Don't print program
5524 (Errors::warning_at_location): Likewise.
5525 (Errors::undefined_symbol): Likewise.
5526 * testsuite/debug_msg.sh: Update accordingly.
5528 2011-04-14 Cary Coutant <ccoutant@google.com>
5530 * gold/layout.cc (Layout::symtab_section_offset): New function.
5531 * gold/layout.h (Layout::symtab_section_offset): New function.
5532 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5534 2011-04-12 Ian Lance Taylor <iant@google.com>
5536 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5537 with MREMAP_MAYMOVE.
5538 * output.h (class Output_file): Add map_is_allocated_ field.
5539 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5540 not available, provide stubs. If mremap is not available, #define
5542 (MREMAP_MAYMOVE): Define if not defined.
5543 (Output_file::Output_file): Initialize map_is_allocated_.
5544 (Output_file::resize): Check map_is_allocated_.
5545 (Output_file::map_anonymous): If mmap fails, use malloc.
5546 (Output_file::unmap): Don't do anything for an anonymous map.
5547 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5548 is not available, provide stubs.
5549 (File_read::View::~View): Use free rather than delete[].
5550 (File_read::make_view): Use malloc rather than new[]. If mmap
5552 (File_read::find_or_make_view): Use malloc rather than new[].
5553 * gold.h: Remove HAVE_REMAP code.
5554 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5555 exists. Rename mremap to gold_mremap. If mmap is not available
5557 * configure, config.in: Rebuild.
5559 2011-04-11 Ian Lance Taylor <iant@google.com>
5561 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5562 initialize local variable v.
5564 2011-04-11 Cary Coutant <ccoutant@google.com>
5566 * archive.cc (Archive::include_member): Adjust call to
5568 (Add_archive_symbols::run): Track argument serial numbers.
5569 (Lib_group::include_member): Likewise.
5570 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5571 * archive.h (Incremental_archive_entry::Archive_member):
5572 Initialize arg_serial_.
5573 (Archive_member::arg_serial_): New data member.
5574 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5575 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5577 (Sized_dynobj::do_for_all_local_got_entries): New function.
5578 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5580 * fileread.cc (get_mtime): New function.
5581 * fileread.h (get_mtime): New function.
5582 * gold.cc (queue_initial_tasks): Check for incremental update.
5583 (process_incremental_input): New function.
5584 (queue_middle_tasks): Don't force valid target for incremental
5586 * incremental-dump.cc (find_input_containing_global): Adjust
5587 size of symbol info entry.
5588 (dump_incremental_inputs): Dump argument serial number and
5589 in_system_directory flag; bias shndx by 1; print symbol names
5590 when dumping per-file symbol lists; use new symbol info readers.
5592 (Output_section_incremental_inputs:update_data_size): New function.
5593 (Sized_incremental_binary::setup_readers): Setup input readers
5594 for each input file; build maps for files added from libraries
5596 (Sized_incremental_binary::check_input_args): New function.
5597 (Sized_incremental_binary::do_check_inputs): Build map of argument
5598 serial numbers to input arguments.
5599 (Sized_incremental_binary::do_file_has_changed): Rename
5600 do_file_is_unchanged to this; compare file modification times.
5601 (Sized_incremental_binary::do_init_layout): New function.
5602 (Sized_incremental_binary::do_reserve_layout): New function.
5603 (Sized_incremental_binary::do_get_input_reader): Remove.
5604 (Sized_incremental_binary::get_symtab_view): New function.
5605 (Incremental_checker::can_incrementally_link_output_file): Remove.
5606 (Incremental_inputs::report_command_line): Exclude --debug options.
5607 (Incremental_inputs::report_archive_begin): Add parameter; track
5608 argument serial numbers; don't put input file entry for archive
5609 before archive members.
5610 (Incremental_inputs::report_archive_end): Put input file entry
5611 for archive after archive members.
5612 (Incremental_inputs::report_object): Add parameter; track argument
5613 serial numbers and in_system_directory flag.
5614 (Incremental_inputs::report_script): Add parameter; track argument
5616 (Output_section_incremental_inputs::set_final_data_size): Adjust
5617 size of symbol info entry; check for forwarding symbols.
5618 (Output_section_incremental_inputs::write_input_files): Write
5619 in_system_directory flag and argument serial number.
5620 (Output_section_incremental_inputs::write_info_blocks): Map section
5621 indices between incremental info and original input file; store
5622 input section index for each symbol.
5623 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5624 change operator() to visit().
5625 (class Global_got_offset_visitor): Likewise.
5626 (class Global_symbol_visitor_got_plt):
5627 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5629 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5630 (Sized_incr_relobj::do_read_symbols): New function.
5631 (Sized_incr_relobj::do_layout): New function.
5632 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5633 (Sized_incr_relobj::do_add_symbols): New function.
5634 (Sized_incr_relobj::do_should_include_member): New function.
5635 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5636 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5637 (Sized_incr_relobj::do_section_size): New function.
5638 (Sized_incr_relobj::do_section_name): New function.
5639 (Sized_incr_relobj::do_section_contents): New function.
5640 (Sized_incr_relobj::do_section_flags): New function.
5641 (Sized_incr_relobj::do_section_entsize): New function.
5642 (Sized_incr_relobj::do_section_address): New function.
5643 (Sized_incr_relobj::do_section_type): New function.
5644 (Sized_incr_relobj::do_section_link): New function.
5645 (Sized_incr_relobj::do_section_info): New function.
5646 (Sized_incr_relobj::do_section_addralign): New function.
5647 (Sized_incr_relobj::do_initialize_xindex): New function.
5648 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5649 (Sized_incr_relobj::do_read_relocs): New function.
5650 (Sized_incr_relobj::do_gc_process_relocs): New function.
5651 (Sized_incr_relobj::do_scan_relocs): New function.
5652 (Sized_incr_relobj::do_count_local_symbols): New function.
5653 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5654 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5655 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5656 (Sized_incr_relobj::do_relocate): New function.
5657 (Sized_incr_relobj::do_set_section_offset): New function.
5658 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5659 (Sized_incr_dynobj::do_read_symbols): New function.
5660 (Sized_incr_dynobj::do_layout): New function.
5661 (Sized_incr_dynobj::do_add_symbols): New function.
5662 (Sized_incr_dynobj::do_should_include_member): New function.
5663 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5664 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5665 (Sized_incr_dynobj::do_section_size): New function.
5666 (Sized_incr_dynobj::do_section_name): New function.
5667 (Sized_incr_dynobj::do_section_contents): New function.
5668 (Sized_incr_dynobj::do_section_flags): New function.
5669 (Sized_incr_dynobj::do_section_entsize): New function.
5670 (Sized_incr_dynobj::do_section_address): New function.
5671 (Sized_incr_dynobj::do_section_type): New function.
5672 (Sized_incr_dynobj::do_section_link): New function.
5673 (Sized_incr_dynobj::do_section_info): New function.
5674 (Sized_incr_dynobj::do_section_addralign): New function.
5675 (Sized_incr_dynobj::do_initialize_xindex): New function.
5676 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5677 (make_sized_incremental_object): New function.
5678 (Incremental_library::copy_unused_symbols): New function.
5679 (Incremental_library::do_for_all_unused_symbols): New function.
5680 * incremental.h (enum Incremental_input_flags): New type.
5681 (class Incremental_checker): Remove.
5682 (Incremental_input_entry::Incremental_input_entry): Add argument
5684 (Incremental_input_entry::arg_serial): New function.
5685 (Incremental_input_entry::set_is_in_system_directory): New function.
5686 (Incremental_input_entry::is_in_system_directory): New function.
5687 (Incremental_input_entry::arg_serial_): New data member.
5688 (Incremental_input_entry::is_in_system_directory_): New data member.
5689 (class Script_info): Move here from script.h.
5690 (Script_info::Script_info): Add filename parameter.
5691 (Script_info::filename): New function.
5692 (Script_info::filename_): New data member.
5693 (Incremental_script_entry::Incremental_script_entry): Add argument
5695 (Incremental_object_entry::Incremental_object_entry): Likewise.
5696 (Incremental_object_entry::add_input_section): Build list of input
5697 sections with map to original shndx.
5698 (Incremental_object_entry::get_input_section_index): New function.
5699 (Incremental_object_entry::shndx_): New data member.
5700 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5701 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5702 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5704 (Incremental_inputs::report_archive_begin): Likewise.
5705 (Incremental_inputs::report_object): Likewise.
5706 (Incremental_inputs::report_script): Likewise.
5707 (class Incremental_global_symbol_reader): New class.
5708 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5709 and store flags and input file type.
5710 (Incremental_input_entry_reader::arg_serial): New function.
5711 (Incremental_input_entry_reader::type): Extract type from flags.
5712 (Incremental_input_entry_reader::is_in_system_directory): New function.
5713 (Incremental_input_entry_reader::get_input_section_count): Call
5714 accessor function for type.
5715 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5716 function for type; adjust size of global symbol entry.
5717 (Incremental_input_entry_reader::get_global_symbol_count): Call
5718 accessor function for type.
5719 (Incremental_input_entry_reader::get_object_count): Likewise.
5720 (Incremental_input_entry_reader::get_object_offset): Likewise.
5721 (Incremental_input_entry_reader::get_member_count): Likewise.
5722 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5723 (Incremental_input_entry_reader::get_member_offset): Likewise.
5724 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5725 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5726 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5727 (Incremental_input_entry_reader::get_global_symbol_reader): New
5729 (Incremental_input_entry_reader::get_output_symbol_index): New
5731 (Incremental_input_entry_reader::type_): Remove.
5732 (Incremental_input_entry_reader::flags_): New data member.
5733 (Incremental_inputs_reader::input_file_offset): New function.
5734 (Incremental_inputs_reader::input_file_index): New function.
5735 (Incremental_inputs_reader::input_file): Call input_file_offset.
5736 (Incremental_inputs_reader::input_file_at_offset): New function.
5737 (Incremental_relocs_reader::get_r_type): Reformat.
5738 (Incremental_relocs_reader::get_r_shndx): Reformat.
5739 (Incremental_relocs_reader::get_r_offset): Reformat.
5740 (Incremental_relocs_reader::data): New function.
5741 (Incremental_binary::Incremental_binary): Initialize new data members.
5742 (Incremental_binary::check_inputs): Add cmdline parameter.
5743 (Incremental_binary::file_is_unchanged): Remove.
5744 (Input_reader::arg_serial): New function.
5745 (Input_reader::get_unused_symbol_count): New function.
5746 (Input_reader::get_unused_symbol): New function.
5747 (Input_reader::do_arg_serial): New function.
5748 (Input_reader::do_get_unused_symbol_count): New function.
5749 (Input_reader::do_get_unused_symbol): New function.
5750 (Incremental_binary::input_file_count): New function.
5751 (Incremental_binary::get_input_reader): Change signature to use
5752 index instead of filename.
5753 (Incremental_binary::file_has_changed): New function.
5754 (Incremental_binary::get_input_argument): New function.
5755 (Incremental_binary::get_library): New function.
5756 (Incremental_binary::get_script_info): New function.
5757 (Incremental_binary::init_layout): New function.
5758 (Incremental_binary::reserve_layout): New function.
5759 (Incremental_binary::output_file): New function.
5760 (Incremental_binary::do_check_inputs): New function.
5761 (Incremental_binary::do_file_is_unchanged): Remove.
5762 (Incremental_binary::do_file_has_changed): New function.
5763 (Incremental_binary::do_init_layout): New function.
5764 (Incremental_binary::do_reserve_layout): New function.
5765 (Incremental_binary::do_input_file_count): New function.
5766 (Incremental_binary::do_get_input_reader): Change signature.
5767 (Incremental_binary::input_args_map_): New data member.
5768 (Incremental_binary::library_map_): New data member.
5769 (Incremental_binary::script_map_): New data member.
5770 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5772 (Sized_incremental_binary::output_section): New function.
5773 (Sized_incremental_binary::inputs_reader): Add const.
5774 (Sized_incremental_binary::symtab_reader): Add const.
5775 (Sized_incremental_binary::relocs_reader): Add const.
5776 (Sized_incremental_binary::got_plt_reader): Add const.
5777 (Sized_incremental_binary::get_symtab_view): New function.
5778 (Sized_incremental_binary::Inputs_reader): New typedef.
5779 (Sized_incremental_binary::Input_entry_reader): New typedef.
5780 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5781 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5782 (Sized_incremental_binary::do_file_has_changed): New function.
5783 (Sized_incremental_binary::do_init_layout): New function.
5784 (Sized_incremental_binary::do_reserve_layout): New function.
5785 (Sized_input_reader::Inputs_reader): Remove.
5786 (Sized_input_reader::Input_entry_reader): Remove.
5787 (Sized_input_reader::do_arg_serial): New function.
5788 (Sized_input_reader::do_get_unused_symbol_count): New function.
5789 (Sized_input_reader::do_get_unused_symbol): New function.
5790 (Sized_incremental_binary::do_input_file_count): New function.
5791 (Sized_incremental_binary::do_get_input_reader): Change signature;
5792 use index instead of filename.
5793 (Sized_incremental_binary::section_map_): New data member.
5794 (Sized_incremental_binary::input_entry_readers_): New data member.
5795 (class Sized_incr_relobj): New class.
5796 (class Sized_incr_dynobj): New class.
5797 (make_sized_incremental_object): New function.
5798 (class Incremental_library): New class.
5799 * layout.cc (Free_list::num_lists): New static data member.
5800 (Free_list::num_nodes): New static data member.
5801 (Free_list::num_removes): New static data member.
5802 (Free_list::num_remove_visits): New static data member.
5803 (Free_list::num_allocates): New static data member.
5804 (Free_list::num_allocate_visits): New static data member.
5805 (Free_list::init): New function.
5806 (Free_list::remove): New function.
5807 (Free_list::allocate): New function.
5808 (Free_list::dump): New function.
5809 (Free_list::print_stats): New function.
5810 (Layout_task_runner::run): Resize output file for incremental updates.
5811 (Layout::Layout): Initialize new data members.
5812 (Layout::set_incremental_base): New function.
5813 (Layout::init_fixed_output_section): New function.
5814 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5815 incremental updates.
5816 (Layout::create_gold_note): Do not create gold note section for
5817 incremental updates.
5818 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5819 for incremental updates.
5820 (Layout::set_section_offsets): For incremental updates, allocate space
5822 (Layout::create_symtab_sections): Layout with offsets relative to
5823 start of section; for incremental updates, allocate space from free
5825 (Layout::create_shdrs): For incremental updates, allocate space from
5827 (Layout::finish_dynamic_section): For incremental updates, do not
5828 check --as-needed (fixed in subsequent patch).
5829 * layout.h (class Free_list): New class.
5830 (Layout::set_incremental_base): New function.
5831 (Layout::incremental_base): New function.
5832 (Layout::init_fixed_output_section): New function.
5833 (Layout::allocate): New function.
5834 (Layout::incremental_base_): New data member.
5835 (Layout::free_list_): New data member.
5836 * main.cc (main): Print Free_list statistics.
5837 * object.cc (Relobj::finalize_incremental_relocs): Add
5838 clear_counts parameter; clear counts only when clear_counts is set.
5839 (Sized_relobj::Sized_relobj): Initialize new base class.
5840 (Sized_relobj::do_layout): Don't report special sections.
5841 (Sized_relobj::do_for_all_local_got_entries): New function.
5842 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5843 symtab_off to all symbol table offsets.
5844 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5845 * object.h (class Got_offset_list): Move to top of file.
5846 (Object::Object): Allow case where input_file == NULL.
5847 (Object::~Object): Likewise.
5848 (Object::input_file): Assert that input_file != NULL.
5849 (Object::lock): Allow case where input_file == NULL.
5850 (Object::unlock): Likewise.
5851 (Object::is_locked): Likewise.
5852 (Object::token): Likewise.
5853 (Object::release): Likewise.
5854 (Object::is_incremental): New function.
5855 (Object::get_mtime): New function.
5856 (Object::for_all_local_got_entries): New function.
5857 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5858 (Object::set_is_in_system_directory): New function.
5859 (Object::is_in_system_directory): New function.
5860 (Object::do_is_incremental): New function.
5861 (Object::do_get_mtime): New function.
5862 (Object::do_for_all_local_got_entries): New function.
5863 (Object::is_in_system_directory_): New data member.
5864 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5865 (class Sized_relobj_base): New class.
5866 (class Sized_relobj): Derive from Sized_relobj_base.
5867 (class Sized_relobj::Symbols): Redeclare from base class.
5868 (class Sized_relobj::local_got_offset_list): Remove.
5869 (class Sized_relobj::Output_sections): Redeclare from base class.
5870 (class Sized_relobj::do_for_all_local_got_entries): New function.
5871 (class Sized_relobj::write_local_symbols): Add offset parameter.
5872 (class Sized_relobj::local_symbol_offset_): Update comment.
5873 (class Sized_relobj::local_dynsym_offset_): Update comment.
5874 * options.cc (Input_arguments::add_file): Remove const.
5875 * options.h (Input_file_argument::Input_file_argument):
5876 Initialize arg_serial_ (all constructors).
5877 (Input_file_argument::set_arg_serial): New function.
5878 (Input_file_argument::arg_serial): New function.
5879 (Input_file_argument::arg_serial_): New data member.
5880 (Input_arguments::Input_arguments): Initialize file_count_.
5881 (Input_arguments::add_file): Remove const.
5882 (Input_arguments::number_of_input_files): New function.
5883 (Input_arguments::file_count_): New data member.
5884 (Command_line::number_of_input_files): Call
5885 Input_arguments::number_of_input_files.
5886 * output.cc (Output_segment_headers::Output_segment_headers):
5888 (Output_section::Input_section::current_data_size): New function.
5889 (Output_section::Output_section): Initialize new data members.
5890 (Output_section::add_input_section): Don't do merge sections for
5891 an incremental link; allocate space from free list for an
5893 (Output_section::add_output_section_data): Allocate space from
5894 free list for an incremental update.
5895 (Output_section::update_data_size): New function.
5896 (Output_section::set_fixed_layout): New function.
5897 (Output_section::reserve): New function.
5898 (Output_segment::set_section_addresses): Remove const.
5899 (Output_segment::set_section_list_addresses): Remove const; allocate
5900 space from free list for an incremental update.
5901 (Output_segment::set_offset): Adjust size of RELRO segment for an
5903 * output.h (Output_data::current_data_size): Move here from
5905 (Output_data::pre_finalize_data_size): New function.
5906 (Output_data::update_data_size): New function.
5907 (Output_section_headers::update_data_size): new function.
5908 (Output_section_data_build::current_data_size): Move to Output_data.
5909 (Output_data_strtab::update_data_size): New function.
5910 (Output_section::current_data_size): Move to Output_data.
5911 (Output_section::set_fixed_layout): New function.
5912 (Output_section::has_fixed_layout): New function.
5913 (Output_section::reserve): New function.
5914 (Output_section::update_data_size): New function.
5915 (Output_section::has_fixed_layout_): New data member.
5916 (Output_section::free_list_): New data member.
5917 (Output_segment::set_section_addresses): Remove const.
5918 (Output_segment::set_section_list_addresses): Remove const.
5919 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5921 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5923 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5924 parameter when calling Add_symbols constructor; store argument
5925 serial number for members of a lib group.
5926 (Add_symbols::locks): Allow case where token == NULL.
5927 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5928 (Read_member::~Read_member): New function.
5929 (Read_member::is_runnable): New function.
5930 (Read_member::locks): New function.
5931 (Read_member::run): New function.
5932 (Check_script::~Check_script): New function.
5933 (Check_script::is_runnable): New function.
5934 (Check_script::locks): New function.
5935 (Check_script::run): New function.
5936 (Check_library::~Check_library): New function.
5937 (Check_library::is_runnable): New function.
5938 (Check_library::locks): New function.
5939 (Check_library::run): New function.
5940 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5941 (Add_symbols::library_): New data member.
5942 (class Read_member): New class.
5943 (class Check_script): New class.
5944 (class Check_library): New class.
5945 * reloc.cc (Read_relocs::is_runnable): Allow case where
5947 (Read_relocs::locks): Likewise.
5948 (Scan_relocs::locks): Likewise.
5949 (Relocate_task::locks): Likewise.
5950 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5952 (Sized_relobj::incremental_relocs_scan): Fix comment.
5953 (Sized_relobj::do_relocate): Pass output file offset to
5954 write_local_symbols.
5955 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5956 from class declaration.
5957 * script.cc (read_input_script): Allocate Script_info; pass
5958 argument serial number to report_script.
5959 * script.h (class Script_info): Move to incremental.h.
5960 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5961 * symtab.h (Symbol_table::add_from_incrobj): New function.
5962 (Symbol_table::set_file_offset): New function.
5964 2011-04-05 Cary Coutant <ccoutant@google.com>
5966 * incremental-dump.cc (dump_incremental_inputs): Change signature
5967 to take a Sized_incremental_binary; change caller. Use readers
5968 in Sized_incremental_binary.
5970 (Sized_incremental_binary::find_incremental_inputs_sections):
5971 Rename do_find_incremental_inputs_sections to this.
5972 (Sized_incremental_binary::setup_readers): New function.
5973 (Sized_incremental_binary::do_check_inputs): Check
5974 has_incremental_info_ flag; move setup code to setup_readers;
5976 (Sized_incremental_binary::do_file_is_unchanged): New function.
5977 (Sized_incremental_binary::do_get_input_reader): New function.
5978 * incremental.h (class Incremental_binary): Move to end of file.
5979 (Incremental_binary::file_is_unchanged): New function.
5980 (Incremental_binary::do_file_is_unchanged): New function.
5981 (Incremental_binary::Input_reader): New class.
5982 (Incremental_binary::get_input_reader): New function.
5983 (class Sized_incremental_binary): Move to end of file.
5984 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5985 input section reader classes.
5986 (Sized_incremental_binary::has_incremental_info): New function.
5987 (Sized_incremental_binary::inputs_reader): New function.
5988 (Sized_incremental_binary::symtab_reader): New function.
5989 (Sized_incremental_binary::relocs_reader): New function.
5990 (Sized_incremental_binary::got_plt_reader): New function.
5991 (Sized_incremental_binary::do_file_is_unchanged): New function.
5992 (Sized_incremental_binary::Sized_input_reader): New class.
5993 (Sized_incremental_binary::get_input_reader): New function.
5994 (Sized_incremental_binary::find_incremental_inputs_sections):
5995 Rename do_find_incremental_inputs_sections to this.
5996 (Sized_incremental_binary::setup_readers): New function.
5997 (Sized_incremental_binary::has_incremental_info_): New data member.
5998 (Sized_incremental_binary::inputs_reader_): New data member.
5999 (Sized_incremental_binary::symtab_reader_): New data member.
6000 (Sized_incremental_binary::relocs_reader_): New data member.
6001 (Sized_incremental_binary::got_plt_reader_): New data member.
6002 (Sized_incremental_binary::current_input_file_): New data member.
6004 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6007 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6010 2011-03-30 Cary Coutant <ccoutant@google.com>
6012 * archive.cc (Archive::include_member): Adjust call to report_object.
6013 (Add_archive_symbols::run): Add script_info to call to
6014 report_archive_begin.
6015 (Lib_group::include_member): Adjust call to report_object.
6016 (Add_lib_group_symbols::run): Adjust call to report_object.
6017 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6018 blocks. Add object count for script input files.
6019 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6020 script_info parameter; change all callers.
6021 (Incremental_inputs::report_object): Add script_info parameter;
6023 (Incremental_inputs::report_script): Store backpointer to
6024 incremental info entry.
6025 (Output_section_incremental_inputs::set_final_data_size): Record
6026 additional information for scripts.
6027 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6028 * incremental.h (Incremental_script_entry::add_object): New function.
6029 (Incremental_script_entry::get_object_count): New function.
6030 (Incremental_script_entry::get_object): New function.
6031 (Incremental_script_entry::objects_): New data member; adjust
6033 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6034 (Incremental_inputs::report_object): Add script_info parameter.
6035 (Incremental_inputs_reader::get_object_count): New function.
6036 (Incremental_inputs_reader::get_object_offset): New function.
6037 * options.cc (Input_arguments::add_file): Return reference to
6039 * options.h (Input_argument::set_script_info): New function.
6040 (Input_argument::script_info): New function.
6041 (Input_argument::script_info_): New data member; adjust all
6043 (Input_file_group::add_file): Return reference to new input argument.
6044 (Input_file_lib::add_file): Likewise.
6045 (Input_arguments::add_file): Likewise.
6046 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6047 * script.cc (Parser_closure::Parser_closure): Add script_info
6048 parameter; adjust all callers.
6049 (Parser_closure::script_info): New function.
6050 (Parser_closure::script_info_): New data member.
6051 (read_input_script): Report scripts earlier to incremental info.
6052 (script_add_file): Set script_info in Input_argument.
6053 (script_add_library): Likewise.
6054 * script.h (Script_options::Script_info): Rewrite class.
6056 2011-03-29 Cary Coutant <ccoutant@google.com>
6058 * archive.cc (Library_base::should_include_member): Move
6059 method here from class Archive.
6060 (Archive::Archive): Initialize base class.
6061 (Archive::should_include_member): Move to base class.
6062 (Archive::do_for_all_unused_symbols): New function.
6063 (Add_archive_symbols::run): Remove redundant access to
6065 (Lib_group::Lib_group): Initialize base class.
6066 (Lib_group::do_filename): New function.
6067 (Lib_group::include_member): Pass pointer to Lib_group to
6069 (Lib_group::do_for_all_unused_symbols): New function.
6070 (Add_lib_group_symbols::run): Report archive information for
6072 * archive.h (class Library_base): New base class.
6073 (class Archive): Derive from Library_base.
6074 (Archive::filename): Move to base class.
6075 (Archive::set_incremental_info): Likewise.
6076 (Archive::incremental_info): Likewise.
6077 (Archive::Should_include): Likewise.
6078 (Archive::should_include_member): Likewise.
6079 (Archive::Armap_entry): Remove.
6080 (Archive::Unused_symbol_iterator): Remove.
6081 (Archive::unused_symbols_begin): Remove.
6082 (Archive::unused_symbols_end): Remove.
6083 (Archive::do_filename): New function.
6084 (Archive::do_get_mtime): New function.
6085 (Archive::do_for_all_unused_symbols): New function.
6086 (Archive::task_): Move to base class.
6087 (Archive::incremental_info_): Likewise.
6088 (class Lib_group): Derive from Library_base.
6089 (Lib_group::do_filename): New function.
6090 (Lib_group::do_get_mtime): New function.
6091 (Lib_group::do_for_all_unused_symbols): New function.
6092 (Lib_group::task_): Move to base class.
6093 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6095 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6097 * incremental.cc (Incremental_inputs::report_archive_begin):
6098 Use Library_base; call library's get_mtime; add incremental inputs
6099 entry before members.
6100 (class Unused_symbol_visitor): New class.
6101 (Incremental_inputs::report_archive_end): Use Library_base; use
6102 visitor class to record unused symbols; don't add incremental inputs
6103 entry after members.
6104 (Incremental_inputs::report_object): Use Library_base.
6106 (Incremental_archive_entry::Incremental_archive_entry): Remove
6107 unused Archive parameter.
6108 (Incremental_inputs::report_archive_begin): Use Library_base.
6109 (Incremental_inputs::report_archive_end): Likewise.
6110 (Incremental_inputs::report_object): Likewise.
6111 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6113 * object.h (Object::for_all_global_symbols): New function.
6114 (Object::do_for_all_global_symbols): New function.
6115 (Sized_relobj::do_for_all_global_symbols): New function.
6116 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6118 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6121 2011-03-27 Ian Lance Taylor <iant@google.com>
6123 * archive.cc (Archive::interpret_header): Return -1 if something
6124 goes wrong. Change callers accordingly.
6126 2011-03-25 Cary Coutant <ccoutant@google.com>
6128 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6129 * testsuite/Makefile.in: Regenerate.
6131 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6133 * plugin.cc (get_view): New.
6134 (Plugin::load): Pass get_view to the plugin.
6135 (Plugin_manager::get_view): New.
6137 2011-03-21 Ian Lance Taylor <iant@google.com>
6139 * testsuite/final_layout.sh: Rewrite to not use dc.
6140 * testsuite/relro_test.sh: Fail if dc is not present.
6142 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6144 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6146 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6147 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6149 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6150 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6152 2011-03-14 Ian Lance Taylor <iant@google.com>
6154 * script-sections.cc (Sort_output_sections::script_compare):
6155 Rename from is_before, change return type.
6156 (Sort_output_sections::operator()): Adjust accordingly.
6158 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6161 * testsuite/odr_violation2.cc: Add comment to make all error line
6162 numbers double digits.
6163 * testsuite/debug_msg.sh: Adjust expected errors.
6165 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6167 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6168 but mark earlier ones as non-canonical
6169 (offset_to_iterator): Update search target and example
6170 (do_addr2line): Return extra lines in a vector*
6171 (format_file_lineno): Extract from do_addr2line
6172 (one_addr2line): Add vector* out-param
6173 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6174 when a lineno entry appeared last for its instruction
6175 (Dwarf_line_info): Add vector* out-param
6176 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6177 * symtab.cc (Odr_violation_compare): Include the lineno in the
6179 (linenos_from_loc): New. Combine the canonical line for an
6180 address with its other lines.
6181 (True_if_intersect): New. Helper functor to make
6182 std::set_intersection a query.
6183 (detect_odr_violations): Compare sets of lines instead of just
6184 one line for each function. This became less deterministic, but
6185 has fewer false positives.
6186 * symtab.h: Declarations.
6187 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6188 mix an optimized and non-optimized object in the same binary
6189 (odr_violation2.so): Same.
6190 * testsuite/Makefile.in: Regenerate from Makefile.am.
6191 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6192 * testsuite/debug_msg.sh: Update line numbers and add
6194 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6195 non-optimized context.
6196 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6197 isn't inlined, and use OdrDerived in an optimized context.
6198 * testsuite/odr_header1.h: Defines OdrDerived, where
6199 optimization will change the
6200 first-instruction-in-the-destructor's file and line number.
6201 * testsuite/odr_header2.h: Defines OdrBase.
6203 2011-03-09 Ian Lance Taylor <iant@google.com>
6205 * fileread.cc (File_read::clear_views): Don't delete the whole
6208 2011-03-08 Ian Lance Taylor <iant@google.com>
6211 * fileread.cc: #include <climits>.
6212 (GOLD_IOV_MAX): Define.
6213 (File_read::read_multiple): Limit number of entries by iov_max.
6214 * fileread.h (class File_read): Always set max_readv_entries to
6217 2011-03-07 Ian Lance Taylor <iant@google.com>
6220 * options.h (class General_options): Add -dy and -dn.
6222 2011-03-02 Cary Coutant <ccoutant@google.com>
6224 * testsuite/script_test_9.t: Add TLS segment.
6226 2011-03-02 Simon Baldwin <simonb@google.com>
6228 * configure.ac: Add check for gnu_indirect_function support in
6229 the toolchain building binutils.
6230 * configure: Rebuild.
6232 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6234 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6235 plugin only symbols.
6236 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6237 in plugin files as not needed in the symbol table.
6239 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6241 * output.cc (Output_section::add_input_section): Delay fill
6242 generation for section ordering.
6244 2011-02-09 Ian Lance Taylor <iant@google.com>
6247 * object.h (class Sized_relobj): Remove clear_local_symbols.
6248 * reloc.cc (Sized_relobj::do_relocate): Don't call
6249 clear_local_symbols.
6251 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6253 * plugin.cc (is_visible_from_outside): Return true for symbols
6256 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6258 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6261 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6263 * icf.h (is_section_foldable_candidate): Change type of parameter
6265 * icf.cc (Icf::find_identical_sections): Change type of local variable
6266 section_name to be std::string.
6267 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6269 2011-01-25 Ian Lance Taylor <iant@google.com>
6271 * script.cc (script_add_extern): Rewrite to use
6272 add_symbol_reference.
6274 2011-01-25 Doug Kwan <dougkwan@google.com>
6276 * icf.cc (get_section_contents): Always lock section's object.
6278 2011-01-24 Ian Lance Taylor <iant@google.com>
6280 * options.h (class General_options): Accept
6281 --no-detect-odr-violations.
6283 2011-01-24 Ian Lance Taylor <iant@google.com>
6285 * version.cc (version_string): Bump to 1.11.
6287 2011-01-24 Ian Lance Taylor <iant@google.com>
6289 * plugin.cc (class Plugin_rescan): Define new class.
6290 (Plugin_manager::claim_file): Set any_claimed_.
6291 (Plugin_manager::save_archive): New function.
6292 (Plugin_manager::save_input_group): New function.
6293 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6295 (Plugin_manager::new_undefined_symbol): New function.
6296 (Plugin_manager::rescan): New function.
6297 (Plugin_manager::rescannable_defines): New function.
6298 (Plugin_manager::add_input_file): Set any_added_.
6299 * plugin.h (class Plugin_manager): define new fields rescannable_,
6300 undefined_symbols_, any_claimed_, and any_added_. Declare
6301 Plugin_rescan as friend. Declare new functions.
6302 (Plugin_manager::Rescannable): Define type.
6303 (Plugin_manager::Rescannable_list): Define type.
6304 (Plugin_manager::Undefined_symbol_list): Define type.
6305 (Plugin_manager::Plugin_manager): Initialize new fields.
6306 * archive.cc (Archive::defines_symbol): New function.
6307 (Add_archive_symbols::run): Pass archive to plugins if any.
6308 * archive.h (class Archive): Declare defines_symbol.
6309 * readsyms.cc (Input_group::~Input_group): New function.
6310 (Finish_group::run): Pass input_group to plugins if any.
6311 * readsyms.h (class Input_group): Declare destructor.
6312 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6315 2011-01-10 Ian Lance Taylor <iant@google.com>
6317 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6319 (Layout::set_segment_offsets): Reset increase_relro before calling
6320 set_section_addresses a second time.
6322 2011-01-04 Cary Coutant <ccoutant@google.com>
6324 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6325 sections before NOBITS sections.
6327 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6329 * version.cc (print_version): Update copyright to 2011.
6331 2010-12-23 Cary Coutant <ccoutant@google.com>
6333 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6334 of OS to this->add. Add OD parameter to second form of the function.
6336 2010-12-20 Ian Lance Taylor <iant@google.com>
6338 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6339 second of two consecutive entries with same offset.
6341 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6343 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6344 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6345 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6346 to avoid unneeded links against $(LDADD).
6347 * testsuite/Makefile.in: Regenerate.
6349 2010-12-15 Ian Lance Taylor <iant@google.com>
6352 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6353 for R_X86_64_32 and R_X86_64_PC32.
6354 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6355 ver_matching_def_pic.o.
6356 (ver_matching_def_pic.o): New target.
6358 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6360 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6361 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6362 Move definition before File_read::View member definitions.
6363 (File_read::View::~View): Initialize and hold lock before
6364 updating current_mapped_bytes.
6366 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6368 * dwarf_reader.cc: Remove outdated comment.
6369 * gold-threads.cc: Fix typo in error message.
6370 * archive.cc: Fix typos in comments.
6371 * archive.h: Likewise.
6372 * arm-reloc-property.cc: Likewise.
6373 * arm-reloc-property.h: Likewise.
6374 * arm-reloc.def: Likewise.
6376 * attributes.h: Likewise.
6377 * cref.cc: Likewise.
6378 * ehframe.cc: Likewise.
6379 * fileread.h: Likewise.
6381 * i386.cc: Likewise.
6383 * incremental.h: Likewise.
6384 * int_encoding.cc: Likewise.
6385 * layout.h: Likewise.
6386 * main.cc: Likewise.
6387 * merge.h: Likewise.
6388 * object.cc: Likewise.
6389 * object.h: Likewise.
6390 * options.cc: Likewise.
6391 * readsyms.cc: Likewise.
6392 * reduced_debug_output.cc: Likewise.
6393 * reloc.cc: Likewise.
6394 * script-sections.cc: Likewise.
6395 * sparc.cc: Likewise.
6396 * symtab.h: Likewise.
6397 * target-reloc.h: Likewise.
6398 * target.cc: Likewise.
6399 * target.h: Likewise.
6400 * timer.cc: Likewise.
6401 * timer.h: Likewise.
6402 * x86_64.cc: Likewise.
6404 2010-12-09 Cary Coutant <ccoutant@google.com>
6406 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6408 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6409 parameter; change all callers.
6410 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6411 * options.h (warn_execstack): New option.
6413 2010-12-07 Doug Kwan <dougkwan@google.com>
6415 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6416 like function call relocations.
6418 2010-12-07 Ian Lance Taylor <iant@google.com>
6420 * archive.cc (Archive::get_elf_object_for_member): Permit
6421 punconfigured to be NULL.
6422 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6423 (Archive::include_member): Pass NULL to get_elf_object_for_member
6424 if we searched for the archive and this is the first included
6427 2010-12-01 Ian Lance Taylor <iant@google.com>
6429 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6430 track_relocs_type_ field.
6431 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6432 Set track_relocs_type_.
6433 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6434 contents when using RELA relocs.
6435 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6437 * reloc.cc (Track_relocs::next_addend): New function.
6438 * reloc.h (class Track_relocs): Declare next_addend.
6440 2010-12-01 Ian Lance Taylor <iant@google.com>
6442 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6445 2010-12-01 Ian Lance Taylor <iant@google.com>
6447 * README: Update compilers known to work and fail.
6449 2010-11-23 Matthias Klose <doko@ubuntu.com>
6451 * configure.in: For --enable-gold, handle value `default' instead of
6452 `both*'. Always install ld as ld.bfd, install as ld if gold is
6454 * configure: Regenerate.
6456 2010-11-18 Doug Kwan <dougkwan@google.com>
6458 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6459 and right_alignment to be zero. Store result alignment only if it is
6460 greater than existing alignment.
6462 2010-11-16 Cary Coutant <ccoutant@google.com>
6465 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6466 Check for ".zdebug_line".
6468 2010-11-16 Doug Kwan <dougkwan@google.com>
6469 Cary Coutant <ccoutant@google.com>
6471 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6472 by reference; adjust all callers.
6473 * output.cc (Output_segment::set_section_addresses): Adjust references
6474 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6476 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6477 end at page boundary.
6479 2010-11-16 Cary Coutant <ccoutant@google.com>
6482 * layout.cc (Layout::choose_output_section): Transform names of
6483 compressed sections even when using a script with a SECTIONS clause.
6484 (Layout::output_section_name): Remove code to transform
6485 compressed debug section names.
6486 * output.cc (Output_section::add_input_section): Use uncompressed
6487 section size when tracking input sections.
6489 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6491 * symtab.h (Symbol::NON_PIC_REF): Remove.
6492 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6493 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6494 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6495 (Symbol::use_plt_offset): Take a flags argument and pass it
6496 directly to needs_dynamic_reloc. Restrict check for undefined
6497 weak symbols to function calls.
6498 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6499 (Target_arm::Scan::global): Use it.
6500 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6501 (Target_arm::Relocate::relocate): Likewise.
6502 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6503 parameter with an r_type parameter. Use get_reference_flags
6505 (Target_arm::Relocate::relocate): Update accordingly.
6506 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6507 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6508 (Target_i386::Scan::global): Likewise.
6509 (Target_i386::Relocate::relocate): Likewise.
6510 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6511 parameter with an r_type parameter. Use get_reference_flags
6513 (Target_i386::Relocate::relocate): Update accordingly.
6514 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6515 (Target_powerpc::Scan::global): Use it.
6516 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6517 (Target_powerpc::Relocate::relocate): Likewise.
6518 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6519 (Target_sparc::Scan::global): Use it.
6520 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6521 (Target_sparc::Relocate::relocate): Likewise.
6522 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6523 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6524 (Target_x86_64::Scan::global): Likewise.
6525 (Target_x86_64::Relocate::relocate): Likewise.
6527 2010-11-08 Doug Kwan <dougkwan@google.com>
6528 Cary Coutant <ccoutant@google.com>
6530 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6531 (Arm_exidx_merge_section::section_contents_): New data member.
6532 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6533 (Arm_input_section::~Arm_input_section): De-allocate memory.
6534 (Arm_input_section::original_contents_): New data member.
6535 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6536 in parameters instead of calling Object::section_contents without
6538 (Arm_output_section::group_section): New parameter TASK. Pass it
6539 to callees that need locking objects.
6540 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6541 to lock EXIDX input sections. Fix a formatting issue. Call
6542 Arm_exidx_merged_section::build_contents to create merged section
6544 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6545 to lock object of stub table owner.
6546 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6547 TEXT_SIZE to initialize data member TEXT_SIZE_.
6548 (Arm_exidx_input_section::addralign): Fix typo in comment.
6549 (Arm_exidx_input_section::text_size): New method.
6550 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6551 that require locking objects. Lock objects before scanning for stubs
6552 and updating local symbols.
6553 (Arm_input_section<big_endian>::init): Copy contents of original
6555 (Arm_input_section<big_endian>::do_write): Use saved contents of
6556 original input section instead of calling Object::section_contents
6558 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6559 size without calling Object::section_size().
6560 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6561 for size. Allocate a buffer for merged EXIDX entries.
6562 (Arm_exidx_merged_section::build_contents): New method.
6563 (Arm_exidx_merged_section::do_write): Move merge section contents
6564 building code to Arm_exidx_merged_section::build_contetns. Write
6565 out contetns in buffer instead of building it on the fly.
6566 (Arm_relobj::make_exidx_input_section): Also pass text section size
6567 to Arm_exidx_input_section constructor.
6568 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6569 (Arm_dynobj::do_read_symbols): Fix memory leak.
6570 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6571 * target.h: (class Task): Add forward declaration.
6572 (Target::relax): Add new parameter TASK and pass it to
6574 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6576 2010-11-05 Cary Coutant <ccoutant@google.com>
6579 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6580 object when reading from the file.
6581 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6583 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6584 when reading section contents.
6585 (get_section_contents): Likewise.
6586 (icf::find_identical_sections): Likewise.
6587 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6588 object when reading from the file.
6589 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6590 the object when doing deferred section layout.
6592 2010-11-03 Nick Clifton <nickc@redhat.com>
6595 * script.h (class Symbol_assignment: name): New member. Returns
6596 the name of the symbol.
6597 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6598 Returns true if the given symbol name is on the list of
6599 assignments wating to be processed.
6600 * archive.cc (should_incldue_member): If the symbol is undefined,
6601 check to see if it is on the list of symbols pending assignment.
6603 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6605 * script-sections.cc (Script_sections::find_memory_region): Check
6606 for a NULL output section pointer.
6608 2010-10-29 Doug Kwan <dougkwan@google.com>
6610 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6611 Output_section::add_relaxed_input_section.
6612 * output.cc (Output_section::add_relaxed_input_section): Add new
6613 arguments LAYOUT and NAME. Set section order index.
6614 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6615 Copy section order index.
6616 * output.h (Output_section::add_relaxed_input_section): Add new
6617 arguments LAYOUT and NAME.
6619 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6621 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6622 NATIVE_OR_CROSS_LINKER.
6623 * testsuite/Makefile.in: Regenerate.
6625 2010-10-20 Doug Kwan <dougkwan@google.com>
6627 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6628 without SHF_LINK_ORDER flags.
6629 * layout.cc (Layout::choose_output_section): Do not filter
6630 SHF_LINK_ORDER flag in a relocatable link.
6632 2010-10-17 Cary Coutant <ccoutant@google.com>
6634 * output.h (Output_segment::set_section_addresses): Change function
6635 signature. Update all callers.
6636 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6638 (Output_segment::set_section_addresses): Align after last TLS
6639 section. Add padding before last relro section instead of after.
6641 2010-10-17 Doug Kwan <dougkwan@google.com>
6643 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6644 GOT output section to be writable.
6646 2010-10-14 Cary Coutant <ccoutant@google.com>
6648 * debug.h (DEBUG_INCREMENTAL): New flag.
6649 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6650 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6652 * incremental.cc (report_command_line): Ignore all forms of
6654 * layout.cc (Layout::Layout): Check parameters for incremental link
6656 * options.cc (General_options::parse_incremental): New function.
6657 (General_options::parse_no_incremental): New function.
6658 (General_options::parse_incremental_full): New function.
6659 (General_options::parse_incremental_update): New function.
6660 (General_options::incremental_mode_): New data member.
6661 (General_options::finalize): Check incremental_mode_.
6662 * options.h (General_options): Update help text for --incremental.
6663 Add --no-incremental, --incremental-full, --incremental-update.
6664 (General_options::Incremental_mode): New enum type.
6665 (General_options::incremental_mode): New function.
6666 (General_options::incremental_mode_): New data member.
6667 * parameters.cc (Parameters::incremental_mode_): New data member.
6668 (Parameters::set_options): Set incremental_mode_.
6669 (Parameters::set_incremental_full): New function.
6670 (Parameters::incremental): New function.
6671 (Parameters::incremental_update): New function.
6672 (set_parameters_incremental_full): New function.
6673 * parameters.h (Parameters::set_incremental_full): New function.
6674 (Parameters::incremental): New function.
6675 (Parameters::incremental_update): New function.
6676 (Parameters::incremental_mode_): New data member.
6677 (set_parameters_incremental_full): New function.
6678 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6679 incremental link mode.
6680 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6681 (Sized_relobj::do_relocate_sections): Likewise.
6682 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6684 * testsuite/Makefile.in: Regenerate.
6685 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6687 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6689 * script-sections.h (class Script_sections): Make
6690 Sections_elements typedef public.
6691 * script-sections.cc (class Sort_output_sections): Add elements_
6692 field. Add constructor which sets it; change all callers.
6693 (Sort_output_sections::is_before): New function.
6694 (Sort_output_sections::operator()): Call is_before.
6695 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6697 * testsuite/script_test_10.sh: New test. Test script section
6699 * testsuite/script_test_10.t: Likewise.
6700 * testsuite/script_test_10.s: Likewise.
6701 * testsuite/Makefile.am: Wrap the cross linker tests and the
6702 common tests into NATIVE_OR_CROSS_LINKER.
6703 (check_SCRIPTS): Add script_test_10.sh.
6704 (check_DATA): Add script_test_10.stdout.
6705 (script_test_10.o, script_test_10): New targets.
6706 (script_test_10.stdout): New target.
6707 * configure, testsuite/Makefile.in: Regenerate.
6709 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6711 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6712 error for the deprecated relocations.
6713 (Target_arm::Scan::global): Likewise.
6714 (Target_arm::Relocate::relocate): Likewise.
6716 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6718 * fileread.cc (Input_file::find_file): Initialize *found_name
6719 and *namep when using the fallback search for case 4.
6721 2010-10-11 Cary Coutant <ccoutant@google.com>
6723 * options.h (class General_options): Redefine -z lazy as an alias for
6724 the negation of -z now.
6726 2010-10-11 Ian Lance Taylor <iant@google.com>
6728 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6731 2010-10-06 Nick Clifton <nickc@redhat.com>
6733 * script-sections.cc(class Memory_region): Remove
6734 current_lma_offset_ field. Rename current_vma_offset_ to
6735 current_offset_. Add last_section_ field.
6736 (Memory_region::get_current_vma_address): Rename to
6737 get_current_address.
6738 (Memory_region::get_current_lma_address): Delete.
6739 (Memory_region::increment_vma_offset): Rename to
6741 (Memory_region::increment_lma_offset): Delete.
6742 (Memory_region::attributes_compatible): New method. Returns
6743 true if the provided section is compatible with the region.
6744 (Memory_region::get_last_section): New method. Returns the last
6745 section to use the region.
6746 (Memory_region::set_last_section): New method. Stores the last
6747 section to use the region.
6748 (Script_sections::block_in_region): New method. Returns true if
6749 a block of memory is contained within a region.
6750 (Script_sections::find_memory_region): New method. Locates a
6751 memory region to be used to set a VMA or LMA address.
6752 (Output_section_definition::set_section_addresses): Add code to
6753 check for addresses set by memory regions.
6754 (Output_segment::set_section_addresses): Remove memory region
6756 (Script_sections::create_segment): Add a warning if a header
6757 segment is created outside of any region.
6758 * script-sections.h (class Script_sections): Add prototypes for
6759 find_memory_region and block_in_region methods.
6760 * testsuite/memory_test.s: Use .long instead of .word.
6761 * testsuite/memory_test.t: Add some more output sections.
6762 * testsuite/memory_test.sh: Update expected output.
6764 2010-10-02 Doug Kwan <dougkwan@google.com>
6766 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6767 defintion to symtab.h
6768 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6769 declaration to defintion.
6771 2010-10-01 Nick Clifton <nickc@redhat.com>
6773 * expression.cc (eval): Replace dummy argument with NULL.
6774 (eval_maybe_dot): Check for a NULL result section pointer.
6775 (Symbol_expression::value): Likewise.
6776 (Dot_expression::value): Likewise.
6777 (BINARY_EXPRESSION): Likewise.
6778 (Max_expression::value): Likewise.
6779 (Min_expression::value): Likewise.
6780 (Absolute_expression::value): Likewise.
6781 (Addr_expression::value_from_output_section): Likewise.
6782 (Loaddddr_expression::value_from_output_section): Likewise.
6783 (Segment_start_expression::value): Likewise.
6784 * script-sections.cc
6785 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6787 (Sections_elememt_dot_assignment::set_section_addresses):
6789 (Output_data_expression::do_write_to_buffer): Likewise.
6790 (Output_section_definition::finalize_symbols): Likewise.
6791 (Output_section_definition::set_section_addresses): Likewise.
6793 2010-09-30 Doug Kwan <dougkwan@google.com>
6795 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6797 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6799 * target.h (Target::can_icf_inline_merge_sections): New virtual
6801 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6803 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6805 * icf.cc (get_section_contents): Inline merge sections only when
6808 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6810 * configure: Regenerate.
6812 2010-09-17 Ian Lance Taylor <iant@google.com>
6814 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6815 * testsuite/Makefile.am (memory_test.o): New target.
6816 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6818 * testsuite/Makefile.in: Rebuild.
6820 2010-09-17 Doug Kwan <dougkwan@google.com>
6822 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6823 defintion if relocation uses GOT entries of the symbol.
6824 * testsuite/icf_safe_test.sh: Fix test.
6825 * testsuite/icf_safe_so_test.sh: Fix test.
6827 2010-09-16 Cary Coutant <ccoutant@google.com>
6829 * script_sections.cc (class Memory_region): Remove "NULL" from
6830 vector initializations.
6832 2010-09-15 Cary Coutant <ccoutant@google.com>
6834 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6835 Resolve forwarding symbols.
6837 2010-09-15 Doug Kwan <dougkwan@google.com>
6839 * gold/testsuite/script_test_3.t: Add ARM special sections.
6840 * gold/testsuite/script_test_4.t: Same.
6841 * gold/testsuite/script_test_5.t: Same.
6842 * gold/testsuite/script_test_6.t: Same.
6843 * gold/testsuite/script_test_7.t: Same.
6844 * gold/testsuite/script_test_7.t: Same.
6845 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6847 2010-09-14 Cary Coutant <ccoutant@google.com>
6849 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6850 (Target_x86_64::Relocate::relocate_tls): Replace check for
6851 saw_tls_block_reloc_ with test for executable section.
6853 2010-09-12 Cary Coutant <ccoutant@google.com>
6855 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6856 position-independent executables to shared libraries need dynamic
6858 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6859 position-independent executables.
6860 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6861 * testsuite/Makefile.in: Regenerate.
6863 2010-09-10 Nick Clifton <nickc@redhat.com>
6866 * testsuite/memory_test.t: Discard any sections that are not
6869 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6872 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6873 "This::" to work around a bug in gcc 4.2.
6875 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6877 2010-09-09 Rafael Espindola <espindola@google.com>
6879 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6880 sections with different PF_X flags in the same segment.
6881 (Layout::find_first_load_seg): Search all segments to find the first
6883 * options.h (rosegment): New.
6885 2010-09-08 Rafael Espindola <espindola@google.com>
6887 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6889 2010-09-08 Doug Kwan <dougkwan@google.com>
6891 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6892 (Arm_relobj::do_relocate_sections): Add new parameter for output
6893 file to match the parent.
6894 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6895 of local symbols instead of input values. Update code to track
6896 changes in gold::relocate_section.
6897 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6898 (Sized_relobj::compute_final_local_value_internal): New methods.
6899 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6900 body into private version of Sized_relobj::compute_final_local_value.
6901 Call the inline method.
6902 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6903 merged symbol value if there is one.
6904 (Symbol_value::has_output_value): New method defintiion.
6905 (Sized_relobj::Compute_final_local_value_status): New enum type.
6906 (Sized_relobj::compute_final_local_value): New methods.
6907 (Sized_relobj::compute_final_local_value_internal): New methods.
6908 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6909 and arm_cortex_a8.sh.
6910 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6911 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6913 * Makefile.in: Regenerate.
6914 * testsuite/arm_bl_out_of_range.s: Update test.
6915 * testsuite/thumb_bl_out_of_range.s: Ditto.
6916 * testsuite/thumb_blx_out_of_range.s: Ditto.
6917 * testsuite/arm_branch_out_of_range.sh: New file.
6918 * testsuite/arm_cortex_a8.sh: Ditto.
6919 * testsuite/arm_cortex_a8_b.s: Ditto.
6920 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6921 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6922 * testsuite/arm_cortex_a8_bl.s: Ditto.
6923 * testsuite/arm_cortex_a8_blx.s: Ditto.
6924 * testsuite/arm_cortex_a8_local.s: Ditto.
6925 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6926 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6928 2010-09-08 Rafael Espindola <espindola@google.com>
6930 * Makefile.am (memory_test.stdout): Run readelf with -W.
6931 * Makefile.in: Regenerate.
6932 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6935 2010-09-08 Rafael Espindola <espindola@google.com>
6937 * script-sections.cc (Script_sections::add_memory_region): Convert
6938 field precision to int.
6939 * script.cc (script_set_section_region, script_set_section_region):
6940 Convert field precision to int.
6942 2010-09-08 Rafael Espindola <espindola@google.com>
6944 * arm.cc (do_finalize_sections): Create the __exidx_start and
6945 __exdix_end symbols even when the section is missing.
6947 2010-09-08 Nick Clifton <nickc@redhat.com>
6949 * README: Remove claim that MEMORY is not supported.
6950 * expression.cc (script_exp_function_origin)
6951 (script_exp_function_length): Move from here to ...
6952 * script.cc: ... here.
6953 (script_set_section_region, script_add_memory)
6954 (script_parse_memory_attr, script_include_directive): New
6956 * script-sections.cc
6957 (class Memory_region): New class.
6958 (class Output_section_definition): Add set_memory_region,
6959 set_section_vma, set_section_lma and get_section_name methods.
6960 (class Script_Sections): Add add_memory_region,
6961 find_memory_region, find_memory_region_origin,
6962 find_memory_region_length and set_memory_region methods.
6963 Have set_section_addresses method walk the list of set memory
6965 Extend the print methos to display memory regions.
6966 * script-sections.h: Add prototypes for new methods.
6967 Add enum for MEMORY region attributes.
6968 * yyscript.y: Add support for parsing MEMORY regions.
6969 * script-c.h: Add prototypes for new functions.
6970 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6971 * testsuite/Makefile.in: Regenerate.
6972 * testsuite/memory_test.sh: New script.
6973 * testsuite/memory_test.s: New assembler source file.
6974 * testsuite/memory_test.t: New linker script.
6976 2010-08-27 Doug Kwan <dougkwan@google.com>
6978 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6979 reference override an existing dynamic weak reference.
6980 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6981 * testsuite/Makefile.in: Regenerate.
6982 * testsuite/dyn_weak_ref.sh: New file.
6983 * testsuite/dyn_weak_ref_1.c: Ditto.
6984 * testsuite/dyn_weak_ref_2.c: Ditto.
6986 2010-08-27 Ian Lance Taylor <iant@google.com>
6988 * incremental.h (class Incremental_input_entry): Add virtual
6991 2010-08-27 Ian Lance Taylor <iant@google.com>
6993 * testsuite/start_lib_test_3.c: Mark t3 as used.
6995 2010-08-27 Nick Clifton <nickc@redhat.com>
6997 * options.cc (version_script): Fix small typo in previous
7000 2010-08-25 Nick Clifton <nickc@redhat.com>
7002 * archive.cc: Formatting fixes: Remove whitespace between
7003 typename and following asterisk. Remove whitespace between
7004 function name and opening parenthesis.
7005 * archive.h: Likewise.
7007 * attributes.cc: Likewise.
7008 * attributes.h: Likewise.
7009 * common.cc: Likewise.
7010 * copy-relocs.cc: Likewise.
7011 * dirsearch.h: Likewise.
7012 * dynobj.cc: Likewise.
7013 * ehframe.cc: Likewise.
7014 * ehframe.h: Likewise.
7015 * expression.cc: Likewise.
7016 * fileread.cc: Likewise.
7017 * fileread.h: Likewise.
7019 * gold-threads.cc: Likewise.
7020 * gold.cc: Likewise.
7021 * i386.cc: Likewise.
7023 * incremental-dump.cc: Likewise.
7024 * incremental.cc: Likewise.
7025 * layout.cc: Likewise.
7026 * layout.h: Likewise.
7027 * main.cc: Likewise.
7028 * merge.cc: Likewise.
7029 * merge.h: Likewise.
7030 * object.cc: Likewise.
7031 * object.h: Likewise.
7032 * options.cc: Likewise.
7033 * options.h: Likewise.
7034 * output.cc: Likewise.
7035 * output.h: Likewise.
7036 * plugin.cc: Likewise.
7037 * plugin.h: Likewise.
7038 * powerpc.cc: Likewise.
7039 * reloc.cc: Likewise.
7040 * script-c.h: Likewise.
7041 * script-sections.cc: Likewise.
7042 * script.cc: Likewise.
7043 * stringpool.cc: Likewise.
7044 * symtab.cc: Likewise.
7045 * symtab.h: Likewise.
7046 * target.cc: Likewise.
7047 * timer.cc: Likewise.
7048 * timer.h: Likewise.
7049 * version.cc: Likewise.
7050 * x86_64.cc: Likewise.
7052 2010-08-24 Nick Clifton <nickc@redhat.com>
7055 * layout.cc (segment_precedes): Sort segments by their physical
7056 addresses, if they have been set.
7058 2010-08-23 Cary Coutant <ccoutant@google.com>
7060 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7062 (Lib_group::include_member): Unlock object after deleting its
7064 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7067 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7068 Cary Coutant <ccoutant@google.com>
7070 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7071 constructor, and set_blocker.
7072 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7074 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7075 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7076 * testsuite/Makefile.am (start_lib_test): New test case.
7077 * testsuite/Makefile.in: Regenerate.
7078 * testsuite/start_lib_test_main.c: New file.
7079 * testsuite/start_lib_test_1.c: New file.
7080 * testsuite/start_lib_test_2.c: New file.
7081 * testsuite/start_lib_test_3.c: New file.
7083 2010-08-19 Ian Lance Taylor <iant@google.com>
7085 * Makefile.in: Rebuild with automake 1.11.1.
7086 * aclocal.m4: Likewise.
7087 * testsuite/Makefile.in: Likewise.
7089 2010-08-19 Ian Lance Taylor <iant@google.com>
7092 * i386.cc (class Output_data_plt_i386): Update declarations.
7093 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7094 local_ifuncs_ fields.
7095 (Target_i386::do_plt_section_for_global): New function.
7096 (Target_i386::do_plt_section_for_local): New function.
7097 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7098 parameter; change all callers. Initialize global_ifuncs_ and
7099 local_ifuncs_. If doing a static link define __rel_iplt_start and
7101 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7102 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7103 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7105 (Target_i386::make_plt_section): New function, broken out of
7106 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7107 (Target_i386::make_plt_entry): Call make_plt_section.
7108 (Target_i386::make_local_ifunc_plt_entry): New function.
7109 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7110 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7111 R_386_IRELATIVE to switch.
7112 (Target_i386::Scan::global): Likewise.
7113 (Target_i386::Relocate::relocate): Likewise.
7114 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7116 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7117 (Target_x86_64::do_plt_section_for_global): New function.
7118 (Target_x86_64::do_plt_section_for_local): New function.
7119 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7120 parameter; change all callers. If doing a static link define
7121 __rela_iplt_start and __rela_iplt_end.
7122 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7123 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7124 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7126 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7127 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7129 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7130 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7131 R_X86_64_IRELATIVE to switch.
7132 (Target_x86_64::Scan::global): Likewise.
7133 (Target_x86_64::Relocate::relocate): Likewise.
7134 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7136 * target.h (class Target): Add plt_section_for_global and
7137 plt_section_for_local functions. Add do_plt_section_for_global
7138 and do_plt_section_for_local virtual functions.
7139 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7140 clarifying comments.
7141 (Symbol::use_plt_offset): Handle IFUNC symbol.
7142 * object.cc (Sized_relobj::Sized_relobj): Initialize
7144 (Sized_relobj::local_has_plt_offset): New function.
7145 (Sized_relobj::local_plt_offset): New function.
7146 (Sized_relobj::set_local_plt_offset): New function.
7147 (Sized_relobj::do_count): Handle IFUNC symbol.
7148 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7149 a bit away from input_shndx_ field. Add set_is_func_symbol and
7150 is_ifunc_symbol functions.
7151 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7152 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7153 local_plt_offsets_ field.
7154 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7155 * output.h (class Output_section_data): Add non-const
7156 output_section function.
7157 (class Output_data_got): Update declarations.
7158 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7159 Add use_plt_offset parameter to global and local constructors.
7160 Change all callers. Change local_sym_index_ field to 31 bits.
7161 Change GSYM_CODE and CONSTANT_CODE accordingly.
7162 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7163 doing a static link don't set sh_link field.
7164 (Output_data_got::Got_entry::write): Use PLT offset if
7166 (Output_data_got::add_global_plt): New function.
7167 (Output_data_got::add_local_plt): New function.
7168 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7169 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7170 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7171 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7172 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7174 * testsuite/ifunc-sel.h: New file.
7175 * testsuite/ifuncmain1.c: New file.
7176 * testsuite/ifuncmain1vis.c: New file.
7177 * testsuite/ifuncmod1.c: New file.
7178 * testsuite/ifuncdep2.c: New file.
7179 * testsuite/ifuncmain2.c: New file.
7180 * testsuite/ifuncmain3.c: New file.
7181 * testsuite/ifuncmod3.c: New file.
7182 * testsuite/ifuncmain4.c: New file.
7183 * testsuite/ifuncmain5.c: New file.
7184 * testsuite/ifuncmod5.c: New file.
7185 * testsuite/ifuncmain6pie.c: New file.
7186 * testsuite/ifuncmod6.c: New file.
7187 * testsuite/ifuncmain7.c: New file.
7188 * configure, testsuite/Makefile.in: Rebuild.
7190 2010-08-18 Ian Lance Taylor <iant@google.com>
7193 (Output_section_incremental_inputs::write_input_files): Add cast
7194 to avoid signed/unsigned comparison warning.
7195 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7197 2010-08-12 Cary Coutant <ccoutant@google.com>
7199 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7201 2010-08-13 Ian Lance Taylor <iant@google.com>
7203 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7205 2010-08-12 Cary Coutant <ccoutant@google.com>
7206 Doug Kwan <dougkwan@google.com>
7208 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7209 defintion overrides non-weak undef, remember that the original undef
7211 * symtab.cc (Symbol_table::sized_write_global): For undef without
7212 an original weak binding, set binding to global in output.
7213 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7214 * testsuite/Makefile.in: Regenerate.
7215 * testsuite/strong_ref_weak_def.sh: New file.
7216 * testsuite/strong_ref_weak_def_1.c: Ditto.
7217 * testsuite/strong_ref_weak_def_2.c: Ditto.
7219 2010-08-12 Cary Coutant <ccoutant@google.com>
7221 * testsuite/incremental_test.sh: Rewrite.
7222 * testsuite/incremental_test_1.c: Rewrite.
7223 * testsuite/incremental_test_2.c: Rewrite.
7225 2010-08-12 Cary Coutant <ccoutant@google.com>
7227 * arm.cc (Target_arm::got_size): Add const.
7228 (Target_arm::got_entry_count): New function.
7229 (Target_arm::plt_entry_count): New function.
7230 (Target_arm::first_plt_entry_offset): New function.
7231 (Target_arm::plt_entry_size): New function.
7232 (Output_data_plt_arm::entry_count): New function.
7233 (Output_data_plt_arm::first_plt_entry_offset): New function.
7234 (Output_data_plt_arm::get_plt_entry_size): New function.
7235 * i386.cc (Target_i386::got_size): Add const.
7236 (Target_i386::got_entry_count): New function.
7237 (Target_i386::plt_entry_count): New function.
7238 (Target_i386::first_plt_entry_offset): New function.
7239 (Target_i386::plt_entry_size): New function.
7240 (Output_data_plt_i386::entry_count): New function.
7241 (Output_data_plt_i386::first_plt_entry_offset): New function.
7242 (Output_data_plt_i386::get_plt_entry_size): New function.
7243 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7244 find_incremental_inputs_sections. Dump incremental_got_plt section.
7245 * incremental.cc: Include target.h.
7246 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7247 parameter. Adjust all callers. Find incremental_got_plt section.
7248 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7250 (Output_section_incremental_inputs::set_final_data_size): Calculate
7251 size of incremental_got_plt section.
7252 (Output_section_incremental_inputs::do_write): Write the
7253 incremental_got_plt section.
7254 (Got_plt_view_info): New struct.
7255 (Local_got_offset_visitor): New class.
7256 (Global_got_offset_visitor): New class.
7257 (Global_symbol_visitor_got_plt): New class.
7258 (Output_section_incremental_inputs::write_got_plt): New function.
7259 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7260 Add parameter. Adjust all callers.
7261 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7262 (Incremental_inputs::got_plt_section): New function.
7263 (Incremental_inputs::got_plt_section_): New data member.
7264 (Incremental_got_plt_reader): New class.
7265 * layout.cc (Layout::create_incremental_info_sections): Add the
7266 incremental_got_plt section.
7267 * object.h (Got_offset_list::get_list): New function.
7268 (Got offset_list::for_all_got_offsets): New function.
7269 (Sized_relobj::local_got_offset_list): New function.
7270 * powerpc.cc (Target_powerpc::got_size): Add const.
7271 (Target_powerpc::got_entry_count): New function.
7272 (Target_powerpc::plt_entry_count): New function.
7273 (Target_powerpc::first_plt_entry_offset): New function.
7274 (Target_powerpc::plt_entry_size): New function.
7275 (Output_data_plt_powerpc::entry_count): New function.
7276 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7277 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7278 * sparc.cc (Target_sparc::got_size): Add const.
7279 (Target_sparc::got_entry_count): New function.
7280 (Target_sparc::plt_entry_count): New function.
7281 (Target_sparc::first_plt_entry_offset): New function.
7282 (Target_sparc::plt_entry_size): New function.
7283 (Output_data_plt_sparc::entry_count): New function.
7284 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7285 (Output_data_plt_sparc::get_plt_entry_size): New function.
7286 * symtab.h (Symbol::got_offset_list): New function.
7287 (Symbol_table::for_all_symbols): New function.
7288 * target.h (Sized_target::got_entry_count): New function.
7289 (Sized_target::plt_entry_count): New function.
7290 (Sized_target::plt_entry_size): New function.
7291 * x86_64.cc (Target_x86_64::got_size): Add const.
7292 (Target_x86_64::got_entry_count): New function.
7293 (Target_x86_64::plt_entry_count): New function.
7294 (Target_x86_64::first_plt_entry_offset): New function.
7295 (Target_x86_64::plt_entry_size): New function.
7296 (Output_data_plt_x86_64::entry_count): New function.
7297 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7298 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7300 2010-08-12 Cary Coutant <ccoutant@google.com>
7302 * archive.cc: Include incremental.h.
7303 (Archive::Archive): Initialize incremental_info_.
7304 (Archive::include_member): Record archive members in incremental info.
7305 (Add_archive_symbols::run): Record begin and end of an archive in
7307 (Lib_group::include_member): Record objects in incremental info.
7308 * archive.h (Incremental_archive_entry): Forward declaration.
7309 (Archive::set_incremental_info): New member function.
7310 (Archive::incremental_info): New member function.
7311 (Archive::Unused_symbol_iterator): New class.
7312 (Archive::unused_symbols_begin): New member function.
7313 (Archive::unused_symbols_end): New member function.
7314 (Archive::incremental_info_): New data member.
7315 * incremental-dump.cc (find_input_containing_global): New function.
7316 (dump_incremental_inputs): Dump new incremental info sections.
7317 * incremental.cc: Include symtab.h.
7318 (Output_section_incremental_inputs): New class.
7319 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7320 new incremental info sections.
7321 (Sized_incremental_binary::do_check_inputs): Likewise.
7322 (Incremental_inputs::report_archive): Remove.
7323 (Incremental_inputs::report_archive_begin): New function.
7324 (Incremental_inputs::report_archive_end): New function.
7325 (Incremental_inputs::report_object): New function.
7326 (Incremental_inputs::finalize_inputs): Remove.
7327 (Incremental_inputs::report_input_section): New function.
7328 (Incremental_inputs::report_script): Rewrite.
7329 (Incremental_inputs::finalize): Do nothing but finalize string table.
7330 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7331 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7332 (Incremental_inputs::create_data_sections): New function.
7333 (Incremental_inputs::relocs_entsize): New function.
7334 (Output_section_incremental_inputs::set_final_data_size): New function.
7335 (Output_section_incremental_inputs::do_write): New function.
7336 (Output_section_incremental_inputs::write_header): New function.
7337 (Output_section_incremental_inputs::write_input_files): New function.
7338 (Output_section_incremental_inputs::write_info_blocks): New function.
7339 (Output_section_incremental_inputs::write_symtab): New function.
7340 * incremental.h (Incremental_script_entry): Forward declaration.
7341 (Incremental_object_entry): Forward declaration.
7342 (Incremental_archive_entry): Forward declaration.
7343 (Incremental_inputs): Forward declaration.
7344 (Incremental_inputs_header_data): Remove.
7345 (Incremental_inputs_header): Remove.
7346 (Incremental_inputs_header_write): Remove.
7347 (Incremental_inputs_entry_data): Remove.
7348 (Incremental_inputs_entry): Remove.
7349 (Incremental_inputs_entry_write): Remove.
7350 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7351 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7352 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7353 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7355 (Incremental_input_entry): New class.
7356 (Incremental_script_entry): New class.
7357 (Incremental_object_entry): New class.
7358 (Incremental_archive_entry): New class.
7359 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7360 (Incremental_inputs::report_inputs): Remove.
7361 (Incremental_inputs::report_archive): Remove.
7362 (Incremental_inputs::report_archive_begin): New function.
7363 (Incremental_inputs::report_archive_end): New function.
7364 (Incremental_inputs::report_object): Change prototype.
7365 (Incremental_inputs::report_input_section): New function.
7366 (Incremental_inputs::report_script): Change prototype.
7367 (Incremental_inputs::get_reloc_count): New function.
7368 (Incremental_inputs::set_reloc_count): New function.
7369 (Incremental_inputs::create_data_sections): New function.
7370 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7371 (Incremental_inputs::inputs_section): New function.
7372 (Incremental_inputs::symtab_section): New function.
7373 (Incremental_inputs::relocs_section): New function.
7374 (Incremental_inputs::get_stringpool): Add const.
7375 (Incremental_inputs::command_line): Add const.
7376 (Incremental_inputs::inputs): Remove.
7377 (Incremental_inputs::command_line_key): New function.
7378 (Incremental_inputs::input_file_count): New function.
7379 (Incremental_inputs::input_files): New function.
7380 (Incremental_inputs::relocs_entsize): New function.
7381 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7382 (Incremental_inputs::finalize_inputs): Remove.
7383 (Incremental_inputs::Input_info): Remove.
7384 (Incremental_inputs::lock_): Remove.
7385 (Incremental_inputs::inputs_): Change type.
7386 (Incremental_inputs::inputs_map_): Remove.
7387 (Incremental_inputs::current_object_entry_): New data member.
7388 (Incremental_inputs::inputs_section_): New data member.
7389 (Incremental_inputs::symtab_section_): New data member.
7390 (Incremental_inputs::relocs_section_): New data member.
7391 (Incremental_inputs::reloc_count_): New data member.
7392 (Incremental_inputs_reader): New class.
7393 (Incremental_symtab_reader): New class.
7394 (Incremental_relocs_reader): New class.
7395 * layout.cc (Layout::finalize): Move finalization of incremental info
7396 and creation of incremental info sections to follow finalization of
7397 symbol table. Set offsets for postprocessing sections.
7398 (Layout::create_incremental_info_sections): Call
7399 Incremental_inputs::create_data_sections. Add incremental symtab
7400 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7401 sections to layout after input sections.
7402 * layout.h (struct Timespec): Forward declaration.
7403 (Layout::incremental_inputs): Add const.
7404 (Layout::create_incremental_info_sections): Add parameter.
7405 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7406 * object.cc: Include incremental.h.
7407 (Relobj::finalize_incremental_relocs): New function.
7408 (Sized_relobj::do_layout): Record input sections in incremental info.
7409 * object.h (Object::output_section): New function.
7410 (Object::output_section_offset): Moved from Relobj.
7411 (Object::get_incremental_reloc_base): New function.
7412 (Object::get_incremental_reloc_count): New function.
7413 (Object::do_output_section): New function.
7414 (Object::do_output_section_offset): Moved from Relobj.
7415 (Object::do_get_incremental_reloc_base): New function.
7416 (Object::do_get_incremental_reloc_count): New function.
7417 (Object::Object): Initialize new data members.
7418 (Relobj::output_section): Renamed do_output_section and moved to
7420 (Relobj::output_section_offset): Moved to Object.
7421 (Relobj::do_get_incremental_reloc_base): New function.
7422 (Relobj::do_get_incremental_reloc_count): New function.
7423 (Relobj::allocate_incremental_reloc_counts): New function.
7424 (Relobj::count_incremental_reloc): New function.
7425 (Relobj::finalize_incremental_relocs): New function.
7426 (Relobj::next_incremental_reloc_index): New function.
7427 (Relobj::reloc_counts_): New data member.
7428 (Relobj::reloc_bases_): New data member.
7429 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7430 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7431 (Sized_relobj::incremental_relocs_scan): New function.
7432 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7433 (Sized_relobj::incremental_relocs_write): New function.
7434 (Sized_relobj::incremental_relocs_write_reltype): New function.
7435 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7437 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7438 archives and object files elsewhere.
7439 (Add_symbols::run): Report object files here.
7440 (Finish_group::run): Report end of archive at end of group.
7441 * reloc.cc: Include layout.h, incremental.h.
7442 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7443 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7444 (Sized_relobj::incremental_relocs_scan): New function.
7445 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7446 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7447 (Sized_relobj::incremental_relocs_write): New function.
7448 (Sized_relobj::incremental_relocs_write_reltype): New function.
7449 * script.cc (read_input_script): Rewrite test for incremental link.
7450 Change call to Incremental_inputs::report_script.
7451 * symtab.h (Symbol_table::first_global_index): New function.
7452 (Symbol_table::output_count): New function.
7454 2010-08-12 Doug Kwan <dougkwan@google.com>
7456 * arm.cc (Target_arm::merge_object_attributes): Check command line
7457 options --no-wchar-size-warning and --no-enum-size-warning.
7458 * options.h (General_options): Add ld-compatible options
7459 --no-enum-size-warning and --no-wchar-size-warning.
7461 2010-08-04 Ian Lance Taylor <iant@google.com>
7463 * x86_64.cc (Target_x86_64::Scan::local): Use
7464 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7465 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7466 (Target_x86_64::Scan::global): Likewise.
7467 (Target_x86_64::Relocate::relocate): Likewise.
7468 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7471 2010-08-03 Cary Coutant <ccoutant@google.com>
7473 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7474 to reserve space in merged_strings vector. Keep total input size
7476 (Output_merge_string::do_print_merge_stats): Print total input size.
7477 * merge.h (Output_merge_string): Add input_size_ field.
7478 * stringpool.cc (Stringpool_template::string_length): Move
7479 implementations out of Stringpool_template class and place in
7481 * stringpool.h (string_length): Move out of Stringpool_template.
7483 2010-08-03 Ian Lance Taylor <iant@google.com>
7486 * layout.cc (relaxation_loop_body): If address of load segment is
7487 set, adjust address to include headers if possible.
7489 2010-08-03 Ian Lance Taylor <iant@google.com>
7491 * version.cc (version_string): Bump to 1.10.
7493 2010-08-03 Ian Lance Taylor <iant@google.com>
7496 * layout.h (enum Output_section_order): Define.
7497 (class Layout): Update declarations.
7498 * layout.cc (Layout::get_output_section): Add order parameter.
7499 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7500 is_first_non_relro parameters. Change all callers.
7501 (Layout::choose_output_section): Likewise.
7502 (Layout::add_output_section_data): Likewise.
7503 (Layout::make_output_section): Likewise. Set order.
7504 (Layout::default_section_order): New function.
7505 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7506 * output.cc (Output_section::Output_section): Initialize order_.
7507 Don't initialize deleted fields.
7508 (Output_segment::Output_segment): Don't initialize deleted
7510 (Output_segment::add_output_section_to_load): New function
7511 replacing add_output_section. Change all callers to call this or
7512 add_output_section_to_nonload.
7513 (Output_segment::add_output_section_to_nonload): New function.
7514 (Output_segment::remove_output_section): Rewrite.
7515 (Output_segment::add_initial_output_data): Likewise.
7516 (Output_segment::has_any_data_sections): Likewise.
7517 (Output_segment::is_first_section_relro): Likewise.
7518 (Output_segment::maximum_alignment): Likewise.
7519 (Output_segment::has_dynamic_reloc): New function replacing
7520 dynamic_reloc_count. Change all callers.
7521 (Output_segment::has_dynamic_reloc_list): New function replacing
7522 dynamic_reloc_count_list. Change all callers.
7523 (Output_segment::set_section_addresses): Rewrite.
7524 (Output_segment::set_offset): Rewrite.
7525 (Output_segment::find_first_and_last_list): Remove.
7526 (Output_segment::set_tls_offsets): Rewrite.
7527 (Output_segment::first_section_load_address): Likewise.
7528 (Output_segment::output_section_count): Likewise.
7529 (Output_segment::section_with_lowest_load_address): Likewise.
7530 (Output_segment::write_section_headers): Likewise.
7531 (Output_segment::print_sections_to_map): Likewise.
7532 * output.h (class Output_data): Remove dynamic_reloc_count_
7533 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7534 (Output_data::add_dynamic_reloc): Rewrite.
7535 (Output_data::has_dynamic_reloc): New function.
7536 (Output_data::dynamic_reloc_count): Remove.
7537 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7538 is_last_relro_, is_first_non_relro_, is_interp_,
7539 is_dynamic_linker_section_ fields. Add order and set_order
7540 functions. Remove is_relro_local, set_is_relro_local,
7541 is_last_relro, set_is_last_relro, is_first_non_relro,
7542 set_is_first_non_relro functions, is_interp, set_is_interp,
7543 is_dynamic_linker_section, and set_is_dynamic_linker_section
7545 (class Output_segment): Change Output_data_list from std::list to
7546 std:;vector. Add output_lists_ field. Remove output_data_ and
7547 output_bss_ fields. Update declarations.
7549 2010-08-02 Ian Lance Taylor <iant@google.com>
7551 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7552 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7553 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7555 2010-08-02 Ian Lance Taylor <iant@google.com>
7558 * script.cc (Script_options::Script_options): Initialize
7559 symbol_definitions_ and symbol_references_.
7560 (Script_options::add_symbol_assignment): Update
7561 symbol_definitions_ and symbol_references_.
7562 (Script_options::add_symbol_reference): New function.
7563 (script_symbol): New function.
7564 * script.h (class Script_options): Add symbol_definitions_ and
7565 symbol_references_ fields.
7566 (Script_options::referenced_const_iterator): New type.
7567 (Script_options::referenced_begin): New function.
7568 (Script_options::referenced_end): New function.
7569 (Script_options::is_referenced): New function.
7570 (Script_options::any_unreferenced): New function.
7571 * script-c.h (script_symbol): Declare.
7572 * yyscript.y (exp): Call script_symbol.
7573 * symtab.cc: Include "script.h".
7574 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7575 Change all callers. Check symbols referenced by scripts.
7576 (Symbol_table::add_undefined_symbols_from_command_line): Add
7577 layout parameter. Change all callers.
7578 (Symbol_table::do_add_undefined_symbols_from_command_line):
7579 Likewise. Break out loop body. Check symbols referenced by
7581 (Symbol_table::add_undefined_symbol_from_command_line): New
7582 function broken out of
7583 do_add_undefined_symbols_from_command_line.
7584 * symtab.h (class Symbol_table): Update declarations.
7585 * archive.cc: Include "layout.h".
7586 (Archive::should_include_member): Add layout parameter. Change
7587 all callers. Check for symbol mentioned in expression.
7588 * archive.h (class Archive): Update declaration.
7589 * object.cc (Sized_relobj::do_should_include_member): Add layout
7591 * object.h (Object::should_include_member): Add layout parameter.
7593 (Object::do_should_include_member): Add layout parameter.
7594 (class Sized_relobj): Update declaration.
7595 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7597 * dynobj.h (class Sized_dynobj): Update declaration.
7598 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7600 * plugin.h (class Sized_pluginobj): Update declaration.
7602 2010-08-02 Ian Lance Taylor <iant@google.com>
7605 * output.cc (Output_segment::set_offset): Search for the first and
7606 last sections rather than assuming that the list is in order.
7607 (Output_segment::find_first_and_last_list): New function.
7608 * output.h (class Output_segment): Update declarations.
7609 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7610 (relro_strip_test_SOURCES): New variable.
7611 (relro_strip_test_DEPENDENCIES): New variable.
7612 (relro_strip_test_LDFLAGS): New variable.
7613 (relro_strip_test_LDADD): New variable.
7614 (relro_strip_test.so): New target.
7616 2010-08-02 Ian Lance Taylor <iant@google.com>
7618 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7619 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7620 (Target_i386::got_tlsdesc_section): New function.
7621 (Target_i386::got_section): Create space for GOT entries for
7622 TLSDESC relocations.
7623 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7625 (Target_i386::Scan::global): Likewise.
7626 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7628 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7629 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7630 (Target_x86_64::got_tlsdesc_section): New function.
7631 (Target_x86_64::got_section): Create space for GOT entries for
7632 TLSDESC relocations.
7633 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7635 (Target_x86_64::Scan::global): Likewise.
7636 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7639 2010-08-02 Ian Lance Taylor <iant@google.com>
7641 * testsuite/final_layout.sh: Use dc to convert from hex to
7644 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7646 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7647 paramter to the call to gold::gc_process_relocs.
7648 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7649 paramter to the call to gold::gc_process_relocs.
7650 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7651 parameter to the call to gold::gc_process_relocs.
7652 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7653 template parameter to the call to gold::gc_process_relocs.
7654 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7655 paramter to the call to gold::gc_process_relocs.
7656 * gc.h (get_embedded_addend_size): New function.
7657 (gc_process_relocs): Save the size of the reloc for use by ICF.
7658 * icf.cc (get_section_contents): Get the addend from the text section
7659 for SHT_REL relocation sections.
7660 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7661 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7662 * int_encoding.h (read_from_pointer): New overloaded function.
7663 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7664 * testsuite/icf_sht_rel_addend_test.sh: New file.
7665 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7666 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7668 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7670 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7671 * Makefile.in: Regenerate.
7672 * testsuite/Makefile.in: Regenerate.
7674 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7676 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7677 * gold/testsuite/debug_msg.cc: Likewise.
7678 * gold/testsuite/odr_violation1.cc
7679 * gold/testsuite/odr_violation2.cc
7681 2010-07-21 Cary Coutant <ccoutant@google.com>
7683 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7684 string, and length fields.
7685 (Output_merge_string::Merged_strings_list): New type.
7686 (Output_merge_string::Merged_strings_lists): New typedef.
7687 (Output_merge_string): Replace merged_strings_ with
7688 merged_strings_lists_.
7689 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7690 Merged_strings_list per input object and section. Don't store pointer
7691 to the string. Don't store length with each merged string entry.
7692 (Output_merge_string::finalize_merged_data): Loop over list of merged
7693 strings lists. Recompute length of each merged string.
7695 2010-07-15 Cary Coutant <ccoutant@google.com>
7697 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7700 2010-07-14 Ian Lance Taylor <iant@google.com>
7702 * descriptors.cc (Descriptors::open): Report correct name in error
7705 2010-07-13 Doug Kwan <dougkwan@google.com>
7707 * arm.cc (Arm_input_section::Arm_input_section): For a
7708 SHT_ARM_EXIDX section, always keeps the input sections.
7709 (Arm_input_section::set_exidx_section_link): New method.
7710 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7711 has_errors_ to false.
7712 (Arm_exidx_input_section::has_errors,
7713 Arm_exidx_input_section::set_has_errors): New methods.
7714 (Arm_exidx_input_section::has_errors_): New data member.
7715 (Arm_relobj::get_exidx_shndx_list): New method.
7716 (Arm_output_section::append_text_sections_to_list): Do not skip
7717 section without SHF_EXECINSTR.
7718 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7720 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7721 section header. Make error messages more verbose. Check for
7722 a non-executable section linked to an EXIDX section.
7723 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7724 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7725 check that there is no deferred EXIDX section if we exit early.
7726 Instead of not making an EXIDX section in case of an error, make one
7727 and set the has_errors flag of it.
7728 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7729 in a relocatable link.
7730 (Target_arm::do_relax): Look for the EXIDX output section instead of
7731 assuming that it is called .ARM.exidx.
7732 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7733 section list. Do not check for SHF_EXECINSTR section flags but
7734 skip any input section with errors.
7735 * output.cc (Output_section::Output_section): Initialize
7736 always_keeps_input_sections_ to false.
7737 (Output_section::add_input_section): Check for
7738 always_keeps_input_sections_.
7739 * output.h (Output_section::always_keeps_input_sections,
7740 Output_section::set_always_keeps_input_sections): New methods.
7741 (Output_section::always_keeps_input_sections): New data member.
7743 2010-07-13 Rafael Espindola <espindola@google.com>
7745 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7746 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7748 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7749 Ian Lance Taylor <iant@google.com>
7751 * output.h (Output_section_lookup_maps::add_merge_section):
7752 Correct check of whether value was inserted.
7753 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7754 (Output_section_lookup_maps::add_relaxed_input_section):
7756 * arm.cc (Target_arm::got_section): Remove used local os.
7757 * i386.cc (Target_i386::got_section): Likewise.
7758 * x86_64.cc (Target_x86_64::got_section): Likewise.
7759 * sparc.cc (Target_sparc::got_section): Likewise.
7760 (Target_sparc::relocate): Remove unused local have_got_offset.
7761 * powerpc.cc (Target_powerpc::relocate): Likewise.
7763 2010-07-13 Ian Lance Taylor <iant@google.com>
7765 * compressed_output.cc (zlib_decompress): Fix signature in
7768 * archive.cc (Archive::include_member): Unlock an external member
7769 of a thin archive. Don't bother to delete an object we know is
7772 2010-07-12 Cary Coutant <ccoutant@google.com>
7774 * compressed_output.cc (zlib_decompress): New function.
7775 (get_uncompressed_size): New function.
7776 (decompress_input_section): New function.
7777 * compressed_output.h (get_uncompressed_size): New function.
7778 (decompress_input_section): New function.
7779 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7780 Handle compressed debug sections.
7781 * layout.cc (is_compressed_debug_section): New function.
7782 (Layout::output_section_name): Map compressed section names to
7784 * layout.h (is_compressed_debug_section): New function.
7785 (is_debug_info_section): Recognize compressed debug sections.
7786 * merge.cc: Include compressed_output.h.
7787 (Output_merge_data::do_add_input_section): Handle compressed
7789 (Output_merge_string::do_add_input_section): Handle compressed
7791 * object.cc: Include compressed_output.h.
7792 (Sized_relobj::Sized_relobj): Initialize new data members.
7793 (build_compressed_section_map): New function.
7794 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7795 * object.h (Object::section_is_compressed): New method.
7796 (Object::do_section_is_compressed): New method.
7797 (Sized_relobj::Compressed_section_map): New type.
7798 (Sized_relobj::do_section_is_compressed): New method.
7799 (Sized_relobj::compressed_sections_): New data member.
7800 * output.cc (Output_section::add_input_section): Handle compressed
7802 * reloc.cc: Include compressed_output.h.
7803 (Sized_relobj::write_sections): Handle compressed debug sections.
7805 2010-07-08 Cary Coutant <ccoutant@google.com>
7807 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7808 weak when resolving to a dynamic def.
7809 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7810 for weak undef/dynamic def cases. Adjust callers.
7811 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7812 undef_binding_weak_.
7813 (Symbol_table::sized_write_globals): Adjust symbol binding.
7814 (Symbol_table::sized_write_symbol): Add binding parameter.
7815 * symtab.h (Symbol::set_undef_binding): New method.
7816 (Symbol::is_undef_binding_weak): New method.
7817 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7818 (Symbol_table::should_override): Add new parameter.
7819 (Symbol_table::sized_write_symbol): Add new parameter.
7821 * testsuite/weak_undef_file1.cc: Add new test case.
7822 * testsuite/weak_undef_file2.cc: Fix header comment.
7823 * testsuite/weak_undef_test.cc: Add new test case.
7825 2010-06-29 Doug Kwan <dougkwan@google.com>
7827 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7828 Initialize USE_SYMBOL_.
7829 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7831 (Arm_reloc_property::uses_symbol_): New data member declaration.
7832 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7833 uses symbol value and symbol is undefined but not weakly undefined.
7835 2010-06-28 Rafael Espindola <espindola@google.com>
7837 * plugin.cc (Plugin::load): Use dlerror.
7839 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7841 * symtab.cc (detect_odr_violations): When reporting an ODR
7842 violation, report an object where the symbol is defined.
7844 2010-06-25 Doug Kwan <dougkwan@google.com>
7846 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7847 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7849 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7850 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7851 target hook to detect function points.
7852 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7853 * icf.h (Icf::check_section_for_function_pointers): Change type of
7854 parameter SECTION_NAME to const reference to std::string. Use
7855 target hook to determine if section may have unsafe pointers.
7856 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7859 2010-06-21 Rafael Espindola <espindola@google.com>
7861 * fileread.cc (Input_file::find_fie): New
7862 (Input_file::open): Use Input_file::find_fie.
7863 * fileread.h (Input_file::find_fie): New
7864 * plugin.cc (set_extra_library_path): New.
7865 (Plugin::load): Add set_extra_library_path to the transfer vector.
7866 (Plugin_manager::set_extra_library_path): New.
7867 (Plugin_manager::add_input_file): Use the extra search path if set.
7868 (set_extra_library_path(): New.
7869 * plugin.h (Plugin_manager): Add set_extra_library_path and
7872 2010-06-19 Cary Coutant <ccoutant@google.com>
7874 * layout.cc (gdb_sections): Add .debug_types.
7875 (lines_only_debug_sections): Likewise.
7877 2010-06-18 Rafael Espindola <espindola@google.com>
7879 * plugin.cc (add_input_file,add_input_library)
7880 (Plugin_manager::add_input_file): Make filename arguments const.
7881 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7884 2010-06-16 Doug Kwan <dougkwan@google.com>
7886 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7887 .ARM.attributes section if we have not merged any input
7888 attributes sections.
7890 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7892 * arm.cc: Allow combining objects with no EABI version
7895 2010-06-15 Rafael Espindola <espindola@google.com>
7897 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7899 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7901 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7902 (struct iovec): Correct !HAVE_READV definition.
7904 2010-06-10 Cary Coutant <ccoutant@google.com>
7906 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7907 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7909 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7912 * symtab.h (Symbol::is_placeholder): New member function.
7913 * target-reloc.h (relocate_section): Check for placeholder symbols.
7915 * testsuite/Makefile.am (plugin_test_8): New test.
7916 (plugin_test_9): New test.
7917 * testsuite/Makefile.in: Regenerate.
7919 2010-06-09 Nick Clifton <nickc@redhat.com>
7921 * yyscript.y (input_list_element): Allow strings prefixed with
7922 the '-' character. Treat these as libraries.
7923 * script.cc (script_add_library): New function. Adds a library
7924 specified by "-l<name>" found in an input script.
7925 * script-c.h: Add prototype for script_add_library.
7927 2010-06-07 Doug Kwan <dougkwan@google.com>
7929 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7930 Restrict stub-group size to be within long conditional branch
7931 range when working around cortex-A8 erratum.
7933 2010-06-07 Damien Diederen <dd@crosstwine.com>
7935 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7938 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7942 (Output_section::Input_section_sort_entry::compare_section_ordering):
7943 Change to return non-zero correctly.
7944 (Output_section::Input_section_sort_section_order_index_compare
7945 ::operator()): Change to fix ambiguity in comparisons.
7947 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7949 * gold.h (is_wildcard_string): New function.
7950 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7951 (Layout::layout_eh_frame): Ditto.
7952 (Layout::find_section_order_index): New method.
7953 (Layout::read_layout_from_file): New method.
7954 * layout.h (Layout::find_section_order_index): New method.
7955 (Layout::read_layout_from_file): New method.
7956 (Layout::input_section_position_): New private member.
7957 (Layout::input_section_glob_): New private member.
7958 * main.cc (main): Call read_layout_from_file here.
7959 * options.h (--section-ordering-file): New option.
7960 * output.cc (Output_section::input_section_order_specified_): New
7962 (Output_section::Output_section): Initialize new member.
7963 (Output_section::add_input_section): Add new parameter.
7964 Keep input sections when --section-ordering-file is used.
7965 (Output_section::set_final_data_size): Sort input sections when
7966 section ordering file is specified.
7967 (Output_section::Input_section_sort_entry): Add new parameter.
7969 (Output_section::Input_section_sort_entry::compare_section_ordering):
7971 (Output_section::Input_section_sort_compare::operator()): Change to
7972 consider section_order_index.
7973 (Output_section::Input_section_sort_init_fini_compare::operator()):
7974 Change to consider section_order_index.
7975 (Output_section::Input_section_sort_section_order_index_compare
7976 ::operator()): New method.
7977 (Output_section::sort_attached_input_sections): Change to sort
7978 according to section order when specified.
7979 (Output_section::add_input_section<32, true>): Add new parameter.
7980 (Output_section::add_input_section<64, true>): Add new parameter.
7981 (Output_section::add_input_section<32, false>): Add new parameter.
7982 (Output_section::add_input_section<64, false>): Add new parameter.
7983 * output.h (Output_section::add_input_section): Add new parameter.
7984 (Output_section::input_section_order_specified): New
7986 (Output_section::set_input_section_order_specified): New method.
7987 (Input_section::Input_section): Initialize section_order_index_.
7988 (Input_section::section_order_index): New method.
7989 (Input_section::set_section_order_index): New method.
7990 (Input_section::section_order_index_): New member.
7991 (Input_section::Input_section_sort_section_order_index_compare): New
7993 (Output_section::input_section_order_specified_): New member.
7994 * script-sections.cc (is_wildcard_string): Delete and move modified
7996 (Output_section_element_input::Output_section_element_input): Modify
7997 call to is_wildcard_string.
7998 (Output_section_element_input::Input_section_pattern
7999 ::Input_section_pattern): Ditto.
8000 (Output_section_element_input::Output_section_element_input): Ditto.
8001 * testsuite/Makefile.am (final_layout): New test case.
8002 * testsuite/Makefile.in: Regenerate.
8003 * testsuite/final_layout.cc: New file.
8004 * testsuite/final_layout.sh: New file.
8006 2010-06-01 Rafael Espindola <espindola@google.com>
8008 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8010 2010-06-01 Rafael Espindola <espindola@google.com>
8012 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8013 visibility of symbols.
8015 2010-05-27 Doug Kwan <dougkwan@google.com>
8017 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8018 from start of output section instead of address for a local symbol
8019 in a merged or relaxed section when doing a relocatable link.
8021 2010-05-26 Rafael Espindola <espindola@google.com>
8024 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8025 adding sections the garbage collector removed.
8026 * gold/testsuite/Makefile.am: Add test.
8027 * gold/testsuite/Makefile.in: Regenerate.
8028 * gold/testsuite/plugin_test_7.sh: New.
8029 * gold/testsuite/plugin_test_7_1.c: New.
8030 * gold/testsuite/plugin_test_7_2.c: New.
8032 2010-05-26 Rafael Espindola <espindola@google.com>
8034 * script-sections.cc (Output_section_definition::set_section_addresses):
8035 Check for --section-start.
8037 2010-05-26 Doug Kwan <dougkwan@google.com>
8039 * arm.cc (Arm_scan_relocatable_relocs): New class.
8040 (Target_arm::relocate_special_relocatable): New method.
8041 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8042 (Arm_relocate_functions::thumb_branch_common): Same.
8043 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8044 instead of Default_scan_relocatable_relocs.
8045 * target-reloc.h (relocate_for_relocatable): Let target handle
8046 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8047 * target.h (Sized_target::relocate_special_relocatable): New method.
8049 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8051 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8053 2010-05-23 Doug Kwan <dougkwan@google.com>
8055 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8057 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8058 with a direct branch, not a conditional branch, to a stub.
8059 * merge.cc (Output_merge_base::record_input_section): New method
8061 (Output_merge_data::do_add_input_section): Record input section if
8062 keeps-input-sections flag is set.
8063 (Output_merge_string::do_add_input_section): Ditto.
8064 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8065 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8067 (Output_merge_base::keeps_input_sections,
8068 Output_merge_base::set_keeps_input_sections,
8069 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8071 (Output_merge_base::Input_sections): New type declaration.
8072 (Output_merge_base::input_sections_begin,
8073 Output_merge_base::input_sections_end,
8074 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8075 (Output_merge_base::bool keeps_input_sections_,
8076 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8077 Output_merge_base::input_sections_): New data members.
8078 (Output_merge_data::do_set_keeps_input_sections): New method
8080 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8081 * output.cc (Output_section::Input_section::relobj): Move method
8082 defintion from class declaration to here and handle merge sections.
8083 (Output_section::Input_section::shndx): Ditto.
8084 (Output_section::Output_section): Remove initializations of removed
8085 data members and initialize new data member LOOKUP_MAPS_.
8086 (Output_section::add_input_section): Set keeps-input-sections flag
8087 for a newly created merge output section as appropriate. Adjust code
8088 to use Output_section_lookup_maps class.
8089 (Output_section::add_relaxed_input_section): Adjst code for lookup
8090 maps code refactoring.
8091 (Output_section::add_merge_input_section): Add a new parameter
8092 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8093 class. If adding input section to a newly created merge output
8094 section fails, remove the new merge section.
8095 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8096 Adjust code for use of the Output_section_lookup_maps class.
8097 (Output_section::find_merge_section): Ditto.
8098 (Output_section::build_lookup_maps): New method defintion.
8099 (Output_section::find_relaxed_input_section): Adjust code to use
8100 Output_section_lookup_maps class.
8101 (Output_section::get_input_sections): Export merge sections. Adjust
8102 code to use Output_section_lookup_maps class.
8103 (Output_section:::add_script_input_section): Adjust code to use
8104 Output_section_lookup_maps class. Update lookup maps for merge
8106 (Output_section::discard_states): Use Output_section_lookup_maps.
8107 (Output_section::restore_states): Same.
8108 * output.h (Merge_section_properties): Move class defintion out of
8110 (Output_section_lookup_maps): New class.
8111 (Output_section::Input_section::is_merge_section): New method
8113 (Output_section::Input_section::relobj): Move defintion out of class
8114 defintion. Declare method only.
8115 (Output_section::Input_section::shndx): Ditto.
8116 (Output_section::Input_section::output_merge_base): New method defintion.
8117 (Output_section::Input_section::u2_.pomb): New union field.
8118 (Output_section::Merge_section_by_properties_map,
8119 Output_section::Output_section_data_by_input_section_map,
8120 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8122 (Output_section::add_merge_input_section): Add new parameter
8123 KEEPS_INPUT_SECTIONS.
8124 (Output_section::build_lookup_maps): New method declaration.
8125 (Output_section::merge_section_map_,
8126 Output_section::merge_section_by_properties_map_,
8127 Output_section::relaxed_input_section_map_,
8128 Output_section::is_relaxed_input_section_map_valid_): Remove data
8130 (Output_section::lookup_maps_): New data member.
8132 2010-05-21 Doug Kwan <dougkwan@google.com>
8135 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8136 avoid a compilation error.
8138 2010-05-19 Rafael Espindola <espindola@google.com>
8140 * script-sections.cc (Output_section_definition::allocate_to_segment):
8141 Update the phdrs_list even when the output section is NULL.
8142 * testsuite/Makefile.am: Add test.
8143 * testsuite/Makefile.in: Regenerate.
8144 * testsuite/script_test_9.cc: New.
8145 * testsuite/script_test_9.sh: New.
8146 * testsuite/script_test_9.t: New.
8148 2010-05-19 Doug Kwan <dougkwan@google.com>
8150 * arm.cc (Arm_input_section::original_size): New method.
8151 (Arm_input_section::do_addralign): Add a cast.
8152 (Arm_input_section::do_output_offset): Remove static cast.
8153 (Arm_input_section::original_addralign,
8154 Arm_input_section::original_size_): Change type to uint32_t.
8155 (Arm_input_section::init): Add safe casts for section alignment
8157 (Arm_input_section::set_final_data_size): Do not set address and
8158 offset of stub table.
8159 (Arm_output_section::fix_exidx_coverage): Change use of of
8160 Output_section::Simple_input_section to that of
8161 Output_section::Input_section.
8162 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8163 except for the first pass.
8164 * output.cc (Output_section::get_input_sections): Change type of
8165 input_sections to std::list<Input_section>.
8166 (Output_section::add_script_input_section): Rename from
8167 Output_section::add_simple_input_section. Change type of SIS
8168 parameter from Simple_input_section to Input_section.
8169 * output.h (Output_section::Simple_input_section): Remove class.
8170 (Output_section::Input_section): Change class visibility to public.
8171 (Output_section::Input_section::addralign): Use stored alignments
8172 for special input sections if set.
8173 (Output_section::Input_section::set_addralign): New method.
8174 (Output_section::get_input_sections): Change parameter type from
8175 list of Simple_input_section to list of Input_section.
8176 (Output_section::add_script_input_section): Rename from
8177 Output_section::add_simple_input_section. Change first parameter's
8178 type from Simple_input_section to Input_section and remove the
8179 second and third parameters.
8180 * script-sections.cc (Input_section::Input_section_list): Change
8181 type to list of Output_section::Input_section/
8182 (Input_section_info::Input_section_info): Change parameter type of
8183 INPUT_SECTION to Output_section::Input_section.
8184 (Input_section_info::input_section): Change return type.
8185 (Input_section_info::input_section_): Change type to
8186 Output_section::Input_section.
8187 (Output_section_element_input::set_section_addresses): Adjust code
8188 to use Output_section::Input_section instead of
8189 Output_section::Simple_input_section. Adjust code for renaming
8190 of Output_section::add_simple_input_section.
8191 (Orphan_output_section::set_section_addresses): Ditto.
8193 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8195 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8196 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8198 2010-05-18 Rafael Espindola <espindola@google.com>
8200 * options.cc (General_options::finalize): Handle -nostdlib.
8201 * options.h (nostdlib): New option.
8202 * script.cc (script_add_search_dir): Handle -nostdlib.
8204 2010-05-12 Doug Kwan <dougkwan@google.com>
8206 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8207 attributes section only if there no attributes section after merging.
8208 (Target_arm::merge_object_attributes): Move value of
8209 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8210 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8211 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8212 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8213 and arm_attr_merge_7.stdout.
8214 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8215 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8216 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8217 arm_attr_merge_7b.o): New rules.
8218 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8220 * testsuite/Makefile.in: Regenerate.
8221 * testsuite/arm_attr_merge.sh: New file.
8222 * testsuite/arm_attr_merge_[67][ab].s: Same.
8224 2010-05-05 Nick Clifton <nickc@redhat.com>
8226 * po/es.po: Updated Spanish translation.
8228 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8230 * Makefile.am (install-exec-local): Properly install gold as
8231 default cross linker.
8232 * Makefile.in: Regenerated.
8234 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8235 Nick Clifton <nickc@redhat.com>
8237 * configure.ac (install_as_default): Define and set to false
8238 unless --enable-gold or --enable-gold=both/gold has been
8240 * configure: Regenerate.
8242 * Makefile.am (install-exec-local): Install the executable as
8243 'ld.gold'. If install_as_default is true then also install it as
8245 * Makefile.in: Regenerated.
8247 2010-04-24 Ian Lance Taylor <iant@google.com>
8249 * layout.cc (Layout::layout_reloc): In relocatable link don't
8250 combine reloc sections for grouped sections.
8252 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8254 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8255 sections that are not ordinary to icf.
8256 * icf.cc (get_section_contents): Handle relocation pointing to section
8257 with no object or shndx information.
8258 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8259 * testsuite/Makefile.in: Regenerate.
8260 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8261 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8263 2010-04-22 Ian Lance Taylor <iant@google.com>
8265 * expression.cc (Expression::Expression_eval_info): Add
8266 result_alignment_pointer field.
8267 (Expression::eval_with_dot): Add result_alignment_pointer
8268 parameter. Change all callers.
8269 (Expression::eval_maybe_dot): Likewise.
8270 (class Binary_expression): Add alignment_pointer parameter to
8271 left_value and right_value. Change all callers.
8272 (BINARY_EXPRESSION): Set result alignment.
8273 (class Trinary_expression): Add alignment_pointer parameter to
8274 arg2_value and arg3_value. Change all callers.
8275 (Trinary_cond::value): Set result alignment.
8276 (Max_expression::value, Min_expression::value): Likewise.
8277 (Align_expression::value): Likewise.
8278 * script-sections.cc (class Sections_element): Add dot_alignment
8279 parameter to set_section_addresses virtual function. Update
8281 (class Output_section_element): Likewise.
8282 (Script_sections::create_segments): Add dot_alignment parameter.
8284 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8285 (Script_sections::set_phdrs_clause_addresses): Likewise.
8286 * script-sections.h: Update declarations.
8287 * script.h: Update declarations.
8288 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8290 * testsuite/script_test_3.t: Set large alignment.
8291 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8292 segment has expected alignment.
8294 2010-04-22 Nick Clifton <nickc@redhat.com>
8296 * po/gold.pot: Updated by the Translation project.
8297 * po/vi.po: Updated Vietnamese translation.
8299 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8301 * testsuite/Makefile.am (check_PROGRAMS): Add
8302 icf_virtual_function_folding_test.
8303 * testsuite/Makefile.in: Regenerated.
8305 2010-04-15 Andrew Haley <aph@redhat.com>
8307 * options.h (merge_exidx_entries): New option.
8308 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8309 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8310 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8311 (Target_arm::merge_exidx_entries): New function.
8312 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8313 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8314 to Arm_exidx_fixup constructor.
8315 Add new arg, merge_exidx_entries.
8316 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8317 Arm_output_section::fix_exidx_coverage.
8319 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8321 * icf.cc (get_section_contents): Check for preemptible functions.
8322 Ignore addend when appropriate.
8323 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8325 (add_from_relobj): Check for section folded.
8326 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8327 * symtab.h (should_add_dynsym_entry): Add new parameter.
8328 * target-reloc.h (scan_relocs): Check for section folded.
8329 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8330 Check reloc types for function pointers in shared objects.
8331 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8333 (icf_preemptible_functions_test): New test case.
8334 (icf_string_merge_test): New test case.
8335 * testsuite.Makefile.in: Regenerate.
8336 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8337 bar_glob. Refactor code.
8338 * testsuite/icf_preemptible_functions_test.cc: New file.
8339 * testsuite/icf_preemptible_functions_test.sh: New file.
8340 * testsuite/icf_string_merge_test.cc: New file.
8341 * testsuite/icf_string_merge_test.sh: New file.
8342 * testsuite/icf_virtual_function_folding_test.cc: New file.
8343 * testsuite/icf_virtual_function_folding_test.sh: New file.
8345 2010-04-14 Doug Kwan <dougkwan@google.com>
8347 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8348 for local symbol recounting if we remove a section due to ICF.
8349 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8350 there are no regular objects in input.
8352 2010-04-13 Doug Kwan <dougkwan@google.com>
8354 * arm.cc (Arm_input_section::set_final_data_size): Compute
8355 accurate final data size instead of using current data size.
8357 2010-04-09 Doug Kwan <dougkwan@google.com>
8359 * layout.cc (Layout::choose_output_section): Handle script section
8361 (Layout::make_output_section_for_script): Add section type parameter.
8362 Handle script section types.
8363 * layout.h (Layout::make_output_section_for_script): Add section
8365 * output.cc (Output_section::Output_section): Initialize data member
8367 (Output_section::do_reset_address_and_file_offset): Do not set address
8368 to 0 if section is a NOLOAD section.
8369 * output.h (Output_section::is_noload): New method.
8370 (Output_section::set_is_noload): Ditto.
8371 (Output_section::is_noload_): New data member.
8372 * script-c.h (Script_section_type): New enum type.
8373 (struct Parser_output_section_header): Add new file section_type.
8374 * script-sections.cc (Sections_element::output_section_name): Add
8375 parameter for returning script section type.
8376 (Output_section_definition::output_section_name): Ditto.
8377 (Output_section_definition::section_type)P; New method.
8378 (Output_section_definiton::script_section_type_name): Ditto.
8379 (Output_section_definition::script_section_type_): New data member.
8380 (Output_section_definition::Output_section_definition): Initialize
8381 data member Output_section_definition::script_section_type_.
8382 (Output_section_definition::create_sections): Pass script section type
8383 to Layout::make_output_section_for_script.
8384 (Output_section_definition::output_section_name): Return script
8385 section type to caller.
8386 (Output_section_definition::set_section_address): Do not advance
8387 dot value and load address if section type is NOLOAD. Set address
8388 of NOLOAD sections regardless of section flags.
8389 (Output_section_definition::print): Print section type if it is
8390 not SCRIPT_SECTION_TYPE_NONE.
8391 (Output_section_definition::section_type): New method.
8392 (Output_section_definition::script_section_type_name): Ditto.
8393 (Script_sections::output_section_name): Add new parameter
8394 PSECTION_TYPE for returning script section type. Pass it to
8395 section elements. Handle discard sections.
8396 (Sort_output_sections::operator()): Handle NOLOAD sections.
8397 * script-sections.h (Script_sections::Section_type): New enum type.
8398 (Script_sections::output_section_name): Add a new parameter for
8399 returning script section type.
8400 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8402 * yyscript.y (union): Add new field SECTION_TYPE.
8403 (COPY, DSECT, INFO, NOLOAD): New tokens.
8404 (opt_address_and_section_type): Change type to output_section_header.
8405 (section_type): New non-terminal
8406 (section_header): Handle section type.
8407 (opt_address_and_section_type): Return section type value.
8409 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8411 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8412 * testsuite/plugin_common_test_2.c (foo): Likewise.
8414 2010-04-08 Doug Kwan <dougkwan@google.com>
8416 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8418 * output.cc (Output_section::add_merge_input_section): Simplify
8419 code and return status of Output_merge_base::add_input_section.
8420 Update merge section map only if Output_merge_base::add_input_section
8423 2010-04-07 Doug Kwan <dougkwan@google.com>
8425 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8426 if section is marked as containing instructions but has no mapping
8428 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8429 correct section index.
8430 (Arm_relobj::find_linked_text_section): Ditto.
8432 2010-04-07 Cary Coutant <ccoutant@google.com>
8434 * archive.cc (include_member): Destroy Read_symbols_data object before
8436 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8437 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8438 (Read_symbols_data::~Read_symbols_data) New destructor.
8439 (Section_relocs::Section_relocs) New constructor.
8440 (Section_relocs::~Section_relocs) New destructor.
8441 (Read_relocs_data::Read_relocs_data) New constructor.
8442 (Read_relocs_data::~Read_relocs_data) New destructor.
8443 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8444 pointers to NULL after deleting.
8446 2010-04-07 Doug Kwan <dougkwan@google.com>
8448 * arm.cc: Replace "endianity" with "endianness" in comments.
8449 (Arm_exidx_cantunwind): Ditto.
8450 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8451 (Arm_relobj::merge_flags_and_attributes): New method.
8452 (Arm_relobj::merge_flags_and_attributes_): New data member.
8453 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8454 (Arm_relobj::scan_sections_for_stubs): Ditto.
8455 (Arm_relobj::do_read_symbols): Check to see if we really want to
8456 merge processor-specific flags and attributes. Exit early if
8457 an object is empty except for section names and the undefined symbol.
8458 (Target_arm::do_finalize_sections): Move check for ELF format to
8459 Arm_relobj::do_read_symbols. Merge processor specific flags and
8460 attributes from a regular object only when we have determined that
8461 it is aapropriate. Do not create an .ARM.attributes section in
8462 output if there is no regular input object.
8463 (Target_arm::merge_processor_specific_flags): Check
8464 --warn-mismatch before printing any error.
8465 (Target_arm::merge_object_attributes): Ditto.
8466 * gold.cc (queue_middle_tasks): Handle the case in which there is
8467 no regular object in input.
8468 * options.cc (General_options::parse_EB): New method.
8469 (General_options::parse_EL): Same.
8470 (General_options::General_options): Initialize endianness_.
8471 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8473 (General_options::Endianness): New enum.
8474 (General_options::endianness): New method.
8475 (General_options::endianness_): New data member.
8476 * parameters.cc (Parameters::set_options): Check target endianness.
8477 (Parameters::set_target_once): Ditto.
8478 (Parameters::check_target_endianness): New method.
8479 (parameters_force_valid_target): If either -EL or -EB is specified,
8480 use it to define endianness of default target.
8481 * parameters.h (Parameters::check_target_endianness): New method
8483 * target.h (class Target): Change "endianity" to "endianness"
8486 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8488 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8489 * configure: Regenerate.
8490 * Makefile.in: Regenerate.
8491 * testsuite/Makefile.in: Regenerate.
8493 2010-04-06 Cary Coutant <ccoutant@google.com>
8496 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8497 prevailing definitions of common symbols.
8498 * testsuite/plugin_test_6.sh: New test case.
8499 * testsuite/plugin_common_test_1.c: New test case.
8500 * testsuite/plugin_common_test_2.c: New test case.
8501 * testsuite/Makefile.am (plugin_test_6): New test case.
8502 * testsuite/Makefile.in: Regenerate.
8504 2010-04-06 Nick Clifton <nickc@redhat.com>
8506 * po/vi.po: New Vietnamese translation.
8508 2010-03-30 Doug Kwan <dougkwan@google.com>
8510 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8512 2010-03-25 Doug Kwan <dougkwan@google.com>
8514 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8515 to avoid a conversion warning on a 32-bit host.
8517 2010-03-24 Ian Lance Taylor <iant@google.com>
8519 * testsuite/script_test_3.t: Add a TLS segment.
8520 * testsuite/Makefile.am (check_PROGRAMS): Add
8521 tls_phdrs_script_test.
8522 (tls_phdrs_script_test_SOURCES): Define.
8523 (tls_phdrs_script_test_DEPENDENCIES): Define.
8524 (tls_phdrs_script_test_LDFLAGS): Define.
8525 (tls_phdrs_script_test_LDADD): Define.
8526 * testsuite/Makefile.in: Rebuild.
8528 2010-03-23 Cary Coutant <ccoutant@google.com>
8530 * fileread.cc (find_or_make_view): Fix comment.
8532 2010-03-23 Ian Lance Taylor <iant@google.com>
8534 * script-sections.cc (class Orphan_section_placement): Define
8535 PLACE_TLS and PLACE_TLS_BSS.
8536 (Orphan_section_placement::Orphan_section_placement): Initialize
8538 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8539 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8540 (tls_script_test_SOURCES): Define.
8541 (tls_script_test_DEPENDENCIES): Define.
8542 (tls_script_test_LDFLAGS): Define.
8543 (tls_script_test_LDADD): Define.
8544 * testsuite/Makefile.in: Rebuild.
8546 2010-03-22 Doug Kwan <dougkwan@google.com>
8548 * arm.cc (Arm_relocate_functions::abs8,
8549 Arm_relocate_functions::abs16): Use correct check for overflow
8550 specified in the ARM ELF specs.
8551 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8552 target of a BLX instruction specially.
8553 (Reloc_stub::stub_type_for_reloc): Ditto.
8554 (Relocate::relocate): Use symbolic names instead of numeric relocation
8555 codes to report error.
8556 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8558 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8559 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8560 thumb2_blx_out_of_range.stdout
8561 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8562 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8563 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8564 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8565 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8566 thumb2_blx_in_range, thumb2_blx_in_range.o,
8567 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8568 thumb2_blx_out_of_range.o): New rules.
8569 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8570 thumb2_blx_in_range and thumb2_blx_out_of_range.
8571 * testsuite/Makefile.in: Regenerate.
8572 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8573 * testsuite/thumb_blx_in_range.s: New file.
8574 * testsuite/thumb_blx_out_of_range.s: New file.
8576 2010-03-22 Rafael Espindola <espindola@google.com>
8578 * archive.cc (Should_include): Move to archive.h.
8579 (should_include_member): Make it a member of Archive.
8581 (Add_lib_group_symbols): New.
8582 * archive.h: Include options.h.
8583 (Archive_member): Moved from Archive.
8584 (Should_include): Moved from archive.cc.
8586 (Add_lib_group_symbols): New.
8587 * dynobj.cc (do_should_include_member): New.
8588 * dynobj.h (do_should_include_member): New.
8589 * gold.cc (queue_initial_tasks): Update call to queue.
8590 * main.cc (main): Print lib group stats.
8591 * object.cc (do_should_include_member): New.
8592 * object.h: Include archive.h.
8593 (Object::should_include_member): New.
8594 (Object::do_should_include_member): New.
8595 (Sized_relobj::do_should_include_member): New.
8596 * options.cc (General_options::parse_start_lib): New.
8597 (General_options::parse_end_lib): New.
8598 (Input_arguments::add_file): Handle lib groups.
8599 (Input_arguments::start_group): Check we are not in a lib.
8600 (Input_arguments::start_lib): New.
8601 (Input_arguments::end_lib): New.
8602 * options.h (General_options): Add start_lib and end_lib.
8603 (Input_argument::lib_): New.
8604 (Input_argument::lib): New.
8605 (Input_argument::is_lib): New.
8606 (Input_file_lib): New.
8607 (Input_arguments::in_lib_): New.
8608 (Input_arguments::in_lib): New.
8609 (Input_arguments::start_lib): New.
8610 (Input_arguments::end_lib_): New.
8611 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8612 in unused members as preempted.
8613 (Sized_pluginobj::do_should_include_member): New.
8614 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8615 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8617 (Read_symbols::do_whole_lib_group): New.
8618 (Read_symbols::do_lib_group): New.
8619 (Read_symbols::do_read_symbols): Handle lib groups.
8620 (Read_symbols::get_name): Handle lib groups.
8621 * readsyms.h (Read_symbols): Add an archive member pointer.
8622 (Read_symbols::do_whole_lib_group): New.
8623 (Read_symbols::do_lib_group): New.
8624 (Read_symbols::member_): New.
8625 * script.cc (read_input_script): Update call to queue_soon.
8627 2010-03-19 Doug Kwan <dougkwan@google.com>
8629 * arm.cc (Stub_table::Stub_table): Initialize new data members
8630 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8631 (Stub_table::add_reloc_stub): Assign stub offset and update
8632 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8633 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8635 (Stub_table::update_data_size_and_addralign): Use
8636 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8637 instead of going over all reloc stubs.
8638 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8639 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8640 Stringpool_template::offset_ to size of Stringpool_char.
8641 (Stringpool_template::new_key_offset): Remove code to initialize
8642 Stringpool_template::offset_.
8643 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8644 Stringpool_template::offset_ to zero.
8646 2010-03-15 Doug Kwan <dougkwan@google.com>
8648 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8650 (Stringpool_template::new_key_offset): New method.
8651 (Stringpool_template::add_string): Assign offsets when adding new
8653 (Stringpool_template::set_string_offsets): Do not set string offsets
8654 when not optimizing.
8655 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8657 (Chunked_vector::clear): Clear size_.
8658 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8659 (Chunked_vector::size): Return size_.
8660 (Chunked_vector::push_back): Use size_ to find insert position.
8661 (Chunked_vector::size_): New data member.
8662 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8663 (Stringpool_template::new_key_offset): New method declaration.
8664 (Stringpool_template::offset_): New data member.
8666 2010-03-15 Rafael Espindola <espindola@google.com>
8668 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8669 Add_symbols' constructor.
8670 * readsyms.h (Add_symbols): Remove the input_group member.
8672 2010-03-10 Ian Lance Taylor <iant@google.com>
8674 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8675 target to ask whether a reference to a symbol requires a stack
8677 * target.h (Target::is_call_to_non_split): New function.
8678 (Target::do_is_call_to_non_split): Declare virtual function.
8679 * target.cc: Include "symtab.h".
8680 (Target::do_is_call_to_non_split): New function.
8681 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8683 2010-03-10 Cary Coutant <ccoutant@google.com>
8685 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8686 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8687 (File_read::open[2]): Add whole_file_view_ to list of views.
8688 (File_read::make_view): Remove test of whole_file_view_.
8689 (File_read::find_or_make_view): Create whole_file_view_ if
8691 (File_read::clear_views): Replace bool parameter with enum;
8692 adjust all callers. Don't delete views with permanent data;
8693 do delete cached views and views from archives if
8694 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8695 if clearing the corresponding view.
8696 * fileread.h (File_read::Clear_views_mode): New enum.
8697 (File_read::View::is_permanent_view): New method.
8698 (File_read::clear_views): Replace bool parameter
8699 with enum; adjust all callers.
8700 * options.h (General_options): Change keep_files_mapped option;
8701 add map_whole_files.
8702 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8704 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8707 2010-03-10 David S. Miller <davem@davemloft.net>
8709 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8711 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8713 * icf.cc (get_section_contents): Add '@' marker after processing the
8716 2010-03-08 Doug Kwan <dougkwan@google.com>
8718 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8719 due to a conversion warning.
8720 (Arm_relobj::update_output_local_symbol_count): Check for local
8721 symbol with unset output index.
8723 2010-03-05 Ian Lance Taylor <iant@google.com>
8725 * options.h (class General_options): Add --spare-dynamic-tags.
8726 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8727 --spare-dynamic-tags.
8729 2010-03-05 Ian Lance Taylor <iant@google.com>
8731 * incremental.cc: Include "libiberty.h".
8733 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8735 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8736 function, is_info_ member.
8737 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8738 (Versions::Versions): Update caller.
8739 (Versions::define_base_version): Likewise.
8740 (Versions::add_def): Likewise.
8742 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8744 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8745 (Scan::possible_function_pointer_reloc): New function.
8746 (Scan::local_reloc_may_be_function_pointer): Change to call
8747 possible_function_pointer_reloc.
8748 (Scan::global_reloc_may_be_function_pointer): Ditto.
8749 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8750 relocations in ".data.rel.ro._ZTV" section.
8751 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8752 * testsuite/icf_safe_so_test.cc: Ditto.
8753 * testsuite/icf_safe_test.cc: Ditto.
8754 * testsuite/icf_safe_test.sh: Ditto.
8756 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8757 Ian Lance Taylor <iant@google.com>
8759 * target-reloc.h (relocate_section): Check the symbol table index
8760 for -1U before setting the local symbol index.
8761 (scan_relocatable_relocs): If copying the relocation, record that
8762 the local symbol is required.
8763 * object.h (Symbol_value::is_output_symtab_index_set): New
8765 (Symbol_value::may_be_discarded_from_output_symtab): New
8767 (Symbol_value::has_output_symtab_entry): New function.
8768 (Symbol_value::needs_output_symtab_entry): Remove.
8769 (Symbol_value::output_symtab_index): Make sure the symbol index is
8771 (Symbol_value::set_output_symtab_index): Make sure the symbol
8772 index is not set. Make sure the new index is valid.
8773 (Symbol_value::set_must_have_output_symtab_entry): New function.
8774 (Symbol_value::has_output_dynsym_entry): New function.
8775 (Symbol_value::set_output_dynsym_index): Make sure the new index
8777 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8778 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8779 local symbol if permitted.
8780 (Sized_relobj::do_finalize_local_symbols): Call
8781 is_output_symtab_index_set rather than needs_output_symtab_entry.
8782 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8783 rather than needs_output_symtab_entry. Call
8784 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8785 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8786 is_output_symtab_index_set rather than needs_output_symtab_entry.
8787 * testsuite/discard_locals_relocatable_test.c: New file.
8788 * testsuite/discard_locals_test.sh: Test -r.
8789 * testsuite/Makefile.am (check_DATA): Add
8790 discard_locals_relocatable_test1.syms,
8791 discard_local_relocatable_test2.syms.
8792 (MOSTLYCLEANFILES): Likewise. Also add
8793 discard_locals_relocatable_test1.lout and
8794 discard_locals_relocatable_test2.out.
8795 (discard_locals_relocatable_test1.syms): New target.
8796 (discard_locals_relocatable_test.o): New target.
8797 (discard_locals_relocatable_test1.out): New target.
8798 (discard_locals_relocatable_test2.syms): New target.
8799 (discard_locals_relocatable_test2.out): New target.
8800 (various): Add missing ../ld-new dependencies.
8801 * testsuite/Makefile.in: Rebuild.
8803 2010-03-03 Nick Clifton <nickc@redhat.com>
8805 * po/fi.po: New Finnish translation.
8807 2010-03-01 Doug Kwan <dougkwan@google.com>
8809 * layout.cc (Layout::Layout): Force section types of .init_array*,
8810 .preinit_array* and .fini_array* sections.
8811 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8812 Fix check of return value of std::string::find.().
8813 (Output_section::Input_section_sort_compare::operator()): Remove
8814 comment about .init_array.
8815 (Output_section::Input_section_sort_init_fini_compare::operator()):
8817 (Output_section::sort_attached_input_sections): Handle .init_array
8818 and .fini_array specially.
8819 * output.h (Output_section::Inut_section_sort_compare): Update
8821 (Output_section::Input_section_sort_init_fini_compare): New struct.
8823 2010-02-26 Doug Kwan <dougkwan@google.com>
8825 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8826 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8827 * testsuite/debug_msg.sh: Avoid matching source line number for
8828 use of global variable undef_int.
8830 2010-02-26 Doug Kwan <dougkwan@google.com>
8832 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8833 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8834 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8835 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8836 * options.cc (General_options::General_options): Initialize member
8838 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8839 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8840 and rm_no_fix_v4bx.stdout
8841 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8842 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8843 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8844 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8845 and arm_no_fix_v4bx.
8846 * Makefile.in: Regenerate.
8847 * testsuite/arm_fix_v4bx.s: New file.
8848 * testsuite/arm_fix_v4bx.sh: Ditto.
8850 2010-02-24 Doug Kwan <dougkwan@google.com>
8852 * arm.cc (Target_arm::got_section): Make the .got section the first
8853 non RELRO section in the data segment.
8854 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8855 suffixes of section names.
8857 2010-02-24 Doug Kwan <dougkwan@google.com>
8859 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8860 flags and attributes merging if an input file is a binary file.
8861 * fileread.cc (Input_file::open): Record format of original file.
8862 * fileread.h (Input_file::Format): New enum type.
8863 (Input_file::Input_file): Initialize data member format_.
8864 (Input_file::format): New method definition.
8865 (Input_file::format_):: New data member.
8867 2010-02-24 Doug Kwan <dougkwan@google.com>
8869 * arm.cc (Arm_output_data_got): New class.
8870 (ARM_TCB_SIZE): New constant
8871 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8872 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8873 If user uses a script with a SECTIONS clause, issue only a warning
8874 for a misplaced EXIDX input section. Otherwise, issue an error.
8875 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8877 (Target_arm::got_mode_index_entry): Handle static linking.
8878 (Target_arm::Scan::local): Ditto.
8879 (Target_arm::Scan::global): Ditto.
8880 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8881 all incorrectly implemented relocations.
8882 (Target_arm::fix_exidx_coverage): Pass layout to
8883 Arm_output_section::fix_exidx_coverage.
8884 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8885 from ".ARM.exidx." and ".ARM.extab.".
8887 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8889 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8890 section if it does not already exist.
8891 * attributes.cc (Attributes_section_data::Attributes_section_data):
8892 Don't crash if size is zero.
8894 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8895 Ian Lance Taylor <iant@google.com>
8897 * gold.cc (queue_middle_tasks): If no input files were opened,
8899 * workqueue.h (Task_function::Task_function): Assert that there is
8902 2010-02-22 Doug Kwan <dougkwan@google.com>
8904 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8905 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8906 types to avoid warnings due to different uint64_t implementations
8909 2010-02-21 Doug Kwan <dougkwan@google.com>
8911 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8912 handling of the maximum backward branch offset.
8913 (Arm_relocate_functions::thumb_branch_common): Ditto.
8914 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8915 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8916 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8917 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8918 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8919 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8920 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8921 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8922 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8923 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8924 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8925 thumb2_bl_out_of_range.o): New rules.
8926 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8927 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8928 thumb2_bl_out_of_range
8929 * testsuite/Makefile.in: Regenerate.
8930 * testsuite/arm_bl_in_range.s: New file.
8931 * testsuite/arm_bl_out_of_range.s: Ditto.
8932 * testsuite/arm_branch_in_range.sh: Ditto.
8933 * testsuite/arm_branch_range.t: Ditto.
8934 * testsuite/thumb2_branch_range.t: Ditto.
8935 * testsuite/thumb_bl_in_range.s: Ditto.
8936 * testsuite/thumb_bl_out_of_range.s: Ditto.
8937 * testsuite/thumb_branch_range.t: Ditto.
8939 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8941 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8942 Add reloc offset information.
8943 * icf.cc (get_section_contents): Change iterators to point to the new
8944 vectors. Add reloc offset information to the contents.
8945 * icf.h (Icf::Sections_reachable_info): New typedef.
8946 (Icf::Sections_reachable_list): New typedef.
8947 (Icf::Offset_info): New typedef.
8948 (Icf::Reloc_info): New struct typedef.
8949 (Icf::Reloc_info_list): New typedef.
8950 (Icf::symbol_reloc_list): Delete method.
8951 (Icf::addend_reloc_list): Delete method.
8952 (Icf::section_reloc_list): Delete method.
8953 (Icf::reloc_info_list): New method.
8954 (Icf::reloc_info_list_): New member.
8956 2010-02-19 Doug Kwan <dougkwan@google.com>
8958 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8959 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8960 * arm.cc (Arm_relocation_functions): New forward declaration.
8961 (Target_arm::Target_arm): Initialize new data members
8962 got_mod_index_offset_ and tls_base_symbol_defined_.
8963 (Target_arm::Relocate::relocate_tls): New method.
8964 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8965 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8967 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8968 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8969 (Target_arm::got_mod_index_offset_,
8970 Target_arm::tls_base_symbol_defined_): New data members.
8971 (Target_arm::Scan::local, Target::Scan::global,
8972 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8975 2010-02-18 Doug Kwan <dougkwan@google.com>
8977 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8978 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8979 text section as a parameter becuase some broken tools may not set
8980 the link in section header.
8981 (Target_arm::has_got_section): New method.
8982 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8983 without any mapping symbol as data only. Remove warning.
8984 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8985 link in its section header, try to discover the link by inspecting the
8986 REL31 relocation at the beginning of the section.
8987 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8989 (Target_arm::Scan::global): Treat any reference to the symbol
8990 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8992 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8994 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8995 (Scan::global_reloc_may_be_function_pointer): New function.
8996 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8997 (Scan::global_reloc_may_be_function_pointer): New function.
8998 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8999 (Scan::global_reloc_may_be_function_pointer): New function.
9000 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9001 (Scan::global_reloc_may_be_function_pointer): New function.
9002 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9003 (Scan::global_reloc_may_be_function_pointer): New function.
9004 (Scan::possible_function_pointer_reloc): New function.
9005 (Target_x86_64::can_check_for_function_pointers): New function.
9006 * gc.h (gc_process_relocs): Scan relocation types to determine if
9007 function pointers were taken for targets that support it.
9008 * icf.cc (Icf::find_identical_sections): Include functions for
9009 folding in safe ICF whose pointer is not taken.
9010 * icf.h (Secn_fptr_taken_set): New typedef.
9011 (fptr_section_id_): New member.
9012 (section_has_function_pointers): New function.
9013 (set_section_has_function_pointers): New function.
9014 (check_section_for_function_pointers): New function.
9015 * options.h: Fix comment for safe ICF option.
9016 * target.h (can_check_for_function_pointers): New function.
9017 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9018 Modify icf_safe_test for X86-64.
9019 * testsuite/Makefile.in: Regenerate.
9020 * testsuite/icf_safe_so_test.cc: New file.
9021 * testsuite/icf_safe_so_test.sh: New file.
9022 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9023 (main): Change to take pointer to function kept_func_3.
9024 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9025 folding is done correctly for X86-64.
9027 2010-02-12 David S. Miller <davem@davemloft.net>
9029 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9030 is_symbolless parameter.
9031 (Output_reloc<SHT_REL>::is_symbolless): New.
9032 (Output_reloc<SHT_REL>::is_symbolless_): New.
9033 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9034 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9035 (Output_reloc<SHT_RELA>::is_symbolless): New.
9036 (Output_data_reloc::add_global): Handle is_symbolless.
9037 (Output_data_reloc::add_global_relative): Likewise.
9038 (Output_data_reloc::add_local): Likewise.
9039 (Output_data_reloc::add_local_relative): Likewise.
9040 (Output_data_reloc::add_symbolless_global_addend): New.
9041 (Output_data_reloc::add_symbolless_local_addend): New.
9042 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9044 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9045 instead of ->is_relative_
9046 (Output_reloc::write): Likewise.
9047 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9048 (Output_reloc::write_rel): Simplify.
9050 * sparc.cc (Target_sparc::Scan::local): Use
9051 ->add_symbolless_local_addend as needed.
9052 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9053 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9054 based upon relocation offset.
9056 2010-02-11 Doug Kwan <dougkwan@google.com>
9058 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9059 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9060 beginning of function.
9061 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9062 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9063 parameter is_32bit in calls to should_apply_static_reloc.
9064 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9065 (check_DATA): Add arm_abs_global.stdout.
9066 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9067 arm_abs_global.stdout): New rules.
9068 (MOSTLLYCLEANFILES): Add arm_abs_global
9069 * Makefile.in: Regenerate.
9070 * testsuite/arm_abs_global.s: New file.
9071 * testsuite/arm_abs_global.sh: Ditto.
9072 * testsuite/arm_abs_lib.s: Ditto.
9074 2010-02-11 Ian Lance Taylor <iant@google.com>
9076 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9078 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9079 Allocate_commons_task first.
9080 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9081 task, rather than symtab_lock_.
9082 (Gc_process_relocs::~Gc_process_relocs): New function.
9083 (Gc_process_relocs::is_runnable): Check this_blocker_.
9084 (Gc_process_relocs::locks): Use next_blocker_ rather than
9086 (Scan_relocs::~Scan_relocs): New function.
9087 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9089 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9091 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9092 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9093 constructor accordingly.
9094 (class Gc_process_relocs): Likewise.
9095 (class Scan_relocs): Likewise.
9096 * common.h (class Allocate_commons_task): Remove symtab_lock_
9097 field, and corresponding constructor parameter.
9098 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9100 (Allocate_commons_task::locks): Likewise.
9102 2010-02-11 Ian Lance Taylor <iant@google.com>
9104 * gold-threads.h (class Once): Define.
9105 (class Initialize_lock): Rewrite as child of Once.
9106 * gold-threads.cc (class Once_initialize): Define.
9107 (once_pointer_control): New static variable.
9108 (once_pointer, once_arg): New static variables.
9109 (c_run_once): New static function.
9110 (Once::Once, Once::run_once, Once::internal_run): New functions.
9111 (class Initialize_lock_once): Remove.
9112 (initialize_lock_control): Remove.
9113 (initialize_lock_pointer): Remove.
9114 (initialize_lock_once): Remove.
9115 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9116 (Initialize_lock::initialize): Rewrite.
9117 (Initialize_lock::do_run_once): New function.
9118 * archive.cc (Archive::interpret_header): Only clear name if it is
9120 * fileread.cc: Include "gold-threads.h"
9121 (file_counts_lock): New static variable.
9122 (file_counts_initialize_lock): Likewise.
9123 (File_read::release): Only increment counts when using --stats.
9124 Use a lock around the increment.
9125 * parameters.cc (class Set_parameters_target_once): Define.
9126 (set_parameters_target_once): New static variable.
9127 (Parameters::Parameters): Move here from parameters.h.
9128 (Parameters::set_target): Rewrite.
9129 (Parameters::set_target_once): New function.
9130 (Parameters::clear_target): Move here and rewrite.
9131 * parameters.h (class Parameters): Update declarations. Add
9132 set_parameters_target_once_ field.
9133 (Parameters::Parameters): Move to parameters.cc.
9134 (Parameters::clear_target): Likewise.
9135 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9137 (Start_group::~Start_group): New function.
9138 (Start_group::is_runnable): New function.
9139 (Start_group::locks, Start_group::run): New functions.
9140 (Finish_group::run): Change saw_undefined to size_t.
9141 * readsyms.h (class Start_group): Define.
9142 (class Finish_group): Change saw_undefined_ field to size_t.
9143 (Finish_group::Finish_group): Remove saw_undefined and
9144 this_blocker parameters. Change all callers.
9145 (Finish_group::set_saw_undefined): New function.
9146 (Finish_group::set_blocker): New function.
9147 * symtab.h (class Symbol_table): Change saw_undefined to return
9148 size_t. Change saw_undefined_ field to size_t.
9149 * target-select.cc (Set_target_once::do_run_once): New function.
9150 (Target_selector::Target_selector): Initialize set_target_once_
9151 field. Don't initialize lock_ and initialize_lock_ fields.
9152 (Target_selector::instantiate_target): Rewrite.
9153 (Target_selector::set_target): New function.
9154 * target-select.h (class Set_target_once): Define.
9155 (class Target_selector): Update declarations. Make
9156 Set_target_once a friend. Remove lock_ and initialize_lock_
9157 fields. Add set_target_once_ field.
9159 2010-02-10 Ian Lance Taylor <iant@google.com>
9161 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9163 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9164 (queue_middle_tasks): Add all blockers before queueing any tasks.
9165 (queue_final_tasks): Likewise.
9166 * token.h (Task_token::add_blockers): New function.
9167 * object.h (Input_objects::number_of_relobjs): New function.
9169 2010-02-10 Ian Lance Taylor <iant@google.com>
9171 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9172 shared, not if not position independent.
9173 * x86_64.cc (Relocate::relocate_tls): Likewise.
9174 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9175 (tls_pie_pic_test): New target.
9176 * testsuite/Makefile.in: Rebuild.
9178 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9179 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9180 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9181 * testsuite/Makefile.in: Rebuild.
9183 2010-02-09 David S. Miller <davem@davemloft.net>
9185 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9186 R_SPARC_RELATIVE using ->add_local_relative().
9187 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9189 * output.h (Output_data_dynamic::add_section_size): New method
9190 that takes two Output_data objects.
9191 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9192 entry param. Handle it in initializers.
9193 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9194 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9195 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9197 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9198 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9199 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9200 for dynrel_includes_plt.
9201 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9202 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9203 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9205 (Target_sparc::do_finalize_sections): Update to pass true for
9206 dynrel_includes_plt.
9207 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9208 output before .rela.plt
9209 (Target_powerpc::do_finalize_sections): Update to pass true for
9210 dynrel_includes_plt when 32-bit.
9212 2010-02-08 Doug Kwan <dougkwan@google.com>
9214 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9216 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9217 Arm_relobj::scan_section_for_cortex_a8_stubs,
9218 Arm_relobj::do_relocation_section): Instead of calling
9219 Output_section::output_address, use faster
9220 Arm_relobj::simple_input_section_output_address.
9222 2010-02-08 David S. Miller <davem@davemloft.net>
9224 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9225 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9226 relocation helper function.
9228 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9229 just like R_SPARC_GOT{10,13,22}.
9230 (Target_sparc::Scan::local): Likewise.
9231 (Target_sparc::Relocate:relocate): Likewise.
9233 2010-02-06 Ian Lance Taylor <iant@google.com>
9235 * configure.ac: Rewrite targetobjs duplicate removal code to use
9236 only shell constructs.
9237 * configure: Rebuild.
9239 2010-02-05 Doug Kwan <dougkwan@google.com>
9242 * arm.cc (Arm_relobj::section_is_scannable): New method.
9243 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9244 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9246 2010-02-04 Doug Kwan <dougkwan@google.com>
9249 * arm-reloc-property.cc (cstdio): Include.
9250 * configure.ac (targetobjs): Remove duplicates.
9251 * configure: Regenerate.
9252 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9253 big and little endian version for a given address size.
9255 2010-02-03 Doug Kwan <dougkwan@google.com>
9257 * arm-reloc-property.cc
9258 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9260 * arm-reloc-property.h
9261 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9262 New method definition.
9263 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9265 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9267 (GOT_PREL): Change implemented to Y.
9268 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9269 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9270 (Arm_relocate_functions::movw_abs_nc): Remove method.
9271 (Arm_relocate_functions::movt_abs): Ditto.
9272 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9273 (Arm_relocate_functions::thm_movt_abs): Ditto.
9274 (Arm_relocate_functions::movw_rel_nc): Ditto.
9275 (Arm_relocate_functions::movw_rel): Ditto.
9276 (Arm_relocate_functions::movt_rel): Ditto.
9277 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9278 (Arm_relocate_functions:thm_movw_rel): Ditto.
9279 (Arm_relocate_functions:thm_movt_rel): Ditto.
9280 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9281 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9282 New method definitions.
9283 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9284 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9285 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9286 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9287 (Target_arm::Relocate::relocate): Check for non-static or
9288 unimplemented relocation code and exit early. Change calls to
9289 Target_arm::reloc_uses_thumb_bit and
9290 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9291 instead. Refactor code to handle similar relocations to increase
9292 code sharing. Remove check for unsupported relocation code in switch
9294 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9295 relocation property table to find out size. Change error message to
9296 print out the name of a relocation code instead of the numeric value.
9297 (Target_arm::scan_reloc_for_stub): Use relocation property table
9298 instead of calling Target_arm::reloc_uses_thumb_bit().
9300 2010-02-02 Doug Kwan <dougkwan@google.com>
9302 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9303 types of relaxed input section.
9305 2010-02-02 Doug Kwan <dougkwan@google.com>
9307 * Makefile.am (HFILES): Add arm-reloc-property.h.
9309 (TARGETSOURCES): Add arm-reloc-property.cc
9310 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9311 (libgold_a_SOURCES): $(DEFFILES)
9312 * Makefile.in: Regenerate.
9313 * arm-reloc-property.cc: New file.
9314 * arm-reloc-property.h: New file.
9315 * arm-reloc.def: New file.
9316 * arm.cc: Update comments.
9317 (arm-reloc-property.h): New included header.
9318 (arm_reloc_property_table): New global variable.
9319 (Target_arm::do_select_as_default_target): New method definition.
9320 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9321 arm-reloc-property to targ_extra_obj.
9322 * parameters.cc (set_parameters_target): Call
9323 Target::select_as_default_target().
9324 * target.h (Target::select_as_default_target): New method definition.
9325 (Target::do_select_as_default_target): Same.
9327 2010-02-01 Doug Kwan <dougkwan@google.com>
9329 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9330 first_output_text_section_.
9331 (Arm_exidx_fixup::first_output_text_section): New method definition.
9332 (Arm_exidx_fixup::first_output_text_section_): New data member.
9333 (Arm_exidx_fixup::process_exidx_section): Record the first text
9334 output section seen.
9335 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9336 and entsize in output section header.
9338 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9340 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9341 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9342 (Arm_relocate_functions::thm_alu11): New Method.
9343 (Arm_relocate_functions::thm_pc8): New Method.
9344 (Arm_relocate_functions::thm_pc12): New Method.
9345 (Target_arm::Scan::local): Handle the relocations.
9346 (Target_arm::Scan::global): Likewise.
9347 (Target_arm::Relocate::relocate): Likewise.
9348 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9350 2010-01-29 Doug Kwan <dougkwan@google.com>
9352 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9353 of relocation types as ld.
9355 2010-01-29 Doug Kwan <dougkwan@google.com>
9357 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9359 (Arm_relocate_functions::thumb_branch_common): Ditto.
9360 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9361 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9362 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9363 Arm_relocate_functions::jump24): Remove.
9364 (Target_arm::Relocate::relocate): Adjust code to call
9365 Arm_relocation_functions::arm_branch_common and
9366 Arm_relocation_functions::thumb_branch_common instead of their removed
9367 wrappers. Merge switch-cases together to reduce source code size.
9369 2010-01-29 Doug Kwan <dougkwan@google.com>
9371 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9372 output_local_symbol_count_needs_update_.
9373 (Arm_relobj::output_local_symbol_count_needs_update,
9374 Arm_relobj::set_output_local_symbol_count_needs_update,
9375 Arm_relobj::update_output_local_symbol_count): New methods.
9376 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9378 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9379 of pointed function as in a R_ARM_PREL31 relocation.
9380 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9381 for output local symbol count updating.
9382 (Target_arm::do_relax): Update output local symbol counts in objects
9384 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9386 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9388 * arm.cc: Added support for the ARM relocations:
9389 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9390 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9391 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9393 (Arm_relocate_functions::movw_rel): New method.
9394 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9395 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9397 (Arm_relocate_functions::thm_movw_rel): New method.
9398 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9400 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9402 (Target_arm::Scan::global): Likewise.
9403 (Target_arm::Relocate::relocate): Likewise.
9404 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9407 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9409 * arm.cc: Added support for ARM group relocations.
9410 (Target_arm::reloc_needs_sym_origin): New method.
9411 (Arm_relocate_functions::calc_grp_kn): New method.
9412 (Arm_relocate_functions::calc_grp_residual): New method.
9413 (Arm_relocate_functions::calc_grp_gn): New method.
9414 (Arm_relocate_functions::arm_grp_alu): New Method.
9415 (Arm_relocate_functions::arm_grp_ldr): New Method.
9416 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9417 (Arm_relocate_functions::arm_grp_ldc): New Method.
9418 (Target_arm::Scan::local): Handle the ARM group relocations.
9419 (Target_arm::Scan::global): Likewise.
9420 (Target_arm::Relocate::relocate): Likewise.
9421 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9424 2010-01-26 Doug Kwan <dougkwan@google.com>
9426 * arm.cc (set): Include.
9427 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9429 (Arm_output_section::Text_section_list): New type.
9430 (Arm_output_section::append_text_sections_to_list): New method.
9431 (Arm_output_section::fix_exidx_coverage): Ditto.
9432 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9433 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9434 Relobj::set_section_offset() instead of
9435 Sized_relobj::invalidate_section_offset().
9436 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9437 parameter for section headers. Ignore relocation sections for
9438 unallocated sections and EXIDX sections.
9439 (Target_arm::fix_exidx_coverage): New method.
9440 (Target_arm::output_section_address_less_than): New type.
9441 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9442 linked text section instead of the EXIDX section.
9443 (Arm_output_section::create_stub_group): Add an assertion to check
9444 that this is not an EXIDX output section.
9445 (Arm_output_section::append_text_sections_to_list): New method.
9446 (Arm_output_section::fix_exidx_coverage): Ditto.
9447 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9448 Arm_relobj::section_needs_reloc_stub_scanning.
9449 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9451 (Target_arm::fix_exidx_coverage): New method.
9452 * object.h (Relobj::set_output_section): New method.
9453 (Sized_relobj::invalidate_section_offset): Remove method.
9454 (Sized_relobj::do_invalidate_section_offset): Remove method.
9455 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9457 2010-01-25 Doug Kwan <dougkwan@google.com>
9459 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9460 Fix warning due to signed and unsigned comparison on a 32-bit host.
9462 2010-01-22 Doug Kwan <dougkwan@google.com>
9464 * arm.cc (Target_arm::do_relax): Record an output section for section
9465 offset adjustment it contains any stub table that has changed.
9466 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9467 offsets in an output section if necessary.
9468 * output.cc (Output_section::Output_section): Initialize
9469 section_offsets_need_adjustments_.
9470 (Output_section::add_input_section_for_script): Renamed to
9471 Output_section::add_simple_input_section.
9472 (Output_section::save_states): Add a comment.
9473 (Output_section::discard_states): New method defintion.
9474 (Output_section::adjust_section_offsets): Same.
9475 * output.h (Output_section::add_input_section_for_script): Renamed to
9476 Output_section::add_simple_input_section.
9477 (Output_section::discard_states): New method declaration.
9478 (Output_section::adjust_section_offsets): Same.
9479 (Output_section::section_offsets_need_adjustment,
9480 Output_section::set_section_offsets_need_adjustment): New method
9482 (Output_section::section_offsets_need_adjustment_): New data member.
9483 * script-sections.cc
9484 (Output_section_element_input::set_section_address): Adjust code for
9485 renaming of Output_section::add_input_section_for_script.
9486 (Orphan_output_section::set_section_address): Same.
9488 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9490 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9491 Fix_v4bx enum values .
9492 * gold/options.h (General_options): New option definitions.
9493 (General_options::fix_v4bx): New method.
9494 (General_options::Fix_v4bx): New enum.
9495 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9496 (General_options::parse_fix_v4bx_interworking): New method.
9498 2010-01-22 Doug Kwan <dougkwan@google.com>
9500 * arm.cc (Arm_exidx_fixup): New class.
9502 2010-01-21 Doug Kwan <dougkwan@google.com>
9504 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9506 (Arm_exidx_section_offset_map): New type.
9508 2010-01-21 Doug Kwan <dougkwan@google.com>
9510 * arm.cc (Arm_exidx_input_section): New class.
9511 (Arm_relobj::exidx_input_section_by_link,
9512 Arm_relobj::exidx_input_section_by_shndx,
9513 Arm_relobj::make_exidx_input_section): New methods.
9514 (read_arm_attributes_section): Remove.
9515 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9516 information about them.
9517 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9520 2010-01-20 Doug Kwan <dougkwan@google.com>
9522 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9523 Input_section_specifier to Section_id.
9524 (Target_arm::new_arm_input_section: Adjust code for change of key
9526 (Target_arm::find_arm_input_section): Ditto.
9527 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9528 (Section_id): Remove.
9529 (Garbage_collection::Section_id_hash): Remove.
9530 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9531 (Section_id): Remove.
9532 (Icf::Section_id_hash): Remove.
9533 * object.h (Section_id, Const_section_id, Section_id_hash,
9534 Const_section_id_hash): New type definitions.
9535 * output.cc (Output_section::add_relaxed_input_section): Change to
9536 use Const_section_id instead of Input_section_specifier as key type.
9537 (Output_section::add_merge_input_section): Ditto.
9538 (Output_section::build_relaxation_map): Change to use Section_id
9539 instead of Input_section_specifier as key type.
9540 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9542 (Output_section::convert_input_sections_to_relaxed_sections): Change
9543 to use Const_section_id instead of Input_section_specifier as key type.
9544 (Output_section::find_merge_section): Ditto.
9545 (Output_section::find_relaxed_input_section): Ditto.
9546 * output.h (Input_section_specifier): Remove class.
9547 (Output_section::Output_section_data_by_input_section_map): Change
9548 key type to Const_section_id.
9549 (Output_section::Output_relaxed_input_section_by_input_section_map):
9551 (Output_section::Relaxation_map): Change key type to Section_id.
9553 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9555 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9556 (class Arm_v4bx_stub): New class.
9557 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9558 (Stub_factory::make_arm_v4bx_stub): New method.
9559 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9560 (Stub_table::empty): Handle v4bx stubs.
9561 (Stub_table::add_arm_v4bx_stub): New method.
9562 (Stub_table::find_arm_v4bx_stub): New method.
9563 (Arm_relocate_functions::v4bx): New method.
9564 (Target_arm::fix_v4bx): New method.
9565 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9566 (Stub_table::relocate_stubs): Likewise.
9567 (Stub_table::do_write): Likewise.
9568 (Stub_table::update_data_size_and_addralign): Likewise.
9569 (Stub_table::finalize_stubs): Likewise.
9570 (Target_arm::Scan::local): Likewise.
9571 (Target_arm::Scan::global): Likewise.
9572 (Target_arm::do_finalize_sections): Likewise.
9573 (Target_arm::Relocate::relocate): Likewise.
9574 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9576 (Target_arm::scan_reloc_for_stub): Likewise.
9577 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9579 2010-01-19 Ian Lance Taylor <iant@google.com>
9581 * output.cc (Output_section_headers::do_sized_write): Write large
9582 segment count to sh_info field.
9583 (Output_file_header::do_sized_write): For large segment count,
9584 write PN_XNUM to e_phnum field.
9586 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9588 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9589 (Arm_relocate_functions::thm_jump8): New function.
9590 (Arm_relocate_functions::thm_jump11): New function.
9591 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9593 (Target_arm::Scan::global): Likewise.
9594 (Target_arm::Relocate::relocate): Likewise.
9595 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9598 2010-01-14 Doug Kwan <dougkwan@google.com>
9600 * arm.cc (map, utility): Include headers.
9601 (Target_arm::apply_cortex_a8_workaround): New method.
9602 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9603 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9604 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9605 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9606 the --[no-]fix-cortex-a8 command line options.
9607 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9608 (Target_arm::relocate_stub): Use addend in instruction template.
9609 * options.h (DEFINE_bool): Set the user-set flag.
9610 (General_options): Add --[no-]-fix-cortex options.
9611 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9612 : Update fast look-up map after conversion.
9614 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9616 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9617 in the first pass of do_layout.
9619 2010-01-13 Doug Kwan <dougkwan@google.com>
9621 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9622 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9623 apparent compiler problem of not folding static constant integral
9624 data members of elfcpp::Elf_sizes<32>.
9626 2010-01-13 Doug Kwan <dougkwan@google.com>
9628 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9629 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9630 Arm_relobj::scan_section_for_cortex_a8_erratum,
9631 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9632 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9633 sections to scan for relocation stubs into a new method
9634 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9635 relocation and Cortex-A8 stub scanning.
9636 (Target_arm::do_relax): Force stubs to be after stubbed sections
9637 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9638 the beginning of a new relaxation pass. Update a comment.
9639 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9641 2010-01-12 Ian Lance Taylor <iant@google.com>
9643 * target-reloc.h (visibility_error): New inline function.
9644 (relocate_section): Call visibility_error.
9645 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9646 (MOSTLYCLEANFILES): Likewise.
9647 (protected_4_pic.o, protected_3.err): New targets.
9648 * testsuite/protected_4.cc: New file.
9650 2010-01-12 Doug Kwan <dougkwan@google.com>
9652 * arm.cc (Cortex_a8_reloc): New class.
9653 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9654 and cortex_a8_relocs_info_.
9655 (Target_arm::fix_cortex_a8): New method definition.
9656 (Target_arm::Cortex_a8_relocs_info): New type.
9657 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9658 New data member declarations.
9659 (Target_arm::scan_reloc_for_stub): Record information about
9660 relocations for THUMB branches that might be exempted from the
9661 Cortex-A8 workaround.
9662 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9663 at the beginning of a relaxation pass.
9665 2010-01-12 Doug Kwan <dougkwan@google.com>
9667 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9668 (Arm_relobj::Mapping_symbol_position,
9669 Arm_reloj::Mapping_symbol_position_less,
9670 Arm_relobj::Mapping_symbols_info): New types.
9671 (Target_arm::is_mapping_symbol_name): New method definition.
9672 (Arm_relobj::do_count_local_symbols): Save information about mapping
9675 2010-01-11 Doug Kwan <dougkwan@google.com>
9677 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9678 Arm_relocate_functions::thumb32_branch_upper,
9679 Arm_relocate_functions::thumb32_branch_lower,
9680 Arm_relocate_functions::thumb32_cond_branch_offset,
9681 Arm_relocate_functions::thumb32_cond_branch_upper,
9682 Arm_relocate_functions::thumb32_cond_branch_lower,
9683 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9684 branch offset encoding.
9685 (Arm_relocate_functions::thumb_branch_common): Use new branch
9686 offset encoding methods to avoid code duplication.
9687 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9688 (Stub_addend_reader::operator()): Use new branch encoding method
9689 to avoid code duplication.
9691 2010-01-11 Doug Kwan <dougkwan@google.com>
9693 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9694 (Target_arm::do_finalize_sections): Define special EXIDX section
9695 symbols only if referenced.
9696 * gc.h (Garbage_collection::add_reference): New method.
9697 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9700 2010-01-11 Ian Lance Taylor <iant@google.com>
9702 * script.cc (Version_script_info::build_expression_list_lookup):
9703 Change complaing about duplicate wildcard match from error to
9706 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9708 (Version_script_info::Version_script_info): Initialize globs_,
9709 default_version_, default_is_global_, and exact_. Don't
9710 initialize globals_ or locals_.
9711 (Version_script_info::build_lookup_tables): Build local symbols
9713 (Version_script_info::unquote): New function.
9714 (Version_script_info::add_exact_match): New function.
9715 (Version_script_info::build_expression_list_lookup): Remove lookup
9716 parameter. Add is_global parameter. Change all callers. Handle
9717 wildcard pattern specially. Unquote pattern. Call
9719 (Version_script_info::get_name_to_match): New function.
9720 (Version_script_info::get_symbol_version): New function.
9721 (Version_script_info::get_symbol_version_helper): Remove.
9722 (Version_script_info::check_unmatched_names): Call unquote.
9723 * script.h (class Version_script_info): Change get_symbol_version
9724 to be non-inline and add is_global parameter; change all callers.
9725 Rewrite symbol_is_local. Update declarations. Define struct
9726 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9727 Remove globals_ and locals_ members. Add exact_, globs_,
9728 default_version_, is_global_.
9729 (Version_script_info::Glob): Remove pattern, add expression and
9730 is_global. Update constructor. Change all callers.
9731 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9733 (Versions::symbol_section_contents): If a symbol is undefined, or
9734 defined in a dynamic object, set the version index to
9736 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9738 (Symbol_table::add_from_pluginobj): Likewise.
9739 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9741 2010-01-11 Doug Kwan <dougkwan@google.com>
9743 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9744 (incremental_dump_LDADD): Add linking option for libintl.
9745 * Makefile.in: Regenerate.
9747 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9750 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9752 * testsuite/Makefile.in: Regenerated.
9754 2010-01-10 Doug Kwan <dougkwan@google.com>
9756 * options.h (DEFINE_var): Use parentheses around argument varname__
9757 in macro body to avoid any unintended subsequent substitutions.
9759 2010-01-10 Ian Lance Taylor <iant@google.com>
9761 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9762 candidates before doing symbol resolution.
9764 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9765 ODR candidates if only one is weak.
9767 2010-01-08 Ian Lance Taylor <iant@google.com>
9769 * script.cc (Version_script_info::build_expression_list_lookup):
9770 Don't warn about ambiguous version, just record the ambiguity.
9771 (Version_script_info::get_symbol_version_helper): Give error if
9772 version is ambiguous.
9774 2010-01-08 Doug Kwan <dougkwan@google.com>
9776 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9777 prev_data_size_ and prev_addralign_. Remove initializer for
9778 deleted data member has_been_changed_.
9779 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9780 to determine if the table is empty.
9781 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9783 (Stub_table::add_reloc_stub): Define method in class definition
9784 instead of just declaring it there.
9785 (Stub_table::add_cortex_a8_stub): New method definition.
9786 (Stub_table::update_data_size_and_addralign): Ditto.
9787 (Stub_table::finalize_stubs): Ditto.
9788 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9789 (Stub_table::do_addralign_): Return address alignment in the
9790 (Stub_table::do_reset_address_and_file_offset): Define method in
9791 class definition instead of declaring it there. Set current data
9792 size to be the data size of the previous pass.
9793 (Stub_table::set_final_data_size): Use current data size as the
9795 (Stub_table::relocate_stub): Change parameter type of stub from
9796 Reloc_stub pointer to Stub pointer.
9797 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9798 (Stub_table::Cortex_a8_stub_list): New typedef.
9799 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9800 Stub_table::prev_addralign_): New data member.
9801 (Arm_relobj::Arm_relobj): Initialize data member
9802 section_has_cortex_a8_workaround_.
9803 (Arm_relobj::section_has_cortex_a8_workaround,
9804 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9806 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9808 (Target_arm::relocate_stub): Change parameter type of stub from
9809 Reloc_stub pointer to Stub pointer.
9810 (Insn_template::size, Insn_template::alignment): Handle
9811 THUMB16_SPECIAL_TYPE.
9812 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9813 Stub_table::update_data_size_and_addralign,
9814 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9816 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9817 (Stub_table::do_write): Ditto.
9818 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9820 2010-01-08 Ian Lance Taylor <iant@google.com>
9823 * symtab.h (class Symbol): Remove fields is_target_special_ and
9824 has_plt_offset_. Add field is_defined_in_discarded_section_.
9825 (Symbol::is_defined_in_discarded_section): New function.
9826 (Symbol::set_is_defined_in_discarded_section): New function.
9827 (Symbol::has_plt_offset): Rewrite.
9828 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9829 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9830 Don't initialize is_target_special_ or has_plt_offset_.
9831 Initialize is_defined_in_discarded_section_.
9832 (Symbol_table::add_from_relobj): If appropriate, set
9833 is_defined_in_discarded_section.
9834 * resolve.cc (Symbol::override_base_with_special): Don't test
9835 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9836 * target-reloc.h (relocate_section): Do special handling for
9837 symbols defined in discarded sections for global symbols as well
9840 2010-01-08 Ian Lance Taylor <iant@google.com>
9842 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9843 the SHT_SYMTAB case.
9845 2010-01-08 Ian Lance Taylor <iant@google.com>
9847 * object.cc (Sized_relobj::do_layout): Don't get confused if
9848 layout_eh_frame returns NULL.
9850 2010-01-08 Ian Lance Taylor <iant@google.com>
9853 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9854 dynamic symbol table, use the normal symbol table.
9855 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9858 2010-01-08 Ian Lance Taylor <iant@google.com>
9861 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9864 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9866 * version.cc (print_version): Change to "Copyright 2010".
9868 2010-01-08 Ian Lance Taylor <iant@google.com>
9872 * i386.cc (class Target_i386): Change return type of plt_section
9874 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9875 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9876 tls_desc_rel_ field.
9877 (Output_data_plt_i386::rel_tls_desc): New function.
9878 (Target_i386::rel_tls_desc_section): New function.
9879 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9880 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9881 R_386_TLS_DESC reloc in rel_tls_desc_section.
9882 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9883 Define struct Tlsdesc_info.
9884 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9885 (Target_x86_64::do_reloc_symbol_index): New function.
9886 (Target_x86_64::add_tlsdesc_info): New function.
9887 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9888 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9890 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9892 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9893 (Target_x86_64::rela_tlsdesc_section): New function.
9894 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9896 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9897 (Target_x86_64::do_reloc_addend): New function.
9898 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9899 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9900 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9901 (Output_reloc::type): New function.
9902 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9903 (Output_reloc::is_target_specific): New function.
9904 (Output_reloc::target_arg): New function.
9905 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9906 absolute relocs and target specific relocs.
9907 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9908 add_target_specific.
9909 (class Output_data_reloc) [SHT_RELA]: Likewise.
9910 * output.cc (Output_reloc::Output_reloc): Add four new versions
9911 for absolute relocs and target specific relocs.
9912 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9913 (Output_reloc::get_symbol_index): Likewise.
9914 (Output_reloc::local_section_offset): Check that local_sym_index_
9915 is not TARGET_CODE or 0.
9916 (Output_reloc::symbol_value): Likewise.
9917 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9919 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9920 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9922 * layout.cc (add_target_dynamic_tags): Use output section for
9923 DT_PLTRELSZ and DT_JMPREL.
9925 2010-01-07 Ian Lance Taylor <iant@google.com>
9928 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9930 (class Output_data_reloc_generic): Define.
9931 (class Output_data_reloc_base): Change base class to
9932 Output_data_reloc_generic. Change add() method to call
9933 bump_relative_reloc_count for a relative reloc. Remove
9935 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9937 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9938 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9940 * layout.h (class Layout): Update declaration.
9942 2010-01-07 Ian Lance Taylor <iant@google.com>
9944 * output.h (class Output_data): Add const version of
9945 output_section and do_output_section.
9946 (class Output_section_data): Add const version of
9948 (class Output_section): Likewise.
9949 * layout.cc (Layout::add_target_dynamic_tags): New function.
9950 * layout.h (class Layout): Update declarations.
9951 * arm.cc (Target_arm::do_finalize_sections): Use
9952 add_target_dynamic_tags.
9953 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9954 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9955 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9956 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9958 2010-01-07 Ian Lance Taylor <iant@google.com>
9961 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9964 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9965 Ian Lance Taylor <iant@google.com>
9968 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9969 Xindex::read_symtab_xindex.
9971 2010-01-07 Doug Kwan <dougkwan@google.com>
9973 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9974 (Insn_template::thumb16_bcond_insn): New method declaration.
9975 (Insn_template): Fix spelling.
9976 (Stub::thumb16_special): New method declaration.
9977 (Stub::do_write): Define virtual method which was previously pure
9979 (Stub::do_thumb16_special): New method declaration.
9980 (Stub::do_fixed_endian_write): New template member.
9981 (Reloc_stub::do_write): Remove.
9982 (Reloc_stub::do_fixed_endian_write): Remove.
9983 (Cortex_a8_stub): New class definition.
9984 (Stub_factory::make_cortex_a8_stub): New method definition.
9985 (Stub_factory::Stub_factory): Add missing static storage class
9986 qualifier for elf32_arm_stub_a8_veneer_blx.
9988 2010-01-07 Ian Lance Taylor <iant@google.com>
9991 * options.h (class General_options): Add --warn-unresolved-symbols
9992 and --error-unresolved-symbols.
9993 * errors.cc (Errors::undefined_symbol): Implement
9994 --warn-unresolved-symbols.
9996 * options.h (class General_options): Add -z text and -z textoff.
9997 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9999 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10001 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10002 (Garbage_collection::cident_sections): New function.
10003 (Garbage_collection::add_cident_section): New function.
10004 (Garbage_collection::cident_sections_): New member.
10005 (gc_process_relocs): Add references to sections whose names are C
10007 * gold.h (cident_section_start_prefix): New constant.
10008 (cident_section_stop_prefix): New constant.
10009 (is_cident): New function.
10010 * layout.cc (Layout::define_section_symbols): Replace string constants
10011 with the newly defined constants.
10012 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10014 * testsuite/Makefile.am: Add gc_orphan_section_test.
10015 * testsuite/Makefile.in: Regenerate.
10016 * testsuite/gc_orphan_section_test.cc: New file.
10017 * testsuite/gc_orphan_section_test.sh: New file.
10019 2010-01-06 Ian Lance Taylor <iant@google.com>
10022 * options.h (class General_options): Add --warn-shared-textrel.
10023 * layout.cc (Layout::finish_dynamic_section): Implement
10024 --warn-shared-textrel.
10027 * options.h (class General_options): Add --warn-multiple-gp.
10029 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10031 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10032 $(THREADSLIB) and $(LIBDL).
10033 * Makefile.in: Rebuild.
10035 2010-01-06 Ian Lance Taylor <iant@google.com>
10038 * options.cc (General_options::parse_section_start): New function.
10039 (General_options::section_start): New function.
10040 (General_options::General_options): Initialize all members.
10041 * options.h: Include <map>
10042 (class General_options): Add --section-start. Add section_starts_
10044 * layout.cc (Layout::attach_allocated_section_to_segment): If
10045 --section-start was used, set the address of the segment. Remove
10046 local sort_sections.
10047 (Layout::relaxation_loop_body): If the address of the load segment
10048 has been set by --section-start, don't use it.
10049 * output.h (Output_segment::update_flags_for_output_section): New
10051 * output.cc (Output_segment::add_output_section): Call
10052 update_flags_for_output_section.
10054 2010-01-05 Ian Lance Taylor <iant@google.com>
10057 * options.h (class General_options): Add --undefined-version.
10058 * script.cc (struct Version_expression): Add was_matched_by_symbol
10060 (Version_script_info::matched_symbol): New function.
10061 (Version_script_info::get_symbol_version_helper): Call
10063 (Version_script_info::check_unmatched_names): New function.
10064 * script.h (class Version_script_info): Update declarations.
10065 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10067 * options.h (class General_options): Use DEFINE_bool_alias for
10068 allow_multiple_definition.
10069 * resolve.cc (Symbol_table::should_override): Don't test
10070 allow_multiple_definition.
10073 * options.h (class General_options): Add --cref.
10074 * main.cc (main): Print cref table if --cref. Don't close mapfile
10075 until after printing cref table.
10076 * cref.cc: Include "symtab.h".
10077 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10078 (Cref_table_compare::operator()): New function.
10079 (Cref_inputs::gather_cref): New function.
10080 (filecol): New static const.
10081 (Cref_inputs::print_cref): New function.
10082 (Cref::print_cref): New function.
10083 * cref.h: Include <cstdio>.
10084 (class Cref): Update declarations.
10085 * mapfile.h (Mapfile::file): New function.
10086 * object.h (class Object): Define Symbols. Declare virtual
10087 do_get_global_symbols.
10088 (Object::get_global_symbols): New function.
10089 * object.cc (Input_objects::add_object): Pass object to cref_ if
10091 (Input_objects::archive_start): Likewise.
10092 (Input_objects::archive_stop): Likewise.
10093 (Input_objects::print_cref): New function.
10094 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10095 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10097 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10099 * plugin.h (class Sized_pluginobj): Update declarations.
10101 2010-01-05 Ian Lance Taylor <iant@google.com>
10103 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10104 to is_default_version. Rename insdef to insdefault.
10105 (Symbol_table::add_from_relobj): Rename def to is_default_version
10106 and local to is_forced_local.
10107 (Symbol_table::add_from_pluginobj): Likewise.
10108 (Symbol_table::add_from_dynobj): Likewise.
10109 (Symbol_table::define_special_symbol): Rename insdef to
10112 2010-01-04 Ian Lance Taylor <iant@google.com>
10115 * options.h (class General_options): Add
10116 --allow-multiple-definition and -z muldefs.
10117 * resolve.cc (Symbol_table::should_override): Don't warn about a
10118 multiple symbol definition if --allow-multiple-definition or -z
10122 * options.h (class General_options): Add --add-needed and
10123 --copy-dt-needed-entries. Tweak --as-needed help entry.
10124 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10125 error if --copy-dt-needed-entries aka --add-needed is used and
10126 would cause a change in behaviour.
10129 * options.h (class General_options): Add -G as a short version of
10130 --shared. Add no-op options -assert, -g, and -i.
10132 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10134 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10135 check for .text or .gnu.linkonce.t sections.
10136 * icf.cc (Icf::find_identical_sections): Ditto.
10137 Change the detection for mangled function name within the section
10139 * icf.h (is_section_foldable_candidate): New function.
10141 2009-12-30 Ian Lance Taylor <iant@google.com>
10144 * options.h (class General_options): Permit two dashes with
10145 --retain-symbols-file.
10147 2009-12-30 Ian Lance Taylor <iant@google.com>
10150 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10151 don't put the file header and segment headers in the text
10155 * common.cc (Sort_commons::operator()): Stabilize sort when both
10157 (Symbol_table::do_allocate_commons_list): When allocating common
10158 symbols, skip a symbol which is no longer common.
10159 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10160 an object before checking its type.
10161 * testsuite/common_test_2.c: New file.
10162 * testsuite/common_test_3.c: New file.
10163 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10164 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10165 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10166 (common_test_2_pic.o, common_test_2.so): New targets.
10167 (common_test_3_pic.o, common_test_3.so): New targets.
10168 * testsuite/Makefile.in: Rebuild.
10171 * script.cc (read_input_script): If we see a new SECTIONS clause,
10172 and we have added an input section, give an error.
10173 * layout.h (class Layout): Add have_added_input_section function.
10174 Add have_added_input_section_ field.
10175 * layout.cc (Layout::Layout): Initialize
10176 have_added_input_section_.
10177 (Layout::layout): Set have_added_input_section_.
10178 (Layout::layout_eh_frame): Likewise.
10180 2009-12-30 Ian Lance Taylor <iant@google.com>
10183 * options.h (class General_options): Add --sort-common option.
10184 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10185 * common.cc (Sort_common): Add sort_order parameter to
10186 constructor. Add sort_order_ field.
10187 (Sort_commons::operator): Check sort_order_.
10188 (Symbol_table::allocate_commons): Determine the sort order.
10189 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10190 Change all callers.
10191 (Symbol_table::do_allocate_commons_list): Likewise.
10193 2009-12-30 Ian Lance Taylor <iant@google.com>
10196 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10197 symbols from this object, don't change the visibility of an
10199 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10201 2009-12-30 Ian Lance Taylor <iant@google.com>
10204 * script.h (class Version_script_info): Define Language enum.
10205 Update declarations. Define Glob, Exact, and Lookup types. Add
10206 new fields globals_, locals_, and is_finalized_.
10207 * script.cc: Various formatting fixes.
10208 (class Parser_closure): Change language_stack_ from a vector of
10209 std::string to one of Version_script_info::Language. Adjust all
10211 (class Lazy_demangler): Remove.
10212 (struct Version_expression): Change language from std::string to
10213 Version_script_info::Language.
10214 (Version_script_info::Version_script_info): New function.
10215 (Version_script_info::~Version_script_info): Don't call clear.
10216 (Version_script_info::finalize): New function.
10217 (Version_script_info::build_lookup_tables): New function.
10218 (Version_script_info::build_expression_list_lookup): New
10220 (Version_script_info::get_symbol_version_helper): Rewrite to use
10222 (Version_script_info::print_expression_list): Adjust to use
10223 Version_script_info::Language.
10224 (script_push_lex_into_version_mode): Check that the version script
10225 has not been finalized.
10226 (version_script_push_lang): Change language string to
10227 Version_script_info::Language.
10228 * options.cc (Command_line::version_script): New function.
10229 * options.h (class General_options): Add finalize_dynamic_list
10230 function. Change version_script from declaration to definition.
10231 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10232 * testsuite/version_script.map: Remove duplicate def of foo.
10233 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10234 version_script.map.
10235 * testsuite/Makefile.in: Rebuild.
10237 2009-12-30 Ian Lance Taylor <iant@google.com>
10240 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10241 if the input symbol index is 0, make the output symbol index 0.
10243 2009-12-30 Ian Lance Taylor <iant@google.com>
10246 * options.h (class General_options): Add -x/--discard-all.
10247 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10248 --discard-all. If the local symbol needs a dynamic entry, check
10249 that before handling --discard-locals.
10251 2009-12-30 Ian Lance Taylor <iant@google.com>
10254 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10256 (Output_segment::add_output_section): Don't change the flags if
10257 the type is PT_TLS.
10260 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10261 GNU hash table if they need a dynamic value. Otherwise, don't add
10262 them if they are defined in a dynamic object or are forced local.
10264 2009-12-29 Ian Lance Taylor <iant@google.com>
10267 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10268 .gnu.hash table for a 32-bit target.
10271 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10272 regular and a dynamic object only needs a dynamic symbol table
10273 entry if it is externally visible.
10276 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10277 constructor. Add global_offset_table_ field.
10278 (Target_i386::got_section): Set global_offset_table_.
10279 (Target_i386::do_finalize_sections): Set global_offset_table_
10281 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10282 in constructor. Add global_offset_table_ field.
10283 (Target_x86_64::got_section): Set global_offset_table_.
10284 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10287 * layout.cc (Layout::Layout): Initialize increase_relro_.
10288 (Layout::get_output_section): Add is_relro, is_last_relro, and
10289 is_first_non_relro parameters. Change all callers.
10290 (Layout::choose_output_section): Likewise.
10291 (Layout::add_output_section_data): Likewise.
10292 (Layout::make_output_section): Likewise.
10293 (Layout::set_segment_offsets): Clear increase_relro when using a
10295 * layout.h (class Layout): Add increase_relro method. Add
10296 increase_relro_ field. Update declarations.
10297 * output.cc (Output_section::Output_section): Initialize
10298 is_last_relro_ and is_first_non_relro_.
10299 (Output_segment::add_output_section): Group relro sections is
10300 do_sort is true. Handle is_last_relro and is_first_non_relro.
10301 (Output_segment::maximum_alignment): Remove relro handling.
10302 (Output_segment::set_section_addresses): Add increase_relro
10303 parameter. Change all callers. Add initial alignment to align
10304 relro sections on separate page. Remove old relro handling.
10305 (Output_segment::set_section_list_addresses): Remove in_relro
10306 parameter. Change all callers.
10307 (Output_segment::set_offset): Add increase parameter. Change all
10308 callers. Remove old relro handling.
10309 * output.h (class Output_section): Add new methods: is_last_relro,
10310 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10311 Add is_last_relro_ and is_first_non_relro_ fields.
10312 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10313 Create separate .got.plt section. Call increase_relro.
10314 * x86_64.cc (Target_x86_64::got_section): Likewise.
10315 * testsuite/relro_script_test.t: Add .got.plt.
10318 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10319 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10320 (Layout::finalize): Call set_dynamic_symbol_size.
10321 (Layout::set_dynamic_symbol_size): New function.
10322 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10323 set_dynamic_symbol_size.
10326 * output.h (class Output_section): Add is_entsize_zero_ field.
10327 * output.cc (Output_section::Output_section): Initialize
10329 (Output_section::set_entsize): If two different entsizes are
10330 requested, force it to zero.
10331 (Output_section::add_input_section): Set flags for .debug_str
10332 before updating section flags. Set entsize.
10333 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10334 and SHF_STRING if all input sections have those flags.
10336 2009-12-29 Rafael Espindola <espindola@google.com>
10338 * main.cc (main): Fix the sys time reporting.
10339 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10342 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10344 * options.cc (General_options::parse_version): Allow -v to exit
10345 without an error if there is nothing to link.
10347 2009-12-29 Ian Lance Taylor <iant@google.com>
10349 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10350 using a version of gcc before 4.1.
10351 * configure: Rebuild.
10353 2009-12-28 Chris Demetriou <cgd@google.com>
10355 * attributes.cc (Output_attributes_section_data::do_write): Use
10356 std::vector::front rather than std::vector::data.
10358 2009-12-28 Ian Lance Taylor <iant@google.com>
10360 * symtab.h (class Symbol_table): Add enum Defined.
10361 * resolve.cc (Symbol_table::should_override): Add defined
10362 parameter. Change all callers. Test whether object is NULL
10363 before calling a method on it.
10364 (Symbol_table::report_resolve_problem): Add defined parameter.
10365 Change all callers.
10366 (Symbol_table::should_override_with_special): Likewise.
10367 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10368 parameter. Change all callers.
10369 (Symbol_table::do_define_in_output_data): Likewise.
10370 (Symbol_table::define_in_output_segment): Likewise.
10371 (Symbol_table::do_define_in_output_segment): Likewise.
10372 (Symbol_table::define_as_constant): Likewise.
10373 (Symbol_table::do_define_as_constant): Likewise.
10374 * script.h (class Symbol_assignment): Add is_defsym parameter to
10375 constructor; change all callers.
10376 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10377 parameter. Change all callers. Add is_defsym_ field.
10378 (class Parser_closure): Add parsing_defsym parameter to
10379 constructor; change all callers. Add parsing_defsym accessor
10380 function. Add parsing_defsym_ field.
10382 2009-12-28 Ian Lance Taylor <iant@google.com>
10384 * gold.cc (queue_middle_tasks): Fix formatting.
10385 * object.cc (Relobj::is_section_name_included): Likewise.
10387 2009-12-23 Ian Lance Taylor <iant@google.com>
10389 * i386.cc (Target_i386::do_calls_non_split): Recognize
10390 -fsplit-stack prologue for a function with a static chain.
10391 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10392 -fsplit-stack prologue when using %r11.
10394 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10396 * options.cc (General_options::parse_version): Make -v continue and do
10397 the link like GNU ld does.
10399 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10401 * Makefile.am (CCFILES): Add timer.cc.
10402 (HFILES): Add timer.h.
10403 * configure.ac: Check for sysconf and times.
10404 * main.cc: include timer.h.
10405 (main): Use Timer instead of get_run_time.
10408 * workqueue.cc: include timer.h.
10409 (Workqueue::find_and_run_task):
10410 Report user, sys and wall time.
10411 * Makefile.in: Regenerate.
10412 * config.in: Regenerate.
10413 * configure: Regenerate.
10415 2009-12-16 Doug Kwan <dougkwan@google.com>
10417 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10419 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10420 relaxed input sections.
10421 * output.cc (Output_section::find_relaxed_input_section): Change
10422 return type to Output_relaxed_input_section pointer. Adjust code
10423 for new type of relaxed_input_section_map_.
10424 * output.h (Output_section::find_relaxed_input_section): Change
10425 return type to Output_relaxed_input_section pointer.
10426 (Output_section::Output_relaxed_input_section_by_input_section_map):
10428 (Output_section::relaxed_input_section_map_): Change type to
10429 Output_section::Output_relaxed_input_section_by_input_section_map.
10430 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10433 2009-12-15 Ian Lance Taylor <iant@google.com>
10435 * layout.cc (Layout::create_shstrtab): Only write out after input
10436 sections if we are compressing debug sections.
10438 2009-12-15 Ian Lance Taylor <iant@google.com>
10440 * archive.cc (Archive::add_symbols): Only look up a symbol without
10441 a version if there is, in fact, a version.
10443 2009-12-14 Ian Lance Taylor <iant@google.com>
10445 Revert -Wshadow changes, all changes from:
10446 2009-12-11 Doug Kwan <dougkwan@google.com>
10447 2009-12-11 Nick Clifton <nickc@redhat.com>
10448 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10450 2009-12-11 Doug Kwan <dougkwan@google.com>
10452 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10454 * attributes.cc (Object_attribute::size): Ditto.
10455 (Attributes_section_data::size): Ditto.
10456 (Attributes_section_data::Attributes_section_data): Ditto.
10457 (Output_attributes_section_data::do_write): Ditto.
10458 * attributes.h (Object_attribute::set_type): Ditto.
10459 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10461 2009-12-11 Nick Clifton <nickc@redhat.com>
10463 * archive.cc: Fix shadowed variable warnings.
10464 * arm.cc: Likewise.
10465 * compressed_output.cc: Likewise.
10466 * compressed_output.h: Likewise.
10467 * configure: Likewise.
10468 * dwarf_reader.cc: Likewise.
10469 * dynobj.cc: Likewise.
10470 * dynobj.h: Likewise.
10471 * ehframe.cc: Likewise.
10472 * ehframe.h: Likewise.
10473 * errors.cc: Likewise.
10474 * expression.cc: Likewise.
10475 * fileread.cc: Likewise.
10476 * fileread.h: Likewise.
10477 * freebsd.h: Likewise.
10478 * i386.cc: Likewise.
10479 * icf.cc: Likewise.
10480 * incremental.h: Likewise.
10481 * layout.cc: Likewise.
10482 * layout.h: Likewise.
10483 * mapfile.cc: Likewise.
10484 * merge.cc: Likewise.
10485 * merge.h: Likewise.
10486 * object.cc: Likewise.
10487 * object.h: Likewise.
10488 * options.h: Likewise.
10489 * output.cc: Likewise.
10490 * output.h: Likewise.
10491 * parameters.cc: Likewise.
10492 * plugin.cc: Likewise.
10493 * powerpc.cc: Likewise.
10494 * reduced_debug_output.cc: Likewise.
10495 * reduced_debug_output.h: Likewise.
10496 * reloc.cc: Likewise.
10497 * reloc.h: Likewise.
10498 * resolve.cc: Likewise.
10499 * script-sections.cc: Likewise.
10500 * script.cc: Likewise.
10501 * script.h: Likewise.
10502 * sparc.cc: Likewise.
10503 * symtab.cc: Likewise.
10504 * symtab.h: Likewise.
10505 * target-select.cc: Likewise.
10506 * target-select.h: Likewise.
10507 * token.h: Likewise.
10508 * workqueue.cc: Likewise.
10509 * workqueue.h: Likewise.
10510 * x86_64.cc: Likewise.
10512 2009-12-10 Doug Kwan <dougkwan@google.com>
10514 * arm.cc (attributes.h): New include.
10515 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10516 (Arm_relobj::~Arm_relobj): Delete object pointed by
10517 attributes_section_data_.
10518 (Arm_relobj::attributes_section_data): New method definition.
10519 (Arm_relobj::attributes_section_data_): New data member declaration.
10520 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10521 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10522 attributes_section_data_.
10523 (Arm_dynobj::attributes_section_data): New method definition.
10524 (Arm_dynobj::attributes_section_data_): New data member declaration.
10525 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10526 initialization value of may_use_blx_ to false.
10527 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10528 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10529 object attributes to compute results instead of hard-coding.
10530 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10531 Target_arm::get_secondary_compatible_arch,
10532 Target_arm::set_secondary_compatible_arch
10533 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10534 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10535 New method declarations.
10536 (Target_arm::get_aeabi_object_attribute): New method definition.
10537 (Target_arm::attributes_section_data_): New data member declaration.
10538 (read_arm_attributes_section): New template definition.
10539 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10540 (Arm_dynobj::do_read_symbols): Ditto.
10541 (Target_arm::do_finalize_sections): Merge attributes sections from
10542 input. Check for BLX use after attributes section merging.
10543 Fix __exidx_start and __exidx_end visibility. Create an
10544 .ARM.attributes section if necessary.
10545 (Target_arm::get_secondary_compatible_arch,
10546 Target_arm::set_secondary_compatible_arch,
10547 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10548 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10549 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10550 New method definitions.
10552 2009-12-09 Ian Lance Taylor <iant@google.com>
10554 * plugin.cc (Plugin::load): Don't cast from void* to a function
10557 2009-12-09 Ian Lance Taylor <iant@google.com>
10559 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10560 information fields.
10562 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10564 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10565 Replace two_file_shared_1.so with two_file_shared_2.so.
10566 * testsuite/Makefile.in: Regenerated.
10568 2009-12-08 Doug Kwan <dougkwan@google.com>
10570 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10571 (HFILES): Add attributes.h and int_encoding.h.
10572 * Makefile.in: Regenerate.
10573 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10574 function definitions to int_encoding.cc
10575 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10576 prototypes to int_encoding.h
10577 * reduced_debug_output.cc (int_encoding.h): New include.
10578 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10579 function definitions to int_encoding.cc
10580 (insert_into_vector, read_from_pointer): Move template definitions to
10582 * attributes.cc: New file.
10583 * attributes.h: New file.
10584 * int_encoding.cc: New file.
10585 * int_encoding.h: New file.
10587 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10590 * incremental-dump.cc (dump_incremental_inputs): New.
10591 (main): Use dump_incremental_inputs.
10593 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10596 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10597 checking elfcpp::STT_FUNC.
10598 (Target_i386::Relocate::relocate): Likewise.
10599 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10601 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10602 symbols from shared libraries into normal FUNC symbols.
10604 * symtab.h (Symbol): Add is_func and use it.
10606 2009-12-05 Doug Kwan <dougkwan@google.com>
10608 * arm.cc (Target_arm::arm_info): Initialize new fields
10609 attributes_section and attributes_vendor.
10610 * i386.cc (Target_i386::i386_info): Same.
10611 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10612 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10613 fields attributes_section and attributes_vendor.
10614 * sparc.cc (Target_sparc::sparc_info): Same.
10615 * target.h (Target::attributes_section, Target::attributes_vendor,
10616 Target::is_attributes_section, Target::attribute_arg_type,
10617 Target::attributes_order): New method definitions.
10618 (Target::Target_info::attributes_section,
10619 Target::Target_info::attributes_vendor): New fields.
10620 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10621 virtual method definitions.
10622 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10623 attributes_section and attributes_vendor.
10624 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10626 2009-12-05 Doug Kwan <dougkwan@google.com>
10628 * arm.cc: Update comments about interworking and stub generation.
10629 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10630 considered as non-PIC.
10631 (Arm_relocate_functions::base_abs): Fix formatting.
10632 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10633 of function to use GOT entry address instead of offset.
10634 (Target_arm::Scan::global): Issue an error if a symbol would need a
10635 PLT does not get one because it is untyped. Remove code to create
10636 dynamic symbols for relative branches.
10637 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10638 takes unsigned integer instead of boolean.
10640 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10642 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10643 (two_file_test_LDADD): Likewise.
10644 (common_test_1_LDADD): Likewise.
10645 (exception_test_LDADD) Likewise.
10646 (weak_test_LDADD): Likewise.
10647 (many_sections_test_LDADD): Likewise.
10648 (initpri1_LDADD): Likewise.
10649 (script_test_1_LDADD): Likewise.
10650 (script_test_2_LDADD): Likewise.
10651 (justsyms_LDADD): Likewise.
10652 (binary_test_LDADD): Likewise.
10653 (large_LDADD): Likewise.
10654 * testsuite/Makefile.in: Regenerated.
10656 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10658 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10659 (Symbol_table::override_with_special): Likewise.
10660 (Symbol_table::add_from_object): Likewise.
10662 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10664 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10665 Don't set the data_offset twice.
10667 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10669 * testsuite/Makefile.in: Regenerate.
10671 2009-12-03 Doug Kwan <dougkwan@google.com>
10673 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10674 (Target_arm::do_finalize_sections): Add parameter for symbol table
10675 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10676 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10677 parameter for symbol table pointer.
10678 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10679 an additional parameter for a pointer to symbol table.
10680 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10681 parameter for a symbol table pointer.
10682 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10683 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10685 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10686 parameter for a symbol table pointer.
10688 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10690 * incremental.cc (Incremental_inputs_header)
10691 (Incremental_inputs_header_write, Incremental_inputs_entry)
10692 (Incremental_inputs_entry_write): Move ...
10693 * incremental.h (Incremental_inputs_header)
10694 (Incremental_inputs_header_write, Incremental_inputs_entry)
10695 (Incremental_inputs_entry_write): here.
10697 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10699 * incremental.cc (make_sized_incremental_binary): Set the target.
10700 Error if it is incompatible.
10701 * output.h (Output_file): Add filename method.
10703 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10705 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10706 from the get_* methods.
10708 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10710 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10711 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10712 Write 0 for the data_offset of scripts.
10714 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10716 * testsuite/Makefile.am: Add the incremental_test.sh test.
10717 * testsuite/incremental_test.sh: New.
10718 * testsuite/incremental_test_1.c: New.
10719 * testsuite/incremental_test_2.c: New.
10721 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10723 * incremental-dump.cc (main): Fix typos.
10725 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10728 * incremental-dump.cc (main): Use llu to print 64 bit values.
10730 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10731 H.J. Lu <hongjiu.lu@intel.com>
10733 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10735 (incremental_dump_LDADD): Likewise.
10736 * Makefile.in: Regenerated.
10738 2009-11-25 Doug Kwan <dougkwan@google.com>
10742 2009-11-25 Doug Kwan <dougkwan@google.com>
10744 * arm.cc (Target_arm::Target_arm): Move method definition
10745 outside of class definition. Add code to handle
10746 --target1-rel, --target1-abs and --target2= options.
10747 (Target_arm::get_reloc_reloc_type): Change method to be
10748 non-static and const.
10749 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10750 New data member declaration.
10751 (Target_arm::Scan::local, Target_arm::Scan::global,
10752 Target_arm::Relocate::relocate,
10753 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10754 Adjust call to Target_arm::get_real_reloc_type.
10755 (Target_arm::get_real_reloc_type): Use command line options
10756 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10757 * options.h (--target1-rel, --target1-abs, --target2): New
10760 2009-11-25 Doug Kwan <dougkwan@google.com>
10762 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10763 class definition. Add code to handle --target1-rel, --target1-abs
10764 and --target2= options.
10765 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10767 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10768 member declaration.
10769 (Target_arm::Scan::local, Target_arm::Scan::global,
10770 Target_arm::Relocate::relocate,
10771 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10772 call to Target_arm::get_real_reloc_type.
10773 (Target_arm::get_real_reloc_type): Use command line options to
10774 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10775 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10778 2009-11-25 Doug Kwan <dougkwan@google.com>
10780 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10781 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10782 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10784 (Arm_relocate_functions::thm_call): Replace body with a call to
10785 Arm_relocate_functions::thumb_branch_common.
10786 (Arm_relocate_functions::thm_jump24,
10787 Arm_relocate_functions::thm_xpc22): New method definitions.
10788 (Arm_relocate_functions::thumb_branch_common): New method definition.
10789 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10791 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10792 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10794 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10796 * Makefile.am: Build incremental-dump
10797 * Makefile.in: Regenerate.
10798 * incremental-dump.cc: New.
10799 * incremental.cc (Incremental_inputs_header_data,
10800 Incremental_inputs_entry_data): Move to incremental.h
10801 * incremental.h: (Incremental_inputs_header_data,
10802 Incremental_inputs_entry_data): Move from incremental.cc
10804 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10806 * incremental.cc (Incremental_inputs_header,
10807 Incremental_inputs_header_write, Incremental_inputs_entry,
10808 Incremental_inputs_entry_write): Add a typedef with the data type.
10810 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10812 * incremental.cc (Incremental_inputs_header,
10813 Incremental_inputs_header_write, Incremental_inputs_entry,
10814 Incremental_inputs_entry_write): Update comment about which
10815 type has the filed descriptions.
10817 2009-11-15 Doug Kwan <dougkwan@google.com>
10819 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10820 (Arm_relocate_functions::arm_branch_common): Change method defintion
10821 in class definition to a method declaration and update list of formal
10823 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10824 Arm_relocation_functions::jump24): Adjust call to
10825 Arm_relocate_functions::arm_branch_common. Update list of formal
10827 (Arm_relocate_functions::xpc25): New method definition.
10828 (Arm_relocate_functions::arm_branch_common): Move method defintion
10829 out from class definition. Use stubs for mode-switching and extending
10831 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10832 specially. Change code to enable use of stubs in ARM branches.
10834 2009-11-10 Doug Kwan <dougkwan@google.com>
10836 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10837 in method declaration.
10838 (Target_arm::relocate_stub): New method declaration.
10839 (Target_arm::default_target): Change to return a pointer instead of
10841 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10842 Target_arm::default_target.
10843 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10845 (Target_arm::relocate_section): Adjust view.
10846 (Target_arm::relocate_stub): New method definition.
10848 2009-11-10 Doug Kwan <dougkwan@google.com>
10850 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10852 * incremental.cc (open_incremental_binary): Initialized local
10853 variables to avoid warnings.
10854 * object.cc (make_elf_object): Ditto.
10855 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10858 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10861 * testsuite/plugin_test.c: Include "config.h".
10863 2009-11-09 Doug Kwan <dougkwan@google.com>
10865 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10866 (arm_symbol_value): Remove.
10867 (Arm_relocate_functions::arm_branch_common,
10868 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10869 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10870 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10871 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10872 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10873 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10874 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10875 Arm_relocate_functions::thm_mobw_abs_nc,
10876 Arm_relocate_functions::thm_mov_abs,
10877 Arm_relocate_functions::movw_prel_nc,
10878 Arm_relocate_functions::thm_movt_abs,
10879 Arm_relocate_functions::movt_prel,
10880 Arm_relocate_functions::thm_movw_prel_nc,
10881 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10882 (Target_arm::Relocate::relocate): Only decompose address into two
10883 parts if relocation type uses the thumb-bit and pass the actual
10884 bit instead of a flag indicating that the thumb-bit is used. Adjust
10885 calls to methods in Arm_relocate_functions for this change.
10887 2009-11-08 Ian Lance Taylor <iant@google.com>
10890 * reloc.cc: Instantiate
10891 Sized_relobj::initialize_input_to_output_maps and
10892 Sized_relobj:free_input_to_output_maps.
10894 2009-11-06 Ian Lance Taylor <iant@google.com>
10897 * defstd.cc (in_segment): Set only_if_ref true for "end".
10899 2009-11-06 Doug Kwan <dougkwan@google.com>
10901 * arm.cc (class Reloc_stub): Correct a comment.
10902 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10903 (Target_arm::scan_section_for_stubs): New method declaration.
10904 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10905 Change methods from private to protected.
10906 (Target_arm::do_may_relax): New method definition.
10907 (Target_arm::do_relax, Target_arm::group_sections,
10908 Target_arm::scan_reloc_for_stub,
10909 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10910 (Target_arm::arm_input_section_map_): New data member declaration.
10911 (Target_arm::scan_reloc_for_stub,
10912 Target_arm::scan_reloc_section_for_stubs,
10913 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10914 Target_arm::do_relax): New method definitions.
10916 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10918 * configure.ac: Check for (struct stat)::st_mtim
10919 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10920 * config.in: Regenerate.
10921 * configure: Regenerate.
10923 2009-11-05 Ian Lance Taylor <iant@google.com>
10926 * output.cc (Output_segment::add_output_section): Add missing
10929 2009-11-04 Ian Lance Taylor <iant@google.com>
10932 * object.h (class Object): Add is_needed and set_is_needed
10933 methods. Add is_needed_ field. Make bool fields into bitfields.
10934 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10935 defined in a dynamic object and referenced by a regular object,
10936 set is_needed for the dynamic object.
10937 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10938 if the file is marked with as_needed and it is not needed.
10940 2009-11-04 Ian Lance Taylor <iant@google.com>
10943 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10944 tags if data is discarded by linker script.
10945 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10946 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10947 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10948 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10950 2009-11-04 Ian Lance Taylor <iant@google.com>
10952 * layout.cc (Layout::get_output_section): Add is_interp and
10953 is_dynamic_linker_section parameters. Change all callers.
10954 (Layout::choose_output_section): Likewise.
10955 (Layout::make_output_section): Likewise.
10956 (Layout::add_output_section_data): Add is_dynamic_linker_section
10957 parameter. Change all callers.
10958 * layout.h (class Layout): Update declarations.
10959 * output.h (class Output_section): Add is_interp, set_is_interp,
10960 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10961 Add is_interp_, is_dynamic_linker_section_ fields. Change
10962 generate_code_fills_at_write_ to a bitfield.
10963 * output.cc (Output_section::Output_sections): Initialize new
10965 (Output_segment::add_output_section): Add do_sort parameter.
10966 Change all callers.
10968 2009-11-03 Ian Lance Taylor <iant@google.com>
10971 * options.h (class General_options): Add --warn-common.
10972 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10973 merging two common symbols.
10974 (Symbol_table::should_override): Handle --warn-common when merging
10975 a common symbol with a defined symbol. Use report_resolve_problem
10976 for multiple definitions.
10977 (Symbol_table::report_resolve_problem): New function.
10978 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10980 2009-11-03 Doug Kwan <dougkwan@google.com>
10982 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10984 (Target_arm::stub_factory): New method definition.
10985 (Target_arm::new_arm_input_section,
10986 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10987 Target_arm::reloc_uses_thumb_bit): New method declarations.
10988 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10989 New type definitions.
10990 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10991 member declarations.
10992 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10993 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10994 New method definitions.
10996 2009-11-03 Ian Lance Taylor <iant@google.com>
10998 * options.h (class General_options): Add --warn_constructors.
11000 2009-11-03 Ian Lance Taylor <iant@google.com>
11003 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11004 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11006 2009-11-03 Ian Lance Taylor <iant@google.com>
11009 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11010 --msgid-bugs-address.
11011 (install-pdf): New target.
11012 (install-data_yes): Look up one directory to find mkinstalldirs.
11014 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11016 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11019 2009-10-30 Doug Kwan <dougkwan@google.com>
11021 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11023 2009-10-30 Doug Kwan <dougkwan@google.com>
11025 * arm.cc (Stub_addend_reader): New struct template definition
11026 and partial specializations.
11027 (Stub_addend_reader::operator()): New method definition for a
11028 partially specialized template.
11030 2009-10-30 Doug Kwan <dougkwan@google.com>
11032 * arm.cc (Arm_relobj::processor_specific_flags): New method
11034 (Arm_relobj::do_read_symbols): New method declaration.
11035 (Arm_relobj::processor_specific_flags_): New data member declaration.
11036 (Arm_dynobj): New class definition.
11037 (Target_arm::do_finalize_sections): Add input_objects parameter.
11038 (Target_arm::do_adjust_elf_header): New method declaration.
11039 (Target_arm::are_eabi_versions_compatible,
11040 (Target_arm::merge_processor_specific_flags): New method declaration.
11041 (Target_arm::do_make_elf_object): New overloaded method definitions
11043 (Arm_relobj::do_read_symbols): New method definition.
11044 (Arm_dynobj::do_read_symbols): Ditto.
11045 (Target_arm::do_finalize_sections): Add input_objects parameters.
11046 Merge processor-specific flags from all input objects.
11047 (Target_arm::are_eabi_versions_compatible,
11048 Target_arm::merge_processor_specific_flags,
11049 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11050 New method definitions.
11051 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11052 Input_objects pointer type parameter.
11053 * layout.cc (Layout::finalize): Pass input objects to target's.
11054 finalize_sections function.
11055 * output.cc (Output_file_header::do_sized_write): Set ELF file
11056 header's processor-specific flags.
11057 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11058 Input_objects pointer type parameter.
11059 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11060 * target.h (Input_objects): New forward class declaration.
11061 (Target::processor_specific_flags,
11062 Target::are_processor_specific_flags_sect): New method definitions.
11063 (Target::finalize_sections): Add input_objects parameter.
11064 (Target::Target): Initialize processor_specific_flags_ and
11065 are_processor_specific_flags_set_.
11066 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11068 (Target::set_processor_specific_flags): New method definition.
11069 (Target::processor_specific_flags_,
11070 Target::are_processor_specific_flags_set_): New data member
11072 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11073 Input_objects pointer type parameter.
11075 2009-10-30 Doug Kwan <dougkwan@google.com>
11077 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11079 2009-10-28 Ian Lance Taylor <iant@google.com>
11081 * object.h (class Relobj): Drop options parameter from
11082 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11083 do_scan_relocs, do_relocate. Change all callers.
11084 (class Sized_relobj): Drop options parameters from
11085 do_gc_process_relocs, do_scan_relocs, do_relocate,
11086 do_relocate_sections, relocate_sections, emit_relocs_scan,
11087 emit_relocs_scan_reltype. Change all callers.
11088 (struct Relocate_info): Remove options field and all references to
11090 * reloc.h (class Read_relocs): Remove options constructor
11091 parameter and options_ field. Change all callers.
11092 (class Gc_process_relocs, class Scan_relocs): Likewise.
11093 (class Relocate_task): Likewise.
11094 * target-reloc.h (scan_relocs): Remove options parameter. Change
11096 (scan_relocatable_relocs): Likewise.
11097 * target.h (class Sized_target): Remove options parameter from
11098 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11100 * gc.h (gc_process_relocs): Remove options parameter. Change all
11102 * arm.cc: Update functions to remove options parameters.
11103 * i386.cc: Likewise.
11104 * powerpc.cc: Likewise.
11105 * sparc.cc: Likewise.
11106 * x86_64.cc: Likewise.
11107 * testsuite/testfile.cc: Likewise.
11109 2009-10-28 Doug Kwan <dougkwan@google.com>
11111 * arm.cc (Arm_relobj): New class definition.
11112 (Arm_relobj::scan_sections_for_stubs,
11113 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11114 New method definitions.
11116 2009-10-28 Cary Coutant <ccoutant@google.com>
11118 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11119 (Plugin::cleanup_done_): New member.
11120 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11121 (Plugin_manager::cleanup_done_): Remove.
11122 (Plugin_manager::add_input_file): Edit error message.
11123 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11124 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11126 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11128 * fileread.cc: (File_read::View::~View): Use the new
11129 data_ownership_ filed.
11130 (File_read::~File_read): Dispose the new whole_file_view_.
11131 (File_read::open): Mmap the whole file if needed.
11132 (File_read::open): Use whole_file_view_ instead of contents_.
11133 (File_read::find_view): Use whole_file_view_ if applicable.
11134 (File_read::do_read): Use whole_file_view_ instead of contents_.
11135 (File_read::make_view): Use whole_file_view_ instead of contents_,
11136 update File_read::View::View call.
11137 (File_read::find_or_make_view): Update File_read::View::View
11139 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11141 (File_read::View::Data_ownership): New enum.
11142 (File_read::View::View): Replace bool mapped_ with Data_ownership
11144 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11145 (File_read::View::data_ownership_): New field.
11146 (File_read::contents_): Remove (replaced by whole_file_view_).
11147 (File_read::whole_file_view_): New field.
11148 * options.h (class General_options): Add --keep-files-mapped.
11150 2009-10-27 Cary Coutant <ccoutant@google.com>
11152 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11153 * testsuite/Makefile.am (plugin_test_5): New test case.
11154 * testsuite/Makefile.in: Regenerate.
11156 2009-10-25 Doug Kwan <dougkwan@google.com>
11158 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11159 from private to protected to allow access by child class.
11160 (Sized_relobj::do_relocate_sections): New method declaration.
11161 (Sized_relobj::relocate_sections): Virtualize.
11162 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11163 Sized_relobj::relocate_sections. Instantiate template explicitly
11164 for different target sizes and endianity.
11166 2009-10-24 Doug Kwan <dougkwan@google.com>
11168 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11169 (Arm_input_section::as_arm_input_section): New method.
11170 (Arm_output_section): New class definition.
11171 (Arm_output_section::create_stub_group,
11172 Arm_output_section::group_sections): New method definitions.
11174 2009-10-22 Doug Kwan <dougkwan@google.com>
11176 * arm.cc (Arm_input_section): New class definition.
11177 (Arm_input_section::init, Arm_input_section:do_write,
11178 Arm_input_section::set_final_data_size,
11179 Arm_input_section::do_reset_address_and_file_offset): New method
11182 2009-10-21 Doug Kwan <dougkwan@google.com>
11184 * arm.cc (Stub_table, Arm_input_section): New forward class
11186 (Stub_table): New class defintion.
11187 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11188 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11189 New method definition.
11191 2009-10-21 Doug Kwan <dougkwan@google.com>
11193 * arm.cc: Update copyright comments.
11194 (Target_arm): New forward class template declaration.
11195 (Arm_address): New type.
11196 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11197 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11198 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11200 (Insn_template): Same.
11201 (DEF_STUBS): New macro.
11202 (Stub_type): New enum type.
11203 (Stub_template): New class definition.
11205 (Reloc_stub): Same.
11206 (Stub_factory): Same.
11207 (Target_arm::Target_arm): Initialize may_use_blx_ and
11208 should_force_pic_veneer_.
11209 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11210 Target_arm::should_force_pic_veneer,
11211 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11212 Target_arm::using_thumb_only, Target_arm:;default_target): New
11214 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11215 New data member declarations.
11216 (Insn_template::size, Insn_template::alignment): New method defintions.
11217 (Stub_template::Stub_template): New method definition.
11218 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11219 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11220 (Stub_factory::Stub_factory): New method definition.
11221 * gold.h (string_hash): New template.
11222 * output.h (Input_section_specifier::hash_value): Use
11224 (Input_section_specifier::string_hash): Remove.
11225 * stringpool.cc (Stringpool_template::string_hash): Use
11228 2009-10-20 Doug Kwan <dougkwan@google.com>
11230 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11231 symbols of relaxed input sections.
11232 * output.h (Output_section::find_relaxed_input_section): Make
11235 2009-10-16 Doug Kwan <dougkwan@google.com>
11237 * dynobj.cc (Versions::Versions): Initialize version_script_.
11238 Only insert base version symbol definition for a shared object
11239 if version script defines any version versions.
11240 (Versions::define_base_version): New method definition.
11241 (Versions::add_def): Check that base version is not needed.
11242 (Versions::add_need): Define base version lazily.
11243 * dynobj.h (Versions::define_base_version): New method declaration.
11244 (Versions::needs_base_version_): New data member declaration.
11245 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11246 (check_DATA): Add no_version_test.stdout.
11247 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11249 * testsuite/Makefile.in: Regenerate.
11250 * testsuite/no_version_test.c: New file.
11251 * testsuite/no_version_test.sh: Ditto.
11253 2009-10-16 Doug Kwan <dougkwan@google.com>
11255 * expression.cc (class Segment_start_expression): New class definition.
11256 (Segment_start_expression::value): New method definition.
11257 (script_exp_function_segment_start): Return a new
11258 Segment_start_expression.
11259 * gold/script-c.h (script_saw_segment_start_expression): New function
11261 * script-sections.cc (Script_sections::Script_sections): Initialize
11262 SAW_SEGMENT_START_EXPRESSION_ to false.
11263 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11264 and -Tbbs options to specify section addresses if given in
11265 command line and no SEGMENT_START expression is seen in a script.
11266 * script-sections.h (Script_sections::saw_segment_start_expression,
11267 Script_sections::set_saw_segment_start_expression): New method
11269 (Script_sections::saw_segment_start_expression_): New data member
11271 * script.cc (script_saw_segment_start_expression): New function.
11272 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11273 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11274 script_test_7.sh and script_test_8.sh.
11275 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11276 script_test_8.stdout.
11277 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11278 (script_test_6, script_test_6.stdout, script_test_7,
11279 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11280 * Makefile.in: Regenerate.
11281 * testsuite/script_test_6.sh: New file.
11282 * testsuite/script_test_6.t: Same.
11283 * testsuite/script_test_7.sh: Same.
11284 * testsuite/script_test_7.t: Same.
11285 * testsuite/script_test_8.sh: Same.
11287 2009-10-16 Doug Kwan <dougkwan@google.com>
11289 * output.cc (Output_segment::set_section_list_address): Cast
11290 expressions to unsigned long long type to avoid format warnings.
11292 2009-10-15 Ian Lance Taylor <iant@google.com>
11294 * script.cc (Script_options::add_symbol_assignment): Always add a
11295 dot assignment to script_sections_.
11296 * script-sections.cc (Script_sections::add_dot_assignment):
11297 Initialize if necessary.
11299 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11300 program headers with no load segment if there is a linker script.
11302 * layout.cc (Layout::set_segment_offsets): Align the file offset
11303 to the segment aligment for -N or -n with no load segment.
11304 * output.cc (Output_segment::add_output_section): Don't crash if
11305 the first section is a TLS section.
11306 (Output_segment::set_section_list_addresses): Print an error
11307 message if the address moves backward in a linker script.
11308 * script-sections.cc
11309 (Output_section_element_input::set_section_addresses): Don't
11310 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11311 (Orphan_output_section::set_section_addresses): Likewise.
11313 2009-10-15 Doug Kwan <dougkwan@google.com>
11315 * layout.cc (Layout::finish_dynamic_section): Generate tags
11316 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11317 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11318 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11320 2009-10-14 Ian Lance Taylor <iant@google.com>
11322 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11324 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11325 data_shdr fields of relinfo.
11326 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11327 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11328 R_386_TLS_LDO_32, adjust based on section flags.
11329 (Target_i386::Relocate::fix_up_ldo): Remove.
11331 2009-10-13 Ian Lance Taylor <iant@google.com>
11333 Add support for -pie.
11334 * options.h (class General_options): Add -pie and
11336 (General_options::output_is_position_independent): Test -pie.
11337 (General_options::output_is_executable): Return true if not shared
11338 and not relocatable.
11339 (General_options::output_is_pie): Remove.
11340 * options.cc (General_options::finalize): Reject incompatible uses
11342 * gold.cc (queue_middle_tasks): A -pie link is not static.
11343 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11344 * symtab.cc (Symbol::final_value_is_known): Return false if
11345 output_is_position_independent.
11346 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11347 output_is_position_independent.
11348 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11349 output_is_position_independent.
11350 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11351 output_is_position_independent.
11352 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11354 (basic_pie_test.o, basic_pie_test): New targets.
11355 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11356 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11357 (two_file_pie_test): New target.
11358 * testsuite/Makefile.in: Rebuild.
11359 * README: Remove note saying that -pie is not supported.
11361 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11363 * options.h (class General_options): Add -init and -fini.
11364 * layout.cc (Layout::finish_dynamic_section): Emit
11365 given init and fini functions.
11367 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11369 * gc.h (gc_process_relocs): Check if icf is enabled using new
11371 * gold.cc (queue_initial_tasks): Likewise.
11372 (queue_middle_tasks): Likewise.
11373 * object.cc (do_layout): Likewise.
11374 * symtab.cc (is_section_folded): Likewise.
11375 * main.cc (main): Likewise.
11376 * reloc.cc (Read_relocs::run): Likewise.
11377 (Sized_relobj::do_scan_relocs): Likewise.
11378 * icf.cc (is_function_ctor_or_dtor): New function.
11379 (Icf::find_identical_sections): Check if function is ctor or dtor when
11380 safe icf is chosen.
11381 * options.h (General_options::icf): Change option to be an enum.
11382 (Icf_status): New enum.
11383 (icf_enabled): New method.
11384 (icf_safe_folding): New method.
11385 (set_icf_status): New method.
11386 (icf_status_): New variable.
11387 * (options.cc) (General_options::finalize): Set icf_status_.
11388 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11389 icf_test and icf_keep_unique_test to use the --icf enum flag.
11390 * testsuite/icf_safe_test.sh: New file.
11391 * testsuite/icf_safe_test.cc: New file.
11393 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11395 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11396 includes to gc.h and icf.h.
11397 * arm.cc: Include gc.h.
11398 * gold.cc: Likewise.
11399 * i386.cc: Likewise.
11400 * powerpc.cc: Likewise.
11401 * sparc.cc: Likewise.
11402 * x86_64.cc: Likewise.
11403 * gc.h: Include icf.h.
11405 2009-10-11 Ian Lance Taylor <iant@google.com>
11407 * plugin.cc: Include "gold.h" before other header files.
11409 2009-10-10 Chris Demetriou <cgd@google.com>
11411 * options.h (Input_file_argument::Input_file_type): New enum.
11412 (Input_file_argument::is_lib_): Replace with...
11413 (Input_file_argument::type_): New member.
11414 (Input_file_argument::Input_file_argument): Take Input_file_type
11415 'type' rather than boolean 'is_lib' as second argument.
11416 (Input_file_argument::is_lib): Use type_.
11417 (Input_file_argument::is_searched_file): New function.
11418 (Input_file_argument::may_need_search): Handle is_searched_file.
11419 * options.cc (General_options::parse_library): Support -l:filename.
11420 (General_options::parse_just_symbols): Update for Input_file_argument
11422 (Command_line::process): Likewise.
11423 * archive.cc (Archive::get_file_and_offset): Likewise.
11424 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11425 * script.cc (read_script_file, script_add_file): Likewise.
11426 * fileread.cc (Input_file::Input_file): Likewise.
11427 (Input_file::will_search_for): Handle is_searched_file.
11428 (Input_file::open): Likewise.
11429 * readsyms.cc (Read_symbols::get_name): Likewise.
11430 * testsuite/Makefile.am (searched_file_test): New test.
11431 * testsuite/Makefile.in: Regenerate.
11432 * testsuite/searched_file_test.cc: New file.
11433 * testsuite/searched_file_test_lib.cc: New file.
11435 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11436 Ian Lance Taylor <iant@google.com>
11438 * descriptor.cc: Include <cstdio> and "binary-io.h".
11439 (Descriptors::open): Open the files in binary mode always.
11440 * script.cc (Lex::get_token): Treat \r as whitespace.
11442 2009-10-09 Ian Lance Taylor <iant@google.com>
11444 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11446 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11447 Ian Lance Taylor <iant@google.com>
11449 * configure.ac: Check for readv function also.
11450 * fileread.cc (readv): Define if not HAVE_READV.
11451 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11453 * config.in: Regenerate.
11454 * configure: Regenerate.
11456 2009-10-09 Doug Kwan <dougkwan@google.com>
11458 * layout.cc (Layout::make_output_section): Call target hook to make
11459 ordinary output section.
11460 (Layout::finalize): Adjust parameter list of call the
11461 Target::may_relax().
11462 * layout.h (class Layout::section_list): New method.
11463 * merge.h (Output_merge_base::entsize): Change visibility to public.
11464 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11466 (Output_merge_string::do_is_string): New method.
11467 * object.cc (Sized_relobj::do_setup): renamed from
11468 Sized_relobj::set_up.
11469 * object.h (Sized_relobj::adjust_shndx,
11470 Sized_relobj::initializ_input_to_output_maps,
11471 Sized_relobj::free_input_to_output_maps): Change visibilities to
11473 (Sized_relobj::setup): Virtualize.
11474 (Sized_relobj::do_setup): New method declaration.
11475 (Sized_relobj::invalidate_section_offset,
11476 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11477 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11478 * options.cc (parse_int): New function.
11479 * options.h (parse_int): New declaration.
11480 (DEFINE_int): New macro.
11481 (stub_group_size): New option.
11482 * output.cc (Output_section::Output_section): Initialize memebers
11483 merge_section_map_, merge_section_by_properties_map_,
11484 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11485 (Output_section::add_input_section): Handled deferred code-fill
11486 generation and remove an old comment.
11487 (Output_section::add_relaxed_input_section): New method definition.
11488 (Output_section::add_merge_input_section): Use merge section by
11489 properties map to speed to search. Update merge section maps
11491 (Output_section::build_relaxation_map): New method definition.
11492 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11494 (Output_section::relax_input_section): Renamed to
11495 Output_section::convert_input_sections_to_relaxed_sections and change
11496 interface to take a vector of pointers to relaxed sections.
11497 (Output_section::find_merge_section,
11498 Output_section::find_relaxed_input_section): New method definitions.
11499 (Output_section::is_input_address_mapped,
11500 Output_section::output_offset, Output_section::output_address):
11501 Use output section data maps to speed up searching.
11502 (Output_section::find_starting_output_address): Add comments.
11503 (Output_section::do_write,
11504 Output_section::write_to_postprocessing_buffer): Do code-fill
11505 generation as appropriate.
11506 (Output_section::get_input_sections): Invalidate relaxed input section
11508 (Output_section::restore_states): Adjust type of checkpoint .
11509 Invalidate relaxed input section map.
11510 * output.h (Output_merge_base): New class declaration.
11511 (Input_section_specifier): New class defintion.
11512 (class Output_relaxed_input_section) Change base class to
11513 Output_section_data_build.
11514 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11515 base class initializer.
11516 (Output_section::add_relaxed_input_section): New method declaration.
11517 (Output_section::Input_section): Change visibility to protected.
11518 (Output_section::Input_section::relobj,
11519 Output_section::Input_section::shndx): Handle relaxed input sections.
11520 Output_section::input_sections) Change visibility to protected. Also
11521 define overload to return a non-const pointer.
11522 (Output_section::Merge_section_properties): New class defintion.
11523 (Output_section::Merge_section_by_properties_map,
11524 Output_section::Output_section_data_by_input_section_map,
11525 Output_section::Relaxation_map): New types.
11526 (Output_section::relax_input_section): Rename method to
11527 Output_section::convert_input_sections_to_relaxed_sections and change
11528 interface to take a vector of relaxed section pointers.
11529 (Output_section::find_merge_section,
11530 Output_section::find_relaxed_input_section,
11531 Output_section::build_relaxation_map,
11532 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11533 New method declarations.
11534 (Output_section::merge_section_map_
11535 Output_section::merge_section_by_properties_map_,
11536 Output_section::relaxed_input_section_map_,
11537 Output_section::is_relaxed_input_section_map_valid_,
11538 Output_section::generate_code_fills_at_write_): New data members.
11539 * script-sections.cc
11540 (Output_section_element_input::set_section_addresses): Call
11541 current_data_size and addralign methods of relaxed input sections.
11542 (Orphan_output_section::set_section_addresses): Call current_data_size
11543 and addralign methods of relaxed input sections.
11544 * symtab.cc (Symbol_table::compute_final_value): Extract template
11545 from the body of Symbol_table::sized_finalize_symbol.
11546 (Symbol_table::sized_finalized_symbol): Call
11547 Symbol_table::compute_final_value.
11548 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11549 (Symbol_table::compute_final_value): New templated method declaration.
11550 * target.cc (Target::do_make_output_section): New method defintion.
11551 * target.h (Target::make_output_section): New method declaration.
11552 (Target::relax): Add more parameters for input objects, symbol table
11553 and layout. Adjust call to do_relax.
11554 (Target::do_make_output_section): New method declaration.
11555 (Target::do_relax): Add parameters for input objects, symbol table
11558 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11560 * pread.c: Include stdio.h.
11562 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11564 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11567 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11569 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11570 Change read_shndx type to unsigned int.
11571 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11573 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11574 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11575 Change read_shndx type to unsigned int.
11576 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11578 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11579 * layout.cc (Layout::create_symtab_sections): Cast the result of
11580 local_symcount * symsize to off_t in the gold_assert.
11582 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11584 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11585 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11587 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11588 (Arm_relocate_functions::thm_abs5): New function.
11589 (Arm_relocate_functions::abs12): New function.
11590 (Arm_relocate_functions::abs16): New function.
11591 (Arm_relocate_functions::base_abs): New function.
11592 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11593 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11594 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11596 (Scan::global): Likewise.
11597 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11598 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11599 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11600 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11603 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11605 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11606 (Arm_relocate_functions::movt_prel): New function.
11607 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11608 (Arm_relocate_functions::thm_movt_prel): New function.
11609 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11610 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11611 (Scan::global, Relocate::relocate): Likewise.
11612 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11614 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11616 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11617 Incremental_checker.
11618 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11620 (class Incremental_inputs_header): New class.
11621 (Incremental_inputs_header_writer): Edit comment.
11622 (Incremental_inputs_entry): New class.
11623 (Incremental_inputs_entry_writer): Edit comment.
11624 (Sized_incremental_binary::do_find_incremental_inputs_section):
11625 Add *strtab_shndx parameter, fill it.
11626 (Sized_incremental_binary::do_check_inputs): New method.
11627 (Incremental_checker::can_incrementally_link_output_file): Use
11628 Sized_incremental_binary::check_inputs.
11629 (Incremental_inputs::report_command_line): Save command line in
11632 (Incremental_binary::find_incremental_inputs_section): New
11634 (Incremental_binary::do_find_incremental_inputs_section): Add
11635 strtab_shndx parameter.
11636 (Incremental_binary::do_check_inputs): New pure virtual method.
11637 (Sized_incremental_binary::do_check_inputs): Declare.
11638 (Incremental_checker::Incremental_checker): Add incremental_inputs
11639 parameter, use it to initialize incremental_inputs_.
11640 (Incremental_checker::incremental_inputs_): New field.
11641 (Incremental_checker::command_line): New method.
11642 (Incremental_checker::inputs): New method.
11643 (Incremental_checker::command_line_): New field.
11645 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11647 * incremental.cc: Include <cstdarg> and "target-select.h".
11648 (vexplain_no_incremental): New function.
11649 (explain_no_incremental): New function.
11650 (Incremental_binary::error): New method.
11651 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11653 (make_sized_incremental_binary): New function.
11654 (open_incremental_binary): New function.
11655 (can_incrementally_link_file): Add checks if output is ELF and has
11657 * incremental.h: Include "elfcpp_file.h" and "output.h".
11658 (Incremental_binary): New class.
11659 (Sized_incremental_binary): New class.
11660 (open_incremental_binary): Declare.
11661 * object.cc (is_elf_object): Use
11662 elfcpp::Elf_recognizer::is_elf_file.
11663 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11664 * output.h (Output_file::filesize): New method.
11666 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11668 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11670 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11671 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11673 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11675 (Arm_relocate_functions::movw_abs_nc): New function.
11676 (Arm_relocate_functions::movt_abs): New function.
11677 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11678 (Arm_relocate_functions::thm_movt_abs): New function.
11679 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11680 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11681 (Scan::global): Likewise.
11682 (Relocate::relocate): Likewise.
11683 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11685 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11687 * arm.cc (Arm_relocate_functions::got_prel) New function.
11688 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11689 (Relocate::relocate): Likewise.
11690 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11692 2009-10-06 Ian Lance Taylor <iant@google.com>
11694 * options.h (class General_options): Define
11695 split_stack_adjust_size parameter.
11696 * object.h (class Object): Add uses_split_stack_ and
11697 has_no_split_stack_ fields. Add uses_split_stack and
11698 has_no_split_stack accessor functions. Declare
11699 handle_split_stack_section.
11700 (class Reloc_symbol_changes): Define.
11701 (class Sized_relobj): Define Function_offsets. Declare
11702 split_stack_adjust, split_stack_adjust_reltype, and
11704 * object.cc (Object::handle_split_stack_section): New function.
11705 (Sized_relobj::do_layout): Call handle_split_stack_section.
11706 * dynobj.cc (Sized_dynobj::do_layout): Call
11707 handle_split_stack_section.
11708 * reloc.cc (Sized_relobj::relocate_sections): Call
11709 split_stack_adjust for executable sections in split_stack
11710 objects. Pass reloc_map to relocate_section.
11711 (Sized_relobj::split_stack_adjust): New function.
11712 (Sized_relobj::split_stack_adjust_reltype): New function.
11713 (Sized_relobj::find_functions): New function.
11714 * target-reloc.h: Include "object.h".
11715 (relocate_section): Add reloc_symbol_changes parameter. Change
11717 * target.h (class Target): Add calls_non_split method. Declare
11718 do_calls_non_split virtual method. Declare match_view and
11720 * target.cc: Include "elfcpp.h".
11721 (Target::do_calls_non_split): New function.
11722 (Target::match_view): New function.
11723 (Target::set_view_to_nop): New function.
11724 * gold.cc (queue_middle_tasks): Give an error if mixing
11725 split-stack and non-split-stack objects with -r.
11726 * i386.cc (Target_i386::relocate_section): Add
11727 reloc_symbol_changes parameter.
11728 (Target_i386::do_calls_non_split): New function.
11729 * x86_64.cc (Target_x86_64::relocate_section): Add
11730 reloc_symbol_changes parameter.
11731 (Target_x86_64::do_calls_non_split): New function.
11732 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11734 * powerpc.cc (Target_powerpc::relocate_section): Add
11735 reloc_symbol_changes parameter.
11736 * sparc.cc (Target_sparc::relocate_section): Add
11737 reloc_symbol_changes parameter.
11738 * configure.ac: Call AM_CONDITIONAL for the default target.
11739 * configure: Rebuild.
11740 * testsuite/Makefile.am (TEST_AS): New variable.
11741 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11742 (check_DATA): Add split_i386 and split_x86_64 files.
11743 (SPLIT_DEFSYMS): Define.
11744 (split_i386_[1234n].o): New targets.
11745 (split_i386_[124]): New targets.
11746 (split_i386_[1234r].stdout): New targets.
11747 (split_x86_64_[1234n].o): New targets.
11748 (split_x86_64_[124]): New targets.
11749 (split_x86_64_[1234r].stdout): New targets.
11750 (MOSTLYCLEANFILES): Add new executables.
11751 * testsuite/split_i386.sh: New file.
11752 * testsuite/split_x86_64.sh: New file.
11753 * testsuite/split_i386_1.s: New file.
11754 * testsuite/split_i386_2.s: New file.
11755 * testsuite/split_i386_3.s: New file.
11756 * testsuite/split_i386_4.s: New file.
11757 * testsuite/split_i386_n.s: New file.
11758 * testsuite/split_x86_64_1.s: New file.
11759 * testsuite/split_x86_64_2.s: New file.
11760 * testsuite/split_x86_64_3.s: New file.
11761 * testsuite/split_x86_64_4.s: New file.
11762 * testsuite/split_x86_64_n.s: New file.
11763 * testsuite/testfile.cc (Target_test): Update relocation_section
11765 * testsuite/Makefile.in: Rebuild.
11767 2009-10-06 Ian Lance Taylor <iant@google.com>
11769 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11770 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11771 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11772 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11773 the address on ldo_addrs_.
11774 (Target_i386::Relocate::fix_up_ldo): New function.
11776 2009-10-06 Rafael Espindola <espindola@google.com>
11778 * plugin.cc (add_input_library): New.
11779 (Plugin::load): Add add_input_library to tv.
11780 (Plugin_manager::add_input_file): Add the is_lib argument.
11781 (add_input_file): Update call to Plugin_manager::add_input_file.
11782 (add_input_library): New.
11783 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11785 2009-09-30 Doug Kwan <dougkwan@google.com>
11787 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11788 symbol and call Symbol::may_need_copy_reloc to determine if
11789 a copy reloc is needed.
11790 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11791 nocopyreloc is given in command line.
11792 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11793 given in command line.
11794 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11795 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11796 of the removed Target_i386::may_need_copy_reloc.
11797 * options.h (copyreloc): New option with default value false.
11798 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11799 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11800 instead of the removed Target_powerpc::may_need_copy_reloc.
11801 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11802 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11803 instead of the removed Target_sparc::may_need_copy_reloc.
11804 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11805 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11806 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11807 instead of the removed Target_x86_64::may_need_copy_reloc.
11809 2009-09-30 Ian Lance Taylor <iant@google.com>
11811 * object.h (class Object): Remove target_ field, and target,
11812 sized_target, and set_target methods.
11813 (Object::sized_target): Remove.
11814 (class Sized_relobj): Update declarations. Remove sized_target.
11815 * object.cc (Sized_relobj::setup): Remove target parameter.
11816 Change all callers.
11817 (Input_objects::add_object): Don't do anything with the target.
11818 (make_elf_sized_object): Add punconfigured parameter. Change all
11819 callers. Set or test parameter target.
11820 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11821 Change all callers.
11822 * parameters.cc (Parameters::set_target): Change parameter type to
11824 (Parameters::default_target): Remove.
11825 (set_parameters_target): Change parameter type to be non-const.
11826 (parameters_force_valid_target): New function.
11827 (parameters_clear_target): New function.
11828 * parameters.h (class Parameters): Update declarations. Remove
11829 default_target method. Add sized_target and clear_target
11830 methods. Change target_ to be non-const.
11831 (set_parameters_target): Update declaration.
11832 (parameters_force_valid_target): Declare.
11833 (parameters_clear_target): Declare.
11834 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11835 as NULL if we aren't searching.
11836 (Add_symbols::run): Don't check for compatible target.
11837 * fileread.cc (Input_file::open_binary): Call
11838 parameters_force_valid_target.
11839 * gold.cc (queue_middle_tasks): Likewise.
11840 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11841 set_target on object.
11842 * dynobj.h (class Sized_dynobj): Update declarations.
11843 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11844 make_elf_object returns NULL.
11845 (Archive::include_member): Don't check whether object target is
11847 * output.cc (Output_section::add_input_section): Get target from
11849 (Output_section::relax_input_section): Likewise.
11850 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11852 (Sized_relobj::do_scan_relocs): Likewise.
11853 (Sized_relobj::relocate_sections): Likewise.
11854 * resolve.cc (Symbol_table::resolve): Likewise.
11855 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11856 parameter. Change all callers.
11857 (Symbol_table::add_from_object): Get target from parameters.
11858 (Symbol_table::add_from_relobj): Don't check object target.
11859 (Symbol_table::add_from_dynobj): Likewise.
11860 (Symbol_table::define_special_symbol): Get target from
11862 * symtab.h (class Symbol_table): Update declaration.
11863 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11864 parameter. Change all callers. Clear parameter target.
11865 (Binary_test): Test target here.
11866 * testsuite/object_unittest.cc (gold_testsuite): Remove
11867 target_test_pointer parameter. Change all callers.
11868 (Object_test): Test target here.
11870 2009-09-26 Ian Lance Taylor <iant@google.com>
11872 * testsuite/initpri1.c: Don't try to use constructor priorities if
11873 compiling with gcc before 4.3.
11875 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11877 * testsuite/retain_symbols_file_test.sh (check_present): Change
11878 output file name to retain_symbols_file_test.stdout.
11879 (check_absent): Likewise.
11881 2009-09-18 Craig Silverstein <csilvers@google.com>
11883 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11884 * options.cc: Include <cerrno> and <fstream>.
11885 (General_options::finalize): Parse -retain-symbols-file tag.
11886 * options.h: New flag.
11887 (General_options): New method should_retain_symbol, new
11888 variable symbols_to_retain.
11889 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11890 should_retain_symbol map.
11891 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11892 * testsuite/Makefile.in: Regenerate.
11893 * testsuite/retain_symbols_file_test.sh: New file.
11895 2009-09-18 Nick Clifton <nickc@redhat.com>
11897 * po/es.po: Updated Spanish translation.
11899 2009-09-17 Doug Kwan <dougkwan@google.com>
11901 * debug.h (DEBUG_RELAXATION): New constant.
11902 (DEBUG_ALL): Add DEBUG_RELAXATION.
11903 (debug_string_to_enum): Add relaxation debug option.
11905 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11906 Layout::Relaxation_debug_check::read_sections,
11907 Layout::Relaxation_debug_check::read_sections): New method definitions.
11908 (Layout::Layout): Initialize data members
11909 record_output_section_data_from_scrips_,
11910 script_output_section_data_list_ and relaxation_debug_check_.
11911 (Layout::save_segments, Layout::restore_segments,
11912 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11913 Layout::relaxation_loop_body): New method definitions.
11914 (Layout::finalize): Support relaxation. Move section layout code to
11915 Layout::relaxation_loop_body.
11916 (Layout::set_asection_address_from_script): Move code for orphan
11917 section placement out.
11918 (Layout::place_orphan_sections_in_script): New method definition.
11919 * layout.h (Output_segment_headers, Output_file_header):
11920 New forward class declarations.
11921 (Layout::~Layout): Define.
11922 (Layout::new_output_section_data_from_script): New method definition.
11923 (Layout::place_orphan_sections_in_script): New method declaration.
11924 (Layout::Segment_states): New type declaration.
11925 (Layout::save_segments, Layout::restore_segments,
11926 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11927 Layout::relaxation_loop_body): New method declarations.
11928 (Layout::Output_section_data_list): New type declaration.
11929 (Layout::Relaxation_debug_check): New class definition.
11930 (Layout::record_output_section_data_from_script_,
11931 Layout::script_output_section_data_list_, Layout::segment_states_,
11932 Layout::relaxation_debug_check_): New data members.
11933 * output.cc: (Output_section_headers::do_size): New method definition.
11934 (Output_section_headers::Output_section_headers): Move size
11935 computation to Output_section_headers::do_size.
11936 (Output_segment_headers::do_size): New method definition.
11937 (Output_file_header::Output_file_header): Move size computation to
11938 Output_file_header::do_size and call it.
11939 (Output_file_header::do_size): New method definition.
11940 (Output_data_group::Output_data_group): Adjust call to
11941 Output_section_data.
11942 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11943 (Output_symtab_xindex::do_write): Add array bound check.
11944 (Output_section::Input_section::print_to_mapfile): Handle
11945 RELAXED_INPUT_SECTION_CODE.
11946 (Output_section::Output_section): Initialize data member checkpoint_.
11947 (Output_section::~Output_section): Delete checkpoint object pointed
11949 (Output_section::add_input_section): Always add an Input_section if
11951 (Output_section::add_merge_input_section): Add assert.
11952 (Output_section::relax_input_section): New method definition.
11953 (Output_section::set_final_data_size): Set load address to zero for
11954 an unallocated section.
11955 (Output_section::do_address_and_file_offset_have_reset_values):
11956 New method definition.
11957 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11958 Handle relaxed input section.
11959 (Output_section::sort_attached_input_sections): Checkpoint input
11960 section list lazily.
11961 (Output_section::get_input_sections): Change type of input_sections to
11962 list of Simple_input_section pointers. Checkpoint input section list
11963 lazily. Also handle relaxed input sections.
11964 (Output_section::add_input_section_for_script): Take a reference to
11965 a Simple_input_section object instead of Relobj pointer and section
11966 index as parameter. Handle relaxed input sections.
11967 (Output_section::save_states, Output_section::restore_states): New
11968 method definitions.
11969 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11970 (Output_data::is_data_size_fixed): New method definition.
11971 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11973 (Output_data::address_and_file_offset_have_reset_values): New method
11975 (Output_data::do_address_and_file_offset_have_reset_values): New method
11977 (Output_data::set_data_size): Check that data size is not fixed.
11978 (Output_data::fix_data_size): New method definition.
11979 (Output_data::is_data_size_fixed_): New data member.
11980 (Output_section_headers::set_final_data_size): New method definition.
11981 (Output_section_headers::do_size): New method declaration.
11982 (Output_segment_headers::set_final_data_size): New method definition.
11983 (Output_segment_headers::do_size): New method declaration.
11984 (Output_file_header::set_final_data_size)::New method definition.
11985 (Output_file_header::do_size)::New method declaration.
11986 (Output_section_data::Output_section_data): Add new parameter
11987 is_data_size_fixed and use it to fix data size.
11988 (Output_data_const::Output_data_const): Adjust call to base class
11989 constructor and fix data size.
11990 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11991 base class constructor and fix data size.
11992 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11993 base class constructor and fix data size.
11994 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11995 class constructor and fix data size.
11996 (Output_data_group::set_final_data_size): New method definition.
11997 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11998 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11999 class constructor and fix data size.
12000 (Output_relaxed_input_section): New class definition.
12001 (Output_section::Simple_input_section): New class definition.
12002 (Output_section::get_input_sections): Adjust parameter list.
12003 (Output_section::add_input_section_for_script): Same.
12004 (Output_section::save_states, Output_section::restore_states,
12005 Output_section::do_address_and_file_offset_have_reset_values,
12006 (Output_section::Input_section::Input_section): Handle
12007 RELAXED_INPUT_SECTION_CODE. Add new overload for
12008 Output_relaxed_input_section.
12009 (Output_section::Input_section::is_input_section,
12010 Output_section::Input_section::set_output_section): Handle relaxed
12012 (Output_section::Input_section::is_relaxed_input_section,
12013 Output_section::Input_section::output_section_data,
12014 Output_section::Input_section::relaxed_input_section): New method
12016 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12018 (Output_section::Input_section::u1_): Update comments.
12019 (Output_section::Input_section::u2_): Add new union member poris.
12020 (Output_section::Checkpoint_output_section): New classs definition.
12021 (Output_section::relax_input_section): New method declaration.
12022 (Output_section::checkpoint_): New data member.
12023 (Output_segment): Update comments.
12024 (Output_segment::Output_segment): Un-privatize copy constructor.
12025 (Output_segment::operator=): Un-privatize.
12026 * script-sections.cc (Output_section_element::Input_section_list):
12027 Change element type to Output_section::Simple_input_section.
12028 (Output_section_element_dot_assignment::set_section_addresses):
12029 Register output section data for relaxation clean up.
12030 (Output_data_exression::Output_data_expression): Adjust call to base
12031 constructor to fix data size.
12032 (Output_section_element_data::set_section_addresses): Register
12033 Output_data_expression object for relaxation clean up.
12034 (struct Input_section_info): Replace Relobj pointer and section index
12035 pair with Output_section::Simple_input_section and Convert struct to a
12037 (Input_section_sorter::operator()): Adjust access to
12038 Input_section_info data member to use accessors.
12039 (Output_section_element_input::set_section_addresses): Use layout
12040 parameter. Adjust code to use Output_section::Simple_input_section
12041 and Input_secction_info classes. Register filler for relaxation
12043 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12044 and section index pair with Output_section::Simple_input_section
12045 class. Adjust code accordingly.
12046 (Phdrs_element::release_segment): New method definition.
12047 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12049 (Script_sections::release_segments): New method definition.
12050 * gold/script-sections.h (Script_sections::release_segments): New
12051 method declaration.
12052 * gold/target.h (Target::may_relax, Target::relax,
12053 Target::do_may_relax, Target::do_relax): New method definitions.
12055 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12057 * arm.cc (has_signed_unsigned_overflow): New function.
12058 (Arm_relocate_functions::abs8): New function.
12059 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12060 (Target_arm::Scan::global): Likewise.
12061 (Target_arm::relocate::relocate): Likewise.
12062 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12065 2009-09-16 Cary Coutant <ccoutant@google.com>
12067 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12068 * testsuite/Makefile.in: Regenerate.
12070 2009-09-11 Nick Clifton <nickc@redhat.com>
12072 * po/gold.pot: Updated by the Translation project.
12074 2009-09-08 Cary Coutant <ccoutant@google.com>
12076 * output.cc (Output_file::open): Add execute permission to empty file.
12077 * testsuite/Makefile.am (permission_test): New test.
12078 * testsuite/Makefile.in: Regenerate.
12080 2009-09-02 Ian Lance Taylor <iant@google.com>
12082 * output.cc (Output_file::resize): Call map_no_anonymous rather
12085 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12087 * gold.cc: Include "incremental.h".
12088 (queue_initial_tasks): Call Incremental_checker methods.
12089 * incremental.cc: Include "output.h".
12090 (Incremental_checker::can_incrementally_link_output_file): New
12092 * incremental.h (Incremental_checker): New class.
12094 * output.cc (Output_file::open_for_modification): New method.
12095 (Output_file::map_anonymous): Changed return type to bool. Record
12096 map in base_ field.
12097 (Output_file::map_no_anonymous): New method, broken out of map.
12098 (Output_file::map): Use map_no_anonymous and map_anonymous.
12099 * output.h (class Output_file): Update declarations.
12101 2009-08-24 Cary Coutant <ccoutant@google.com>
12103 * options.h (Command_line::Pre_options): New class.
12104 (Command_line::pre_options): New member.
12105 * options.cc (gold::options::ready_to_register): New variable.
12106 (One_option::register_option): Do nothing if not registering options.
12107 Assert if same short option registered twice.
12108 (General_options::General_options): Turn off option registration when
12110 (Command_line::Pre_options::Pre_options): New constructor.
12112 2009-08-24 Cary Coutant <ccoutant@google.com>
12114 * options.h (General_options::no_keep_memory): Remove incorrect
12117 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12119 * Makefile.am (am__skiplex, am__skipyacc): New.
12120 * Makefile.in: Regenerate.
12122 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12124 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12125 (INCLUDES): ... this.
12126 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12127 (AM_CPPFLAGS): Renamed from ...
12128 (INCLUDE): ... this.
12129 * Makefile.in, testsuite/Makefile.in: Regenerate.
12131 * Makefile.in: Regenerate.
12132 * aclocal.m4: Likewise.
12133 * config.in: Likewise.
12134 * configure: Likewise.
12135 * testsuite/Makefile.in: Likewise.
12137 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12138 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12139 * Makefile.in: Regenerate.
12140 * testsuite/Makefile.in: Regenerate.
12142 2009-08-19 Cary Coutant <ccoutant@google.com>
12144 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12145 symbols in shared libraries overridden by hidden or internal symbols
12146 in the main program.
12148 2009-08-19 Chris Demetriou <cgd@google.com>
12150 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12151 checking source file names in error messages.
12153 2009-08-18 Doug Kwan <dougkwan@google.com>
12155 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12156 an elcpp::Ehdr as parameter. Adjust call to set_target.
12157 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12158 an elfcpp::Ehdr as parameter.
12159 * object.cc (Object::set_target): Remove the version that looks up
12160 a target and sets it.
12161 (Sized_relobj::setup): Take a Target object instead of
12162 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12163 (make_elf_sized_object): Find target and ask target to
12164 make an ELF object.
12165 * object.h: (Object::set_target): Remove the version that looks up
12166 a target and sets it.
12167 (Sized_relobj::setup): Take a Target object instead of
12168 an elfcpp:Ehdr as parameter.
12169 * target.cc: Include dynobj.h.
12170 (Target::do_make_elf_object_implementation): New.
12171 (Target::do_make_elf_object): New.
12172 * target.h (Target::make_elf_object): New template declaration.
12173 (Target::do_make_elf_object): New method declarations.
12174 (Target::do_make_elf_object_implementation): New template declaration.
12176 2009-08-14 Ian Lance Taylor <iant@google.com>
12178 * gold.h (FUNCTION_NAME): Define.
12179 (gold_unreachable): Use FUNCTION_NAME.
12181 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12183 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12184 symbol in the --keep-unique list is not found.
12186 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12188 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12189 been maked as --keep-unique.
12190 (Icf::unfold_section): New function.
12191 * icf.h (Icf::unfold_section): New function.
12192 * options.h (General_options::keep_unique): New option.
12193 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12194 * testsuite/Makefile.in: Regenerate.
12195 * testsuite/icf_keep_unique_test.sh: New file.
12196 * testsuite/icf_keep_unique_test.cc: New file.
12198 2009-08-12 Cary Coutant <ccoutant@google.com>
12201 * resolve.cc (Symbol_table::resolve): Check for references from
12202 dynamic objects to hidden and internal symbols.
12203 * testsuite/Makefile.am (hidden_test.sh): New test.
12204 * testsuite/Makefile.in: Regenerate.
12205 * testsuite/hidden_test.sh: New script.
12206 * testsuite/hidden_test_1.c: New test source.
12207 * testsuite/hidden_test_main.c: New test source.
12209 2009-08-11 Doug Kwan <dougkwan@google.com>
12211 * arm.cc: Update comments.
12212 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12213 segment to locate the .ARM.exidx section if present.
12215 2009-08-09 Doug Kwan <dougkwan@google.com>
12217 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12220 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12221 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12224 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12226 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12227 valid tls_segment only for non-debug-section relocations.
12228 * testsuite/Makefile.am: Add gc_tls_test.
12229 * testsuite/Makefile.in: Regenerate.
12230 * testsuite/gc_tls_test.cc: New file.
12231 * testsuite/gc_tls_test.sh: New file.
12233 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12235 * icf.cc: New file.
12237 * Makefile.am (CCFILES): Add icf.cc.
12238 (HFILES): Add icf.h
12239 * Makefile.in: Regenerate.
12240 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12241 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12242 section, symbol and addend information for the relocs.
12243 * gold.cc (queue_middle_tasks): Call identical code folding.
12244 * gold.h: Add defines for multimap.
12245 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12246 to the call of finalize_local_symbols.
12247 * main.cc (main): Create object of class Icf.
12248 * object.cc (Sized_relobj::do_layout): Allow this function to be
12249 called twice during icf.
12250 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12251 to sections marked as identical by icf.
12252 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12254 (Sized_relobj::do_section_entsize): New function.
12255 * object.h (Object::section_entsize): New function.
12256 (Object::do_section_entsize): New pure virtual function.
12257 (Relobj::finalize_local_symbols): Add new parameter.
12258 (Relobj::do_section_entsize): New function.
12259 * options.h (General_options::icf): New option.
12260 (General_options::icf_iterations): New option.
12261 (General_options::print_icf_sections): New option.
12262 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12263 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12264 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12266 * symtab.cc (Symbol_table::is_section_folded): New function.
12267 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12268 to sections marked as identical by icf.
12269 * symtab.h (Symbol_table::set_icf): New function.
12270 (Symbol_table::icf): New function.
12271 (Symbol_table::is_section_folded): New function.
12272 (Symbol_table::icf_): New data member.
12273 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12274 * testsuite/Makefile.am: Add commands to build icf_test.
12275 * testsuite/Makefile.in: Regenerate.
12276 * testsuite/icf_test.sh: New file.
12277 * testsuite/icf_test.cc: New file.
12279 2009-07-24 Chris Demetriou <cgd@google.com>
12281 * layout.cc (is_compressible_debug_section): Fix incorrect
12282 comment about compressed section names.
12284 2009-07-20 Ian Lance Taylor <ian@airs.com>
12287 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12289 2009-07-16 Ian Lance Taylor <iant@google.com>
12292 * layout.h: #include <map>.
12293 (class Kept_section): Change from struct to class. Add accessors
12294 and setters. Add section size to Comdat_group mapping. Change
12295 Comdat_group to std::map. Add is_comdat_ field. Add
12296 linkonce_size field in union.
12297 (class Layout): Update declaration of find_or_add_kept_section.
12298 Don't declare find_kept_object.
12299 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12300 parameter. Add object, shndx, is_comdat, and is_group_name
12301 parameters. Change all callers. Adjust for new Kept_section.
12302 (Layout::find_kept_object): Remove.
12303 * object.cc (Sized_relobj::include_section_group): Update use of
12304 Kept_section. Rename secnum to shndx. Only record
12305 Kept_comdat_section if sections are the same size.
12306 (Sized_relobj::include_linkonce_section): Update use of
12307 Kept_section. Only record Kept_comdat_section if sections are the
12308 same size. Set size of linkonce section.
12309 (Sized_relobj::map_to_kept_section): Update call to
12310 get_kept_comdat_section.
12311 * object.h (class Sized_relobj): Rename fields in
12312 Kept_comdat_section to drop trailing underscores; change object
12313 field to Relobj*. Change Kept_comdat_section_table to store
12314 struct rather than pointer.
12315 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12316 Add kept_object and kept_shndx parameters. Change all callers.
12317 (Sized_relobj::get_kept_comdat_section): Change return type to
12318 bool. Add kept_object and kept_shndx parameters. Change all
12320 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12321 Layout::find_or_add_kept_section.
12323 2009-07-09 Ian Lance Taylor <iant@google.com>
12325 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12326 Reserve space in the hash table.
12328 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12330 * fileread.cc (File_read::get_mtime): New method.
12331 * fileread.h (Timespec): New structure.
12332 (File_read::get_mtime): New method.
12333 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12334 Renamed from timestamp_nsec.
12335 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12337 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12339 (Incremental_inputs::report_archive): Save mtime; style fix.
12340 (Incremental_inputs::report_obejct): Save mtime; style fix.
12341 (Incremental_inputs::report_script): Save mtime; style fix.
12342 (Incremental_inputs::finalize_inputs): Style fix.
12343 (Incremental_inputs::finalize): Style fix.
12344 (Incremental_inputs::create_input_section_data): Store inputs
12346 * incremental.h (Incremental_inputs::report_script): Add mtime
12348 (Incremental_inputs::Input_info::Input_info): Intialize only one
12350 (Incremental_inputs::Input_info::archive): Move to nameless
12352 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12353 (Incremental_inputs::Input_info::script): Move to nameless union.
12354 (Incremental_inputs::mtime): New field.
12355 * script.cc (read_input_script): Pass file mtime to
12357 * script.h (Script_info::inputs): Style fix.
12359 2009-07-01 Ian Lance Taylor <ian@airs.com>
12361 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12364 2009-06-24 Ian Lance Taylor <iant@google.com>
12367 * layout.cc (Layout::choose_output_section): If we find an
12368 existing section, update the flags.
12369 (Layout::create_notes): New function, broken out of
12371 (Layout::finalize): Don't create note sections.
12372 (Layout::create_note): Don't crash if linker script discards
12374 (Layout::create_gold_note): Likewise.
12375 (Layout::create_build_id): Likewise. Don't set
12376 after_input_sections on the section.
12377 (Layout::create_executable_stack_info): Remove target parameter.
12379 * layout.h (class Layout): Declare create_notes. Update
12380 declaration of create_executable_stack_info.
12381 * gold.cc (queue_middle_tasks): Call create_notes.
12382 * output.cc (Output_section::update_flags_for_input_section): Move
12383 here from output.h. If SHF_ALLOC flag is newly set, mark address
12385 * output.h (Output_data::mark_address_invalid): New function.
12386 (class Output_section): Only declare, not define,
12387 update_flags_for_input_section. Remove set_flags.
12389 2009-06-24 Ian Lance Taylor <iant@google.com>
12391 * script-sections.cc (Output_section_definition::
12392 set_section_addresses): Rename shadowing local load_address to
12395 2009-06-24 Ian Lance Taylor <iant@google.com>
12398 * reloc.cc (relocate_sections): Skip empty relocation sections.
12400 2009-06-23 Ian Lance Taylor <iant@google.com>
12403 * layout.cc (Layout::create_note): Use choose_output_section
12404 rather than make_output_section.
12406 2009-06-23 Ian Lance Taylor <iant@google.com>
12409 * options.cc (General_options::parse_V): Set printed_version_.
12410 (General_options::General_options): Initialize printed_version_.
12411 * options.h (class General_options): Add printed_version_ field.
12412 * gold.cc (queue_initial_tasks): If there are no input files,
12413 don't give a fatal error if we printed the version information.
12414 (queue_middle_tasks): If using -r with a shared object, give a
12415 fatal error rather than an ordinary error.
12417 2009-06-23 Ian Lance Taylor <iant@google.com>
12420 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12421 (Layout::make_output_section): Set have_stabstr_section_ if we see
12422 a .stab*str section.
12423 (Layout::finalize): Call link_stabs_sections.
12424 (Layout::link_stabs_sections): New file.
12425 * layout.h (class Layout): Add have_stabstr_section_ field.
12426 Declare link_stabs_sections.
12428 2009-06-23 Doug Kwan <dougkwan@google.com>
12430 * Makefile.am (libgold_a_LIBADD): New.
12431 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12432 * Makefile.in: Regenerate.
12433 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12434 * configure: Regenerate.
12435 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12436 * fileread.cc: Include sys/state.h
12437 * gold.h: Declare memmem and strndup if found missing.
12438 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12440 2009-06-23 Ian Lance Taylor <iant@google.com>
12442 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12443 * configure: Rebuild.
12445 2009-06-23 Ian Lance Taylor <iant@google.com>
12448 * object.cc (Object::section_contents): Don't try to get a view if
12449 the section has length zero.
12450 (Object::handle_gnu_warning_section): If the section is empty, use
12451 the name of the section as the warning.
12453 2009-06-23 Ian Lance Taylor <iant@google.com>
12456 * stringpool.h (class Stringpool_template): Add optimize_ field.
12457 (Stringpool_template::set_optimize): New function.
12458 * stringpool.cc (Stringpool_template::Stringpool_template):
12459 Initialize optimize_ field.
12460 (Stringpool_template::set_string_offsets): Test local optimize
12461 fild rather than parameter.
12462 * layout.cc (Layout::Layout): Call set_optimize on the section
12465 2009-06-22 Ian Lance Taylor <iant@google.com>
12468 * yyscript.y: Parse TARGET.
12469 * script.cc (script_set_target): New function.
12470 * script-c.h (script_set_target): Declare.
12471 * options.cc (General_options::string_to_object_format): Rename
12472 from string_to_object_format in anonymous namespace. Change
12474 * options.h (class General_options): Declare
12475 string_to_object_format.
12477 2009-06-22 Ian Lance Taylor <iant@google.com>
12479 * script-sections.cc (Script_sections::create_segments): Don't put
12480 program headers in a PT_LOAD segment if -n or -N.
12482 2009-06-22 Ian Lance Taylor <iant@google.com>
12485 * options.h (class General_options): Add -z lazy and -z now. Sort
12486 -z options into alphabetical order.
12487 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12489 2009-06-21 Ian Lance Taylor <iant@google.com>
12491 * layout.cc (Layout::make_output_section): Call
12492 Target::new_output_section.
12493 (Layout::attach_allocated_section_to_segment): Put large section
12494 sections in a separate load segment with the large segment flag
12496 (Layout::segment_precedes): Sort large data segments after other
12498 (align_file_offset): New static function.
12499 (Layout::set_segment_offsets): Use align_file_offset.
12500 * output.h (class Output_section): Add is_small_section_ and
12501 is_large_section_ fields.
12502 (Output_section::is_small_section): New function.
12503 (Output_section::set_is_small_section): New function.
12504 (Output_section::is_large_section): New function.
12505 (Output_section::set_is_large_section): New function.
12506 (Output_section::is_large_data_section): New function.
12507 (class Output_segment): Add is_large_data_segment_ field.
12508 (Output_segment::is_large_data_segment): New function.
12509 (Output_segment::set_is_large_data_segment): New function.
12510 * output.cc (Output_section::Output_section): Initialize new
12512 (Output_segment::Output_segment): Likewise.
12513 (Output_segment::add_output_section): Add assertion that large
12514 data sections always go in large data segments. Force small data
12515 sections to the end of the list of data sections. Force small BSS
12516 sections to the start of the list of BSS sections. For large BSS
12517 sections to the end of the list of BSS sections.
12518 * symtab.h (class Symbol): Declare is_common_shndx.
12519 (Symbol::is_defined): Check Symbol::is_common_shndx.
12520 (Symbol::is_common): Likewise.
12521 (class Symbol_table): Define enum Commons_section_type. Update
12522 declarations. Add small_commons_ and large_commons_ fields.
12523 * symtab.cc (Symbol::is_common_shndx): New function.
12524 (Symbol_table::Symbol_table): Initialize new fields.
12525 (Symbol_table::add_from_object): Put small and large common
12526 symbols in the right list.
12527 (Symbol_table::sized_finalized_symbol): Check
12528 Symbol::is_common_shndx.
12529 (Symbol_table::sized_write_globals): Likewise.
12530 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12531 common symbol lists. Don't call do_allocate_commons_list if the
12533 (Symbol_table::do_allocate_commons_list): Remove is_tls
12534 parameter. Add comons_section_type parameter. Change all
12535 callers. Handle small and large common symbols.
12536 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12537 Symbol::is_common_shndx.
12538 * resolve.cc (symbol_to_bits): Likewise.
12539 * target.h (Target::small_common_shndx): New function.
12540 (Target::small_common_section_flags): New function.
12541 (Target::large_common_shndx): New function.
12542 (Target::large_common_section_flags): New function.
12543 (Target::new_output_section): New function.
12544 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12545 small_common_section_flags, and large_common_section_flags
12547 (Target::do_new_output_section): New virtual function.
12548 * arm.cc (Target_arm::arm_info): Initialize new fields.
12549 * i386.cc (Target_i386::i386_info): Likewise.
12550 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12552 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12553 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12554 (Target_x86_64::do_new_output_section): New function.
12555 * configure.ac: Define conditional MCMODEL_MEDIUM.
12556 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12557 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12558 (large_LDFLAGS): Define.
12559 * testsuite/large.c: New file.
12560 * testsuite/testfile.cc (Target_test::test_target_info):
12561 Initialize new fields.
12562 * configure, testsuite/Makefile.in: Rebuild.
12564 2009-06-05 Doug Kwan <dougkwan@google.com>
12566 * Makefile.am (CCFILES): Add target.cc.
12567 * Makefile.in: Regenerate.
12568 * i386.cc (class Target_i386): Define new virtual method to
12569 override do_is_local_label_name in parent.
12570 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12571 local symbols if --discard-locals or -X is given.
12572 * options.h (class General_options): Declare new options
12573 '--discard-locals' and '-X' for discarding locals.
12574 * target.h (class Target): Define new methods is_local_label_name.
12575 Declare new virtual method do_is_local_label_name.
12576 * target.cc: New file.
12577 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12578 (check_SCRIPTS): Add discard_locals_test.sh.
12579 (check_DATA): Add discard_local_tests.syms.
12580 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12581 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12582 * testsuite/Makefile.in: Regenerate.
12583 * testsuite/discard_locals_test.c: New file.
12584 * testsuite/discard_locals_test.sh: Same.
12586 2009-06-05 Doug Kwan <dougkwan@google.com>
12588 * object.cc (Sized_relobj::Sized_relobj): Initialize
12589 discarded_eh_frame_shndx_ to -1U.
12590 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12592 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12593 a discarded .eh_frame section.
12594 (Sized_relobj::do_finalize_local_symbols): Ditto.
12595 * object.h (class Sized_relobj): Declare new member
12596 discarded_eh_frame_shndx_.
12597 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12598 (local_labels_test.o, local_labels_test): New rules.
12599 * testsuite/Makefile.in: Regenerate.
12601 2009-06-04 Doug Kwan <dougkwan@google.com>
12603 * layout.cc (Layout::section_name_mapping): Add mapping for
12604 special ARM sections.
12606 2009-06-03 Doug Kwan <dougkwan@google.com>
12608 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12609 (utils::has_overflow): Same.
12611 2009-06-03 Ian Lance Taylor <iant@google.com>
12613 * layout.cc (Layout::section_name_mapping): New array, replacing
12614 Layout::linkonce_mapping.
12615 (Layout::section_name_mapping_count): New variable, replacing
12616 Layout::linkonce_mapping_count.
12617 (Layout::linkonce_output_name): Remove.
12618 (Layout::output_section_name): Rewrite.
12619 * layout.h (class Layout): Rename Linkonce_mapping to
12620 Section_name_mapping, linkonce_mapping to section_name_mapping,
12621 linkonce_mapping_count to section_name_mapping_count. Don't
12622 declare linkonce_output_name.
12624 2009-06-03 Doug Kwan <dougkwan@google.com>
12626 * gold/arm.cc (namespace utils): New.
12627 (Target_arm::reloc_is_non_pic): Define new method.
12628 (class Arm_relocate_functions): New.
12629 (Target_arm::Relocate::relocate): Handle relocation types used by
12632 2009-06-03 Ian Lance Taylor <iant@google.com>
12634 * arm.cc (Target_arm::scan::global): Use || instead of |.
12636 2009-06-02 Doug Kwan <dougkwan@google.com>
12638 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12639 issued_non_pic_error_.
12640 (class Target_arm::Scan): Declare new method check_non_pic.
12641 Define new method symbol_needs_plt_entry.
12642 Declare new data member issued_non_pic_error_.
12643 (class Target_arm::Relocate): Declare new method
12644 should_apply_static_reloc.
12645 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12646 (Target_arm::Scan::check_non_pic): Define new method.
12647 (Target_arm::Scan::local): Handle a small subset of reloc types used
12649 (Target_arm::Scan::local): Same.
12650 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12652 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12654 * incremental.cc (Incremental_inputs::report_command_line): Filter
12655 out --incremental-* options.
12657 2009-05-29 Doug Kwan <dougkwan@google.com>
12659 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12661 (class Target_arm): Update comment.
12662 (Target_arm::Target_arm): Initialize new data members GOT_,
12663 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12664 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12665 and Target_arm::rel_dyn_section.
12666 Declare new_enum Target_arm::Got_type.
12667 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12669 Update commments for member do_dynsym_value.
12670 (Target_arm::got_size, Target_arm::plt_section,
12671 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12672 new methods inside class defintion.
12673 (Target_arm::got_section): Define new method.
12674 (Target_arm::rel_dyn_section): Same.
12675 (Output_data_plt_arm): New template class.
12676 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12677 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12678 (Output_data_plt_arm::add_entry): Same.
12679 (Output_data_plt_arm::first_plt_entry): Define new
12680 static data member for PLT instruction template.
12681 (Output_data_plt_arm::plt_entry): Same.
12682 (Output_data_plt_arm::do_write): Define new method.
12683 (Target_arm::make_plt_entry): Same.
12684 (Target_arm::do_finalize_sections): Same.
12685 (Target_arm::do_dynsym_value): Same.
12687 2009-05-28 Doug Kwan <dougkwan@google.com>
12689 * Makefile.am (TARGETSOURCES): Add arm.cc.
12690 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12691 * Makefile.in: Regenerate.
12692 * arm.cc: New file.
12693 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12695 2009-05-26 Doug Kwan <dougkwan@google.com>
12697 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12698 (General_options::check_excluded_libs): Strip off directories in
12699 archive name before matching like GNU ld does.
12700 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12701 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12702 (exclude_libs_test_LDFLAGS): Add linker option
12703 -Wl,--exclude-libs,libexclude_libs_test_3
12704 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12705 an explicit archive without using -l.
12706 (alt/libexclude_libs_test_3.a): New make rule.
12707 * testsuite/Makefile.in: Regenerate.
12708 * testsuite/exclude_libs_test.c : Declare lib3_default().
12710 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12711 * exclude_libs_test_3.c: New file.
12713 2009-05-26 Nick Clifton <nickc@redhat.com>
12715 * po/id.po: New Indonesian translation.
12716 * po/gold.pot: Updated template file.
12718 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12720 * testsuite/Makefile.am: Add -ffunction-sections to compile
12721 gc_comdat_test files. Add -Wl,--gc-sections to build
12723 * testsuite/Makefile.in: Regenerate.
12724 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12726 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12728 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12729 kept comdat section was garbage collected.
12730 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12731 * testsuite/Makefile.in: Regenerate.
12732 * testsuite/gc_comdat_test.sh: New file.
12733 * testsuite/gc_comdat_test_1.cc: New file.
12734 * testsuite/gc_comdat_test_2.cc: New file.
12736 2009-05-19 Doug Kwan <dougkwan@google.com>
12738 * archive.cc (Archive::Archive): Move constructor from archive.h
12739 to here. Initialize no_export_.
12740 (Archive::get_elf_object_for_member): Set no_export flag of object.
12741 * archive.h (Archive::Archive): Move constructor body to
12743 (Archive::no_export): New method.
12744 (Archive::no_export_): New field.
12745 * object.h (Object::Object): Initialize no_export_ to false.
12746 (Object::no_export, Object::set_no_export): New methods.
12747 (Object::no_export_): New field.
12748 * options.cc (General_options::parse_exclude_libs): New method.
12749 (General_options::check_excluded_libs) Same.
12750 * options.h (exclude_libs): New option.
12751 (General_options::check_excluded_libs): New method declaration.
12752 (General_options::excluded_libs_): New field.
12753 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12754 default or protected visibility if an object has no-export flag set.
12755 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12756 (check_SCRIPTS): Add exclude_libs_test.sh.
12757 (check_DATA): Add exclude_libs_test.syms.
12758 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12759 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12760 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12761 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12762 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12763 libexclude_libs_test_2.a): New rules.
12764 * testsuite/Makefile.in: Regenerate.
12765 * testsuite/exclude_libs_test.c: New file.
12766 * testsuite/exclude_libs_test.sh: Ditto.
12767 * testsuite/exclude_libs_test_1.c: Ditto.
12768 * testsuite/exclude_libs_test_2.c: Ditto.
12770 2009-05-15 Ian Lance Taylor <iant@google.com>
12772 * configure.ac: Check for declarations for cases where libiberty.h
12773 checks HAVE_DECL_xxx.
12774 * configure, config.in: Rebuild.
12776 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12778 * gold.h (Incremental_argument_list): Remove (invalid) forward
12780 * incremental.cc (Incremental_inputs::report_achive): New method.
12781 (Incremental_inputs::report_object): New method.
12782 (Incremental_inputs::report_script): New method.
12783 (Incremental_inputs::finalize_inputs): New method.
12784 (Incremental_inputs::finalize): Call finalize_inputs().
12785 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12786 Create inputs entries.
12787 * incremental.h (Incremental_input_type): New enum.
12788 (Incremental_inputs::Incremental_input): Initialize new fields.
12789 (Incremental_inputs::report_inputs): New method.
12790 (Incremental_inputs::report_achive): New method.
12791 (Incremental_inputs::report_object): New method.
12792 (Incremental_inputs::report_script): New method.
12793 (Incremental_inputs::finalize_inputs): New method.
12794 (Incremental_inputs::Input_info): New struct.
12795 (Incremental_inputs::Input_info_map): New typedef.
12796 (Incremental_inputs::lock_): New field.
12797 (Incremental_inputs::Inputs_): New field.
12798 (Incremental_inputs::Inputs_map): New field.
12799 * main.cc (main): Call Incremental_input::report_inputs.
12800 * options.h (Input_argument_list): Typedef moved from
12802 (Input_file_group::Files): Remove, use ::Input_argument_list.
12803 (Input_file_group::Input_argument_list): Remove, use
12804 ::Input_argument_list.
12805 * plugin.cc (Plugin_manager::add_input_file): Add error in
12807 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12809 * script.cc (read_input_script): Call
12810 Incremental_input::report_script.
12811 * script.h (Script_info): New class.
12813 2009-04-27 Ian Lance Taylor <iant@google.com>
12815 * x86_64.cc (do_adjust_output_section): Set entsize to
12818 2009-04-23 Elliott Hughes <enh@google.com>
12820 * output.cc (Output_file::close): After short writes, continue
12821 writing from the correct offset in the buffer being written.
12823 2009-04-23 Chris Demetriou <cgd@google.com>
12825 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12826 * configure: Regenerate.
12827 * config.in: Regenerate.
12828 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12829 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12831 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12833 * incremental.cc (Incremental_inputs_header_data): Renamed from
12834 Incremental_input_header_data.
12835 (Incremental_inputs_header_data::data_size): New field.
12836 (Incremental_inputs_header_data::put_input_file_count): Renamed
12837 from input_file_count.
12838 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12839 from command_line_offset.
12840 (Incremental_inputs_header_data::put_reserved): Renamed from
12842 (Incremental_inputs_entry_data): Renamed from
12843 Incremental_input_entry_data.
12844 (Incremental_inputs_entry_data::data_size): New field.
12845 (Incremental_inputs::report_command_line): New method.
12846 (Incremental_inputs::finalize): New method.
12847 (Incremental_inputs::create_incremental_inputs_data): New method.
12848 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12849 * incremental.h: New file.
12850 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12851 (Layout::finalize): Create incremental inputs section in
12852 incremental builds.
12853 (Layout::create_incremental_info_sections): New method.
12854 * layout.h (Layout::incremental_inputs): New method.
12855 (Layout::create_incremental_info_sections): New method.
12856 (Layout::incremental_inputs_): New field.
12857 * main.cc (main): Notify Incremental_input of the command line.
12859 2009-04-01 Ian Lance Taylor <iant@google.com>
12860 Mikolaj Zalewski <mikolajz@google.com>
12862 * gold.h (reserve_unordered_map): Define, three versions, one for
12863 each version of Unordered_map.
12864 * layout.cc (Layout::Layout): Remove options parameter. Add
12865 number_of_input_files parameter. Don't initialize options_.
12866 Initialize number_of_input_files_ and resized_signatures_. Move
12867 sections_are_attached_.
12868 (Layout::layout_group): Reserve space for group_signatures_.
12869 (Layout::find_or_add_kept_section): Change name parameter to be a
12870 reference. Resize signatures_ map when it gets large enough.
12871 (Layout::layout_eh_frame): Use parameters->options() instead of
12873 (Layout::make_output_section): Likewise.
12874 (Layout::attach_allocated_section_to_segment): Likewise.
12875 (Layout::finalize, Layout::create_executable_stack): Likewise.
12876 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12877 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12878 * layout.h (class Layout): Update declarations. Remove options_
12879 field. Add number_of_input_files_ and resized_signatures_
12880 fields. Move sections_are_attached_ field.
12881 * main.cc (main): Pass number of input files to Layout
12882 constructor. Don't pass options.
12884 2009-03-30 Ian Lance Taylor <iant@google.com>
12886 * ffsll.c (ffsll): Correct implementation.
12888 2009-03-27 Ian Lance Taylor <iant@google.com>
12890 * ffsll.c: New file.
12891 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12892 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12893 * ftruncate.c (ftruncate): Declare before definition.
12894 * mremap.c (mremap): Likewise.
12895 * pread.c (pread): Likewise.
12896 * configure, Makefile.in, config.in: Rebuild.
12898 * mremap.c: New file.
12899 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12900 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12901 (mremap): Declare if HAVE_MREMAP is not defined.
12902 * configure, Makefile.in, config.in: Rebuild.
12904 2009-03-27 Cary Coutant <ccoutant@google.com>
12906 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12907 position independent.
12908 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12909 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12911 2009-03-24 Cary Coutant <ccoutant@google.com>
12913 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12915 (needs_dynamic_reloc): Likewise.
12917 2009-03-24 Ian Lance Taylor <iant@google.com>
12919 * yyscript.y (file_cmd): Recognize EXTERN.
12920 (extern_name_list, extern_name_list_body): New nonterminals.
12921 * script.cc (script_add_extern): Define.
12922 * script-c.h (script_add_extern): Declare.
12924 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12926 * object.cc (is_elf_object): Define.
12927 * object.h (is_elf_object): Declare.
12928 * archive.cc (Archive::get_elf_object_for_member): Call
12930 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12932 2009-03-24 Elliott Hughes <enh@google.com>
12934 * output.cc (Output_file::map_anonymous): Define.
12935 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12936 try an anonymous one. Report the size if the mmap fails.
12937 * output.h (class Output_file): Declare map_anonymous.
12939 2009-03-24 Ian Lance Taylor <iant@google.com>
12941 * target-select.cc (instantiate_target): Don't acquire the lock if
12942 the instantiated_target_ field has already been set.
12944 2009-03-23 Ian Lance Taylor <iant@google.com>
12946 * gold-threads.h (class Initialize_lock): Define.
12947 * gold-threads.cc (class Initialize_lock_once): Define.
12948 (initialize_lock_control): New static variable.
12949 (initialize_lock_pointer): New static variable.
12950 (initialize_lock_once): New static function.
12951 (Initialize_lock::Initialize_lock): Define.
12952 (Initialize_lock::initialize): Define.
12953 * target-select.h: Include "gold-threads.h".
12954 (class Target_selector): Add lock_ and initialize_lock_ fields.
12955 Don't define instantiate_target, just declare it.
12956 * target-select.cc (Target_selector::Target_selector): Initialize
12958 (Target_selector::instantiate_target): Define.
12959 * descriptors.h: Include "gold-threads.h".
12960 (class Descriptors): Add initialize_lock_ field.
12961 * descriptors.cc (Descriptors::Descriptors): Initialize new
12963 (Descriptors::open): Use initialize_lock_ field
12964 * errors.h (class Errors): Add initialize_lock_ field.
12965 * errors.cc (Errors::Errors): Initialize new field.
12966 (Errors::initialize_lock): Use initialize_lock_ field.
12967 * powerpc.cc (class Target_selector_powerpc): Remove
12968 instantiated_target_ field. In do_recognize call
12969 instantiate_target rather than do_instantiate_target. In
12970 do_instantiate_target just allocate a new target.
12971 * sparc.cc (class Target_selector_sparc): Likewise.
12973 * freebsd.h: New file.
12974 * i386.cc: Include "freebsd.h".
12975 (Target_i386): Derive from Target_freebsd rather than
12977 (Target_selector_i386): Derive from Target_selector_freebsd rather
12978 than Target_selector.
12979 * x86_64.cc: Include "freebsd.h".
12980 (Target_x86_64): Derive from Target_freebsd rather than
12982 (Target_selector_x86_64): Derive from Target_selector_freebsd
12983 rather than Target_selector.
12984 * target.h (class Target): Add adjust_elf_header and
12985 do_adjust_elf_header.
12986 * output.cc (Output_file_header:: do_sized_write): Call target
12987 adjust_elf_header routine.
12988 * configure.tgt: Set targ_osabi.
12989 * configure.ac: Define GOLD_DEFAULT_OSABI.
12990 * parameters.cc (Parameters::default_target): Pass
12991 GOLD_DEFAULT_OSABI to select_target.
12992 * target-select.h (class Target_selector): Make instantiate_target
12993 protected rather than private.
12994 * Makefile.am (HFILES): Add freebsd.h.
12995 * configure, Makefile.in, config.in: Rebuild.
12997 * merge.cc (do_add_input_section): Correct pend value. Change
12998 message about last entry not being null terminated from error to
13001 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13003 * incremental.cc: New file.
13004 * Makefile.am (CCFILES): Add incremental.cc.
13005 * Makefile.in: Rebuild.
13007 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13009 * layout.cc (Layout::output_section_name): Preserve names
13010 of '.note.' sections.
13012 2009-03-19 Ian Lance Taylor <iant@google.com>
13014 * descriptors.cc (Descriptors::open): Check that the options are
13015 valid before using them.
13017 2009-03-18 Ian Lance Taylor <iant@google.com>
13019 * script-sections.h: Include <list>.
13020 (class Script_sections): Change Sections_elements from std::vector
13021 to std::list. Typedef public Elements_iterator. Add
13022 orphan_section_placement_, data_segment_align_start_, and
13023 saw_data_segment_align_ fields. Remove data_segment_align_index_
13025 * script-sections.cc (class Orphan_section_placement): New class.
13026 (class Sections_element): Add virtual functions is_relro and
13027 orphan_section_init. Remove virtual function place_orphan_here.
13028 (class Output_section_definition): Add is_relro and
13029 orphan_section_init. Remove place_orphan_here.
13030 (class Orphan_output_section): Likewise.
13031 (Script_sections::Script_sections): Update for field changes.
13032 (Script_sections::data_segment_align): Set saw_data_segment_align_
13033 and data_segment_align_start_, not data_segment_align_index.
13034 (Script_sections::data_segment_relro_end): Check
13035 saw_data_segment_align_. Use data_segment_align_start_ rather
13036 than data_segment_align_index_.
13037 (Script_sections::place_orphan): Rewrite to use
13038 Orphan_section_placement.
13040 2009-03-17 Ian Lance Taylor <iant@google.com>
13042 * archive.cc (Archive::add_symbols): Check for a version attached
13043 to the symbol name in the archive map.
13044 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13045 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13046 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13047 (ver_test_11.a): New target.
13048 * testsuite/Makefile.in: Rebuild.
13050 * configure.ac: Check for chsize and posix_fallocate. Replace
13052 * ftruncate.c: New file, from gnulib.
13053 * output.cc (posix_fallocate): Define dummy version if not
13054 HAVE_POSIX_FALLOCATE.
13055 (Output_file::map): Call posix_fallocate rather than lseek and
13057 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13058 * configure, Makefile.in, config.in: Rebuild.
13060 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13062 * layout.h (Layout::create_note): Add section_name parameter.
13063 * layout.cc (Layout::create_note): Likewise.
13064 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13066 2009-03-17 Ian Lance Taylor <iant@google.com>
13068 * descriptors.cc: Include "options.h".
13069 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13070 (Descriptors::open): Always use O_CLOEXEC when opening a new
13071 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13072 then set FD_CLOEXEC.
13074 * sparc.cc (class Target_sparc): Add has_got_section.
13075 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13076 make sure we have a GOT section.
13078 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13079 (Target_sparc::Scan::local): Likewise.
13080 (Target_sparc::Scan::global): Likewise.
13081 (Target_sparc::Relocate::relocate): Likewise.
13082 (Target_sparc::Relocate::relocate_tls): Likewise.
13084 * symtab.cc (Symbol_table::define_default_version): New function,
13085 broken out of add_from_object.
13086 (Symbol_table::add_from_object): Call define_default_version.
13087 (Symbol_table::define_special_symbol): Add resolve_oldsym
13088 parameter. Change all callers. If the version for a symbol comes
13089 from a version script, resolve it with the symbol with the same
13090 name with no version. Also add the symbol without a version if
13092 (do_define_in_output_data): If resolving with oldsym, don't delete
13094 (do_define_in_output_segment): Likewise.
13095 (do_define_as_constant): Likewise.
13096 * symtab.h (class Symbol_table): Update declarations.
13098 2009-03-13 Ian Lance Taylor <iant@google.com>
13100 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13101 (Read_symbols::requeue): New function.
13102 (Read_symbols::do_read_symbols): If make_elf_object fails because
13103 the target type is not configured, and the file was searched for,
13104 issue a warning and retry with the next directory.
13105 (Add_symbols::run): If the file has an incompatible format, and
13106 it was searched for, requeue the Read_symbols task. On error,
13107 release the object.
13108 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13109 dirindex parameter to constructor. Change all callers. Declare
13110 incompatible_warning and requeue.
13111 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13112 input_argument_ and input_group_ fields. Add them to
13113 constructor. Change all callers.
13114 (class Read_script): Add dirindex_ field. Add it to constructor.
13115 Change all callers.
13116 * archive.cc (Archive::setup): Remove input_objects parameter.
13117 Change all callers.
13118 (Archive::get_file_and_offset): Likewise.
13119 (Archive::read_all_symbols): Likewise.
13120 (Archive::read_symbols): Likewise.
13121 (Archive::get_elf_object_for_member): Remove input_objects
13122 parameter. Add punconfigured parameter. Change all callers.
13123 (Archive::add_symbols): Change return type to bool. Check return
13124 value of include_member.
13125 (Archive::include_all_members): Likewise.
13126 (Archive::include_member): Change return type to bool. Return
13127 false if first included object has incompatible target. Set
13128 included_member_ field.
13129 (Add_archive_symbols::run): If add_symbols returns false, requeue
13131 * archive.h (class Archive): Add included_member_ field.
13132 Initialize it in constructor. Add input_file and searched_for
13133 methods. Update declarations.
13134 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13135 input_argument_ fields. Add them to constructor. Change all
13137 * script.cc: Include "target-select.h".
13138 (class Parser_closure): Add skip_on_incompatible_target_ and
13139 found_incompatible_target_ fields. Add
13140 skip_on_incompatible_target parameter to constructor. Change all
13141 callers. Add methods skip_on_incompatible_target,
13142 clear_skip_on_incompatible_target, found_incompatible_target, and
13143 set_found_incompatible_target.
13144 (read_input_script): Add dirindex parameter. Change all callers.
13145 If parser finds an incompatible target, requeue Read_symbols
13147 (script_set_symbol): Clear skip_on_incompatible_target in
13149 (script_add_assertion, script_parse_option): Likewise.
13150 (script_start_sections, script_add_phdr): Likewise.
13151 (script_check_output_format): New function.
13152 * script.h (read_input_script): Update declaration.
13153 * script-c.h (script_check_output_format): Declare.
13154 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13155 (ignore_cmd): Remove OUTPUT_FORMAT.
13156 * fileread.cc (Input_file::Input_file): Add explicit this.
13157 (Input_file::will_search_for): New function.
13158 (Input_file::open): Add pindex parameter. Change all callers.
13159 * fileread.h (class Input_file): Add input_file_argument method.
13160 Declare will_search_for. Update declarations.
13161 * object.cc (make_elf_object): Add punconfigured parameter.
13162 Change all callers.
13163 * object.h (class Object): Make input_file public. Add
13164 searched_for method.
13165 (make_elf_object): Update declaration.
13166 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13168 * dirsearch.h (class Dirsearch): Update declaration.
13169 * options.h (class General_options): Add --warn-search-mismatch.
13170 * parameters.cc (Parameters::is_compatible_target): New function.
13171 * parameters.h (class Parameters): Declare is_compatible_target.
13172 * workqueue.cc (Workqueue::add_blocker): New function.
13173 * workqueue.h (class Workqueue): Declare add_blocker.
13175 * fileread.cc (Input_file::open): Remove options parameter.
13176 Change all callers.
13177 (Input_file::open_binary): Likewise.
13178 * script.cc (read_input_script): Likewise.
13179 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13180 options parameter from constructor. Change all callers.
13181 (class Read_script): Likewise.
13182 * fileread.h (class Input_file): Update declarations.
13183 * script.h (read_input_script): Update declaration.
13185 2009-03-10 Nick Clifton <nickc@redhat.com>
13187 * po/es.po: New Spanish translation.
13189 2009-03-06 Cary Coutant <ccoutant@google.com>
13191 * options.cc (parse_short_option): Keep dash_z from registering itself.
13193 2009-03-03 Ian Lance Taylor <iant@google.com>
13196 * target-reloc.h (relocate_section): Pass output_section to
13198 * i386.cc (Target_i386::should_apply_static_reloc): Add
13199 output_section parameter. Change all callers.
13200 (Target_i386::Relocate::relocate): Add output_section parameter.
13201 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13202 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13203 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13204 * testsuite/two_file_shared.sh: New script.
13205 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13206 (check_DATA): Add two_file_shared.dbg.
13207 (two_file_shared.dbg): New target.
13208 * testsuite/Makefile.in: Rebuild.
13210 2009-03-01 Ian Lance Taylor <iant@google.com>
13212 * configure.ac: Check for byteswap.h.
13213 * configure: Rebuild.
13214 * config.in: Rebuild.
13216 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13218 * layout.cc (Layout::find_or_add_kept_section): New function.
13219 (Layout::add_comdat): Removed.
13220 * layout.h (struct Kept_section): Move out of class Layout.
13221 Remove trailing underscores from field names. Add group_sections
13222 field. Rename group_ field to is_group. Change all uses.
13223 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13224 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13225 comdat_groups_ field.
13226 (Sized_relobj::include_section_group): Use
13227 find_or_add_kept_section and Kept_section::group_sections.
13228 (Sized_relobj::include_linkonce_section): Likewise.
13229 * object.cc (class Sized_relobj): Don't define Comdat_group or
13230 Comdat_group_table. Remove find_comdat_group and
13231 add_comdat_group. Remove comdat_groups_ field.
13232 * plugin.cc (include_comdat_group): Use
13233 Layout::find_or_add_kept_section.
13235 2009-02-28 Ian Lance Taylor <iant@google.com>
13237 * README: --gc-sections and map files are now supported. Document
13238 some build requirements.
13241 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13242 relocatable link set the value of the section symbol to zero.
13243 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13244 relocatable link don't include the section address in the local
13247 2009-02-27 Ian Lance Taylor <iant@google.com>
13250 * options.h (class Search_directory): Add is_system_directory.
13251 (class General_options): Declare is_in_system_directory.
13252 * options.cc (get_relative_sysroot): Make static.
13253 (get_default_sysroot): Make static.
13254 (General_optoins::is_in_system_directory): New function.
13255 * fileread.cc (Input_file::is_in_system_directory): New function.
13256 * fileread.h (class Input_file): Declare is_in_system_directory.
13257 * object.h (class Object): Add is_in_system_directory.
13258 (class Input_objects): Remove system_library_directory_ field.
13259 * object.cc (Input_objects::add_object): Don't set
13260 system_library_directory_.
13261 (input_objects::found_in_system_library_directory): Remove.
13262 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13263 parameter. Change all callers.
13264 (Symbol_table::sized_write_globals): Likewise.
13265 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13266 Call Object::is_in_system_directory.
13267 * symtab.h (class Symbol_table): Update declarations.
13270 * descriptors.h (Open_descriptor): Add is_on_stack field.
13271 * descriptors.cc (Descriptors::open): If the descriptor is on the
13272 top of the stack, remove it. Initialize is_on_stack field.
13273 (Descriptors::release): Only add pod to stack if it is not on the
13275 (Descriptors::close_some_descriptor): Clear stack_next and
13276 is_on_stack fields.
13279 * output.cc (Output_section::find_starting_output_address): Rename
13280 from starting_output_address; add PADDR parameter; change return
13282 * output.h (class Output_section): Declare
13283 find_starting_output_address instead of starting_output_address.
13284 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13285 section symbol for which we can't find a merge section.
13288 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13289 hidden or internal, force the symbol to be local.
13290 * resolve.cc (Symbol::override_visibility): Define.
13291 (Symbol::override_base): Use override_visibility.
13292 (Symbol_table::resolve): Likewise.
13293 (Symbol::override_base_with_special): Likewise.
13294 (Symbol_table::override_with_special): If the visibility is hidden
13295 or internal, force the symbol to be local.
13296 * symtab.h (class Symbol): Add set_visibility and
13297 override_visibility.
13298 * testsuite/ver_test_1.sh: New file.
13299 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13300 (check_DATA): Add ver_test_1.syms.
13301 (ver_test_1.syms): New target.
13302 * testsuite/Makefile.in: Rebuild.
13304 2009-02-25 Cary Coutant <ccoutant@google.com>
13306 * layout.cc (Layout::choose_output_section): Don't rename sections
13307 when using a linker script that has a SECTIONS clause.
13308 * Makefile.in: Regenerate.
13310 * testsuite/Makefile.am (script_test_5.sh): New test case.
13311 * testsuite/Makefile.in: Regenerate.
13312 * testsuite/script_test_5.cc: New file.
13313 * testsuite/script_test_5.sh: New file.
13314 * testsuite/script_test_5.t: New file.
13316 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13318 * archive.cc (Archive::include_member): Update calls to add_symbols.
13319 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13320 the Layout argument.
13321 * dynobj.h (do_add_symbols): Add the Layout argument.
13322 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13324 * object.h (Object::add_symbols): Add the Layout argument.
13325 (Object::do_add_symbols): Add the Layout argument.
13326 (Sized_relobj::do_add_symbols): Add the Layout argument.
13327 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13328 Unify the two versions.
13329 (Add_plugin_symbols): Remove.
13330 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13331 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13332 (Add_plugin_symbols): Remove.
13333 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13334 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13335 (Add_symbols::run): Make it work with Pulginobj.
13337 2009-02-06 Ian Lance Taylor <iant@google.com>
13339 * object.cc (Sized_relobj::do_layout): Make info message start
13340 with lower case letter.
13342 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13344 * binary.cc: Fix file comment.
13346 * options.h (enum Incremental_disposition): Define.
13347 (class General_options): Add new options: --incremental,
13348 --incremental_changed, --incremental_unchanged,
13349 --incremental_unknown. Add incremental_disposition_ and
13350 implicit_incremental_ fields.
13351 (General_options::incremental_disposition): New function.
13352 (class Position_dependent_options): Add incremental_disposition
13354 (Position_dependent_options::copy_from_options): Set incremental
13356 * options.cc (General_options::parse_incremental_changed): New
13358 (General_options::parse_incremental_unchanged): New function.
13359 (General_options::parse_incremental_unknown): New function.
13360 (General_options::General_options): Initialize new fields
13361 incremental_disposition_ and implicit_incremental_.
13362 (General_options::finalize): Check for uasge of --incremental-*
13363 without --incremental.
13365 2009-02-06 Chris Demetriou <cgd@google.com>
13367 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13368 pointer and to report location as the file name associated with
13370 (gold_undefined_symbol_at_location): New function to replace the
13371 old gold_undefined_symbol functionality.
13372 * target-reloc.h (relocate_section): Update to use
13373 gold_undefined_symbol_at_location.
13374 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13375 Call gold_undefined_symbol function rather than gold_error.
13376 * errors.h (Errors::undefined_symbol): Take location as a
13377 string, rather than calculating it from a relocation.
13378 * errors.cc (Errors::fatal): Print "fatal error:" before the
13380 (Errors::error, Errors::error_at_location): Print "error: "
13381 before the formatted message.
13382 (Errors::undefined_symbol): Take location as a string, rather
13383 than calculating it from a relocation.
13384 (gold_undefined_symbol_at_location): New function akin to
13385 old gold_undefined_symbol, calculates location from relocation.
13386 (gold_undefined_symbol): Change to take only a Symbol pointer
13387 and to report location as the file name associated with the symbol.
13388 * testsuite/debug_msg.sh: Update for changed error messages.
13389 * testsuite/undef_symbol.sh: Likewise.
13391 2009-02-04 Duncan Sands <baldrick@free.fr>
13394 * reduced_debug_output.h
13395 (Output_reduced_debug_abbrev_section::failed): Use format for
13397 (Output_reduced_debug_info_section::faild): Likewise.
13399 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13401 * script.cc (Lazy_demangler): New class.
13402 (Version_script_info::get_symbol_version_helper): Demangle a
13405 2009-01-29 Cary Coutant <ccoutant@google.com>
13407 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13409 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13411 2009-01-28 Ian Lance Taylor <iant@google.com>
13413 * version.cc (version_string): Bump to 1.9.
13415 * gold.h: Include <cstring> and <stdint.h>.
13416 * version.cc: Include <cstdio>.
13417 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13419 * reduced_debug_output.cc (insert_into_vector): Rename from
13420 Insert_into_vector; change all callers. Use Swap_unaligned to
13421 avoid aliasing issue; remove union since it is unnecessary.
13423 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13425 * Makefile.am (CCFILES): Add gc.cc.
13426 (HFILES): Add gc.h.
13427 * Makefile.in: Regenerate.
13428 * gold.cc (Gc_runner): New class.
13429 (queue_initial_tasks): Call garbage collection related tasks
13430 when corresponding options are invoked.
13431 (queue_middle_gc_tasks): New function.
13432 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13433 processed early before laying out sections during garbage collection.
13434 * gold.h (queue_middle_gc_tasks): New function.
13435 (is_prefix_of): Move from "layout.cc".
13436 * i386.cc (Target_i386::gc_process_relocs): New function.
13437 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13438 * main.cc (main): Create object of class "Garbage_collection".
13439 * object.cc (Relobj::copy_symbols_data): New function.
13440 (Relobj::is_section_name_included): New function.
13441 (Sized_relobj::do_layout): Allow this function to be called twice
13442 during garbage collection and defer layout of section during the
13444 * object.h (Relobj::get_symbols_data): New function.
13445 (Relobj::is_section_name_included): New function.
13446 (Relobj::copy_symbols_data): New function.
13447 (Relobj::set_symbols_data): New function.
13448 (Relobj::get_relocs_data): New function.
13449 (Relobj::set_relocs_data): New function.
13450 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13451 (Relobj::gc_process_relocs): New function.
13452 (Relobj::do_gc_process_relocs): New pure virtual function.
13453 (Relobj::sd_): New data member.
13454 (Sized_relobj::is_output_section_offset_invalid): New function.
13455 (Sized_relobj::do_gc_process_relocs): New function.
13456 * options.h (General_options::gc_sections): Modify to not be a no-op.
13457 (General_options::print_gc_sections): New option.
13458 * plugin.cc (Plugin_finish::run): Remove function call to
13459 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13460 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13461 * reloc.cc (Read_relocs::run): Add task to process relocs and
13462 determine unreferenced sections when doing garbage collection.
13463 (Gc_process_relocs): New class.
13464 (Sized_relobj::do_gc_process_relocs): New function.
13465 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13466 sections that are garbage collected.
13467 * reloc.h (Gc_process_relocs): New class.
13468 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13469 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13470 symbols whose corresponding sections are garbage collected.
13471 (Symbol_table::Symbol_table): Add new parameter for the garbage
13473 (Symbol_table::gc_mark_undef_symbols): New function.
13474 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13475 (Symbol_table::gc_mark_dyn_syms): New function.
13476 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13478 (Symbol_table::add_from_object): Likewise.
13479 (Symbol_table::add_from_relobj): When building shared objects, do not
13480 treat externally visible symbols as garbage.
13481 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13482 table information for static and relocatable links.
13483 * symtab.h (Symbol_table::set_gc): New function.
13484 (Symbol_table::gc): New function.
13485 (Symbol_table::gc_mark_undef_symbols): New function.
13486 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13487 (Symbol_table::gc_mark_dyn_syms): New function.
13488 (Symbol_table::gc_): New data member.
13489 * target.h (Sized_target::gc_process_relocs): New pure virtual
13491 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13492 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13494 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13496 * options.h (General_options::gc_sections): Define as a no-op for now.
13497 (General_options::no_keep_memory): Ditto.
13498 (General_options::Bshareable): Define.
13499 * options.cc (General_options::finalize): Honor -Bshareable.
13501 2009-01-20 Andreas Schwab <schwab@suse.de>
13503 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13504 read the value in the contents, since we don't use it. Use the
13505 template endianness when writing.
13506 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13508 2009-01-19 Andreas Schwab <schwab@suse.de>
13510 * configure.tgt (powerpc64-*): Fix targ_obj.
13512 2009-01-15 Ian Lance Taylor <iant@google.com>
13514 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13515 local symbols when stripping all symbols.
13517 2009-01-14 Cary Coutant <ccoutant@google.com>
13519 * output.cc (Output_reloc): Add explicit instantiations.
13521 2009-01-14 Cary Coutant <ccoutant@google.com>
13523 * archive.cc (Archive::get_elf_object_for_member): Remove call
13524 to File_read::claim_for_plugin.
13525 * descriptors.cc (Descriptors::open): Remove reference to
13527 (Descriptors::claim_for_plugin): Remove.
13528 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13529 (Descriptors::is_claimed): Remove.
13530 (claim_descriptor_for_plugin): Remove.
13531 * fileread.cc (File_read::claim_for_plugin): Remove.
13532 * fileread.h (File_read::claim_for_plugin): Remove.
13533 (File_read::descriptor): Reopen descriptor if necessary.
13534 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13535 (Plugin_manager::all_symbols_read): Add task parameter. Change
13537 (Plugin_manager::get_input_file): New function.
13538 (Plugin_manager::release_input_file): New function.
13539 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13540 corresponding data member.
13541 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13542 and pass to base constructor. Change all callers.
13543 (get_input_file, release_input_file): New functions.
13544 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13545 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13546 (Plugin_manager::all_symbols_read): Add task parameter.
13547 (Plugin_manager::get_input_file): New function.
13548 (Plugin_manager::release_input_file): New function.
13549 (Plugin_manager::task_): New data member.
13550 (Pluginobj::Pluginobj): Add filesize parameter.
13551 (Pluginobj::filename): New function.
13552 (Pluginobj::descriptor): New function.
13553 (Pluginobj::filesize): New function.
13554 (Pluginobj::filesize_): New data member.
13555 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13556 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13557 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13559 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13560 with archive libraries.
13561 * testsuite/Makefile.in: Regenerate.
13562 * testsuite/plugin_test.c (struct sym_info): New type.
13563 (get_input_file, release_input_file): New static variables.
13564 (onload): Capture new transfer vector entries.
13565 (claim_file_hook): Stop reading at end of file according to filesize.
13566 Factor out parsing of readelf output into separate function.
13567 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13568 APIs and get the source file name from the symbol table. Convert
13569 source file name to corresponding object file name. Print info
13570 message when adding new input files.
13571 (parse_readelf_line): New function.
13572 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13573 * testsuite/plugin_test_2.sh: Likewise.
13574 * testsuite/plugin_test_3.sh: Likewise.
13575 * testsuite/plugin_test_4.sh: New test case.
13577 2009-01-07 Ian Lance Taylor <iant@google.com>
13579 * version.cc (version_string): Bump to 1.8.
13581 2008-12-23 Cary Coutant <ccoutant@google.com>
13583 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13584 * plugin.cc (Plugin_manager::finish): Rename as
13585 layout_deferred_objects. Move cleanup to separate function.
13586 (Plugin_manager::cleanup): New function.
13587 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13589 * plugin.h (Plugin_manager::finish): Rename as
13590 layout_deferred_objects.
13591 (Plugin_manager::cleanup): New function.
13592 (Plugin_manager::cleanup_done): New field.
13594 2008-12-23 Cary Coutant <ccoutant@google.com>
13596 * plugin.cc (is_visible_from_outside): New function.
13597 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13598 so we don't return "IR only" status for exported symbols or -r links.
13600 * testsuite/Makefile.am (plugin_test_3): New test case.
13601 * testsuite/Makefile.in: Regenerate.
13602 * testsuite/plugin_test_3.sh: New file.
13604 2008-12-22 Cary Coutant <ccoutant@google.com>
13606 * object.cc (Sized_relobj::layout_section): New function.
13607 (Sized_relobj::do_layout): Defer layout of input sections until after
13608 plugin has provided replacement files.
13609 (Sized_relobj::do_layout_deferred_sections): New function.
13610 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13611 (Relobj::layout_deferred_sections): New function.
13612 (Relobj::do_layout_deferred_sections): New function.
13613 (Sized_relobj::do_layout_deferred_sections): New function.
13614 (Sized_relobj::layout_section): New function.
13615 (Sized_relobj::Deferred_layout): New structure.
13616 (Sized_relobj::deferred_layout_): New field.
13617 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13618 Change all callers. Layout deferred sections.
13619 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13621 (Plugin_hook::run): Move code from do_plugin_hook inline.
13622 (Plugin_hook::do_plugin_hook): Remove.
13623 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13624 (Plugin_manager::finish): Renamed, was cleanup.
13625 (Plugin_manager::should_defer_layout): New function.
13626 (Plugin_manager::add_deferred_layout_object): New function.
13627 (Plugin_manager::Deferred_layout_list): New type.
13628 (Plugin_manager::deferred_layout_objects_): New field.
13629 (Plugin_hook::do_plugin_hook): Remove.
13631 2008-12-17 Ian Lance Taylor <iant@google.com>
13633 * options.h (class General_options): Add --no case for
13636 2008-12-16 Cary Coutant <ccoutant@google.com>
13638 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13640 (Plugin_manager::claim_file): Create plugin object even if
13641 plugin did not call the add_symbols callback.
13642 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13643 asking for more symbols than were added.
13644 * testsuite/Makefile.am (plugin_test_1): Add test case with
13646 (empty.syms): New target.
13647 * testsuite/Makefile.in: Regenerate.
13648 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13649 message. Don't call add_symbols if no globals.
13650 (all_symbols_read_hook): Don't provide replacement for empty
13653 2008-12-12 Ian Lance Taylor <iant@google.com>
13655 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13656 r_type == 0 for a local symbol with r_sym == 0.
13657 (scan_relocatable_relocs): Pass r_sym to
13658 local_non_section_strategy.
13659 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13662 * configure.ac: Update test for TLS descriptors: they are
13663 supported as of glibc 2.9.
13664 * configure: Rebuild.
13666 2008-12-11 Ian Lance Taylor <iant@google.com>
13669 * target-reloc.h (Default_scan_relocatable_relocs): For each
13670 function, map r_type == 0 to RELOC_DISCARD.
13672 2008-12-10 Cary Coutant <ccoutant@google.com>
13674 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13675 object to override a kept COMDAT group from a plugin object.
13677 2008-12-09 Ian Lance Taylor <iant@google.com>
13680 * yyscript.y (file_cmd): Handle INPUT.
13682 * testsuite/initpri1.c: Change all declarations to be full
13683 prototypes by adding void, to avoid compiler warnings.
13685 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13687 * options.cc (General_options::parse_plugin_opt): New.
13688 (General_options::add_plugin): The argument now is just the filename.
13689 (General_options::add_plugin_option): New.
13690 * options.h (plugin_opt): New.
13691 (add_plugin): Change argument name.
13692 (add_plugin_option): New.
13693 * plugin.cc (Plugin::load): Don't parse the plugin option.
13694 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13695 (Plugin::add_option): New.
13696 (Plugin::args_): Change type.
13697 (Plugin::filename_): New.
13698 (Plugin_manager::add_plugin_option): New.
13699 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13700 * testsuite/Makefile.in: Regenerate.
13702 2008-12-05 Cary Coutant <ccoutant@google.com>
13704 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13705 Handle --strip-lto-sections option.
13706 * options.h (strip_lto_sections): New option.
13708 2008-12-01 Cary Coutant <ccoutant@google.com>
13710 * plugin.cc (ld_plugin_message): Change format parameter to const.
13711 Fix mismatch between new[] and delete.
13713 2008-11-14 Cary Coutant <ccoutant@google.com>
13715 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13718 2008-11-05 Craig Silverstein <csilvers@google.com>
13720 * options.cc (General_options::parse_dynamic_list): New function.
13721 * options.h (General_options): New flags dynamic_list,
13722 dynamic_list_data, dynamic_list_cpp_new, and
13723 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13724 (General_options::in_dynamic_list): New function.
13725 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13726 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13727 (Lex::can_continue_name): Likewise.
13729 (read_script_file): New parameter script_options.
13730 (read_dynamic_list): New function.
13731 (Script_options::define_dynamic_list): New function.
13732 (dynamic_list_keyword_parsecodes): New variable.
13733 (dynamic_list_keywords): New variable.
13734 * script.h (Script_options::define_dynamic_list): New function
13736 (read_dynamic_list): New function prototype.
13737 * symtab.cc (strprefix): New macro.
13738 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13739 dynamic_list_data, dynamic_list_cpp_new, and
13740 dynamic_list_cpp_typeinfo.
13741 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13742 (dynamic_list_expr): New rule.
13743 (dynamic_list_nodes): Likewise.
13744 (dynamic_list_node): Likewise.
13745 * testsuite/Makefile.am (dynamic_list): New test.
13746 * testsuite/Makefile.in: Regenerated.
13747 * testsuite/dynamic_list.t: New file.
13748 * testsuite/dynamic_list.sh: New file.
13750 2008-11-05 Craig Silverstein <csilvers@google.com>
13752 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13753 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13754 (t11_last): Likewise.
13755 * testsuite/ver_test_6.c (main): Likewise.
13757 2008-10-07 Cary Coutant <ccoutant@google.com>
13759 * options.c (General_options::finalize): Add check for -static and
13761 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13764 2008-10-02 Cary Coutant <ccoutant@google.com>
13766 * plugin.cc (make_sized_plugin_object): Fix conditional
13767 compilation to work when not all targets are enabled.
13769 2008-09-29 Cary Coutant <ccoutant@google.com>
13771 * archive.cc (Archive::get_file_and_offset): Use filename instead
13772 of name to get library path.
13773 (Archive::include_member): Unlock external member of a thin archive.
13775 * testsuite/Makefile.am (TEST_AR): New variable.
13776 (thin_archive_test_1): New test.
13777 (thin_archive_test_2): New test.
13778 * testsuite/Makefile.in: Regenerate.
13779 * testsuite/thin_archive_main.cc: New file.
13780 * testsuite/thin_archive_test_1.cc: New file.
13781 * testsuite/thin_archive_test_2.cc: New file.
13782 * testsuite/thin_archive_test_3.cc: New file.
13783 * testsuite/thin_archive_test_4.cc: New file.
13785 2008-09-29 Cary Coutant <ccoutant@google.com>
13787 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13788 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13790 (Sized_relobj::do_finalize_local_symbols): Likewise.
13791 (Sized_relobj::map_to_kept_section): Likewise.
13792 * object.h (Sized_relobj::invalid_address): New constant.
13793 (Sized_relobj::do_output_section_offset): Check for invalid_address
13795 * output.cc (Output_reloc::local_section_offset): Use constant
13796 invalid_address instead of -1U.
13797 (Output_reloc::get_address): Likewise.
13798 (Output_section::output_address): Change -1U to -1ULL.
13799 * output.h (Output_reloc::invalid_address): New constant.
13800 * reloc.cc (Sized_relobj::write_sections): Use constant
13801 invalid_address instead of -1U.
13802 (Sized_relobj::relocate_sections): Likewise.
13803 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13804 values for merge sections.
13805 * target-reloc.h (relocate_for_relocatable): Use constant
13806 invalid_address instead of -1U.
13808 2008-09-19 Cary Coutant <ccoutant@google.com>
13810 Add plugin functionality for link-time optimization (LTO).
13811 * configure.ac (plugins): Add --enable-plugins option.
13812 * configure: Regenerate.
13813 * config.in: Regenerate.
13814 * Makefile.am (LIBDL): New variable.
13815 (CCFILES): Add plugin.cc.
13816 (HFILES): Add plugin.h.
13817 (ldadd_var): Add LIBDL.
13818 * Makefile.in: Regenerate.
13820 * archive.cc: Include "plugin.h".
13821 (Archive::setup): Don't preread archive symbols when using a plugin.
13822 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13823 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13825 (Archive::include_member): Add symbols from plugin objects.
13826 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13827 * descriptors.cc (Descriptors::open): Check for file descriptors
13828 abandoned by plugins.
13829 (Descriptors::claim_for_plugin): New function.
13830 * descriptors.h (Descriptors::claim_for_plugin): New function.
13831 (Open_descriptor::is_claimed): New field.
13832 (claim_descriptor_for_plugin): New function.
13833 * fileread.cc (File_read::claim_for_plugin): New function.
13834 * fileread.h (File_read::claim_for_plugin): New function.
13835 (File_read::descriptor): New function.
13836 * gold.cc: Include "plugin.h".
13837 (queue_initial_tasks): Add task to call plugin hooks for generating
13839 * main.cc: Include "plugin.h".
13840 (main): Load plugin libraries.
13841 * object.h (Pluginobj): Declare.
13842 (Object::pluginobj): New function.
13843 (Object::do_pluginobj): New function.
13844 (Object::set_target): New function.
13845 * options.cc: Include "plugin.h".
13846 (General_options::parse_plugin): New function.
13847 (General_options::General_options): Initialize plugins_ field.
13848 (General_options::add_plugin): New function.
13849 * options.h (Plugin_manager): Declare.
13850 (General_options): Add --plugin option.
13851 (General_options::has_plugins): New function.
13852 (General_options::plugins): New function.
13853 (General_options::add_plugin): New function.
13854 (General_options::plugins_): New field.
13855 * plugin.cc: New file.
13856 * plugin.h: New file.
13857 * readsyms.cc: Include "plugin.h".
13858 (Read_symbols::do_read_symbols): Check for archive before checking
13859 for ELF file. Call plugin hooks to claim files.
13860 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13861 from a real object file; force override when processing replacement
13863 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13864 (Symbol::init_base_object): Likewise.
13865 (Symbol::init_base_output_data): Likewise.
13866 (Symbol::init_base_output_segment): Likewise.
13867 (Symbol::init_base_constant): Likewise.
13868 (Symbol::init_base_undefined): Likewise.
13869 (Symbol::output_section): Assert that object is not a plugin.
13870 (Symbol_table::add_from_pluginobj): New function.
13871 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13873 (Symbol_table::sized_write_globals): Likewise.
13874 (Symbol_table::add_from_pluginobj): Instantiate template.
13875 * symtab.h (Sized_pluginobj): Declare.
13876 (Symbol::in_real_elf): New function.
13877 (Symbol::set_in_real_elf): New function.
13878 (Symbol::in_real_elf_): New field.
13879 (Symbol_table::add_from_pluginobj): New function.
13881 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13882 (LIBDL): New variable.
13883 (LDADD): Add LIBDL.
13884 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13885 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13886 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13887 (MOSTLYCLEANFILES): Likewise.
13888 * testsuite/Makefile.in: Regenerate.
13889 * testsuite/plugin_test.c: New file.
13890 * testsuite/plugin_test_1.sh: New file.
13891 * testsuite/plugin_test_2.sh: New file.
13893 2008-09-16 Ian Lance Taylor <iant@google.com>
13895 * target-reloc.h (relocate_section): Check whether a symbol is
13896 defined by the ABI before reporting an undefined symbol error.
13897 * target.h (Target::is_defined_by_abi): Make parameter const.
13898 (Target::do_is_defined_by_abi): Likewise.
13899 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13900 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13901 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13902 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13903 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13904 * testsuite/Makefile.in: Rebuild.
13906 * fileread.cc (make_view): Add casts to avoid warning.
13908 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13910 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13911 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13913 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13915 * options.h (General_options::output_is_executable): New.
13916 (General_options::output_is_pie): New.
13917 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13918 for shared libraries.
13919 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13921 2008-09-11 Chris Demetriou <cgd@google.com>
13923 * options.h (origin): New -z option.
13924 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13925 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13928 2008-09-05 Cary Coutant <ccoutant@google.com>
13930 * fileread.cc (File_read::make_view): Add check for attempt to map
13931 beyond end of file.
13933 2008-09-05 Cary Coutant <ccoutant@google.com>
13935 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13936 explicit instantiations.
13938 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13941 * options.cc (General_options::finalize): Allow undefined symbols
13942 in shlibs if linking -shared.
13945 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13946 symbols as not needing a dynsym entry.
13948 2008-08-20 Craig Silverstein <csilvers@google.com>
13950 * fileread.cc (File_read::open): Do not lock the file unless it
13951 was successfully opened.
13953 2008-08-14 Cary Coutant <ccoutant@google.com>
13955 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13956 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13957 * testsuite/tls_test.cc (struct int128): 128-bit struct
13958 for testing TLS relocs with non-zero addend.
13959 (v12): New TLS variable.
13961 (t_last): Add check for v12.
13962 * testsuite/tls_test.h (t12): New function.
13963 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13965 2008-08-13 Ian Lance Taylor <iant@google.com>
13967 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13968 set tls_segment_ or relro_segment_.
13969 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13971 * output.h (Output_section::clear_is_relro): New function.
13972 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13973 sections specially even when output_data_ is empty.
13974 (Output_segment::maximum_alignment): When first section is relro,
13975 only force alignment for PT_LOAD segments.
13976 * script.cc (script_data_segment_align): New function.
13977 (script_data_segment_relro_end): New function.
13978 * script-c.h (script_data_segment_align): Declare.
13979 (script_data_segment_relro_end): Declare.
13980 * script-sections.h (class Script_sections): Declare
13981 data_segment_align and data_segment_relro_end. Add fields
13982 segment_align_index_ and saw_relro_end_.
13983 * script-sections.cc (class Sections_element): Add set_is_relro
13984 virtual function. Add new bool* parameter to place_orphan_here.
13985 Add get_output_section virtual function.
13986 (class Output_section_definition): Add set_is_relro. Add new
13987 bool* parameter to place_orphan_here. Add get_output_section.
13988 Add is_relro_ field.
13989 (Output_section_definition::Output_section_definition): Initialize
13990 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13991 and is_relro_ fields.
13992 (Output_section_definition::place_orphan_here): Add is_relro
13994 (Output_section_definition::set_section_addresses): Set relro for
13996 (Output_section_definition::alternate_constraint): Likewise.
13997 (class Orphan_output_section): Add new bool* parameter to
13998 place_orphan_here. Add get_output_section.
13999 (Orphan_output_section::place_orphan_here): Add is_relro
14001 (Script_sections::Script_sections): Initialize
14002 data_segment_align_index_ and saw_relro_end_.
14003 (Script_sections::data_segment_align): New function.
14004 (Script_sections::data_segment_relro_end): New function.
14005 (Script_sections::place_orphan): Set or clear is_relro.
14006 (Script_sections::set_section_addresses): Force alignment of first
14008 * yyscript.y (exp): Call script_data_segment_align and
14009 script_data_segment_relro_end.
14010 * testsuite/relro_script_test.t: New file.
14011 * testsuite/relro_test.cc (using_script): Declare.
14012 (t1, t2): Test using_script.
14013 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14014 (relro_script_test_SOURCES): Define.
14015 (relro_script_test_DEPENDENCIES): Define.
14016 (relro_script_test_LDFLAGS): Define.
14017 (relro_script_test_LDADD): Define.
14018 (relro_script_test.so): New target.
14019 * testsuite/Makefile.in: Rebuild.
14021 2008-08-06 Cary Coutant <ccoutant@google.com>
14023 * archive.cc (Archive::total_archives, Archive::total_members)
14024 (Archive::total_members_loaded): New variables.
14025 (Archive::setup): Add parameter. Add option to preread
14027 (Archive::read_armap): Add counter.
14028 (Archive::get_file_and_offset): New function.
14029 (Archive::get_elf_object_for_member): New function.
14030 (Archive::read_all_symbols): New function.
14031 (Archive::read_symbols): New function.
14032 (Archive::add_symbols): Add counters.
14033 (Archive::include_all_members): Use armap to find members if it's
14035 (Archive::include_member): Skip reading symbols if already read.
14036 Factored code into Archive::get_file_and_offset and
14037 Archive::get_elf_object_for_member. Changed call to
14038 Mapfile::report_include_archive_member.
14039 (Archive::print_stats): New function.
14040 * archive.h: Declare Object and Read_symbols_data classes.
14041 (Archive::Archive): Add initializers for new members.
14042 (Archive::setup): Add parameter.
14043 (Archive::print_stats): New function.
14044 (Archive::total_archives, Archive::total_members)
14045 (Archive::total_members_loaded): New variables.
14046 (Archive::get_file_and_offset): New function.
14047 (Archive::get_elf_object_for_member): New function.
14048 (Archive::read_all_symbols): New function.
14049 (Archive::read_symbols): New function.
14050 (Archive::Archive_member): New class.
14051 (Archive::members_): New member.
14052 (Archive::num_members_): New member.
14053 * main.cc: Include archive.h.
14054 (main): Call Archive::print_stats.
14055 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14056 archive parameter; member_name is now the fully-decorated name.
14057 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14058 * options.h: (General_options): Add --preread-archive-symbols option.
14059 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14062 2008-08-04 Ian Lance Taylor <iant@google.com>
14064 * symtab.h (Symbol::use_plt_offset): New function.
14065 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14066 * powerpc.cc (Relocate::relocate): Likewise.
14067 * sparc.cc (Relocate::relocate): Likewise.
14068 * x86_64.cc (Relocate::relocate): Likewise.
14069 * testsuite/weak_plt.sh: New test.
14070 * testsuite/weak_plt_main.cc: New test.
14071 * testsuite/weak_plt_shared.cc: New test.
14072 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14073 (check_PROGRAMS): Add weak_plt.
14074 (check_DATA): Add weak_plt_shared.so.
14075 (weak_plt_main_pic.o, weak_plt): New targets.
14076 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14077 * testsuite/Makefile.in: Rebuild.
14079 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14081 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14082 * testsuite/Makefile.in: Rebuild.
14084 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14086 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14087 * Makefile.in: Regenerate.
14088 * po/POTFILES.in: Regenerate.
14090 2008-07-29 Ian Lance Taylor <iant@google.com>
14092 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14093 symbols before other symbols.
14094 * testsuite/script_test_2.cc (test_addr): Declare.
14095 (test_addr_alias): Declare.
14096 (main): Check that test_addr and test_addr_alias have the right
14098 * testsuite/script_test_2.t: Define test_addr_alias and
14101 2008-07-24 Ian Lance Taylor <iant@google.com>
14104 * descriptors.cc: New file.
14105 * descriptors.h: New file.
14106 * gold-threads.h (class Hold_optional_lock): New class.
14107 * fileread.cc: Include "descriptors.h".
14108 (File_read::~File_read): Release descriptor rather than closing
14110 (File_read::open) [file]: Call open_descriptor rather than open.
14111 Set is_descriptor_opened_.
14112 (File_read::open) [memory]: Assert that descriptor is not open.
14113 (File_read::reopen_descriptor): New function.
14114 (File_read::release): Release descriptor.
14115 (File_read::do_read): Make non-const. Reopen descriptor.
14116 (File_read::read): Make non-const.
14117 (File_read::make_view): Reopen descriptor.
14118 (File_read::do_readv): Likewise.
14119 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14120 Update declarations.
14121 * layout.cc: Include "descriptors.h".
14122 (Layout::create_build_id): Use open_descriptor rather than open.
14123 * output.cc: Include "descriptors.h".
14124 (Output_file::open): Use open_descriptor rather than open.
14125 * archive.cc (Archive::const_iterator): Change Archive to be
14127 (Archive::begin, Archive::end): Make non-const.
14128 (Archive::count_members): Likewise.
14129 * archive.h (class Archive): Update declarations.
14130 * object.h (Object::read): Make non-const.
14131 * Makefile.am (CCFILES): Add descriptors.cc.
14132 (HFILES): Add descriptors.h.
14133 * Makefile.in: Rebuild.
14136 * gold.h: Always include <clocale>. Add Solaris workarounds
14137 following code in binutils/sysdep.h.
14140 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14141 this->eh_frame_hdr_ is NULL before using it.
14143 * dynobj.cc (Versions::Versions): Update comment.
14145 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14146 the base version name.
14148 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14149 array size plus one.
14150 (Stringpool_template::set_string_offsets): Subtract one from key
14151 before using it as an array index.
14152 (Stringpool_template::get_offset_with_length): Likewise.
14153 (Stringpool_template::write_to_buffer): Likewise.
14154 * stringpool.h (Stringpool_template::get_offset_from_key):
14157 2008-07-23 Ian Lance Taylor <iant@google.com>
14160 * object.h (Merged_symbol_value::value): Do our best to handle a
14164 * script.cc (Version_script_info::get_versions): Don't add empty
14165 version tag to return value.
14166 (Version_script_info::get_symbol_version_helper): Change return
14167 type to bool. Add pversion parameter. Change all callers.
14168 (script_register_vers_node): Don't require a non-NULL tag.
14169 * script.h (class Version_script_info): Update declarations.
14170 (Version_script_info::get_symbol_version): Change return type to
14171 bool. Add version parameter. Change all callers.
14172 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14173 handling. Handle an empty version from a version script.
14174 (Symbol_table::define_special_symbol): Likewise.
14175 * testsuite/ver_test_10.script: New file.
14176 * testsuite/ver_test_10.sh: New file.
14177 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14178 (check_DATA): Add ver_test_10.syms.
14179 (ver_test_10.syms, ver_test_10.so): New target.
14180 * testsuite/Makefile.in: Rebuild.
14182 2008-07-23 Simon Baldwin <simonb@google.com>
14184 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14185 to zero for undefined symbols from dynamic libraries.
14187 2008-07-23 Ian Lance Taylor <iant@google.com>
14189 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14190 Change all callers.
14191 * symtab.h (class Symbol_table): Update declaration.
14192 * testsuite/ver_test_9.cc: New file.
14193 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14194 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14195 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14196 (ver_test_9.so, ver_test_9.o): New targets.
14197 * testsuite/Makefile.in: Rebuild.
14199 2008-07-22 Ian Lance Taylor <iant@google.com>
14201 * options.h (class General_options): Define --check-sections.
14202 * layout.cc (Layout::set_segment_offsets): Handle
14205 * options.h (class General_options): Define -n/--nmagic and
14207 * options.cc (General_options::finalize): For -n/--nmagic or
14208 -N/--omagic, set -static.
14209 * layout.cc (Layout::attach_allocated_section_to_segment): If
14210 -N/--omagic, don't put read-only and read-write sections in
14211 different segments.
14212 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14213 finding a read-only segment.
14214 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14215 don't set the minimum segment alignment to the common page size,
14216 and don't set the file offset to the address modulo the page size.
14217 * script-sections.cc (Script_sections::create_segments): If
14218 -n/--omagic, don't put read-only and read-write sections in
14219 different segments.
14221 * cref.cc: New file.
14222 * cref.h: New file.
14223 * options.h (class General_options): Add --print-symbol-counts.
14224 * main.cc (main): Issue defined symbol report if requested.
14225 * archive.cc (Archive::interpret_header): Make into a const member
14227 (Archive::add_symbols): Call Input_objects::archive_start and
14229 (Archive::const_iterator): Define new class.
14230 (Archive::begin, Archive::end): New functions.
14231 (Archive::include_all_members): Rewrite to use iterator.
14232 (Archive::count_members): New function.
14233 * archive.h (class Archive): Update declarations.
14234 (Archive::filename): New function.
14235 * object.cc: Include "cref.h".
14236 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14237 (Sized_relobj::do_get_global_symbol_counts): New function.
14238 (Input_objects::add_object): Add object to cross-referencer.
14239 (Input_objects::archive_start): New function.
14240 (Input_objects::archive_stop): New function.
14241 (Input_objects::print_symbol_counts): New function.
14242 * object.h: Declare Cref and Archive.
14243 (Object::get_global_symbol_counts): New function.
14244 (Object::do_get_global_symbol_counts): New pure virtual function.
14245 (class Sized_relobj): Add defined_count_ field. Update
14247 (class Input_objects): Add cref_ field. Update constructor.
14248 Update declarations.
14249 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14251 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14253 (Sized_dynobj::do_get_global_symbol_counts): New function.
14254 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14255 defined_count_. Update declarations. Define Symbols typedef.
14256 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14257 parameter. Change all callers.
14258 (Symbol_table::add_from_dynobj): Add sympointers and defined
14259 parameters. Change all callers.
14260 * symtab.h (class Symbol_table): Update declarations.
14261 * Makefile.am (CCFILES): Add cref.cc.
14262 (HFILES): Add cref.h.
14263 * Makefile.in: Rebuild.
14265 2008-07-22 Simon Baldwin <simonb@google.com>
14267 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14268 to zero when writing undefined symbols.
14270 2008-07-22 Ian Lance Taylor <iant@google.com>
14272 * output.cc (Output_section::add_input_section): Don't try to
14273 merge empty merge sections.
14275 2008-07-21 Craig Silverstein <csilvers@google.com>
14277 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14278 Include symbol version in error message.
14280 2008-07-20 Chris Demetriou <cgd@google.com>
14282 * configure.ac (gold_cv_c_random_seed): New configured variable.
14283 (RANDOM_SEED_CFLAGS): New substituted variable.
14284 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14285 * configure: Rebuild.
14286 * Makefile.in: Likewise.
14287 * testsuite/Makefile.in: Likewise.
14289 2008-07-18 Ian Lance Taylor <iant@google.com>
14291 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14292 where we see NAME/NULL and NAME/VERSION as separate symbols.
14293 * testsuite/ver_test_main.cc (main): Call t4.
14294 (t4, t4_2a): Define.
14295 * testsuite/ver_test_2.cc (t4_2): Define.
14296 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14297 * testsuite/ver_test_4.cc (t4_2a): Define.
14298 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14299 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14301 2008-07-17 Ian Lance Taylor <iant@google.com>
14303 * dynobj.cc (Versions::add_def): If we give an error about a
14304 missing version, go ahead and create the version anyhow.
14306 2008-07-10 Ian Lance Taylor <iant@google.com>
14308 Handle output sections with more than 0x7fffffff bytes.
14309 * object.h (class Relobj): Change map_to_output_ to
14310 output_sections_, and just keep a section pointer. Change all
14311 uses. Move comdat group support to Sized_relobj.
14312 (Relobj::is_section_specially_mapped): Remove.
14313 (Relobj::output_section): Remove poff parameter. Change all
14315 (Relobj::output_section_offset): New function.
14316 (Relobj::set_section_offset): Rewrite.
14317 (Relobj::map_to_output): Remove.
14318 (Relobj::output_sections): New function.
14319 (Relobj::do_output_section_offset): New pure virtual function.
14320 (Relobj::do_set_section_offset): Likewise.
14321 (class Sized_relobj): Add section_offsets_ field. Add comdat
14322 group support from Relobj. Update declarations.
14323 (Sized_relobj::get_output_section_offset): New function.
14324 (Sized_relobj::do_output_section_offset): New function.
14325 (Sized_relobj::do_set_section_offset): New function.
14326 * object.cc (Relobj::output_section_address): Remove.
14327 (Sized_relobj::Sized_relobj): Initialize new fields.
14328 (Sized_relobj::include_section_group): Cast find_kept_object to
14330 (Sized_relobj::include_linkonce_section): Likewise.
14331 (Sized_relobj::do_layout): Use separate arrays for output section
14333 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14335 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14336 output_sections and section_offsets.
14337 (Sized_relobj::write_local_symbols): Likewise.
14338 (map_to_kept_section): Compute output address directly.
14339 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14340 output_sections and section_offsets.
14341 (Sized_relobj::write_sections): Likewise.
14342 (Sized_relobj::relocate_sections): Likewise.
14343 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14344 * output.h (class Output_reloc): Update declarations. Change
14345 u2_.relobj to Sized_relobj*.
14346 (class Output_data_reloc): Change add functions to use
14348 * output.cc (Output_reloc::Output_reloc): Change relobj to
14350 (Output_reloc::local_section_offset): Change return type to
14351 Elf_Addr. Use get_output_section_offset.
14352 (Output_reloc::get_address): Likewise.
14353 (Output_section::is_input_address_mapped): Don't call
14354 is_section_specially_mapped.
14355 (Output_section::output_offset): Likewise.
14356 (Output_section::output_address): Likewise.
14357 (Output_section::starting_output_address): Likewise.
14358 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14359 parameter to Sized_relobj*.
14360 (Copy_relocs::need_copy_reloc): Likewise.
14361 (Copy_relocs::save): Likewise.
14362 * copy-relocs.h (class Copy_relocs): Update declarations.
14363 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14364 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14365 * target-reloc.h (relocate_for_relocatable): Change
14366 offset_in_output_section type to Elf_Addr. Change code that uses
14368 * layout.cc (Layout::layout): Always set *off.
14369 * mapfile.cc (Mapfile::print_input_section): Use
14370 output_section_offset.
14371 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14373 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14374 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14375 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14377 2008-07-03 Ian Lance Taylor <iant@google.com>
14379 * layout.cc (Layout::include_section): Do not discard unrecognized
14380 SHT_STRTAB sections.
14382 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14384 * script.cc (Lex::can_continue_name): Make '?' allowable in
14385 version-script names.
14386 * testsuite/version_script.map: Change glob pattern to use '?'
14388 2008-06-30 Manish Singh <yosh@gimp.org>
14391 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14394 2008-06-30 Ian Lance Taylor <iant@google.com>
14398 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14399 versions]: Don't try to read the value in the contents, since we
14400 don't use it. Use the template endianness when writing.
14402 2008-06-25 Cary Coutant <ccoutant@google.com>
14404 * fileread.cc (File_read::make_view): Assert on zero-length view.
14405 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14406 symbol table when there are no symbols to read.
14408 2008-06-23 Craig Silverstein <csilvers@google.com>
14410 * version.cc (version_string): Bump to 1.7
14412 2008-06-18 Craig Silverstein <csilvers@google.com>
14414 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14415 constant 0xFFFF to type Valtype.
14416 (Powerpc_relocate_functions::rel16_ha): Likewise.
14418 2008-06-17 Ian Lance Taylor <iant@google.com>
14420 * output.h (Output_section::Input_section): Initialize p2align_ to
14421 zero for Output_section_data constructors.
14422 (Output_section::Input_section::addralign): If not an input
14423 section, return the alignment of the Output_section_data.
14424 * testsuite/copy_test.cc: New file.
14425 * testsuite/copy_test_1.cc: New file.
14426 * testsuite/copy_test_2.cc: New file.
14427 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14428 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14429 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14430 (copy_test_1_pic.o, copy_test_1.so): New targets.
14431 (copy_test_2_pic.o, copy_test_2.so): New targets.
14432 * testsuite/Makefile.in: Rebuild.
14434 * script-sections.cc (Script_sections::place_orphan): Initialize
14435 local variable exact.
14437 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14439 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14441 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14442 David S. Miller <davem@davemloft.net>
14444 * powerpc.cc: New file.
14445 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14446 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14447 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14448 * Makefile.in: Rebuild.
14450 2008-06-09 Ian Lance Taylor <iant@google.com>
14452 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14454 (throwing, orig_terminate): New static variables.
14455 (terminate_handler): New static function.
14456 (t2): Set terminate handler.
14458 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14461 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14464 2008-05-30 Cary Coutant <ccoutant@google.com>
14466 * archive.cc (Archive::include_all_members) Correct to step
14467 over symbol table and extended name table in thin archives.
14469 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14472 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14475 2008-05-28 Caleb Howe <cshowe@google.com>
14477 * reduced_debug_output.cc: New file.
14478 * reduced_debug_output.h: New file.
14479 * options.h (class General_options): Add --strip-debug-non-line.
14480 * options.cc (General_options::finalize): Add strip_debug_non_line
14481 to the strip heirarchy.
14482 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14484 * layout.cc: Include "reduced_debug_output.h".
14485 (Layout::Layout): Initialize new fields.
14486 (line_only_debug_sections): New static array.
14487 (is_lines_only_debug_sections): New static inline function.
14488 (Layout::include_section): Handle --strip-debug-non-line.
14489 (Layout::make_output_section): If --strip-debug-non-line, build
14490 new output sections for .debug_abbrev and .debug_info.
14491 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14492 gold. Warn about possible overflow.
14493 (read_signed_LEB_128): Likewise.
14494 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14495 (read_signed_LEB_128): Declare.
14496 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14497 (HFILES): Add reduced_debug_output.h.
14498 * Makefile.in: Rebuild.
14500 2008-05-21 Ian Lance Taylor <iant@google.com>
14502 * mapfile.cc: New file.
14503 * mapfile.h: New file.
14504 * options.h (class General_options): Add -M/--print-map and -Map.
14505 * options.cc (General_options::finalize): Make -M equivalent to
14507 * main.cc: Include <cstdio> and "mapfile.h".
14508 (main): Open mapfile if requested.
14509 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14510 constructor. Change caller.
14511 (queue_initial_tasks): Add mapfile parameter. Change caller.
14512 (queue_middle_tasks): Likewise.
14513 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14515 * archive.cc: Include "mapfile.h".
14516 (Archive::add_symbols): Add mapfile parameter. Change all
14517 callers. Pass mapfile, symbol, and reason to include_member.
14518 (Archive::include_all_members): Add mapfile parameter. Change all
14520 (Archive::include_member): Add mapfile, sym, and why parameters.
14521 Change all callers. Report inclusion to map file.
14522 * archive.h: Include "fileread.h".
14523 (class Archive): Update declarations.
14524 (Archive::file): New const method.
14525 (class Add_archive_symbols): Add mapfile_ field. Update
14526 constructor. Change all callers.
14527 * readsyms.h (class Read_symbols): Likewise.
14528 (class Finish_group): Likewise.
14529 (class Read_script): Likewise.
14530 * common.cc: Include "mapfile.h".
14531 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14533 (Symbol_table::do_allocate_commons): Likewise.
14534 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14535 symbol allocation to mapfile.
14536 * common.h (class Allocate_commons_task): Add mapfile_ field.
14537 Update constructor. Change all callers.
14538 * symtab.h (class Symbol_table): Update declarations.
14539 * layout.cc: Include "mapfile.h".
14540 (Layout_task_runner::run): Print information to mapfile.
14541 (Layout::create_gold_note): Change Output_data_fixed_space to
14542 Output_data_zero_fill.
14543 (Layout::create_build_id): Likewise.
14544 (Layout::print_to_mapfile): New function.
14545 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14546 constructor. Change caller.
14547 (class Layout): Declare print_to_mapfile.
14548 * output.cc (Output_section::Input_section::print_to_mapfile): New
14550 (Output_section::add_input_section): If producing a map, always
14551 add to input_sections_ list.
14552 (Output_section::do_print_to_mapfile): New function.
14553 (Output_segment::print_sections_to_mapfile): New function.
14554 (Output_segment::print_section_list_to_mapfile): New function.
14555 * output.h: Include "mapfile.h".
14556 (Output_data::print_to_mapfile): New function.
14557 (Output_data::do_print_to_mapfile): New virtual function.
14558 (Output_segment_headers::do_print_to_mapfile): New function.
14559 (Output_file_header::do_print_to_mapfile): New function.
14560 (Output_data_const::do_print_to_mapfile): New function.
14561 (class Output_data_const_buffer): Add map_name_ field. Update
14562 constructor. Change all callers. Add do_print_to_mapfile
14564 (class Output_data_fixed_space): Likewise.
14565 (class Output_data_space): Likewise.
14566 (class Output_data_zero_fill): New class.
14567 (Output_data_strtab::do_print_to_mapfile): New function.
14568 (Output_data_reloc_base::do_print_to_mapfile): New function.
14569 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14570 (Output_data_group::do_print_to_mapfile): New function.
14571 (Output_data_got::do_print_to_mapfile): New function.
14572 (Output_data_dynamic::do_print_to_mapfile): New function.
14573 (Output_symtab_xindex::do_print_to_mapfile): New function.
14574 (class Output_section): Declare do_print_to_mapflie. Declare
14575 print_to_mapfile in Input_section.
14576 (class Output_segment): Declare new functions.
14577 * object.h (Sized_relobj::symbol_count): New function.
14578 * script-sections.cc
14579 (Output_section_element_dot_assignment::set_section_addresses):
14580 Change Output_data_fixed_space to Output_data_zero_fill.
14581 (Output_data_expression::do_print_to_mapfile): New function.
14582 * script.cc (read_input_script): Add mapfile parameter. Change
14584 * script.h (read_input_script): Update declaration.
14585 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14586 (Eh_frame::do_print_to_mapfile): New function.
14587 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14588 (Output_merge_string::do_print_to_mapfile): New function.
14589 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14591 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14593 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14595 * Makefile.am (CCFILES): Add mapfile.cc.
14596 (HFILES): Add mapfile.h.
14597 * Makefile.in: Rebuild.
14599 2008-05-19 Ian Lance Taylor <iant@google.com>
14601 * options.h (class General_options): Add -z relro.
14602 * layout.cc (Layout::Layout): Initialize relro_segment_.
14603 (Layout::add_output_section_data): Return the output section.
14604 (Layout::make_output_section): Rcognize relro sections and mark
14605 them appropriately.
14606 (Layout::attach_allocated_section_to_segment): Put relro sections
14607 in a PT_GNU_RELRO segment.
14608 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14610 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14612 (Layout::linkonce_mapping): Map d.rel.ro.local to
14613 .data.rel.ro.local.
14614 (Layout::output_section_name): Us .data.rel.ro.local for any
14615 section which begins with that.
14616 * layout.h (class Layout): Update add_output_section_data
14617 declaration. Add relro_segment_ field.
14618 * output.cc (Output_section::Output_section): Initialize is_relro_
14619 and is_relro_local_ fields.
14620 (Output_segment::add_output_section): Group relro sections.
14621 (Output_segment::is_first_section_relro): New function.
14622 (Output_segment::maximum_alignment): If there is a relro section,
14623 align the segment to the common page size.
14624 (Output_segment::set_section_addresses): Track whether we are
14625 looking at relro sections. If the last section is a relro
14626 section, align to the common page size.
14627 (Output_segment::set_section_list_addresses): Add in_relro
14628 parameter. Change all callers. Align to the page size when
14629 moving from relro to non-relro section.
14630 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14632 * output.h (class Output_section): Add is_relro_ and
14633 is_relro_local_ fields.
14634 (Output_section::is_relro): New function.
14635 (Output_section::set_is_relro): New function.
14636 (Output_section::is_relro_local): New function.
14637 (Output_section::set_is_relro_local): New function.
14638 (class Output_segment): Update declarations.
14639 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14640 * sparc.cc (Target_sparc::got_section): Likewise.
14641 * x86_64.cc (Target_x86_64::got_section): Likewise.
14642 * testsuite/relro_test_main.cc: New file.
14643 * testsuite/relro_test.cc: New file.
14644 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14645 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14646 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14647 (relro_test.so, relro_test_pic.o): New targets.
14648 * testsuite/Makefile.in: Rebuild.
14650 2008-05-16 Ian Lance Taylor <iant@google.com>
14652 * output.cc (Output_segment::add_output_section): Remove front
14654 * output.h (class Output_segment): Remove
14655 add_initial_output_section and overloaded add_output_section.
14656 Update declaration of remaining add_output_section.
14657 * layout.cc (Layout::create_interp): Call add_output_section
14658 rather than add_initial_output_section.
14659 (Layout::finish_dynamic_section): Likewise.
14661 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14662 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14663 know the dynamic type.
14664 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14665 field. Initialize it in constructor.
14666 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14667 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14668 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14671 * output.cc (Output_reloc::get_address): Change return type to
14673 * output.h (class Output_reloc): Update get_address declaration.
14674 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14675 for section addresses.
14677 2008-05-09 Ian Lance Taylor <iant@google.com>
14680 * gold.cc (gold_nomem): Use return value of write.
14682 2008-05-08 Ian Lance Taylor <iant@google.com>
14684 * symtab.c (Symbol::init_base_output_data): Add version
14685 parameter. Change all callers.
14686 (Symbol::init_base_output_segment): Likewise.
14687 (Symbol::init_base_constant): Likewise.
14688 (Symbol::init_base_undefined): Likewise.
14689 (Sized_symbol::init_output_data): Likewise.
14690 (Sized_symbol::init_output_segment): Likewise.
14691 (Sized_symbol::init_constant): Likewise.
14692 (Sized_symbol::init_undefined): Likewise.
14693 (Symbol_table::do_define_in_output_data): If the new symbol has a
14694 version, mark it as the default.
14695 (Symbol_table::do_define_in_output_segment): Likewise.
14696 (Symbol_table::do_define_as_constant): Likewise.
14697 * symtab.h (class Symbol): Update declarations.
14698 (class Sized_symbol): Likewise.
14699 * resolve.cc (Symbol::override_version): New function.
14700 (Symbol::override_base): Call override_version.
14701 (Symbol::override_base_with_special): Likewise.
14702 * testsuite/ver_script_8.script: New file.
14703 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14704 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14705 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14706 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14708 2008-05-06 Ian Lance Taylor <iant@google.com>
14711 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14713 (class General_options): Remove existing --undefined, and add
14714 --no-undefined instead. Add new --undefined as synonym for -u.
14715 * archive.cc (Archive::add_symbols): Check whether symbol was
14717 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14718 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14719 all uses. Add IS_UNDEFINED. Update declarations to split
14720 different versions of init_base. Declare init_base_undefined.
14721 (Symbol::is_defined): Handle IS_UNDEFINED.
14722 (Symbol::is_undefined): Likewise.
14723 (Symbol::is_weak_undefined): Call is_undefined.
14724 (Symbol::is_absolute): Handle IS_CONSTANT.
14725 (class Sized_symbol): Update declarations to split different
14726 versions of init. Declare init_undefined.
14727 (class Symbol_table): Declare new functions.
14728 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14729 Change all callers.
14730 (Symbol::init_base_output_data): Likewise.
14731 (Symbol::init_base_output_segment): Likewise.
14732 (Symbol::init_base_constant): Likewise.
14733 (Symbol::init_base_undefined): New function.
14734 (Sized_symbol::init_object): Rename from init. Change all
14736 (Sized_symbol::init_output_data): Likewise.
14737 (Sized_symbol::init_output_segment): Likewise.
14738 (Sized_symbol::init_constant): Likewise.
14739 (Sized_symbol::init_undefined): New function.
14740 (Symbol_table::add_undefined_symbols_from_command_line): New
14742 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14744 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14745 (Symbol::output_section): Likewise.
14746 (Symbol::set_output_section): Likewise.
14747 (Symbol_table::sized_finalize_symbol): Likewise.
14748 (Symbol_table::sized_write_globals): Likewise.
14749 * resolve.cc (Symbol_table::should_override): Likewise.
14750 (Symbol::override_base_with_special): Likewise.
14752 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14753 symbol, change it to have default visibility.
14754 * testsuite/protected_1.cc: New file.
14755 * testsuite/protected_2.cc: New file.
14756 * testsuite/protected_3.cc: New file.
14757 * testsuite/protected_main_1.cc: New file.
14758 * testsuite/protected_main_2.cc: New file.
14759 * testsuite/protected_main_3.cc: New file.
14760 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14761 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14762 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14763 (protected_1.so): New target.
14764 (protected_1_pic.o, protected_2_pic.o): New targets.
14765 (protected_3_pic.o): New target.
14766 (check_PROGRAMS): Add protected_2.
14767 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14768 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14769 * testsuite/Makefile.in: Rebuild.
14771 * options.h (DEFINE_var): Add set_user_set_##varname__.
14772 (DEFINE_bool_alias): New macro.
14773 (class General_options): Define -Bstatic using DEFINE_bool_alias
14774 rather than DEFINE_special. Add --undefined as an alias for -z
14776 * options.cc (General_options::parse_Bstatic): Remove.
14778 * options.h (class General_options): Add --fatal-warnings.
14779 * main.cc (main): Implement --fatal-warnings.
14780 * errors.h (Errors::warning_count): New function.
14782 * options.h (class General_options): Add -Bsymbolic-functions.
14783 * symtab.h (Symbol::is_preemptible): Check for
14784 -Bsymbolic-functions.
14786 2008-05-05 Ian Lance Taylor <iant@google.com>
14788 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14789 as noVARNAME rather than no-VARNAME.
14790 (class General_options): Add option -z combreloc.
14791 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14793 (Output_reloc::sort_before) [SHT_REL]: New function.
14794 (Output_reloc::sort_before) [SHT_RELA]: New function.
14795 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14796 Sort_relocs_comparison.
14797 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14798 parameter. Change all callers.
14799 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14800 sort_relocs parameter. Change all callers.
14801 * output.cc (Output_reloc::get_address): New function, broken out
14803 (Output_reloc::write_rel): Call it.
14804 (Output_reloc::compare): New function.
14805 (Output_data_reloc_base::do_write): Optionally sort relocs.
14807 * configure.ac: If targ_extra_obj is set, link it in.
14808 * configure.tgt: Initialize all variables.
14809 (x86_64*): Set targ_extra_obj and targ_extra_size.
14810 * configure: Rebuild.
14812 * object.cc (Sized_relobj::include_section_group): Adjust section
14813 indexes read from group data. Build vector to pass to
14815 * layout.cc (Layout::layout_group): Add flags and shndxes
14816 parameters. Remove contents parameter. Change caller. Update
14817 explicit instantiations.
14818 * layout.h (class Layout): Update layout_group declaration.
14819 * output.cc (Output_data_group::Output_data_group): Add flags and
14820 input_shndxes parameters. Remove contents parameter. Change
14822 (Output_data_group::do_write): Change input_sections_ to
14824 * output.h (class Output_data_group): Update constructor
14825 declaration. Rename input_sections_ to input_shndxes_.
14826 * testsuite/many_sections_test.cc: Add template.
14828 2008-04-30 Cary Coutant <ccoutant@google.com>
14830 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14832 * layout.cc (Layout::include_section): Refactored check for debug
14834 (Layout::add_comdat): Add new parameters. Change type
14835 of signature parameter. Add object and shndx to signatures table.
14836 (Layout::find_kept_object): New function.
14837 * layout.h: Include <cstring>.
14838 (Layout::is_debug_info_section): New function.
14839 (Layout::add_comdat): Add new parameters.
14840 (Layout::find_kept_object): New function.
14841 (Layout::Kept_section): New struct.
14842 (Layout::Signatures): Change type of map range.
14843 * object.cc (Relobj::output_section_address): New function.
14844 (Sized_relobj::include_section_group): Add new parameters. Change
14845 calls to Layout::add_comdat. Change to build table of kept comdat
14846 groups and table mapping discarded sections to kept sections.
14847 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14848 (Sized_relobj::do_layout): Change calls to include_section_group and
14849 include_linkonce_section.
14850 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14851 value to zero when section is discarded.
14852 (Sized_relobj::map_to_kept_section): New function.
14853 * object.h (Relobj::output_section_address): New function.
14854 (Relobj::Comdat_group): New type.
14855 (Relobj::find_comdat_group): New function.
14856 (Relobj::Comdat_group_table): New type.
14857 (Relobj::Kept_comdat_section): New type.
14858 (Relobj::Kept_comdat_section_table): New type.
14859 (Relobj::add_comdat_group): New function.
14860 (Relobj::set_kept_comdat_section): New function.
14861 (Relobj::get_kept_comdat_section): New function.
14862 (Relobj::comdat_groups_): New field.
14863 (Relobj::kept_comdat_sections_): New field.
14864 (Symbol_value::input_value): Update comment.
14865 (Sized_relobj::map_to_kept_section) New function.
14866 (Sized_relobj::include_linkonce_section): Add new parameter.
14867 * target-reloc.h (Comdat_behavior): New type.
14868 (get_comdat_behavior): New function.
14869 (relocate_section): Add code to map a discarded section to the
14870 corresponding kept section when applying a relocation.
14872 2008-04-30 Craig Silverstein <csilvers@google.com>
14874 * dwarf_reader.cc (next_generation_count): New static var.
14875 (Addr2line_cache_entry): New struct.
14876 (addr2line_cache): New static var.
14877 (Dwarf_line_info::one_addr2line): Added caching.
14878 (Dwarf_line_info::clear_addr2line_cache): New function.
14879 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14880 cache-size parameter.
14881 (Dwarf_line_info::one_addr2line_cache): New function.
14882 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14883 new cache-size argument to one_addr2line(), and clear cache.
14885 2008-04-28 Cary Coutant <ccoutant@google.com>
14887 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14888 R_386_PC8 relocations.
14890 2008-04-23 Ian Lance Taylor <iant@google.com>
14892 * object.cc (Sized_relobj::include_section_group): Check for
14893 invalid section group.
14895 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14898 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14899 than read for file header.
14900 * archive.cc (Archive::include_member): Likewise.
14902 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14904 * aclocal.m4: Regenerate.
14905 * configure: Regenerate.
14907 2008-04-19 Ian Lance Taylor <iant@google.com>
14909 * version.cc (version_string): Bump to 1.6.
14911 * testsuite/Makefile.am (many_sections_r_test): New target.
14912 (many_sections_r_test_SOURCES): Remove.
14913 (many_sections_r_test_DEPENDENCIES): Remove.
14914 (many_sections_r_test_LDFLAGS): Remove.
14915 (many_sections_r_test_LDADD): Remove.
14917 * object.cc (Sized_relobj::do_add_symbols): Always pass
14918 local_symbol_count_ to add_from_relobj.
14920 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14921 every thousand variables.
14922 * testsuite/Makefile.in: Rebuild.
14924 * object.cc (Xindex::initialize_symtab_xindex): New function.
14925 (Xindex::read_symtab_xindex): New function.
14926 (Xindex::sym_xindex_to_shndx): New function.
14927 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14929 (Sized_relobj::do_initialize_xindex): New function.
14930 (Sized_relobj::do_read_symbols): Adjust section links.
14931 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14932 parameter. Change all callers.
14933 (Sized_relobj::include_section_group): Adjust section links and
14934 symbol section indexes.
14935 (Sized_relobj::do_layout): Adjust section links.
14936 (Sized_relobj::do_count_local_symbols): Adjust section links and
14937 symbol section indexes.
14938 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14939 ordinary and special symbols.
14940 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14941 dynsym_xindex parameters. Change all callers. Adjust section
14942 links. Use SHN_XINDEX when needed.
14943 (Sized_relobj::get_symbol_location_info): Adjust section links.
14944 Don't get fooled by special symbols.
14945 * object.h (class Xindex): Define.
14946 (class Object): Add xindex_ parameter. Declare virtual functoin
14947 do_initialize_xindex.
14948 (Object::adjust_sym_shndx): New function.
14949 (Object::set_xindex): New protected function.
14950 (class Symbol_value): Add is_ordinary_shndx_ field.
14951 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14952 (Symbol_value::value): Assert ordinary section.
14953 (Symbol_value::initialize_input_to_output_map): Likewise.
14954 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14955 Change all callers.
14956 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14958 (class Sized_relobj): Update declarations.
14959 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14960 parameter. Change all callers.
14961 (Sized_relobj::adjust_shndx): New function.
14962 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14964 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14965 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14966 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14967 (Sized_dynobj::read_dynsym_section): Adjust section links.
14968 (Sized_dynobj::read_dynamic): Likewise.
14969 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14971 (Sized_dynobj::do_initialize_xindex): New function.
14972 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14973 do_initialize_xindex.
14974 (Sized_dynobj::adjust_shndx): New function.
14975 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14976 dynsym_xindex_ fields.
14977 (Layout::finalize): Add a call to set_section_indexes before
14978 creating the symtab sections.
14979 (Layout::set_section_indexes): Don't do anything if the section
14980 already has a section index.
14981 (Layout::create_symtab_sections): Add shnum parameter. Change
14982 caller. Create .symtab_shndx section if needed.
14983 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14985 (Layout::allocated_output_section_count): New function.
14986 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14988 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14989 fields. Update declarations.
14990 (Layout::symtab_xindex): New function.
14991 (Layout::dynsym_xindex): New function.
14992 (class Write_symbols_task): Add layout_ field.
14993 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14995 * output.cc (Output_section_headers::Output_section_headers): Add
14996 shstrtab_section parameter. Change all callers.
14997 (Output_section_headers::do_sized_write): Store overflow values
14998 for section count and section string table section index in
14999 section header zero.
15000 (Output_file_header::do_sized_write): Check for overflow of
15001 section count and section string table section index.
15002 (Output_symtab_xindex::do_write): New function.
15003 (Output_symtab_xindex::endian_do_write): New function.
15004 * output.h (class Output_section_headers): Add shstrtab_section_.
15005 Update declarations.
15006 (class Output_symtab_xindex): Define.
15007 (Output_section::has_out_shndx): New function.
15008 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15010 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15011 Change all callers.
15012 (Sized_symbol::init): Likewise.
15013 (Symbol::output_section): Check for ordinary symbol.
15014 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15015 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15017 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15018 Change all callers. Simplify handling of symbols from sections
15019 not included in the link.
15020 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15022 (Weak_alias_sorter::operator()): Assert that symbols are
15024 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15026 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15027 parameters. Change all callers.
15028 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15029 symbol distinction. Use SHN_XINDEX when needed.
15030 (Symbol_table::write_section_symbol): Add symtab_xindex
15031 parameter. Change all callers.
15032 (Symbol_table::sized_write_section_symbol): Likewise. Use
15033 SHN_XINDEX when needed.
15034 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15036 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15037 (Symbol::is_defined): Check is_ordinary.
15038 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15039 (Symbol::is_absolute, Symbol::is_common): Likewise.
15040 (class Sized_symbol): Update declarations.
15041 (class Symbol_table): Update declarations.
15042 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15043 parameters. Change all callers.
15044 (Sized_symbol::override): Likewise.
15045 (Symbol_table::override): Likewise.
15046 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15047 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15048 is_ordinary, and orig_st_shndx parameters. Change all callers.
15049 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15050 to be in an ordinary section.
15051 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15052 object and is_ordinary parameters. Change all callers.
15053 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15054 Change all callers. Don't add undefined or non-ordinary symbols
15056 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15057 Change all callers.
15058 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15060 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15061 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15062 (Sized_relobj::relocate_sections): Likewise.
15063 * target-reloc.h (scan_relocs): Adjust section symbol index.
15064 (scan_relocatable_relocs): Likewise.
15065 * i386.cc (Scan::local): Check for ordinary symbols.
15066 * sparc.cc (Scan::local): Likewise.
15067 * x86_64.cc (Scan::local): Likewise.
15068 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15069 to symbol_section_and_value.
15070 * testsuite/many_sections_test.cc: New file.
15071 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15072 (check_PROGRAMS): Add many_sections_test.
15073 (many_sections_test_SOURCES): Define.
15074 (many_sections_test_DEPENDENCIES): Define.
15075 (many_sections_test_LDFLAGS): Define.
15076 (BUILT_SOURCES): Add many_sections_define.h.
15077 (many_sections_define.h): New target.
15078 (BUILT_SOURCES): Add many_sections_check.h.
15079 (many_sections_check.h): New target.
15080 (check_PROGRAMS): Add many_sections_r_test.
15081 (many_sections_r_test_SOURCES): Define.
15082 (many_sections_r_test_DEPENDENCIES): Define.
15083 (many_sections_r_test_LDFLAGS): Define.
15084 (many_sections_r_test_LDADD): Define.
15085 (many_sections_r_test.o): New target.
15086 * testsuite/Makefile.in: Rebuild.
15088 2008-04-17 Cary Coutant <ccoutant@google.com>
15090 * errors.cc (Errors::info): New function.
15091 (gold_info): New function.
15092 * errors.h (Errors::info): New function.
15093 * gold.h (gold_info): New function.
15094 * object.cc (Input_objects::add_object): Print trace output.
15095 * options.cc (options::parse_set): New function.
15096 (General_options::parse_wrap): Deleted.
15097 (General_options::General_options): Deleted initializer.
15098 * options.h (options::String_set): New typedef.
15099 (options::parse_set): New function.
15100 (DEFINE_set): New macro.
15101 (General_options::wrap): Changed to use DEFINE_set. Changed
15102 callers of any_wrap_symbols and is_wrap_symbol.
15103 (General_options::trace, General_options::trace_symbol):
15105 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15106 (General_options::wrap_symbols_): Deleted.
15107 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15109 2008-04-17 David S. Miller <davem@davemloft.net>
15111 * options.cc (General_options::parse_V): New function.
15112 * options.h: Add entries for -V and -Qy.
15114 2008-04-17 Ian Lance Taylor <iant@google.com>
15116 * common.cc (Symbol_table::allocate_commons): Remove options
15117 parameter. Change caller.
15118 (Symbol_table::do_allocate_commons): Remove options parameter.
15119 Change caller. Just call do_allocate_commons_list twice.
15120 (Symbol_table::do_allocate_commons_list): New function, broken out
15121 of do_allocate_commons.
15122 * common.h (class Allocate_commons_task): Remove options_ field.
15123 Update constructor.
15124 * symtab.cc (Symbol_table::Symbol_table): Initialize
15126 (Symbol_table::add_from_object): Put TLS common symbols on
15128 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15129 which are IN_OUTPUT_DATA.
15130 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15131 allocate_commons and do_allocate_commons declarations. Declare
15132 do_allocate_commons_list.
15133 * gold.cc (queue_middle_tasks): Update creation of
15134 Allocate_commons_task to not pass options.
15135 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15136 (TLS_TEST_C_FLAGS): New variable.
15137 (tls_test_c_pic.o): New target.
15138 (tls_test_shared.so): Link in tls_test_c_pic.o.
15139 (tls_test_c_pic_ie.o): New target.
15140 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15141 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15142 (tls_test_c.o): New target.
15143 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15144 (tls_pic_test_LDADD): Likewise.
15145 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15146 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15147 (tls_test_c_gnu2.o): New target.
15148 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15150 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15151 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15152 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15153 * testsuite/tls_test.cc: Include "config.h".
15154 (t_last): Call t11_last.
15155 * testsuite/tls_test.h (t11, t11_last): Declare.
15156 * testsuite/tls_test_c.c: New file.
15157 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15158 * configure.ac: Check for OpenMP support.
15159 * configure, config.in, Makefile.in: Rebuild.
15160 * testsuite/Makefile.in: Rebuild.
15162 2008-04-16 Cary Coutant <ccoutant@google.com>
15164 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15165 (Target_i386::tls_base_symbol_defined_): New field.
15166 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15167 (Target_i386::Scan::global): Likewise.
15168 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15169 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15170 (Target_x86_64::tls_base_symbol_defined_): New field.
15171 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15172 (Target_x86_64::Scan::global): Likewise.
15174 2008-04-16 Cary Coutant <ccoutant@google.com>
15176 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15177 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15178 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15179 building shared libraries.
15180 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15181 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15182 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15183 * testsuite/Makefile.in: Rebuild.
15184 * testsuite/weak_undef.h: New file.
15185 * testsuite/weak_undef_file1.cc: Add extra test cases.
15186 * testsuite/weak_undef_file2.cc: Likewise.
15187 * testsuite/weak_undef_test.cc: Likewise.
15189 2008-04-16 David S. Miller <davem@davemloft.net>
15191 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15192 Add issued_non_pic_error_ field. Declare check_non_pic.
15193 (Target_sparc::Scan::check_non_pic): New function.
15194 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15195 (Target_sparc::Scan::global): Likewise.
15197 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15198 * configure: Rebuild.
15200 * options.h (DEFINE_enable): New macro.
15201 (new_dtags): New enable option.
15202 (initfirst, interpose, loadfltr, nodefaultlib,
15203 nodelete, nodlopen, nodump): New -z options.
15204 * layout.cc (Layout:finish_dynamic_section): If new
15205 dtags enabled, emit DT_RUNPATH. Also, emit a
15206 DT_FLAGS_1 containing any specified -z flags.
15208 2008-04-16 Ian Lance Taylor <iant@google.com>
15210 * copy-relocs.cc: New file.
15211 * copy-relocs.h: New file.
15212 * reloc.cc: Remove Copy_relocs code.
15213 * reloc.h: Likewise.
15214 * reloc-types.h (struct Reloc_types) [both versions]: Add
15215 get_reloc_addend_noerror.
15216 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15217 variants of add_global which take an addend which must be zero.
15218 * i386.cc: Include "copy-relocs.h".
15219 (class Target_i386): Change type of copy_relocs_ to variable,
15220 update initializer.
15221 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15222 Change all callers.
15223 (Target_i386::do_finalize_sections): Change handling of
15225 * sparc.cc: Include "copy-relocs.h".
15226 (class Target_sparc): Change type of copy_relocs_ to variable,
15227 update initializer.
15228 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15229 Change all callers.
15230 (Target_sparc::do_finalize_sections): Change handling of
15232 * x86_64.cc: Include "copy-relocs.h".
15233 (class Target_x86_64): Change type of copy_relocs_ to variable,
15234 update initializer.
15235 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15236 class. Change all callers.
15237 (Target_x86_64::do_finalize_sections): Change handling of
15239 * Makefile.am (CCFILES): Add copy-relocs.cc.
15240 (HFILES): Add copy-relocs.h.
15242 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15244 * testsuite/script_test_4.sh: Permit leading zeroes.
15246 2008-04-15 Ian Lance Taylor <iant@google.com>
15248 * script-sections.cc (Script_sections::create_segments): Use
15249 header_size_adjustment even when there is enough room for the
15251 * testsuite/script_test_4.sh: New file.
15252 * testsuite/script_test_4.t: New file.
15253 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15254 (check_DATA): Add script_test_4.stdout.
15255 (MOSTLYCLEANFILES): Likewise.
15256 (script_test_4): New target.
15257 (script_test_4.stdout): New target.
15258 * testsuite/Makefile.in: Rebuild.
15260 * sparc.cc: Add definitions for Output_data_plt_sparc class
15263 2008-04-14 David S. Miller <davem@davemloft.net>
15265 * sparc.cc: New file.
15266 * Makefile.am (TARGETSOURCES): Add sparc.cc
15267 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15268 * configure.tgt: Document targ_extra_size and
15269 targ_extra_big_endian. Add entries for sparc-* and
15271 * configure.ac: Handle targ_extra_size and
15272 targ_extra_big_endian.
15273 * Makefile.in: Rebuild.
15274 * configure: Likewise.
15275 * po/POTFILES.in: Likewise.
15276 * po/gold.pot: Likewise.
15278 2008-04-14 Ian Lance Taylor <iant@google.com>
15280 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15281 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15282 in the name/type/flags to section mapping. Don't call
15283 allocate_output_section.
15284 (Layout::choose_output_section): Change parameter from adjust_name
15285 to is_input_section. Don't permit input sections after sections
15286 are attached to segments. Don't call allocate_output_section.
15287 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15288 not write_enable_output_section.
15289 (Layout::make_output_section): Don't push to
15290 unattached_section_list_ nor call attach_to_segment. Call
15291 attach_section_to_segment if sections are attached.
15292 (Layout::attach_sections_to_segments): New function.
15293 (Layout::attach_section_to_segment): New function.
15294 (Layout::attach_allocated_section_to_segment): Rename from
15295 attach_to_segment. Remove flags parameter.
15296 (Layout::allocate_output_section): Remove function.
15297 (Layout::write_enable_output_section): Remove function.
15298 * layout.h (class Layout): Update for above changes. Add new
15299 field sections_are_attached_.
15300 * output.h (Output_section::update_flags_for_input_section): New
15302 * output.cc (Output_section::add_input_section): Call
15303 update_flags_for_input_section.
15304 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15306 2008-04-11 Cary Coutant <ccoutant@google.com>
15308 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15309 thought unnecessary.
15310 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15312 2008-04-11 Ian Lance Taylor <iant@google.com>
15314 * output.h (class Output_section_data): Remove inline definition
15316 * output.cc (Output_section_data::set_addralign): New function.
15318 2008-04-11 Cary Coutant <ccoutant@google.com>
15320 Add support for TLS descriptors for i386 and x86_64.
15321 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15322 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15323 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15325 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15326 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15327 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15329 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15330 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15331 Fix problem with initial-exec relocations.
15332 (Target_i386::Relocate::relocate_tls): Likewise.
15333 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15335 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15336 support for section-plus-offset dynamic table entries.
15337 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15338 (Output_data_dynamic::Dynamic_entry): Add support for
15339 section-plus-offset dynamic table entries.
15340 (Output_data_dynamic::Classification): Likewise.
15341 (Output_data_dynamic::classification_): Renamed offset_.
15342 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15343 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15344 (Target_x86_64::make_plt_section): New function.
15345 (Target_x86_64::reserve_tlsdesc_entries): New function.
15346 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15347 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15348 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15349 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15350 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15351 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15352 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15353 add extra PLT entry for TLS descriptors.
15354 (Output_data_plt_x86_64::got_): New field.
15355 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15356 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15358 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15360 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15361 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15362 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15363 R_386_TLS_DESC_CALL relocations.
15364 (Target_x86_64::Scan::global): Likewise.
15365 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15366 for TLS descriptors.
15367 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15368 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15369 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15370 GD-to-IE relaxation.
15371 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15372 and TLS_DESCRIPTORS.
15373 * Makefile.in: Rebuild.
15374 * configure: Rebuild.
15375 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15376 (tls_test_shared2.so): New target.
15377 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15378 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15379 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15380 (tls_shared_gd_to_ie_test_LDADD): New variable.
15381 (tls_shared_gnu2_gd_to_ie_test): New target.
15382 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15384 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15385 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15386 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15387 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15388 (tls_shared_gnu2_test): New target.
15389 (tls_test_gnu2_shared.so): New target.
15390 (tls_shared_gnu2_test_SOURCES): New variable.
15391 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15392 (tls_shared_gnu2_test_LDFLAGS): New variable.
15393 (tls_shared_gnu2_test_LDADD): New variable.
15394 * testsuite/Makefile.in: Rebuild.
15395 * testsuite/Makefile.
15397 2008-04-11 Ian Lance Taylor <iant@google.com>
15399 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15401 * testsuite/Makefile.in: Rebuild.
15403 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15405 * testsuite/script_test_2.cc (main): Adjust test.
15407 2008-04-11 David S. Miller <davem@davemloft.net>
15408 Ian Lance Taylor <iant@google.com>
15410 * options.h (General_options): Add entries for '-Y' and
15412 * options.cc (General_options:finalize): If -Y was used, add those
15413 entries to the library path instead of the default "/lib" and
15416 2008-04-11 David S. Miller <davem@davemloft.net>
15418 * testsuite/justsyms.t: Start at 0x100.
15419 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15420 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15422 * testsuite/script_test_2.cc: Adjust string and section length
15425 2008-04-09 Ian Lance Taylor <iant@google.com>
15428 * script-sections.cc (Sections_element::allocate_to_segment): Add
15430 (Output_section_definition::allocate_to_segment): Likewise.
15431 (Orphan_output_section::allocate_to_segment): Likewise.
15432 (Script_sections::attach_sections_using_phdrs_clause): Don't
15433 propagate non-PT_LOAD segments to orphan sections.
15434 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15435 readelf rather than objdump.
15436 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15437 .interp section and PT_INTERP segment are the same size.
15438 * testsuite/Makefile.in: Rebuild.
15440 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15441 aliases for symbols defined in the same object.
15442 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15443 (weak_alias_test_SOURCES): New variable.
15444 (weak_alias_test_DEPENDENCIES): New variable.
15445 (weak_alias_test_LDFLAGS): New variable.
15446 (weak_alias_test_LDADD): New variable.
15447 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15448 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15449 (weak_alias_test_3.o): New target.
15450 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15451 * testsuite/weak_alias_test_main.cc: New file.
15452 * testsuite/weak_alias_test_1.cc: New file.
15453 * testsuite/weak_alias_test_2.cc: New file.
15454 * testsuite/weak_alias_test_3.cc: New file.
15456 2008-04-08 Ian Lance Taylor <iant@google.com>
15458 * options.h (class General_options): Add --noinhibit-exec option.
15459 * main.cc (main): Check --noinhibit-exec.
15461 * options.h (class General_options): Define --wrap as a special
15462 option. Add wrap_symbols_ field.
15463 (General_options::any_wrap_symbols): New function.
15464 (General_options::is_wrap_symbol): New function.
15465 * options.cc (General_options::parse_wrap): New function.
15466 (General_options::General_options): Initialize wrap_symbols_.
15467 * symtab.cc (Symbol_table::wrap_symbol): New function.
15468 (Symbol_table::add_from_object): Handle --wrap.
15469 * symtab.h (class Symbol_table): Declare wrap_symbol.
15470 * target.h (Target::wrap_char): New function.
15471 (Target::Target_info): Add wrap_char field.
15472 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15473 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15474 * testsuite/testfile.cc (Target_test::test_target_info):
15477 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15480 * layout.h (class Layout): Add added_eh_frame_data_ field.
15481 * layout.cc (Layout::Layout): Initialize new field.
15482 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15483 output section until we find a section we merged successfully.
15484 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15485 that the size be non-zero.
15487 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15490 2008-04-08 Craig Silverstein <csilvers@google.com>
15492 * configure.ac: Export new conditional variable HAVE_ZLIB.
15493 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15495 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15496 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15498 2008-04-07 Ian Lance Taylor <iant@google.com>
15500 * version.cc (version_string): Set to "1.5".
15502 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15503 Add issued_non_pic_error_ field. Declare check_non_pic.
15504 (Target_x86_64::Scan::check_non_pic): New function.
15505 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15506 (Target_x86_64::Scan::global): Likewise.
15508 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15509 addend parameter. Change caller. Handle merge sections.
15510 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15511 Address to Addend. Don't add in the result of
15512 local_section_offset, pass down the addend and use the returned
15514 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15515 Update declarations of local_section_offset and symbol_value.
15516 * testsuite/two_file_test_1.cc (t18): New function.
15517 * testsuite/two_file_test_2.cc (f18): New function.
15518 * testsuite/two_file_test_main.cc (main): Call t18.
15519 * testsuite/two_file_test.h (t18, f18): Declare.
15521 * configure.ac: Don't test for objdump, c++filt, or readelf.
15522 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15524 (TEST_READELF): New variable.
15525 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15526 (check_PROGRAMS): Add two_file_strip_test.
15527 (two_file_strip_test): New target.
15528 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15529 (two_file_same_shared_strip_test_SOURCES): New variable.
15530 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15531 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15532 (two_file_same_shared_strip_test_LDADD): New variable.
15533 (two_file_shared_strip.so): New target.
15534 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15535 (ver_test_5.syms, ver_test_7.syms): Likewise.
15536 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15537 (strip_test_3.stdout): Use TEST_OBJDUMP.
15538 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15540 2008-04-04 Cary Coutant <ccoutant@google.com>
15542 * symtab.h (Symbol::is_weak_undefined): New function.
15543 (Symbol::is_strong_undefined): New function.
15544 (Symbol::is_absolute): New function.
15545 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15546 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15548 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15549 (weak_undef_test): New target.
15550 * testsuite/Makefile.in: Rebuild.
15551 * testsuite/weak_undef_file1.cc: New file.
15552 * testsuite/weak_undef_file2.cc: New file.
15553 * testsuite/weak_undef_test.cc: New file.
15555 2008-04-03 Craig Silverstein <csilvers@google.com>
15557 * compressed_output.h (class Output_compressed_section): Use
15559 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15561 (zlib_compressed_suffix): Removed.
15562 (Output_compressed_section::set_final_data_size): Use unsigned
15564 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15565 Fix linker invocation.
15566 (flagstest_o_specialfile_and_compress_debug_sections):
15568 * testsuite/Makefile.in: Regenerated.
15570 2008-04-02 David S. Miller <davem@davemloft.net>
15572 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15573 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15575 2008-04-02 Craig Silverstein <csilvers@google.com>
15579 2008-04-02 Ian Lance Taylor <iant@google.com>
15581 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15582 parameters. Update for new key type to views_. Change all
15584 (File_read::read): Adjust for byteshift in returned view.
15585 (File_read::add_view): New function, broken out of
15586 find_and_make_view.
15587 (File_read::make_view): New function, broken out of
15588 find_and_make_view.
15589 (File_read::find_or_make_view): Add offset and aligned
15590 parameters. Rewrite accordingly. Change all callers.
15591 (File_read::get_view): Add offset and aligned parameters. Adjust
15592 for byteshift in return value.
15593 (File_read::get_lasting_view): Likewise.
15594 * fileread.h (class File_read): Update declarations.
15595 (class File_read::View): Add byteshift_ field. Add byteshift to
15596 constructor. Add byteshift method.
15597 * archive.h (Archive::clear_uncached_views): New function.
15598 (Archive::get_view): Add aligned parameter. Change all callers.
15599 * object.h (Object::get_view): Add aligned parameter. Change all
15601 (Object::get_lasting_view): Likewise.
15603 * fileread.cc (File_read::release): Don't call clear_views if
15604 there are multiple objects.
15605 * fileread.h (File_read::clear_uncached_views): New function.
15606 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15609 2008-03-31 Cary Coutant <ccoutant@google.com>
15611 Add thin archive support.
15612 * archive.cc (Archive::armagt): New const.
15613 (Archive::setup): Remove task parameter and calls to unlock.
15614 (Archive::unlock_nested_archives): New function.
15615 (Archive::read_header): Add nested_off parameter. Change
15617 (Archive::interpret_header): Likewise.
15618 (Archive::include_all_members): Change to handle thin
15620 (Archive::include_member): Likewise.
15621 * archive.h (Archive::Archive): Add new parameters and
15623 (Archive::armagt): New const.
15624 (Archive::setup): Remove task parameter.
15625 (Archive::unlock_nested_archives): New function.
15626 (Archive::read_header): Add nested_off parameter.
15627 (Archive::interpret_header): Likewise.
15628 (Archive::Nested_archive_table): New typedef.
15629 (Archive::is_thin_archive_): New field.
15630 (Archive::nested_archives_): New field.
15631 (Archive::options_): New field.
15632 (Archive::dirpath_): New field.
15633 (Archive::task_): New field.
15634 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15635 for thin archives. Pass additional parameters to
15636 Archive::Archive. Unlock the archive file after calling
15639 2008-03-29 Ian Lance Taylor <iant@google.com>
15641 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15642 version symbol to be local.
15643 * testsuite/ver_test_4.sh: New file.
15644 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15645 (check_DATA): Add ver_test_4.syms.
15646 (ver_test_4.syms): New target.
15647 * testsuite/Makefile.in: Rebuild.
15650 (Output_section::Input_section_sort_entry::has_priority): New
15652 (Output_section::Input_section_sort_entry::match_file_name): New
15654 (Output_section::Input_section_sort_entry::match_section_name):
15656 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15658 (Output_section::Input_section_sort_entry::match_section_file):
15660 (Output_section::Input_section_sort_compare::operator()): Rewrite
15661 using new Input_section_sort_entry functions. Sort crtbegin and
15662 crtend first. Sort sections with no priority before sections with
15664 * testsuite/initpri1.c (d3): Check j != 4.
15665 (cd5): New constructor/destructor function.
15666 (main): Check j != 2.
15668 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15669 new symbol when resolving, don't call set_is_default.
15670 * testsuite/ver_test_7.cc: New file.
15671 * testsuite/ver_test_7.sh: New file.
15672 * testsuite/Makefile.am (ver_test_7.so): New target.
15673 (ver_test_7.o): New target.
15674 (check_SCRIPTS): Add ver_test_7.sh.
15675 (check_DATA): Add ver_test_7.syms.
15676 (ver_test_7.syms): New target.
15678 2008-03-28 Ian Lance Taylor <iant@google.com>
15680 * layout.cc (Layout::layout): If we see an input section with a
15681 name that needs sorting, set the must_sort flag for the output
15683 (Layout::make_output_section): If the name of the output section
15684 indicates that it might require sorting, set the may_sort flag.
15685 * output.h (Output_section::may_sort_attached_input_sections): New
15687 (Output_section::set_may_sort_attached_input_sections): New
15689 (Output_section::must_sort_attached_input_sections): New
15691 (Output_section::set_must_sort_attached_input_sections): New
15693 (class Output_section): Declare Input_section_sort_entry. Define
15694 Input_section_sort_compare. Declare
15695 sort_attached_input_sections. Add new fields:
15696 may_sort_attached_input_sections_,
15697 must_sort_attached_input_sections_,
15698 attached_input_sections_are_sorted_.
15699 * output.cc (Output_section::Output_section): Initialize new
15701 (Output_section::add_input_section): Add an entry to
15702 input_sections_ if may_sort or must_sort are true.
15703 (Output_section::set_final_data_size): Call
15704 sort_attached_input_sections if necessary.
15705 (Output_section::Input_section_sort_entry): Define new class.
15706 (Output_section::Input_section_sort_compare::operator()): New
15708 (Output_section::sort_attached_input_sections): New function.
15709 * configure.ac: Check whether the compiler supports constructor
15710 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15711 * testsuite/initpri1.c: New file.
15712 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15713 CONSTRUCTOR_PRIORITY.
15714 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15715 (initpri1_LDFLAGS): New variable.
15716 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15718 2008-03-27 Ian Lance Taylor <iant@google.com>
15720 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15721 * testsuite/common_test_1.c: New file.
15722 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15723 (common_test_1_SOURCES): New variable.
15724 (common_test_1_DEPENDENCIES): New variable.
15725 (common_test_1_LDFLAGS): New variable.
15727 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15728 and commons_ correctly when NAME/VERSION does not override
15730 * testsuite/ver_test_6.c: New file.
15731 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15732 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15733 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15735 2008-03-26 Ian Lance Taylor <iant@google.com>
15737 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15738 of an undefined symbol from a version script.
15739 * testsuite/Makefile.am (ver_test_5.so): New target.
15740 (ver_test_5.o): New target.
15741 (check_SCRIPTS): Add ver_test_5.sh.
15742 (check_DATA): Add ver_test_5.syms.
15743 (ver_test_5.syms): New target.
15744 * testsuite/ver_test_5.cc: New file.
15745 * testsuite/ver_test_5.script: New file.
15746 * testsuite/ver_test_5.sh: New file.
15747 * Makefile.in, testsuite/Makefile.in: Rebuild.
15750 Fix problems building gold with gcc 4.3.0.
15751 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15752 (gold_error_at_location, gold_warning_at_location): Use it.
15753 * configure.ac: Check whether we can compile and use a template
15754 function with a printf attribute.
15755 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15756 when jumping over bytes.
15757 * object.cc: Instantiate Object::read_section_data.
15758 * debug.h: Include <cstring>
15759 * dwarf_reader.cc: Include <algorithm>
15760 * main.cc: Include <cstring>.
15761 * options.cc: Include <cstring>.
15762 * output.cc: Include <cstring>.
15763 * script.cc: Include <cstring>.
15764 * script.h: Include <string>.
15765 * symtab.cc: Include <cstring> and <algorithm>.
15766 * target-select.cc: Include <cstring>.
15767 * version.cc: Include <string>.
15768 * testsuite/testmain.cc: Include <cstdlib>.
15769 * configure, config.in: Rebuild.
15771 2008-03-25 Ian Lance Taylor <iant@google.com>
15773 * options.cc: Include "../bfd/bfdver.h".
15774 (options::help): Print bug reporting address.
15776 * version.cc (print_version): Adjust output for current value of
15777 BFD_VERSION_STRING.
15781 * options.cc (options::help): Print list of supported targets.
15782 * target-select.h: Include <vector>.
15783 (class Target_selector): Make machine_, size_, and is_big_endian_
15784 fields const. Add bfd_name_ and instantiated_target_ fields.
15785 (Target_selector::Target_selector): Add bfd_name parameter.
15786 (Target_selector::recognize): Make non-virtual, call
15788 (Target_selector::recognize_by_name): Make non-virtual, call
15789 do_recognize_by_name.
15790 (Target_selector::supported_names): New function.
15791 (Target_selector::bfd_name): New function.
15792 (Target_selector::do_instantiate_target): New pure virtual
15794 (Target_selector::do_recognize): New virtual function.
15795 (Target_selector::do_recognize_by_name): New virtual function.
15796 (Target_selector::instantiate_target): New private function.
15797 (supported_target_names): Declare.
15798 * target-select.cc (Target_selector::Target_selector): Update for
15799 new parameter and fields.
15800 (select_target_by_name): Check that the name matches before
15801 calling recognize_by_name.
15802 (supported_target_names): New function.
15803 * i386.cc (class Target_selector_i386): Update Target_selector
15804 constructor call. Remove recognize and recognize_by_name. Add
15805 do_instantiate_target.
15806 * x86_64.cc (class Target_selector_x86_64): Likewise.
15807 * testsuite/testfile.cc (class Target_selector_test): Update for
15808 changes to Target_selector.
15810 * README: Rewrite, with some notes on unsupported features.
15812 2008-03-24 Cary Coutant <ccoutant@google.com>
15814 * i386.cc (Target_i386::Got_type): New enum declaration.
15815 (Target_i386::Scan::local): Updated callers of Output_data_got
15817 (Target_i386::Scan::global): Likewise.
15818 (Target_i386::Relocate::relocate): Likewise.
15819 (Target_i386::Relocate::relocate_tls): Likewise.
15820 * object.h (Got_offset_list): New class.
15821 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15822 (Sized_relobj::local_got_offset): Likewise.
15823 (Sized_relobj::set_local_got_offset): Likewise.
15824 (Sized_relobj::local_has_tls_got_offset): Removed.
15825 (Sized_relobj::local_tls_got_offset): Removed.
15826 (Sized_relobj::set_local_tls_got_offset): Removed.
15827 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15828 * output.cc (Output_data_got::add_global): Added got_type parameter.
15829 (Output_data_got::add_global_with_rel): Likewise.
15830 (Output_data_got::add_global_with_rela): Likewise.
15831 (Output_data_got::add_global_pair_with_rel): New function.
15832 (Output_data_got::add_global_pair_with_rela): New function.
15833 (Output_data_got::add_local): Added got_type parameter.
15834 (Output_data_got::add_local_with_rel): Likewise.
15835 (Output_data_got::add_local_with_rela): Likewise.
15836 (Output_data_got::add_local_pair_with_rel): New function.
15837 (Output_data_got::add_local_pair_with_rela): New function.
15838 (Output_data_got::add_global_tls): Removed.
15839 (Output_data_got::add_global_tls_with_rel): Removed.
15840 (Output_data_got::add_global_tls_with_rela): Removed.
15841 (Output_data_got::add_local_tls): Removed.
15842 (Output_data_got::add_local_tls_with_rel): Removed.
15843 (Output_data_got::add_local_tls_with_rela): Removed.
15844 * output.h (Output_data_got::add_global): Added got_type parameter.
15845 (Output_data_got::add_global_with_rel): Likewise.
15846 (Output_data_got::add_global_with_rela): Likewise.
15847 (Output_data_got::add_global_pair_with_rel): New function.
15848 (Output_data_got::add_global_pair_with_rela): New function.
15849 (Output_data_got::add_local): Added got_type parameter.
15850 (Output_data_got::add_local_with_rel): Likewise.
15851 (Output_data_got::add_local_with_rela): Likewise.
15852 (Output_data_got::add_local_pair_with_rel): New function.
15853 (Output_data_got::add_local_pair_with_rela): New function.
15854 (Output_data_got::add_global_tls): Removed.
15855 (Output_data_got::add_global_tls_with_rel): Removed.
15856 (Output_data_got::add_global_tls_with_rela): Removed.
15857 (Output_data_got::add_local_tls): Removed.
15858 (Output_data_got::add_local_tls_with_rel): Removed.
15859 (Output_data_got::add_local_tls_with_rela): Removed.
15860 * resolve.cc (Symbol::override_base_with_special): Removed
15861 reference to has_got_offset_ field.
15862 * symtab.cc (Symbol::init_fields): Replaced initialization
15863 of got_offset_ with got_offsets_. Removed initialization
15865 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15866 (Symbol::got_offset): Likewise.
15867 (Symbol::set_got_offset): Likewise.
15868 (Symbol::has_tls_got_offset): Removed.
15869 (Symbol::tls_got_offset): Removed.
15870 (Symbol::set_tls_got_offset): Removed.
15871 (Symbol::got_offset_): Removed.
15872 (Symbol::tls_mod_got_offset_): Removed.
15873 (Symbol::tls_pair_got_offset_): Removed.
15874 (Symbol::got_offsets_): New field.
15875 (Symbol::has_got_offset): Removed.
15876 (Symbol::has_tls_mod_got_offset): Removed.
15877 (Symbol::has_tls_pair_got_offset): Removed.
15878 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15879 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15881 (Target_x86_64::Scan::global): Likewise.
15882 (Target_x86_64::Relocate::relocate): Likewise.
15883 (Target_x86_64::Relocate::relocate_tls): Likewise.
15885 2008-03-25 Ben Elliston <bje@au.ibm.com>
15887 * yyscript.y: Fix spelling error in comment.
15889 2008-03-24 Ian Lance Taylor <iant@google.com>
15891 * options.h (class General_options): Define build_id option.
15892 * layout.h (class Layout): Declare write_build_id, create_note,
15893 create_build_id. Add build_id_note_ member.
15894 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15895 "libiberty.h", "md5.h", "sha1.h".
15896 (Layout::Layout): Initialize eh_frame_data_,
15897 eh_frame_hdr_section_, and build_id_note_.
15898 (Layout::finalize): Call create_build_id.
15899 (Layout::create_note): New function, broken out of
15900 Layout::create_gold_note.
15901 (Layout::create_gold_note): Call create_note.
15902 (Layout::create_build_id): New function.
15903 (Layout::write_build_id): New function.
15904 (Close_task_runner::run): Call write_build_id.
15906 * x86_64.cc: Correct license to GPLv3.
15908 2008-03-23 Ian Lance Taylor <iant@google.com>
15910 * options.cc: Include "demangle.h".
15911 (parse_optional_string): New function.
15912 (parse_long_option): Handle takes_optional_argument.
15913 (parse_short_option): Update dash_z initializer. Handle
15914 takes_optional_argument.
15915 (General_options::General_options): Initialize do_demangle_.
15916 (General_options::finalize): Set do_demangle_. Handle demangling
15918 * options.h (parse_optional_string): Declare.
15919 (struct One_option): Add optional_arg field. Update constructor.
15920 Update call constructor calls. Add takes_optional_argument
15922 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15923 (DEFINE_optional_string): Define.
15924 (General_options::demangle): Change from DEFINE_bool to
15925 DEFINE_optional_string.
15926 (General_options::no_demangle): New function.
15927 (General_options::do_demangle): New function.
15928 (General_options::set_do_demangle): New function.
15929 (General_options::execstack_status_): Move definition to end of
15931 (General_options::static_): Likewise.
15932 (General_options::do_demangle_): New field.
15933 * object.cc (big_endian>::get_symbol_location_info): Call
15934 Options::do_demangle, not Options::demangle.
15935 * symtab.cc (demangle): Likewise.
15937 2008-03-22 Ian Lance Taylor <iant@google.com>
15939 * gold.h: Include <cstddef> and <sys/types.h>
15940 * options.h: Include <cstring>.
15942 2008-03-21 Ian Lance Taylor <iant@google.com>
15944 * Added source code to GNU binutils.
15946 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15948 Copying and distribution of this file, with or without modification,
15949 are permitted in any medium without royalty provided the copyright
15950 notice and this notice are preserved.
15956 version-control: never