1 2014-08-13 Sriraman Tallam <tmsriram@google.com>
3 * options.h (-no-pie): Add option.
5 2014-08-08 Jing Yu <jingyu@google.com>
6 Han Shen <shenhan@google.com>
8 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
9 (DEFFILES): add aarch64-reloc.def.
10 (TARGETSOURCES): Add aarch64-reloc-property.cc.
11 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
12 * Makefile.in: Regenerate.
13 * aarch64-reloc-property.cc: New file.
14 * aarch64-reloc-property.h: New file.
15 * aarch64-reloc.def: New file.
16 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
17 with tab to make the format consistent.
18 (Output_data_got_aarch64::symbol_table_): New method.
19 (Target_aarch64::do_plt_address_for_global): New method.
20 (Target_aarch64::do_plt_address_for_local): New method.
21 (Target_aarch64::do_select_as_default_target): New method.
22 (Target_aarch64::do_make_data_plt): New method.
23 (Target_aarch64::make_data_plt): New method.
24 (Output_data_plt_aarch64::has_irelative_section): New method.
25 (Output_data_plt_aarch64::address_for_global): New method.
26 (Output_data_plt_aarch64::address_for_local): New method.
27 (Output_data_plt_aarch64::irelative_rel_): New parameter.
28 (Output_data_plt_aarch64::add_entry): Implement contents.
29 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
30 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
31 the got_pov entry to plt0.
32 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
34 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
35 (AArch64_howto): New struct.
36 (aarch64_howto[]): New static const array.
37 (AArch64_relocate_functions): New class.
38 (Target_aarch64::Scan::get_reference_flags): Remove method.
39 (Target_aarch64::Scan::local): Implement to support a few relocations.
40 (Target_aarch64::Scan::global): Implement to support a few relocations.
41 (Target_aarch64::make_plt_section): Implement contents.
42 (Target_aarch64::make_plt_entry): Implement contents.
43 (Target_aarch64::do_finalize_sections): Implement contents.
44 (Target_aarch64::Relocate::relocate): Implement a few relocations.
45 (Target_aarch64::relocate_section): Implement contents.
47 2014-08-06 Alan Modra <amodra@gmail.com>
49 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
51 2014-08-06 Alan Modra <amodra@gmail.com>
54 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
56 2014-07-21 Sriraman Tallam <tmsriram@google.com>
58 * object.cc (Relobj::is_section_name_included): Add
59 ".rodata.nptl_version" to not garbage collect this section.
61 2014-07-08 Cary Coutant <ccoutant@google.com>
63 * expression.cc (struct Expression::Expression_eval_info): Add
64 new fields type_pointer, vis_pointer, and nonvis_pointer.
65 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
66 nonvis_pointer parameters. Adjust all calls.
67 (Symbol_expression::value): Update type, visibility, and nonvis bits
69 * script.cc (Symbol_assignment::sized_finalize): Update type,
70 visibility, and remaining st_other bits for new symbol.
71 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
72 vis_pointer, and nonvis_pointer parameters.
73 * symtab.h (Symbol::set_type): New method.
75 * testsuite/Makefile.am (defsym_test): New test.
76 * testsuite/Makefile.in: Regenerate.
77 * testsuite/defsym_test.c: New file.
78 * testsuite/defsym_test.sh: New file.
80 2014-07-08 Cary Coutant <ccoutant@google.com>
83 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
84 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
85 (Sized_dynobj::base_read_symbols): ...new method.
86 * object.h (Sized_relobj_file::base_read_symbols): New method.
87 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
88 (Sized_relobj_file::base_read_symbols): ...new method.
89 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
90 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
91 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
93 2014-07-04 Alan Modra <amodra@gmail.com>
95 * po/POTFILES.in: Regenerate.
97 2014-07-02 Jing Yu <jingyu@google.com>
99 * aarch64.cc: New file
100 * Makefile.am (TARGETSOURCES): Add aarch64.cc
101 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
102 * Makefile.in: Regenerate.
103 * configure.tgt: Add entries for aarch64*.
104 * configure.ac: Likewise.
105 * configure: Likewise.
107 2014-06-27 Alan Modra <amodra@gmail.com>
109 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
111 2014-06-24 Cary Coutant <ccoutant@google.com>
113 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
115 (Dwo_file::sized_read_unit_index): Likewise.
117 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
120 * Makefile.am (TARGETSOURCES): Add mips.cc
121 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
122 * configure.tgt: Add entries for mips*.
123 * configure.ac: Likewise.
124 * Makefile.in: Regenerate.
125 * configure: Likewise.
127 2014-06-09 Cary Coutant <ccoutant@google.com>
129 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
130 unit_length is within section bounds.
132 2014-06-09 Cary Coutant <ccoutant@google.com>
135 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
138 2014-06-07 Alan Modra <amodra@gmail.com>
140 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
142 2014-06-06 Cary Coutant <ccoutant@google.com>
144 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
145 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
146 (Dwarf_pubnames_table::read_header): Likewise.
147 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
150 2014-06-05 Joel Brobecker <brobecker@adacore.com>
152 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
153 * Makefile.in, configure: Regenerate.
155 2014-06-03 Alan Modra <amodra@gmail.com>
157 * powerpc.cc (addis_12_2): Define.
158 (Stub_table::do_write): Support fusion on ELFv2 stubs.
160 2014-06-03 Alan Modra <amodra@gmail.com>
162 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
165 2014-06-02 Alan Modra <amodra@gmail.com>
167 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
168 Only ignore relocs on ELFv1.
169 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
171 2014-05-30 Cary Coutant <ccoutant@google.com>
173 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
174 * testsuite/Makefile.in: Regenerate.
175 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
177 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
180 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
181 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
183 2014-05-15 Alan Modra <amodra@gmail.com>
185 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
186 Compare FDE contents with DW_CFA_nop rather than 0.
188 2014-05-13 Sriraman Tallam <tmsriram@google.com>
190 * symtab.h (may_need_copy_reloc): Remove check for position independent
192 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
193 position independence before pc absolute may_need_copy_reloc call.
194 Add check for executable output befor pc relative may_need_copy_reloc
200 * powerpc.cc: Add check for no position independence before
201 may_need_copy_reloc calls.
202 * testsuite/pie_copyrelocs_test.cc: New file.
203 * testsuite/pie_copyrelocs_shared_test.cc: New file.
204 * Makefile.am (pie_copyrelocs_test): New test.
205 * Makefile.in: Regenerate.
207 2014-05-08 Martin Liška <mliska@suse.cz>
209 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
211 2014-05-06 Cary Coutant <ccoutant@google.com>
214 * i386.cc (Output_data_got_plt_i386): New class.
215 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
216 parameter. Change all callers.
217 (Output_data_plt_i386::layout_): Remove.
218 (Output_data_plt_i386::got_plt_): Change type.
219 (Target_i386::got_plt_): Change type. Change all references.
220 (Target_i386::got_section): Create instance of new class.
221 (Output_data_got_plt_i386::do_write): New function.
222 * x86_64.cc (Output_data_got_plt_x86_64): New class.
223 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
224 parameter. Change all callers.
225 (Output_data_plt_x86_64::layout_): Remove.
226 (Output_data_plt_x86_64::got_plt_): Change type.
227 (Target_x86_64::got_plt_): Change type. Change all references.
228 (Target_x86_64::got_section): Create instance of new class.
229 (Output_data_got_plt_x86_64::do_write): New function.
230 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
231 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
234 2014-05-05 Cary Coutant <ccoutant@google.com>
236 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
237 if we have pubnames/pubtypes.
239 2014-05-02 Cary Coutant <ccoutant@google.com>
241 * defstd.cc (in_segment): Define __ehdr_start here...
242 * layout.cc (Layout::finalize): ...Instead of here. Set the
243 output segment when known.
244 * resolve.cc (Symbol::override_base_with_special): Remember
245 the original binding.
246 * symtab.cc (Symbol::set_output_segment): New function.
247 (Symbol::set_undefined): New function.
248 * symtab.h (Symbol::is_weak_undefined): Check original undef
250 (Symbol::is_strong_undefined): New function.
251 (Symbol::set_output_segment): New function.
252 (Symbol::set_undefined): New function.
253 * target-reloc.h (is_strong_undefined): Remove.
254 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
255 Check for hidden undefs.
256 (relocate_section): Call Symbol::is_strong_undefined.
258 * testsuite/Makefile.am (ehdr_start_test_1)
259 (ehdr_start_test_2, ehdr_start_test_3)
260 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
261 * testsuite/Makefile.in: Regenerate.
262 * testsuite/ehdr_start_def.cc: New source file.
263 * testsuite/ehdr_start_test.cc: New source file.
264 * testsuite/ehdr_start_test.t: New linker script.
265 * testsuite/ehdr_start_test_4.sh: New shell script.
267 2014-04-23 Cary Coutant <ccoutant@google.com>
270 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
272 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
274 * layout.cc (Layout::include_section): Allow a target to decide
275 whether to include a section.
276 * target.h (Target::should_include_section): New function.
277 (Target::do_should_include_section): New function.
279 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
281 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
283 (Copy_relocs::emit): ... here.
284 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
285 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
286 (Copy_reloc_entry::entries_): Change from private to protected.
288 2014-04-02 Sriraman Tallam <tmsriram@google.com>
290 * icf.cc (get_section_contents): Replace copies of reloc
291 vectors with const references.
293 2014-04-02 Cary Coutant <ccoutant@google.com>
295 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
296 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
297 * configure: Regenerate.
298 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
299 -fno-use-linker-plugin.
300 (LINK1, CXXLINK1): Add it to the link command.
301 * testsuite/Makefile.in: Regenerate.
303 2014-03-12 Alan Modra <amodra@gmail.com>
305 * Makefile.in: Regenerate.
307 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
309 * symtab.h (Symbol::set_nonvis): New function.
311 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
313 * symtab.cc (Sized_symbol<32>::init_output_data):
314 Instantiate the template.
315 (Sized_symbol<64>::init_output_data): Likewise.
317 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
319 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
320 adjust dynamic symbol value.
321 * target.h (Target::adjust_dyn_symbol): New function.
322 (Target::do_adjust_dyn_symbol): New function.
324 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
326 * output.cc (Output_data_dynamic::Dynamic_entry::write):
327 Get the value of DYNAMIC_CUSTOM dynamic entry.
328 * output.h (Output_data_dynamic::add_custom): New function.
329 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
331 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
332 * target.h (Target::dynamic_tag_custom_value): New function.
333 (Target::do_dynamic_tag_custom_value): New function.
335 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
337 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
339 * target.h (Target::has_custom_set_dynsym_indexes): New function.
340 (Target::do_has_custom_set_dynsym_indexes): New function.
341 (Target::set_dynsym_indexes): New function.
342 (Target::do_set_dynsym_indexes): New function.
344 2014-03-07 Alan Modra <amodra@gmail.com>
346 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
347 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
348 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
349 (Powerpc_relocate_functions::has_overflow_bitfield,
350 overflowed): Use the above.
351 (Target_powerpc::Relocate::relocate): Correct overflow checking
352 for a number of relocations. Modify overflow test for 16-bit
353 fields in instructions to signed/unsigned according to whether
354 the field takes a signed or unsigned value.
356 2014-03-05 Alan Modra <amodra@gmail.com>
358 Update copyright years.
360 2014-03-05 Alan Modra <amodra@gmail.com>
362 * powerpc.cc (Target_powerpc::Scan::local, global): Support
363 R_PPC64_ADDR64_LOCAL.
364 (Target_powerpc::Relocate::relocate): Likewise.
366 2014-03-03 Alan Modra <amodra@gmail.com>
368 * dwp.cc (print_version): Update copyright year to current.
370 2014-02-10 Alan Modra <amodra@gmail.com>
372 * po/gold.pot: Regenerate.
374 2014-02-06 Cary Coutant <ccoutant@google.com>
376 Fix problem where -u is ignored when a weak undef is seen.
378 * archive.cc (Library_base::should_include_member): Reorder
379 code to check for -u option if a weak undef has already been seen.
380 * testsuite/Makefile.am (weak_undef_test_2): New test case.
381 * testsuite/Makefile.in: Regenerate.
382 * testsuite/weak_undef_file3.cc: New file.
383 * testsuite/weak_undef_file4.cc: New file.
384 * testsuite/weak_undef_test_2.cc: New file.
386 2014-02-05 Cary Coutant <ccoutant@google.com>
388 Fix issues with gold undefined symbol diagnostics.
391 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
393 * target-reloc.h (is_strong_undefined): New function.
394 (relocate_section): Move undef vtable symbol check from here.
395 Check for is_strong_undefined.
397 2014-02-05 Cary Coutant <ccoutant@google.com>
399 Fix problems with the --dynamic-list option.
402 * options.cc (General_options::parse_dynamic_list):
403 Set have_dynamic_list_.
404 (General_options::General_options): Initialize have_dynamic_list_.
405 (General_options::finalize): Turn off -Bsymbolic and
406 -Bsymbolic-functions if --dynamic-list provided.
407 * options.h (General_options::have_dynamic_list): New function.
408 (General_options::have_dynamic_list_): New data member.
409 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
413 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
414 in --dynamic-list, mark it.
416 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
417 (dynamic_list_2): New test case.
418 * testsuite/Makefile.in: Regenerate.
419 * testsuite/dynamic_list_2.cc: New file.
420 * testsuite/dynamic_list_2.t: New file.
421 * testsuite/dynamic_list_lib1.cc: New file.
422 * testsuite/dynamic_list_lib2.cc: New file.
423 * testsuite/gc_dynamic_list_test.c: New file.
424 * testsuite/gc_dynamic_list_test.sh: New file.
425 * testsuite/gc_dynamic_list_test.t: New file.
427 2014-01-28 Cary Coutant <ccoutant@google.com>
429 Add .gdb_index version 7 support.
431 * gold/dwarf_reader.cc: include <utility> (for make_pair).
432 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
434 (Dwarf_ranges_table::read_ranges_table): Likewise.
435 (Dwarf_pubnames_table::read_section): Check for GNU-style
436 sections, and for compressed debug sections.
437 (Dwarf_pubnames_table::read_header): Compute end address of table.
438 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
439 for end of list by offset, not by offset == 0.
440 (Dwarf_info_reader::do_read_string_table): Check for compressed
442 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
443 Initialize new data members.
444 (Dwarf_pubnames_table::next_name): return flag_byte.
445 (Dwarf_pubnames_table::end_of_table_): New data member.
446 (Dwarf_pubnames_table::is_gnu_style_): New data member.
447 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
448 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
449 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
450 read skeleton type unit DIEs.
451 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
452 (Gdb_index::do_write): Write flag_byte.
453 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
454 (Gdb_index::Cu_vector): Store flags along with cu indexes.
455 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
456 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
458 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
460 * version.cc (print_version): Update copyright year to 2014.
462 2013-12-19 Dimitry Andric <dimitry@andric.com>
464 * stringpool.cc (Stringpool_template::reserve): Add
465 HAVE_UNORDERED_MAP case.
466 * stringpool.cc (Stringpool_template::print_stats): Likewise.
468 2013-12-18 Cary Coutant <ccoutant@google.com>
470 * configure.ac: Check for <unordered_set> and <unordered_map>.
471 * config.in: Regenerate.
472 * configure: Regenerate.
473 * system.h: Use <unordered_set> and <unordered_map> if available.
475 2013-12-10 Roland McGrath <mcgrathr@google.com>
477 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
478 with $(INSTALL_PROGRAM_ENV).
479 * Makefile.in: Regenerate.
481 2013-11-22 Cary Coutant <ccoutant@google.com>
483 * configure.ac: Add check for which library is needed for
485 * configure: Regenerate.
487 2013-11-22 Cary Coutant <ccoutant@google.com>
489 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
491 * testsuite/Makefile.in: Regenerate.
493 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
495 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
496 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
497 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
498 (Target_x86_64<size>::Scan::local): Likewise.
499 (Target_x86_64<size>::Scan::global): Likewise.
500 (Target_x86_64<size>::Relocate::relocate): Likewise.
501 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
503 (Target_x86_64<size>::Scan::check_non_pic(): Handle
506 * testsuite/Makefile.am (check_PROGRAMS): Add
507 exception_x86_64_bnd_test.
508 (exception_x86_64_bnd_test_SOURCES): New macro.
509 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
510 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
511 (exception_x86_64_bnd_test_LDADD): Likewise.
512 (exception_x86_64_bnd_1.o): New rule.
513 (exception_x86_64_bnd_2.o): Likewise.
514 * testsuite/Makefile.in: Regenerated.
516 2013-11-15 Alan Modra <amodra@gmail.com>
518 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
520 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
521 Only call ppc64_local_entry_offset for 64-bit. Restrict
522 symval_for_branch lookup to ELFv1.
523 (Stub_table::add_plt_call_entry): Use unsigned int off.
524 (Output_data_glink::Address, invalid_address): New.
525 (Output_data_glink::add_eh_frame): Move out of line. Add
527 (Output_data_glink::add_global_entry, find_global_entry,
528 global_entry_address): New functions.
529 (Output_data_glink::global_entry_stubs_, end_branch_table_,
530 ge_size): New variables.
531 (Output_data_glink::set_final_data_size): Add global entry
533 (Output_data_glink::do_write): Write global entry stubs.
534 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
535 parameter. Return true for ELFv2. Adjust callers.
536 (Target_powerpc::Scan::local, global): Restrict opd lookup to
537 ELFv1. Similarly for ifunc and dynamic relocation processing
538 specific to ELFv1. Recognize that symbols are defined on
539 their plt entries for ELFv2.
540 (Target_powerpc::symval_for_branch): Assert if called for
542 (Target_powerpc::Relocate::relocate): Use global entry plt
543 stub for symbol value if such exists on ELFv2.
544 (Target_powerpc::Relocate::relocate): Don't call
545 symval_for_branch when ELFv2. Do adjust for local entry
547 (Target_powerpc::do_dynsym_value): Set symbols to global entry
549 (Target_powerpc::do_plt_address_for_global): Similarly.
551 2013-11-14 Cary Coutant <ccoutant@google.com>
553 Revert patch -- this did not fix the problem, and there is
556 2013-11-14 Cary Coutant <ccoutant@google.com>
559 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
560 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
561 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
562 updating fde_offsets_.
563 (Eh_frame_hdr::lock_): New data member.
565 2013-11-14 Cary Coutant <ccoutant@google.com>
567 * dwp.cc (Dwo_file_entry): New type.
568 (File_list): Use Dwo_file_entry.
569 (Dwo_file::verify): New function.
570 (Dwo_file::verify_dwo_list): New function.
571 (Dwo_file::sized_verify_dwo_list): New function.
572 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
574 (Dwp_options): New enum type.
575 (dwp_options): Add --verify-only.
578 * dwp.h (gold_info): Add declaration.
580 2013-11-14 Cary Coutant <ccoutant@google.com>
583 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
584 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
585 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
586 updating fde_offsets_.
587 (Eh_frame_hdr::lock_): New data member.
589 2013-11-06 Cary Coutant <ccoutant@google.com>
592 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
593 before reloc sections.
595 2013-11-04 Alan Modra <amodra@gmail.com>
597 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
598 (Symbol::needs_dynamic_reloc): Test new flag.
599 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
600 (Target_powerpc::Scan::get_reference_flags): Add target param.
601 Return FUNC_DESC_ABI for 64-bit ELFv1.
602 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
604 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
605 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
607 2013-10-31 Cary Coutant <ccoutant@google.com>
609 Restore support for dwp v2 DWARF package file format.
611 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
612 tu_length parameter. Adjust all callers.
613 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
614 * dwp.cc: Include dwarf.h.
615 (Section_bounds): New struct type.
616 (Unit_set): New struct type.
617 (Dwo_file::Dwo_file): Initialize new data member.
618 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
619 Combine and rename to...
620 (Dwo_file::read_unit_index): ...this.
621 (Dwo_file::sized_read_compunit_index)
622 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
623 (Dwo_file::sized_read_unit_index): ...this.
624 (Dwo_file::copy_section): Remove section_name, is_str_offsets
625 parameters; add section_id parameter.
626 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
627 (Dwo_file::add_unit_set): ...this.
628 (Dwo_file::shndx_map_): Remove.
629 (Dwo_file::sect_offsets_): New data member.
630 (Dwp_output_file::Dwp_output_file): Initialize new data members.
631 (Dwp_output_file::add_section): Rename to...
632 (Dwp_output_file::add_contribution): ...this.
633 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
634 (Dwp_output_file::add_tu_set): Likewise.
635 (Dwp_output_file::Contribution): New type.
636 (Dwp_output_file::Section::contributions): New data member.
637 (Dwp_output_file::Cu_or_tu_set): Remove.
638 (Dwp_output_file::Section::Section): New ctor.
639 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
640 (Dwp_output_file::Dwp_index::Section_table): New type.
641 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
642 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
644 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
645 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
646 (Dwp_output_file::Dwp_index::section_table): New member function.
647 (Dwp_output_file::Dwp_index::section_table_end): New member function.
648 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
649 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
650 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
651 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
652 (Dwp_output_file::Dwp_index::section_table_): New data member.
653 (Dwp_output_file::Dwp_index::section_mask_): New data member.
654 (Dwp_output_file::add_output_section): New member function.
655 (Dwp_output_file::write_new_section): New member function.
656 (Dwp_output_file::write_contributions): New member function.
657 (Dwp_output_file::section_id_map_): New data member.
658 (class Dwo_id_info_reader): Remove.
659 (class Unit_reader): New class.
660 (get_dwarf_section_name): New function.
661 (Dwo_file::read_executable): Adjust initializations of class data.
662 (Dwo_file::read): Add support for v2 package file format.
663 (Dwo_file::read_unit_index): Likewise.
664 (Dwo_file::sized_read_unit_index): Likewise.
665 (Dwo_file::copy_section): Likewise.
666 (Dwo_file::add_unit_set): Likewise.
667 (Dwp_output_file::add_output_section): Likewise.
668 (Dwp_output_file::add_contribution): Likewise.
669 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
671 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
673 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
675 (Dwp_output_file::initialize): Remove unused function.
676 (Dwp_output_file::finalize): Add support for v2 package file format.
677 (Dwp_output_file::write_index): Likewise.
678 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
681 2013-10-31 Cary Coutant <ccoutant@google.com>
683 * configure.ac: Fix check for -fmerge-constants.
684 * configure.ac: Regenerate.
686 2013-10-30 Roland McGrath <mcgrathr@google.com>
688 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
689 Correct 9-byte nop sequence to match what the assembler generates.
691 2013-10-30 Alan Modra <amodra@gmail.com>
693 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
694 ppc64_local_entry_offset, ppc64_local_entry_offset,
695 do_read_symbols): New functions.
696 (Powerpc_relobj::e_flags_, st_other_): New vars.
697 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
698 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
699 (Powerpc_relobj::e_flags_): New var.
700 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
701 and adjust for ELFv2.
702 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
703 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
704 (Powerpc_dynobj::do_find_special_sections): Likewise.
705 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
706 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
707 to ELFv2 local entry.
708 (Target_powerpc::do_relax): No thread safe barriers needed for
710 (Output_data_plt_powerpc::initial_plt_entry_size_,
711 plt_entry_size): Delete. Replace all uses with
712 first_plt_entry_offset() and plt_entry_size().
713 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
714 reserved_size parm. Update callers.
715 (Output_data_plt_powerpc::entry_count): Update.
716 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
717 and use Target_powerpc::first_plt_entry_offset().
718 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
719 rename to plt_entry_size.
720 (Output_data_plt_powerpc::add_ifunc_entry,
721 add_local_ifunc_entry): Adjust reloc for ELFv2.
722 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
723 (glink_eh_frame_fde_64v2): New.
724 (Stub_table::plt_call_size): Support ELFv2 sizing.
725 (Output_data_glink::add_eh_frame): Use the new FDE.
726 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
727 (Stub_table::do_write): Write ELFv2 stubs and glink.
728 (Target_powerpc::Relocate::relocate): Replaces nop after call
729 with ld 2,24(1) and adjust local offset destination for ELFv2.
731 2013-10-30 Alan Modra <amodra@gmail.com>
733 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
734 (Target_powerpc::Scan::global, local): Likewise.
735 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
736 on all ppc64 @h and @ha relocs.
738 2013-10-14 Alan Modra <amodra@gmail.com>
740 * output.h (Output_data_got::add_constant): Tidy.
741 (Output_data_got::add_constant_pair): New function.
742 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
743 methods used so as to first call reserve_ent().
745 2013-10-11 Roland McGrath <mcgrathr@google.com>
747 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
748 add_got_entry and add_got_entry_pair.
750 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
751 (HAVE_PUBNAMES): Likewise.
752 * configure: Regenerate.
754 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
755 * testsuite/Makefile.in: Regenerate.
757 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
758 Remove const from declaration.
759 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
760 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
761 * output.h (Output_file_header): Remove const from member target_
762 and corresponding constructor argument.
763 * output.cc (Output_file_header::Output_file_header): Update prototype.
764 (Output_file_header::do_sized_write): Use this->target_ in place
765 of parameters()->target().
767 * testsuite/undef_symbol.cc (Foo::get_a): New method.
769 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
770 * configure: Regenerate.
771 * Makefile.in: Regenerate.
772 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
773 * testsuite/merge_string_literals_2.c: Likewise.
774 * testsuite/Makefile.am
775 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
776 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
777 literal -fmerge-constants.
778 * testsuite/Makefile.in: Regenerate.
780 * i386.cc (Target_i386): Remove unused member dynbss_.
781 * arm.cc (Target_arm): Likewise.
782 * powerpc.cc (Target_powerpc): Likewise.
783 * sparc.cc (Target_sparc): Likewise.
784 * tilegx.cc (Target_tilegx): Likewise.
785 * x86_64.cc (Target_x86_64): Likewise.
786 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
787 type_signature_, type_offset_.
788 * plugin.h (Plugin_hook): Remove unused member layout_.
789 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
791 (Read_member): Remove unused members input_objects_, symtab_,
793 (Check_library): Remove unused member symtab_.
794 * archive.h (Lib_group): Remove unused member lib_.
795 * archive.cc (Lib_group::Lib_group): Update initializer.
796 * incremental.h (Incremental_binary): Remove unused member target_.
797 (Incremental_script_entry): Removed unused member script_.
798 * layout.h (Write_symbols_task): Remove unused member input_objects_.
799 * icf.h (Icf): Remove unused member num_tracked_relocs.
801 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
802 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
804 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
806 * archive.h: Use struct rather than class for forward declaration
807 of Read_symbols_data.
809 2013-10-07 Cary Coutant <ccoutant@google.com>
812 * testsuite/Makefile.am (icf_test): Fix dependencies.
813 (icf_safe_test): Likewise.
814 (icf_safe_so_test): Likewise.
815 (large_symbol_alignment): Add empty _LDADD rule.
816 * testsuite/Makefile.in: Regenerate.
818 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
821 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
822 relocation for R_X86_64_32 on x32.
824 2013-08-27 Roland McGrath <mcgrathr@google.com>
826 * output.cc (Output_segment::set_section_addresses): Take new
827 Target* argument. If target->isolate_execinstr() and the segment
828 is executable and starts at a target->abi_pagesize() boundary,
829 pad its end out to a target->abi_pagesize() boundary with code fill.
830 * output.h (Output_segment::set_section_addresses): Update decl.
831 * layout.h (Layout::check_output_data_for_reset_values): Take new
832 argument RELAX_OUTPUTS.
833 (Layout): New member relax_output_list_.
834 (Layout::add_relax_output): New method.
835 * layout.cc (Layout::Layout): Update constructor.
836 (Layout::reset_relax_output): New method.
837 (Layout::clean_up_after_relaxation): Call it.
838 (Layout::prepare_for_relaxation): Update caller.
839 (Layout::set_segment_offsets): Update callers of set_section_addresses.
840 Call reset_relax_output before re-processing segments for
841 isolate_execinstr case.
842 (Layout::write_data): Handle relax_output_list_.
843 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
844 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
846 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
849 * object.h: Fix typos.
851 2013-08-16 Roland McGrath <mcgrathr@google.com>
853 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
854 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
856 2013-08-07 Cary Coutant <ccoutant@google.com>
858 Revert support for v2 DWP files:
860 2013-03-01 Cary Coutant <ccoutant@google.com>
862 Add dwp support for v2 DWARF package file format.
863 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
864 tu_length parameter. Adjust all callers.
865 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
866 * dwp.cc: Include dwarf.h.
867 (Section_bounds): New struct type.
868 (Unit_set): New struct type.
869 (Dwo_file::Dwo_file): Initialize new data member.
870 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
871 Combine and rename to...
872 (Dwo_file::read_unit_index): ...this.
873 (Dwo_file::sized_read_compunit_index)
874 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
875 (Dwo_file::sized_read_unit_index): ...this.
876 (Dwo_file::copy_section): Remove section_name, is_str_offsets
877 parameters; add section_id parameter.
878 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
879 (Dwo_file::add_unit_set): ...this.
880 (Dwo_file::shndx_map_): Remove.
881 (Dwo_file::sect_offsets_): New data member.
882 (Dwp_output_file::Dwp_output_file): Initialize new data members.
883 (Dwp_output_file::add_section): Rename to...
884 (Dwp_output_file::add_contribution): ...this.
885 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
886 (Dwp_output_file::add_tu_set): Likewise.
887 (Dwp_output_file::Contribution): New type.
888 (Dwp_output_file::Section::contributions): New data member.
889 (Dwp_output_file::Cu_or_tu_set): Remove.
890 (Dwp_output_file::Section::Section): New ctor.
891 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
892 (Dwp_output_file::Dwp_index::Section_table): New type.
893 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
894 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
896 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
897 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
898 (Dwp_output_file::Dwp_index::section_table): New member function.
899 (Dwp_output_file::Dwp_index::section_table_end): New member function.
900 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
901 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
902 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
903 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
904 (Dwp_output_file::Dwp_index::section_table_): New data member.
905 (Dwp_output_file::Dwp_index::section_mask_): New data member.
906 (Dwp_output_file::add_output_section): New member function.
907 (Dwp_output_file::write_new_section): New member function.
908 (Dwp_output_file::write_contributions): New member function.
909 (Dwp_output_file::section_id_map_): New data member.
910 (class Dwo_id_info_reader): Remove.
911 (class Unit_reader): New class.
912 (get_dwarf_section_name): New function.
913 (Dwo_file::read_executable): Adjust initializations of class data.
914 (Dwo_file::read): Add support for v2 package file format.
915 (Dwo_file::read_unit_index): Likewise.
916 (Dwo_file::sized_read_unit_index): Likewise.
917 (Dwo_file::copy_section): Likewise.
918 (Dwo_file::add_unit_set): Likewise.
919 (Dwp_output_file::add_output_section): Likewise.
920 (Dwp_output_file::add_contribution): Likewise.
921 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
923 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
925 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
927 (Dwp_output_file::initialize): Remove unused function.
928 (Dwp_output_file::finalize): Add support for v2 package file format.
929 (Dwp_output_file::write_index): Likewise.
930 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
933 2013-07-31 Cary Coutant <ccoutant@google.com>
935 * object.cc (Sized_relobj::do_output_section_address): New function.
936 (Sized_relobj): Instantiate explicitly.
937 * object.h (Object::output_section_address): New function.
938 (Object::do_output_section_address): New function.
939 (Sized_relobj::do_output_section_address): New function.
940 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
942 2013-07-30 Cary Coutant <ccoutant@google.com>
943 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
945 * parameters.cc (Parameters::entry): Return target-specific entry
947 * target.h (Target::entry_symbol_name): New function.
948 (Target_info::entry_symbol_name): New data member.
950 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
951 * i386.cc (Target_i386::i386_info): Likewise.
952 (Target_i386_nacl::i386_nacl_info): Likewise.
953 * sparc.cc (Target_sparc::sparc_info): Likewise.
954 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
955 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
956 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
957 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
959 2013-07-22 Sterling Augustine <saugustine@google.com>
961 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
962 Convert parameter shndx to local variable. Add parameters symtab
963 and symtab_size. Scan over section names. Find relocation
964 section corresponding to current section. Create and initialize
965 reloc_mapper_ and reloc_type_.
966 (Dwarf_pubnames_table::read_header): Add assertion. Change
967 unit_length to off_t. Initialize member unit_length_. Fill in field
969 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
970 Initialize new fields unit_length_ and cu_offset_.
971 (Dwarf_pubnames_table::read_section): Update prototype.
972 (Dwarf_pubnames_table::cu_offset): New member function.
973 (Dwarf_pubnames_table::subsection_size): Likewise.
974 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
976 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
977 member functions public.
978 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
979 Update comment. Rework logic. Move repeated parts to...
980 (Gdb_index_info_reader::read_pubtable): ...here. New function.
981 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
982 pubtypes_table_, and stmt_list_offset.
983 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
984 Gdb_index::find_pubtype_offset,
985 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
986 (Gdb_index::pubnames_read): Update prototype and rework logic.
987 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
989 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
990 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
991 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
992 Gdb_index::map_pubtable_to_dies):
994 (Gdb_index::pubnames_read): Update declaration.
995 (Gdb_index::Pubname_offset_map): New type.
996 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
997 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
998 Gdb_index::stmt_list_offset): Declare.
999 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1000 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1001 Gdb_index::pubtypes_offset_): Remove.
1003 2013-07-19 Roland McGrath <mcgrathr@google.com>
1005 * options.h (General_options): Add -Trodata-segment option.
1006 * parameters.cc (Parameters::check_rodata_segment): New function.
1007 (Parameters::set_target_once): Call it.
1008 * parameters.h (Parameters): Declare it (private member function).
1009 * layout.cc (load_seg_unusable_for_headers): New function, broken
1010 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1011 then validate rodata segment rather than text segment.
1012 (relaxation_loop_body): Call that.
1013 (is_text_segment): New function. Don't admit a non-executable
1014 segment if TARGET->isolate_execinstr().
1015 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1017 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1020 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1021 * nacl.h (Sniff_file::View::View): Request aligned view.
1023 2013-07-11 Cary Coutant <ccoutant@google.com>
1025 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1026 correct BRLT entry size.
1028 2013-07-03 Alan Modra <amodra@gmail.com>
1030 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1033 2013-07-01 Cary Coutant <ccoutant@google.com>
1035 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1037 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1038 (Dwarf_ranges_table::lookup_reloc): New function.
1039 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1041 (Dwarf_ranges_table::lookup_reloc): New function.
1042 (Dwarf_ranges_table::reloc_type_): New data member.
1044 2013-06-27 Jing Yu <jingyu@google.com>
1047 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1049 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1050 (Target_powerpc::do_relax): Call the above.
1052 2013-06-27 Cary Coutant <ccoutant@google.com>
1054 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1055 on garbage collected .opd section.
1057 2013-06-27 Alan Modra <amodra@gmail.com>
1059 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1061 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1062 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1064 2013-06-14 Cary Coutant <ccoutant@google.com>
1066 * resolve.cc (Symbol::override_base): Don't override st_type
1067 from plugin placeholder symbols.
1068 (Symbol_table::resolve): Likewise.
1069 (Symbol_table::should_override): Don't complain about TLS mismatch
1070 if the TO symbol is a plugin placeholder.
1071 * testsuite/Makefile.am (plugin_test_tls): New test.
1072 * testsuite/Makefile.in: Regenerate.
1073 * testsuite/plugin_test_tls.sh: New test script.
1074 * testsuite/two_file_test_2_tls.cc: New test source.
1075 * testsuite/two_file_test_tls.cc: New test source.
1077 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1079 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1080 the maximum segment alignment is larger than the page size.
1081 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1082 correctly aligns the symbols with large alignemnt.
1083 * testsuite/Makefile.in: Regenerate.
1084 * testsuite/large_symbol_alignment.cc: New file.
1086 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1087 Sriraman Tallam <tmsriram@google.com>
1089 * options.h (sort_section): New option.
1090 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1091 Rename from Input_section_sort_section_name_special_ordering_compare.
1092 (Input_section_sort_section_name_compare): New struct.
1093 * output.cc (Output_section::Input_section_sort_section_name_compare::
1094 operator()): New function.
1095 (Output_section::sort_attached_input_sections): Use new sort function
1096 for .text if --sort-section=name is specified.
1097 * layout.cc (Layout::make_output_section):
1098 Add sorting by name when --sort-section=name is specified.
1099 * testsuite/Makefile.am (text_section_grouping): Test option
1100 --sort-section=name.
1101 * testsuite/Makefile.in: Regenerate.
1102 * testsuite/section_sorting_name.cc: New file.
1103 * testsuite/section_sorting_name.sh: New file.
1105 2013-05-21 Cary Coutant <ccoutant@google.com>
1107 * symtab.h (Symbol::is_cxx_vtable): New function.
1108 * target-reloc.h (relocate_section): Check for vtable symbol.
1109 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1110 * testsuite/Makefile.in: Regenerate.
1111 * testsuite/missing_key_func.cc: New test source.
1112 * testsuite/missing_key_func.sh: New test script.
1114 2013-05-21 Cary Coutant <ccoutant@google.com>
1116 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1117 type of enclosing symbol.
1118 (Relocate_info::location): Check symbol type when describing symbol.
1119 * object.h (Symbol_location_info): Remove unused line_number;
1120 add enclosing_symbol_type.
1121 * testsuite/debug_msg.sh: Adjust expected output.
1123 2013-05-13 Cary Coutant <ccoutant@google.com>
1125 * configure.ac: Export DEFAULT_TARGET.
1126 * configure: Regenerate.
1127 * Makefile.in: Regenerate.
1128 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1129 * testsuite/Makefile.in: Regenerate.
1130 * testsuite/debug_msg.sh: Delete duplicate tests.
1131 Don't check undef_int error message match for powerpc where the
1132 source file and line number aren't available.
1134 2013-05-10 Roland McGrath <mcgrathr@google.com>
1136 * options.h (General_options): Add --rosegment-gap option.
1137 * options.cc (finalize): --rosegment-gap implies --rosegment.
1138 * layout.cc (set_segment_offsets): Let user option override
1139 target->rosegment_gap().
1141 2013-05-10 Roland McGrath <mcgrathr@google.com>
1143 * options.h (General_options): Remove leading space from help
1144 messages for -nostdlib and --rosegment.
1146 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1149 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1151 2013-05-03 Alan Modra <amodra@gmail.com>
1153 * merge.cc (Output_merge_string::do_add_input_section): Correct
1154 scan for number of strings. Rename vars to avoid shadowing.
1155 Include missing terminator in input_size_.
1157 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1159 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1160 Restore empty string handling.
1162 2013-05-01 Cary Coutant <ccoutant@google.com>
1164 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1165 uninitialized warning.
1167 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1169 * output.cc (Output_section::add_merge_input_section): Allow
1170 to merge sections if the alignment is more than character size.
1171 * merge.h (Output_merge_string::Output_merge_string): Remove
1173 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1174 only not-null strings. Check the alignment of strings.
1176 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1177 alignment as the argument.
1178 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1179 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1180 Align non-zero length strings according to the addralign_.
1181 (Stringpool_template<Stringpool_char>::set_string_offsets):
1182 Updating offsets according to the given alignment.
1183 * testsuite/Makefile.am (text_section_grouping): Test if string
1184 literals are getting merged.
1185 * testsuite/Makefile.in: Regenerate.
1186 * testsuite/merge_string_literals_1.c: New file.
1187 * testsuite/merge_string_literals_2.c: Ditto.
1188 * testsuite/merge_string_literals.sh: Ditto.
1190 2013-04-26 Ian Lance Taylor <iant@google.com>
1192 * target-reloc.h (relocate_section): If the reloc offset is out of
1193 range, pass VIEW as NULL to relocate.relocate.
1194 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1195 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1196 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1197 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1198 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1199 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1201 2013-04-26 Geoff Pike <gpike@chromium.org>
1203 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1204 * layout.cc (Hash_task): New class.
1205 (Layout::queue_build_id_tasks): New function.
1206 (Layout::write_build_id): Handle single-thread portion of build ID
1207 computation. (In some cases, all of it is single-threaded.) Replace
1208 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1209 functionality in fewer lines of code.
1210 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1211 * options.h (General_options): make "--build-id" default to tree
1212 rather than sha1. Add two new options related to --build-id=tree:
1213 --build-id-chunk-size-for-treehash and
1214 --build-id-min-file-size-for-treehash.
1215 * Makefile.am: add testing of --build-id=tree and related new options
1216 (these tests will be invoked by "make check").
1217 * Makefile.in: Regenerate.
1219 2013-04-25 Alan Modra <amodra@gmail.com>
1221 * configure.tgt: Add powerpcle and powerpc64le.
1223 2013-04-22 Alan Modra <amodra@gmail.com>
1226 * layout.cc (Layout::segment_precedes): Allow more than one
1227 segment with the same type and flags.
1229 2013-04-15 Cary Coutant <ccoutant@google.com>
1231 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1232 allocate space in file for BSS sections.
1234 2013-04-15 Cary Coutant <ccoutant@google.com>
1236 * script-sections.cc (Orphan_output_section): Reset address
1237 to zero after each orphaned section for relocatable links.
1239 2013-04-15 Cary Coutant <ccoutant@google.com>
1241 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1242 section starting address for relocatable link.
1243 * testsuite/Makefile.am (script_test_11): New test.
1244 * testsuite/Makefile.in: Regenerate.
1245 * testsuite/script_test_11.c: New source file.
1246 * testsuite/script_test_11.t: New linker script.
1248 2013-04-13 Alan Modra <amodra@gmail.com>
1250 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1251 owner when sections are not adjacent and exceed group size.
1252 (Target_powerpc::group_sections): Handle corner case.
1253 (Target_powerpc::Branch_info::make_stub): Handle case where
1254 stub table doesn't exist due to branches in non-exec sections.
1255 (Target_powerpc::Relocate::relocate): Likewise.
1257 2013-04-11 Alan Modra <amodra@gmail.com>
1260 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1261 .branch_lt to match bfd ld. Adjust comments throughout file.
1263 2013-04-04 Ian Lance Taylor <iant@google.com>
1266 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1267 sections before checking whether they are included in the link.
1269 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1271 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1272 object before calling the plugin claim_file handler. Pass the elf
1273 object of the archive to the plugin. Delete the elf object if the
1274 plugin claims the file.
1276 2013-03-21 Alan Modra <amodra@gmail.com>
1278 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1279 segment when omagic.
1281 2013-03-21 Alan Modra <amodra@gmail.com>
1283 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1285 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1286 uninitialized" warning.
1288 2013-03-20 Alan Modra <amodra@gmail.com>
1290 * symtab.h (Symbol::clear_version): New function.
1291 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1292 is_needed by weak references. Clear version for symbols defined
1293 in as-needed objects that are not needed.
1295 2013-03-15 Alan Modra <amodra@gmail.com>
1297 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1298 static and public. Add report_err param. Return false for data refs.
1299 (Target_powerpc::rela_dyn_section): New overloaded function.
1300 (Target_powerpc::plt_, iplt_): Elucidate.
1301 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1302 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1303 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1304 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1305 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1306 push_branch and make_plt_entry for ifunc syms when
1307 reloc_needs_plt_for_ifunc.
1308 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1309 for ifunc unless reloc_needs_plt_for_ifunc.
1311 2013-03-15 Alan Modra <amodra@gmail.com>
1313 * gc.h (gc_process_relocs): Don't look through function descriptors.
1314 * icf.cc (get_section_contents): Do so here instead.
1316 2013-03-13 Alan Modra <amodra@gmail.com>
1318 * powerpc.cc (is_branch_reloc): Forward declare.
1319 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1320 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1321 false for 64-bit, true for 32-bit non-branch relocs.
1322 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1323 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1325 (icf_safe_test): Generate linker map file as well as nm output.
1326 (icf_safe_so_test): Likewise.
1327 * testsuite/Makefile.in: Regenerate.
1328 * testsuite/icf_test.sh: Parse linker map file to determine
1330 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1331 * testsuite/icf_safe_so_test.sh: Likewise.
1332 (X86_32_or_ARM_specific_safe_fold): Merge into..
1333 (arch_specific_safe_fold): ..this.
1334 (X86_64_specific_safe_fold): Delete unused function.
1336 2013-03-12 Alan Modra <amodra@gmail.com>
1338 * gc.h (gc_process_relocs): Look through function descriptors
1339 to determine shndx, symvalue and addend used by ICF. Tidy
1340 variable duplication.
1342 2013-03-11 Alan Modra <amodra@gmail.com>
1344 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1345 * layout.cc (Layout_task_runner::run): ..to here.
1346 * symtab.h (struct Symbol_location): Extract from..
1347 (class Symbol_table): ..here.
1348 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1349 * target.h (class Target): Add function_location and
1350 do_function_location functions.
1351 (class Sized_target): Add do_function_location.
1352 * object.h (class Sized_relobj_file): Move find_shdr..
1353 (class Object): ..to here.
1354 * object.cc: Likewise. Update to suit. Instantiate.
1355 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1356 * powerpc.cc (class Powerpc_dynobj): New.
1357 (Target_powerpc::do_function_location): New function.
1358 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1359 (Powerpc_dynobj::do_read_symbols): New function.
1360 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1362 2013-03-08 Ian Lance Taylor <iant@google.com>
1364 * options.cc (General_options::string_to_object_format): Accept
1367 2013-03-08 Alan Modra <amodra@gmail.com>
1369 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1370 pointer to Post_fde.
1371 (struct Post_fde): Move definition to here..
1372 * ehframe.cc (struct Post_fde): ..from here.
1373 (Cie::write): Don't alloc Post_fde.
1374 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1376 2013-03-07 Alan Modra <amodra@gmail.com>
1378 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1379 relocation referencing .LC0.
1380 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1382 2013-03-07 Alan Modra <amodra@gmail.com>
1384 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1385 always_inline. Add assembly for powerpc to avoid GOT.
1387 2013-03-07 Alan Modra <amodra@gmail.com>
1389 * testsuite/script_test_10.sh: Don't test .bss section
1392 2013-03-06 Alan Modra <amodra@gmail.com>
1394 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1395 (Target_powerpc::symval_for_branch): Add symtab param. Update
1396 all callers. Handle folded sections.
1397 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1399 (Global_symbol_visitor_opd::operator()): Likewise.
1401 2013-03-04 Alan Modra <amodra@gmail.com>
1403 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1404 * testsuite/Makefile.in: Regenerate.
1406 2013-03-01 Cary Coutant <ccoutant@google.com>
1408 Add dwp support for v2 DWARF package file format.
1409 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1410 tu_length parameter. Adjust all callers.
1411 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1412 * dwp.cc: Include dwarf.h.
1413 (Section_bounds): New struct type.
1414 (Unit_set): New struct type.
1415 (Dwo_file::Dwo_file): Initialize new data member.
1416 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1417 Combine and rename to...
1418 (Dwo_file::read_unit_index): ...this.
1419 (Dwo_file::sized_read_compunit_index)
1420 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1421 (Dwo_file::sized_read_unit_index): ...this.
1422 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1423 parameters; add section_id parameter.
1424 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1425 (Dwo_file::add_unit_set): ...this.
1426 (Dwo_file::shndx_map_): Remove.
1427 (Dwo_file::sect_offsets_): New data member.
1428 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1429 (Dwp_output_file::add_section): Rename to...
1430 (Dwp_output_file::add_contribution): ...this.
1431 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1432 (Dwp_output_file::add_tu_set): Likewise.
1433 (Dwp_output_file::Contribution): New type.
1434 (Dwp_output_file::Section::contributions): New data member.
1435 (Dwp_output_file::Cu_or_tu_set): Remove.
1436 (Dwp_output_file::Section::Section): New ctor.
1437 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1438 (Dwp_output_file::Dwp_index::Section_table): New type.
1439 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1440 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1442 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1443 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1444 (Dwp_output_file::Dwp_index::section_table): New member function.
1445 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1446 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1447 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1448 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1449 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1450 (Dwp_output_file::Dwp_index::section_table_): New data member.
1451 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1452 (Dwp_output_file::add_output_section): New member function.
1453 (Dwp_output_file::write_new_section): New member function.
1454 (Dwp_output_file::write_contributions): New member function.
1455 (Dwp_output_file::section_id_map_): New data member.
1456 (class Dwo_id_info_reader): Remove.
1457 (class Unit_reader): New class.
1458 (get_dwarf_section_name): New function.
1459 (Dwo_file::read_executable): Adjust initializations of class data.
1460 (Dwo_file::read): Add support for v2 package file format.
1461 (Dwo_file::read_unit_index): Likewise.
1462 (Dwo_file::sized_read_unit_index): Likewise.
1463 (Dwo_file::copy_section): Likewise.
1464 (Dwo_file::add_unit_set): Likewise.
1465 (Dwp_output_file::add_output_section): Likewise.
1466 (Dwp_output_file::add_contribution): Likewise.
1467 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1469 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1471 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1473 (Dwp_output_file::initialize): Remove unused function.
1474 (Dwp_output_file::finalize): Add support for v2 package file format.
1475 (Dwp_output_file::write_index): Likewise.
1476 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1479 2013-03-01 Cary Coutant <ccoutant@google.com>
1481 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1482 function into class definition in header file.
1483 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1484 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1486 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1488 2013-02-28 Alan Modra <amodra@gmail.com>
1490 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1491 * target.cc (Target::do_plt_fde_location): New function.
1492 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1493 accessor function, and constructor param.
1494 (struct Post_fde, Post_fdes): Declare.
1495 (Cie::write): Add post_fdes param.
1496 * ehframe.cc (Fde::write): Use plt_fde_location.
1497 (struct Post_fde): Define.
1498 (Cie::write): Stash FDEs added post merge mapping.
1499 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1500 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1501 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1503 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1504 (Target_powerpc::has_glink): New function.
1505 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1506 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1507 glink_eh_frame_fde_32, default_fde): New data.
1508 (Stub_table::eh_frame_added_): New var.
1509 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1511 (Stub_table::add_eh_frame): New function.
1512 (Output_data_glink::add_eh_frame): New function.
1513 (Target_powerpc::make_glink_section): Call add_eh_frame.
1515 2013-02-15 Ian Lance Taylor <iant@google.com>
1517 * options.h (DEFINE_uint64_alias): Define.
1518 (class General_options): Add -Ttext-segment as an alias for
1521 2013-02-15 Alan Modra <amodra@gmail.com>
1523 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1524 (Stub_table::do_write): ..here, two places.
1525 (Stub_table::plt_call_size): Use it here too.
1527 2013-02-11 Ian Lance Taylor <iant@google.com>
1529 * descriptors.cc (Descriptors::close_all): New function.
1530 * descriptors.h (class Descriptors): Declare close_all.
1531 (close_all_descriptors): New inline function.
1532 * plugin.cc: Include "descriptors.h".
1533 (Plugin_manager::cleanup): Call close_all_descriptors.
1535 2013-02-06 Alan Modra <amodra@gmail.com>
1537 * README: Update coding style link.
1539 2013-01-28 Cary Coutant <ccoutant@google.com>
1541 * dwp.cc (File_list): New typedef.
1542 (Dwo_name_info_reader): New class.
1543 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1544 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1545 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1546 (Dwo_file::read_executable): New function.
1547 (Dwo_file::read): Move common setup code to ...
1548 (Dwo_file::make_object): ... here.
1549 (dwp_options): Add --exec/-e.
1553 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1555 * layout.cc (Layout::layout): Check for option text_reorder.
1556 (Layout::make_output_section): Ditto.
1557 * options.h (text_reorder): New option.
1558 * output.cc (Input_section_sort_compare): Remove special ordering
1561 Input_section_sort_section_name_special_ordering_compare::
1562 operator()): New function.
1563 (Output_section::sort_attached_input_sections): Use new sort function
1565 * output.h (Input_section_sort_section_name_special_ordering_compare):
1567 * testsuite/Makefile.am (text_section_grouping): Test option
1569 * testsuite/Makefile.in: Regenerate.
1570 * testsuite/text_section_grouping.sh: Check order of functions without
1571 default text reordering.
1573 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1575 * options.h (General_options): Change default to true for new_dtags.
1577 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1579 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1580 when enable_new_dtags is false. Only add DT_RUNPATH when
1581 enable_new_dtags is true.
1583 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1585 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1586 used in declaration and definition consistent.
1587 (Target_powerpc::symval_for_branch): Ditto.
1589 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1591 * testsuite/plugin_final_layout.cc: Fix comment.
1593 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1595 * layout.cc (Layout::layout): Do not do default sorting for
1596 text sections when section ordering is specified.
1597 (make_output_section): Ditto.
1598 * testsuite/plugin_final_layout.cc: Name the function sections
1599 to catch reordering issues.
1601 2013-01-15 Alan Modra <amodra@gmail.com>
1603 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1606 2013-01-15 Alan Modra <amodra@gmail.com>
1608 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1609 * testsuite/Makefile.in: Regenerate.
1611 2013-01-14 Alan Modra <amodra@gmail.com>
1613 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1614 * testsuite/Makefile.in: Regenerate.
1616 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1619 Fix mingw gold build with plugins enabled
1620 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1621 * configure.ac: Export DLOPEN_LIBS and add headers check.
1622 * plugin.cc: Handle non-dlfcn case.
1623 * Makefile.in: Regenerate.
1624 * config.in: Regenerate.
1625 * configure: Regenerate.
1626 * testsuite/Makefile.in: Regenerate.
1628 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1630 * output.h (sort_attached_input_sections): Change to be public.
1631 * script-sections.cc
1632 (Output_section_definition::set_section_addresses): Sort
1633 attached input sections according to section order before linker
1634 script assigns section addresses.
1635 (Orphan_output_section::set_section_addresses): Sort
1636 attached input sections according to section order before linker
1637 script assigns section addresses.
1638 * Makefile.am (final_layout.sh): Use a simple linker script to
1639 check if section ordering still works.
1640 * Makefile.in: Regenerate.
1642 2013-01-09 Ben Cheng <bccheng@google.com>
1644 * arm.cc (Target_arm::attributes_accept_div): New function.
1645 (Target_arm::attributes_forbid_div): New function.
1646 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1647 attribute using the same new functions as what bfd/elf32_arm.c
1650 2013-01-07 Cary Coutant <ccoutant@google.com>
1653 * output.cc (Output_section::add_input_section): For incremental
1654 updates, don't track input sections that are allocated from patch
1657 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1658 Ian Lance Taylor <iant@google.com>
1661 * configure.ac (--enable-ld): Removed.
1662 (install_as_default): Set to yes only for --enable-gold=default
1664 * configure: Regenerated.
1666 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1668 * options.h (General_options): Add -fuse-ld= for GCC linker
1669 option compatibility.
1671 2013-01-04 Cary Coutant <ccoutant@google.com>
1673 * configure.ac: Fix typo restoring CXXFLAGS.
1674 * configure: Regenerate.
1676 2013-01-04 Cary Coutant <ccoutant@google.com>
1678 * testsuite/Makefile.am (CXXLINK_S): New macro.
1679 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1680 * testsuite/Makefile.in: Regenerate.
1682 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1684 * version.cc (print_version): Update copyright year to 2013.
1686 2012-12-20 Ian Lance Taylor <iant@google.com>
1688 * layout.cc (Layout::special_ordering_of_input_section): New
1690 (Layout::layout): If input section requires special ordering, must
1691 sort input sections.
1692 (Layout::make_output_section): May sort .text input sections.
1693 (Layout::is_section_name_prefix_grouped): Remove.
1694 * layout.h (class Layout): Declare
1695 special_ordering_of_input_section. Don't declare
1696 is_section_name_prefix_grouped.
1697 * output.cc (Output_section::add_input_section): Revert last
1699 (Output_section::Input_section_sort::match_file_name): Don't crash
1700 if called on output section data.
1701 (Output_section::Input_section_sort_compare): Sort based on
1703 (Output_section::Input_section_sort_section_order_index_compare):
1705 (Output_section::sort_attached_input_sections): Likewise.
1707 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1709 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1710 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1711 * output.cc (Output_section::add_input_section): Check if section
1712 name contains special prefix. Keep input sections to sort such
1714 (Output_section::Input_section_sort_section_order_index_compare
1715 ::operator()): Group sections according to prefixes.
1716 (Output_section::sort_attached_input_sections): Add condition to
1717 Input_section_entry constructor call.
1718 * testsuite/Makefile.am (text_section_grouping): New test.
1719 * testsuite/Makefile.in: Regenerate.
1720 * testsuite/text_section_grouping.cc: New file.
1721 * testsuite/text_section_grouping.sh: New file.
1723 2012-12-17 Nick Clifton <nickc@redhat.com>
1725 * Makefile.am: Add copyright notice.
1728 * configure.ac: Likewise.
1729 * ftruncate.c: Likewise.
1730 * Makefile.in: Regenerate.
1732 2012-12-14 Cary Coutant <ccoutant@google.com>
1734 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1735 --no-as-needed flag.
1736 (exception_separate_shared_12_test): Likewise.
1737 (incremental_copy_test): Likewise.
1738 * testsuite/Makefile.in: Regenerate.
1740 2012-12-14 Cary Coutant <ccoutant@google.com>
1742 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1743 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1745 2012-12-12 Alan Modra <amodra@gmail.com>
1747 * powerpc.cc (class Track_tls): New.
1748 (class Relocate, class Scan): Inherit Track_tls.
1749 (Target_powerpc::Scan::local, global): Track tls optimization
1750 and avoid creating plt entry for __tls_get_addr if all uses
1752 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1754 2012-12-12 Alan Modra <amodra@gmail.com>
1756 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1757 Replace no_toc_optimize with toc_optimize.
1758 * output.h (Output_section::input_sections): Provide non-const variant.
1759 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1760 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1762 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1763 (class Sort_toc_sections): New.
1764 (Target_powerpc::do_finalize_sections): Sort toc sections.
1765 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1767 2012-12-10 Roland McGrath <mcgrathr@google.com>
1769 * testsuite/binary_unittest.cc (read_all): New function.
1770 (Sized_binary_test): Use it instead of ::read.
1771 * fileread.cc (do_read): Don't assume pread always reads the whole
1772 amount in a single call.
1774 2012-12-10 Alan Modra <amodra@gmail.com>
1776 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1777 Set EM_PPC64 or EM_PPC here.
1778 (Target_selector_powerpc::do_recognize): Delete.
1780 2012-12-10 Alan Modra <amodra@gmail.com>
1782 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1784 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1786 2012-12-07 Roland McGrath <mcgrathr@google.com>
1788 * testsuite/binary_unittest.cc (Sized_binary_test):
1789 Use open_descriptor rather than ::open.
1791 2012-12-07 Alan Modra <amodra@gmail.com>
1793 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1794 typedef and invalid_address constant.
1795 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1796 instantiate constants.
1798 2012-12-06 Roland McGrath <mcgrathr@google.com>
1800 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1801 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1802 * aclocal.m4: Regenerate.
1803 * configure: Regenerate.
1804 * Makefile.in: Regenerate.
1805 * testsuite/Makefile.in: Regenerate.
1807 2012-12-07 Alan Modra <amodra@gmail.com>
1809 * options.h (General_options): Add no_toc_optimize.
1810 * powerpc.cc (ok_lo_toc_insn): New function.
1811 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1813 2012-12-06 Alan Modra <amodra@gmail.com>
1815 * options.h (General_options): Add plt_align, plt_static_chain,
1816 plt_thread_safe. Update stub_group_size help text.
1817 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1818 for new plt_thread_safe_ var.
1819 (use_plt_offset): Correct comments.
1820 (Target_powerpc::do_relax): Look for thread creation symbols to
1821 determine default plt_thread_safe value. Clear plt call stubs
1822 as well as branch stubs each iteration.
1823 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1825 (l, hi, ha, write_insn): Move earlier.
1826 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1827 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1829 (Stub_table::update_size): Adjust.
1830 (Stub_table::prev_size, set_prev_size): Delete.
1831 (Stub_table::stub_align): Let --plt-align affect result.
1832 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1833 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1834 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1835 (Stub_table::do_write): Support more stub variants.
1837 2012-12-04 Alan Modra <amodra@gmail.com>
1839 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1840 (Target_powerpc::do_define_standard_symbols): New function.
1842 2012-12-03 Alan Modra <amodra@gmail.com>
1844 * output.h: Formatting, whitespace.
1846 2012-12-03 Alan Modra <amodra@gmail.com>
1848 * layout.h (Layout::get_executable_sections): Declare.
1849 * layout.cc (Layout::get_executable_sections): New function.
1850 * arm.cc (Target_arm::group_sections): Use it.
1851 (Arm_output_section::group_sections): Delete now redundant test.
1852 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1853 param to handle relative relocs.
1854 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1855 (Output_data_reloc::add_absolute): Adjust.
1856 (Output_data_reloc::add_relative): New function.
1857 (Output_data::reset_data_size): New function.
1858 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1859 (Output_section::set_addralign): New function.
1860 (Output_section::checkpoint_set_addralign): New function.
1861 (Output_section::clear_section_offsets_need_adjustment): New function.
1862 (Output_section::input_sections): Make public.
1863 * powerpc.cc (class Output_data_brlt_powerpc): New.
1864 (class Stub_table, class Stub_control): New.
1865 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1866 stub_table_, set_stub_table, stub_table): New vectors and accessor
1868 (Target_powerpc::do_may_relax, do_relax, push_branch,
1869 new_stub_table, stub_tables, brlt_section, group_sections,
1870 add_branch_lookup_table, find_branch_lookup_table,
1871 write_branch_lookup_table, make_brlt_section): New functions.
1872 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1873 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1874 branch_info_): New vars.
1875 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1876 make call stubs here.
1877 (Output_data_glink): Remove all call stub handling from this class.
1878 (Target_powerpc::Scan::local, global): Save interesting branch
1879 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1880 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1881 functions on final link.
1882 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1883 Handle long branch destinations too.
1884 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1885 do_plt_address_for_local): Adjust lookup of plt call stubs.
1887 2012-11-30 Alan Modra <amodra@gmail.com>
1889 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1890 relocs against protected symbols when building 32-bit shared libs.
1892 2012-11-30 Alan Modra <amodra@gmail.com>
1894 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1895 param. Call got_section() to make .got. Update all callers
1896 and their callers and so on.
1898 2012-11-30 Alan Modra <amodra@gmail.com>
1900 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1901 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1902 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1903 value if it already exists.
1905 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1908 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1910 2012-11-14 Roland McGrath <mcgrathr@google.com>
1912 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1913 than bfc instruction for data sandboxing.
1915 2012-11-08 Alan Modra <amodra@gmail.com>
1917 * po/POTFILES.in: Regenerate.
1919 2012-11-05 Alan Modra <amodra@gmail.com>
1921 * configure.ac: Apply 2012-09-10 change to config.in here.
1922 * configure: Regenerate.
1924 2012-11-05 Alan Modra <amodra@gmail.com>
1926 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1927 (struct Opd_ent): Use "Address" rather than "Offset".
1928 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1929 (Target_powerpc::got_section): Make public.
1930 (Target_powerpc::scan_relocs): Move code setting symbols..
1931 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1932 Create _SDA_BASE_ only when referenced.
1934 2012-11-02 Roland McGrath <mcgrathr@google.com>
1936 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1939 2012-11-01 Roland McGrath <mcgrathr@google.com>
1941 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1942 for offset_in_output_section parameter.
1943 (Sized_target::relocate_special_relocatable): Likewise.
1944 * arm.cc (Target_arm::relocate_relocs): Likewise.
1945 (Target_arm::relocate_special_relocatable): Likewise.
1946 * i386.cc (Target_i386::relocate_relocs): Likewise.
1947 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1948 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1949 * target-reloc.h (relocate_relocs): Likewise.
1950 * testsuite/testfile.cc (Target_test): Likewise.
1951 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1952 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1954 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1955 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1957 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1958 parameter, which is unused in the [!F_SETFD] case.
1960 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1961 SYMNDX to off_t before comparing it to this->data_size().
1962 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1963 * incremental.cc (Output_section_incremental_inputs::do_write):
1964 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1966 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1968 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1970 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1971 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1974 2012-10-29 Cary Coutant <ccoutant@google.com>
1976 * dwp.cc (usage): Add file and exit status parameters;
1977 add --help and --version options.
1978 (print_version): New function.
1979 (main): Add --help and --version options.
1981 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1983 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1984 final_layout_sequence.txt.
1985 * testsuite/Makefile.in: Regenerated.
1987 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1989 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1990 COMPILE generated by automake.
1992 (CXXCOMPILE1): Likewise.
1993 (CXXLINK1): Likewise.
1994 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1996 (CXXCOMPILE): Likewise.
1997 (CXXLINK): Likewise.
1998 * testsuite/Makefile.in: Regenerated.
2000 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2002 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2003 on bad fwrite return.
2005 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2007 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2010 2012-10-23 Cary Coutant <ccoutant@google.com>
2012 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2013 * testsuite/Makefile.in: Regenerate.
2014 * testsuite/dwp_test.h: New source file.
2015 * testsuite/dwp_test_1.cc: New source file.
2016 * testsuite/dwp_test_1.s: New source file.
2017 * testsuite/dwp_test_1.sh: New source file.
2018 * testsuite/dwp_test_1b.cc: New source file.
2019 * testsuite/dwp_test_1b.s: New source file.
2020 * testsuite/dwp_test_2.cc: New source file.
2021 * testsuite/dwp_test_2.s: New source file.
2022 * testsuite/dwp_test_2.sh: New source file.
2023 * testsuite/dwp_test_main.cc: New source file.
2024 * testsuite/dwp_test_main.s: New source file.
2026 2012-10-23 Cary Coutant <ccoutant@google.com>
2028 * dwp.h: New header file.
2029 * dwp.cc: New source file.
2030 * gold.h: Move shared declarations to system.h.
2031 * system.h: New header file.
2032 * Makefile.am: Add dwp.
2033 * Makefile.in: Regenerate.
2035 2012-10-23 Cary Coutant <ccoutant@google.com>
2037 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2038 Dwarf_info_reader::read_from_pointer.
2039 (Dwarf_pubnames_table::read_header): Likewise.
2040 (Dwarf_pubnames_table::next_name): Likewise.
2041 (Dwarf_die::read_attributes): Likewise.
2042 (Dwarf_die::skip_attributes): Likewise.
2043 (Dwarf_info_reader::read_from_pointer): New function template.
2044 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2045 (Dwarf_pubnames_table): Likewise.
2046 (Dwarf_info_reader::read_from_pointer): New function template.
2047 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2048 Dwarf_pubnames_table ctor.
2050 2012-10-23 Cary Coutant <ccoutant@google.com>
2052 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2054 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2056 (Dwarf_info_reader::set_abbrev_shndx): New method.
2057 (Dwarf_info_reader::abbrev_shndx_): New data member.
2059 2012-10-23 Cary Coutant <ccoutant@google.com>
2061 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2062 from object, not parameters.
2063 (Dwarf_info_reader::parse): Likewise.
2064 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2065 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2066 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2069 2012-10-23 Cary Coutant <ccoutant@google.com>
2071 * fileread.cc (Input_file::Input_file): New constructor.
2072 * fileread.h (class Input_file): Add new constructor.
2074 2012-10-18 Alan Modra <amodra@gmail.com>
2077 * object.cc (Relobj::is_section_name_included): Also match
2078 .sdata personality section.
2080 2012-10-18 Alan Modra <amodra@gmail.com>
2082 * target-reloc.h (class Default_comdat_behavior): New, package up..
2083 (get_comdat_behaviour): ..this.
2084 (relocate_section): Add Relocate_comdat_behavior template arg,
2085 adjust code to suit.
2086 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2087 (Target_arm::scan_reloc_section): Likewise.
2088 * i386.cc (Target_i386::relocate_section): Likewise.
2089 * sparc.cc (Target_sparc::relocate_section): Likewise.
2090 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2091 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2092 * powerpc.cc (class Relocate_comdat_behavior): New.
2093 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2094 gold::relocate_section with new template arg.
2096 2012-10-18 Alan Modra <amodra@gmail.com>
2098 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2099 dynamic relocs for GOT_TPREL got entries, without symbol if
2101 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2102 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2103 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2105 2012-10-17 Alan Modra <amodra@gmail.com>
2108 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2110 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2112 * layout.cc (Layout::include_section): Keep sections marked
2113 SHF_EXCLUDE when doing relocatable links.
2115 2012-10-16 Alan Modra <amodra@gmail.com>
2117 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2118 (Target_powerpc::do_finalize_sections): Call it.
2119 (Output_data_save_res): New class and supporting functions.
2120 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2121 normal symbols defined in object files.
2123 2012-10-12 Alan Modra <amodra@gmail.com>
2125 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2126 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2127 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2128 section if scan_opd_relocs not yet called.
2129 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2131 2012-10-12 Alan Modra <amodra@gmail.com>
2133 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2134 add_local_ifunc_entry): Revert last change.
2135 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2137 2012-10-05 Alan Modra <amodra@gmail.com>
2139 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2140 do_plt_address_for_global): New functions.
2141 (Output_data_got_powerpc::do_write): Don't segfault when linking
2143 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2144 add_local_ifunc_entry): Return true on adding entry..
2145 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2146 glink->add_entry call. Remove unused symtab param. Adjust calls.
2147 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2148 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2149 set up symbols here.
2150 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2151 syms here. Do so even when no .iplt. Don't segfault when linking
2153 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2154 new variants without reloc param.
2155 (Glink_sym_ent::Glink_sym_ent): Likewise.
2156 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2157 reloc when refs will resolve to plt call stub.
2158 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2159 R_PPC_PLTREL24 to resolve locally.
2160 (Target_powerpc::Scan::global): Correct ifunc handling.
2161 (Target_powerpc::Relocate::relocate): Correct local sym glink
2162 lookup. Don't destroy "value" when we have a plt call stub,
2163 and when checking plt call validity.
2164 (Target_powerpc::do_dynsym_value): Simplify.
2166 2012-10-05 Alan Modra <amodra@gmail.com>
2168 * i386.cc (Output_data_plt_i386::address_for_global,
2169 address_for_local): Add plt offset to returned value. Adjust uses.
2170 * sparc.cc (Output_data_plt_sparc::address_for_global,
2171 address_for_local): Likewise.
2172 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2173 address_for_local): Likewise.
2174 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2175 address_for_local): Likewise.
2176 * target.h (Target::plt_address_for_global, plt_address_for_local):
2178 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2179 (Output_data_got::Got_entry::write): Nor here.
2180 * output.h: Comment fix.
2182 2012-10-02 Jiong Wang <jiwang@tilera.com>
2184 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2185 global_offset_table_ value for larget got.
2186 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2188 2012-09-29 Alan Modra <amodra@gmail.com>
2190 * powerpc.cc (Target_powerpc::iplt_): New output section.
2191 (Target_powerpc::iplt_section, make_iplt_section,
2192 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2193 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2194 Target_powerpc::plt_entry_count): Count iplt entries too.
2195 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2196 reloc section in constructor. New params.
2197 (Target_powerpc::make_plt_section): Create reloc section here instead.
2198 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2200 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2201 (Output_data_glink::add_entry, find_entry): New functions to
2202 deal with local syms.
2203 (Glink_sym_ent): Add support for local syms.
2204 (Output_data_glink::do_write): Handle ifunc plt entries.
2205 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2206 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2207 (Target_powerpc::Relocate::relocate): Likewise.
2208 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2210 2012-09-25 Alan Modra <amodra@gmail.com>
2212 * object.h (Sized_relobj_file::adjust_local_symbol,
2213 do_adjust_local_symbol): New functions.
2214 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2215 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2216 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2217 and irregular opd entry spacing.
2218 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2219 (Global_symbol_visitor_opd): New functor.
2220 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2221 on deleted opd entries.
2223 2012-09-15 Jiong Wang <jiwang@tilera.com>
2225 * tilegx.cc: New file.
2226 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2227 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2228 * configure.tgt: Add entries for tilegx*.
2229 * configure.ac: Likewise.
2230 * Makefile.in: Rebuild.
2231 * configure: Likewise.
2232 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2235 2012-09-13 Alan Modra <amodra@gmail.com>
2237 * target-reloc.h (scan_relocs): Call scan.local for relocs
2238 against symbols in discarded sections. Pass is_discarded
2240 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2241 Add is_discarded param.
2242 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2243 is_discarded to flag opd entry as discarded. Don't emit dyn
2244 relocs on such entries.
2245 (Target_powerpc::Scan::global): Similarly detect and handle
2247 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2248 opd_ent_. Update all uses.
2249 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2250 (Target_powerpc::relocate_section): Zero out discarded opd
2253 2012-09-12 Ian Lance Taylor <iant@google.com>
2256 * output.cc: Rename Output_data_got template parameter from size
2257 to got_size for all functions. Compile all variants of
2259 (Output_data_got::Got_entry::write): Correct use of size for
2260 symbol value. Use local_is_tls rather than casting to
2262 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2263 (class Sized_relobj_file): Add do_local_is_tls.
2264 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2266 2012-09-11 Alan Modra <amodra@gmail.com>
2269 * layout.cc (Layout::set_segment_offsets): When using
2270 common-page-size alignment, ensure we are on a new max-page-size
2272 * output.cc (Output_segment::set_section_addresses): Use
2273 abi_pagesize, not common_pagesize for relro boundary.
2274 (Output_segment::set_offset): Likewise.
2276 2012-09-11 Alan Modra <amodra@gmail.com>
2278 * output.h (Output_data_got::add_global_tls, add_local_tls,
2279 add_local_tls_pair): New functions.
2280 (Output_data_got::add_local_pair_with_rel): Remove second
2281 reloc param. Expand comment.
2282 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2283 use_plt_or_tls_offset_, similarly for constructor param.
2284 (Output_data_got::Got_entry::write): Add got_index param.
2285 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2286 add_local_tls_pair): New functions.
2287 (Output_data_got::Got_entry::write): Handle tls symbols
2288 with use_plt_or_tls_offset_ set specially.
2289 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2290 (Output_data_got::do_write): Replace iterator with index, pass
2291 index to entry write function.
2292 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2293 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2294 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2296 * i386.cc (Target_i386::Scan::local): Likewise.
2297 * sparc.cc (Target_sparc::Scan::local): Likewise.
2298 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2299 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2300 do_tls_offset_for_global): New functions.
2301 (Target_powerpc::Scan::local): Correct TLS relocations and got
2303 (Target_powerpc::Scan::global): Don't emit unnecessary
2304 dynamic relocations on TLS GOT entries.
2306 2012-09-10 Matthias Klose <doko@ubuntu.com>
2308 * config.in: Disable sanity check for kfreebsd.
2310 2012-09-10 Sterling Augustine <saugustine@google.com>
2312 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2313 (Gdb_index::pubtypes_read): New parameter.
2314 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2316 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2319 2012-09-09 Alan Modra <amodra@gmail.com>
2321 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2322 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2323 * gc.h (gc_process_relocs): Call target gc_add_reference.
2324 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2325 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2326 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2328 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2329 to cater for when we don't need code offset. Update use.
2330 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2331 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2332 set_opd_valid): New functions.
2333 (Target_powerpc::do_gc_add_reference): New function.
2334 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2336 (Target_powerpc::do_gc_mark_symbol): New function.
2338 2012-09-06 Cary Coutant <ccoutant@google.com>
2340 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2341 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2342 (Dwarf_die::skip_attributes): Likewise.
2343 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2344 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2346 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2348 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2350 * testsuite/script_test_3.t: Add .got.plt output section
2352 * testsuite/script_test_4.t: Likewise.
2354 2012-09-05 Alan Modra <amodra@gmail.com>
2356 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2357 update all uses and lose "enum" when using type.
2359 2012-09-05 Alan Modra <amodra@gmail.com>
2361 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2362 * configure: Regenerate.
2363 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2364 (plugin_final_layout.stdout): Likewise.
2365 (memory_test): Set page sizes to 0x1000.
2366 * testsuite/Makefile.in: Regenerate.
2367 * testsuite/discard_locals_test.sh: Add FIXME comment.
2368 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2369 * testsuite/pr14265.t: Add .got output section statement.
2370 * testsuite/script_test_2.t: Likewise.
2371 * testsuite/script_test_3.t: Likewise.
2372 * testsuite/script_test_4.t: Likewise.
2373 * testsuite/script_test_5.t: Likewise.
2374 * testsuite/script_test_6.t: Likewise.
2375 * testsuite/script_test_7.t: Likewise.
2376 * testsuite/script_test_9.t: Likewise.
2378 2012-09-05 Alan Modra <amodra@gmail.com>
2380 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2381 (Powerpc_relocate_functions::Status): New typedef.
2382 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2383 (Target_powerpc::Scan::local): Handle REL64.
2384 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2385 for REL32 and REL64.
2386 (Target_powerpc::symval_for_branch): New function, extracted from..
2387 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2388 checks. Report overflow errors.
2390 2012-09-05 Alan Modra <amodra@gmail.com>
2392 * object.h (Sized_relobj_file::emit_relocs): Delete.
2393 (Sized_relobj_file::emit_relocs_reltype): Delete.
2394 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2395 relocate_relocs for --emit-relocs.
2396 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2397 * output.h: Update comment.
2398 (Output_segment::first_section): New function.
2399 (Output_segment::first_section_load_address): Use first_section.
2400 * output.cc (Output_segment::first_section): New function extracted..
2401 (Output_segment::first_section_load_address): ..from here. Delete.
2402 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2403 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2404 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2405 adjust call to target.h function.
2406 * i386.cc (Target_i386): Likewise.
2407 * sparc.cc (Target_sparc): Likewise.
2408 * x86_64.cc (Target_x86_64): Likewise.
2409 * powerpc.cc (Target_powerpc): Likewise.
2410 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2411 first tls section has section symbol for optimised local dynamic
2413 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2414 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2416 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2417 Rename to relocate_relocs. Update error message.
2419 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2421 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2424 2012-08-31 Alan Modra <amodra@gmail.com>
2426 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2427 (Powerpc_relobj::toc_base_offset): New stub function.
2428 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2429 got_mod_index_offset to tlsld_got_offset. Update all refs.
2430 (Target_powerpc::Relocate::enum skip_tls): New.
2431 (Target_powerpc::call_tls_get_addr_): New var.
2432 (Target_powerpc::is_branch_reloc): Move to file scope.
2433 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2434 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2436 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2437 (powerpc_info): Correct common_pagesize for ppc64.
2438 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2439 (Powerpc_relocate_functions): Add overflow check enums and functions.
2440 Add non-shift version of rela, rela_ua. Delete all rel public
2441 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2442 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2443 addr16_ha3, addr14 functions.
2444 (Output_data_got_powerpc::add_constant_pair): New function.
2445 (Output_data_got_powerpc::got_base_offset): Likewise.
2446 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2447 (instruction constants): Sort, add some more.
2448 (Output_data_glink::do_write): Add and use Address typedef. Use
2449 object->toc_base_offset() stub for 64-bit.
2450 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2451 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2452 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2453 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2454 Always treat .opd relocs as against locally defined symbol.
2455 Correct condition for RELATIVE relocs.
2456 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2457 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2458 for 32-bit syms with a plt entry. Correct ppc64 toc base
2459 calculations. Handle TLS relocs, and more. Add overflow
2460 checking and adjust for Powerpc_relocate_functions changes.
2461 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2462 Reinstate --emit-relocs code with FIXME.
2464 2012-08-30 Alan Modra <amodra@gmail.com>
2466 * layout.cc (Layout::set_segment_offsets): Set p_align to
2467 abi_pagesize, not common_pagesize.
2468 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2469 to determine whether file header can go in segment.
2471 2012-08-30 Alan Modra <amodra@gmail.com>
2473 * output.h (Output_reloc::Output_reloc <output section>): Add
2474 is_relative param. Adjust calls.
2475 (Output_reloc::add_output_section_relative): New functions.
2476 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2478 (Output_reloc::symbol_value): Handle SECTION_CODE.
2480 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2482 * gold.cc (queue_middle_tasks): Call layout again when unique
2483 segments for sections is desired.
2484 * layout.cc (Layout::Layout): Initialize new members.
2485 (Layout::get_output_section_flags): New function.
2486 (Layout::choose_output_section): Call get_output_section_flags.
2487 (Layout::layout): Make output section for mapping to a unique segment.
2488 (Layout::insert_section_segment_map): New function.
2489 (Layout::attach_allocated_section_to_segment): Make unique segment for
2490 output sections marked so.
2491 (Layout::segment_precedes): Check for unique segments when sorting.
2492 * layout.h (Layout::Unique_segment_info): New struct.
2493 (Layout::Section_segment_map): New typedef.
2494 (Layout::insert_section_segment_map): New function.
2495 (Layout::get_output_section_flags): New function.
2496 (Layout::is_unique_segment_for_sections_specified): New function.
2497 (Layout::set_unique_segment_for_sections_specified): New function.
2498 (Layout::unique_segment_for_sections_specified_): New member.
2499 (Layout::section_segment_map_): New member.
2500 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2501 Rename is_gc_pass_one to is_pass_one.
2502 Rename is_gc_pass_two to is_pass_two.
2503 Rename is_gc_or_icf to is_two_pass.
2504 Check for which pass based on whether symbols data is present.
2505 Make it two pass when unique segments for sections is desired.
2506 * output.cc (Output_section::Output_section): Initialize new
2508 * output.h (Output_section::is_unique_segment): New function.
2509 (Output_section::set_is_unique_segment): New function.
2510 (Output_section::is_unique_segment_): New member.
2511 (Output_section::extra_segment_flags): New function.
2512 (Output_section::set_extra_segment_flags): New function.
2513 (Output_section::extra_segment_flags_): New member.
2514 (Output_section::segment_alignment): New function.
2515 (Output_section::set_segment_alignment): New function.
2516 (Output_section::segment_alignment_): New member.
2517 (Output_segment::Output_segment): Initialize is_unique_segment_.
2518 (Output_segment::is_unique_segment): New function.
2519 (Output_segment::set_is_unique_segment): New function.
2520 (Output_segment::is_unique_segment_): New member.
2521 * plugin.cc (allow_unique_segment_for_sections): New function.
2522 (unique_segment_for_sections): New function.
2523 (Plugin::load): Add new functions to transfer vector.
2524 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2525 * Makefile.in: Regenerate.
2526 * testsuite/plugin_final_layout.sh: Check if unique segment
2527 functionality works.
2528 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2530 (allow_unique_segment_for_sections): New global.
2531 (unique_segment_for_sections): New global.
2532 (claim_file_hook): Call allow_unique_segment_for_sections.
2533 (all_symbols_read_hook): Call unique_segment_for_sections.
2535 2012-08-22 Cary Coutant <ccoutant@google.com>
2537 * layout.cc (Layout::include_section): Don't assert on GROUP
2538 sections with --emit-relocs.
2540 2012-08-21 Cary Coutant <ccoutant@google.com>
2542 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2543 if --export-dynamic-symbol names an undef symbol.
2545 2012-08-18 Alan Modra <amodra@gmail.com>
2547 * powerpc.cc: Formatting and white space.
2548 (Powerpc_relobj): Rename got2_section_ to special_.
2549 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2550 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2551 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2552 (Target_powerpc): Add Address typedef and invalid_address. Use
2554 (Target_powerpc::is_branch_reloc): New function.
2555 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2556 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2557 for dst_mask, value and addend.
2558 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2559 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2560 (Output_data_glink::do_write): Correct toc base. Don't try to use
2561 uint16_t for 24-bit offset. Use get_output_section_offset and
2563 (Target_powerpc::Scan::local): Handle more relocs.
2564 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2565 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2566 Plug in toc restoring insn after plt calls. Translate branches
2567 to function descriptor symbols to corresponding entry point.
2568 (Target_powerpc::relocate_for_relocatable): Check return from
2569 get_output_section_offset.
2570 * symtab.h: Comment typo.
2572 2012-08-14 Ian Lance Taylor <iant@google.com>
2574 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2575 unsupported_relocal_local to call unsupported_reloc_global.
2577 2012-08-14 Nick Clifton <nickc@redhat.com>
2580 * script-sections.cc (Sections_element::output_section_name): Add
2581 keep return parameter.
2582 (Output_section_element::match_name): Add keep return parameter.
2583 Return the value of the keep_ member.
2584 * script-sections.h (class Output_section): Update
2585 output_section_name prototype.
2586 * layout.cc (Layout::keep_input_section): New public member
2588 (Layout::choose_output_section): Pass keep parameter to
2589 output_section_name.
2590 * layout.h (class Layout): Add keep_input_section.
2591 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2593 * testsuite/Makefile.am: Add a test.
2594 * testsuite/Makefile.in: Regenerate.
2595 * testsuite/pr14265.c: Source file for the test.
2596 * testsuite/pr14265.t: Linker script for the test.
2597 * testsuite/pr14265.sh: Shell script for the test.
2599 2012-08-14 Alan Modra <amodra@gmail.com>
2601 * target.h (Target::output_section_name): New function.
2602 (Target::do_output_section_name): New function.
2603 * layout.cc (Layout::choose_output_section): Call the above.
2604 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2606 2012-08-14 Alan Modra <amodra@gmail.com>
2608 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2609 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2610 for replace_constant call.
2611 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2612 (Output_data_glink::do_print_to_mapfile): New function.
2613 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2614 (Target_powerpc::Relocate::relocate): Likewise.
2616 2012-08-14 Alan Modra <amodra@gmail.com>
2618 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2619 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2620 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2621 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2622 all references to shndx_. Handle special case for R_PPC_PLTREL24
2624 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2625 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2626 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2628 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2629 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2631 2012-08-12 Alan Modra <amodra@gmail.com>
2633 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2634 (glink insn constants): Use uint32_t.
2635 (Output_data_glink::add_entry): Use insert, not [] operator.
2637 2012-08-11 Alan Modra <amodra@gmail.com>
2639 * object.h (Sized_relobj_file::find_shdr): New function.
2640 (Sized_relobj_file::find_special_sections): New function.
2641 * object.cc (Sized_relobj_file::find_shdr): New function.
2642 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2643 (Sized_relobj_file::find_special_sections): New function, split out..
2644 (Sized_relobj_file::do_read_symbols): ..from here.
2645 * output.h (Output_data_got::replace_constant): New function.
2646 (Output_data_got::num_entries): New function.
2647 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2648 (Output_data_got::got_offset): Protected rather than private.
2649 (Output_data_got::replace_got_entry): New function.
2650 * output.cc (Output_data_got::replace_got_entry): New function.
2651 * powerpc.cc (class Powerpc_relobj): New.
2652 (class Powerpc_relocate_functions): Delete all psymval variants or
2653 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2654 Implement _ha functions using corresponding _hi function.
2655 (Powerpc_relobj::find_special_sections): New function.
2656 (Target_powerpc::do_make_elf_object): New function.
2657 (class Output_data_got_powerpc): New.
2658 (class Output_data_glink): New.
2659 (class Powerpc_scan_relocatable_reloc): New.
2660 Many more changes througout file.
2662 2012-08-09 Nick Clifton <nickc@redhat.com>
2664 * po/vi.po: Updated Vietnamese translation.
2666 2012-08-07 Ian Lance Taylor <iant@google.com>
2668 * layout.cc (Layout::add_target_dynamic_tags): If
2669 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2672 2012-07-30 Nick Clifton <nickc@redhat.com>
2674 * po/gold.pot: Updated template.
2675 * po/es.po: Updated Spanish translation.
2677 2012-07-18 Cary Coutant <ccoutant@google.com>
2680 * configure.ac: Add check for -gpubnames support.
2681 * configure: Regenerate.
2682 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2683 support; force -gno-pubnames.
2684 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2686 (gdb_index_test_4): New test.
2687 * testsuite/Makefile.in: Regenerate.
2688 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2689 * testsuite/gdb_index_test_2.sh: Likewise.
2690 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2691 * testsuite/gdb_index_test_4.sh: New script.
2692 * testsuite/gdb_index_test_comm.sh: New script with common code;
2693 don't look for space after colon.
2695 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2697 * gold.cc (queue_middle_tasks): Update function order only after
2698 deferred objects due to plugins are processed.
2700 2012-07-11 Ian Lance Taylor <iant@google.com>
2702 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2703 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2704 (Target_arm::scan_reloc_for_stub): Likewise.
2705 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2706 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2707 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2708 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2709 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2711 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2712 Ian Lance Taylor <iant@google.com>
2715 * configure.ac: Test whether std::tr1::hash<off_t> works.
2716 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2718 * output.h (class Output_fill): Add virtual destructor.
2719 * configure, config.in: Rebuild.
2721 2012-06-22 Roland McGrath <mcgrathr@google.com>
2723 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2725 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2727 * plugin.cc (Plugin::load): Handle position independent executables.
2729 2012-06-06 Cary Coutant <ccoutant@google.com>
2731 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2733 (lines_only_debug_sections): Likewise.
2734 (gdb_fast_lookup_sections): New static array.
2735 (is_gdb_debug_section): Rename formal parameter.
2736 (is_lines_only_debug_section): Likewise.
2737 (is_gdb_fast_lookup_section): New function.
2738 (Layout::include_section): Check for ".zdebug_" prefix; pass
2739 section name suffix to is_gdb_debug_section, et al.; check for
2740 fast-lookup sections when building .gdb_index.
2741 * options.h (--strip-debug-gdb): Update GDB version number.
2743 2012-06-06 Cary Coutant <ccoutant@google.com>
2745 * configure.ac: Add check for fallocate.
2746 * configure: Regenerate.
2747 * config.in: Regenerate.
2749 * options.h (class General_options): Add --mmap-output-file and
2750 --posix-fallocate options.
2751 * output.cc: (posix_fallocate): Remove; replace with...
2752 (gold_fallocate): New function.
2753 (Output_file::map_no_anonymous): Call gold_fallocate.
2754 (Output_file::map): Check --mmap-output-file option.
2756 2012-06-05 Jing Yu <jingyu@google.com>
2758 * gold.h (textdomain): Add do {} to empty while(0).
2759 (bindtextdomain): Likewise.
2761 2012-06-04 Cary Coutant <ccoutant@google.com>
2763 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2766 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2768 * symtab.cc (Symbol_table::define_special_symbol):
2769 Initialize *poldsym to prevent uninitialized variable errors.
2771 2012-05-23 Cary Coutant <ccoutant@google.com>
2773 * layout.cc (Layout::section_name_mapping): Add rules to handle
2774 exact match on .data.rel.ro.local or .data.rel.ro.
2775 (Layout::output_section_name): Check for exact matches.
2777 2012-05-23 Cary Coutant <ccoutant@google.com>
2779 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2782 2012-05-22 Cary Coutant <ccoutant@google.com>
2784 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2785 object before exporting symbol.
2787 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2789 * testsuite/tls_test.cc: Include "config.h" first.
2790 * testsuite/tls_test_c.c: Likewise.
2792 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2793 Nick Clifton <nickc@redhat.com>
2796 * configure.in: Add check that sysdep.h has been included before
2797 any system header files.
2798 * configure: Regenerate.
2799 * config.in: Regenerate.
2801 2012-05-14 Cary Coutant <ccoutant@google.com>
2803 * layout.cc (Layout::make_output_section): Mark .tdata section
2805 * testsuite/relro_test.cc: Add a TLS variable.
2807 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2810 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2811 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2814 2012-05-08 Cary Coutant <ccoutant@google.com>
2816 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2817 (lines_only_debug_sections): Likewise.
2819 2012-05-02 Roland McGrath <mcgrathr@google.com>
2821 * nacl.cc: New file.
2823 * Makefile.am (CCFILES, HFILES): Add them.
2824 * Makefile.in: Regenerate.
2825 * i386.cc (Output_data_plt_i386_nacl): New class.
2826 (Output_data_plt_i386_nacl_exec): New class.
2827 (Output_data_plt_i386_nacl_dyn): New class.
2828 (Target_i386_nacl): New class.
2829 (Target_selector_i386_nacl): New class.
2830 (target_selector_i386): Use it instead of Target_selector_i386.
2831 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2832 (Target_x86_64_nacl): New class.
2833 (Target_selector_x86_64_nacl): New class.
2834 (target_selector_x86_64, target_selector_x32): Use it instead of
2835 Target_selector_x86_64.
2836 * arm.cc (Output_data_plt_arm_nacl): New class.
2837 (Target_arm_nacl): New class.
2838 (Target_selector_arm_nacl): New class.
2839 (target_selector_arm, target_selector_armbe): Use it instead of
2840 Target_selector_arm.
2842 * target-select.cc (select_target): Take new Input_file* and off_t
2843 arguments, pass them on to recognize method of selector.
2844 * object.cc (make_elf_sized_object): Update caller.
2845 * parameters.cc (parameters_force_valid_target): Likewise.
2846 * incremental.cc (make_sized_incremental_binary): Likewise.
2847 * target-select.h: Update decl.
2848 (Target_selector::recognize): Take new Input_file* argument,
2849 pass it on to do_recognize.
2850 (Target_selector::do_recognize): Take new Input_file* argument.
2851 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2852 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2853 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2854 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2856 * target.h (Target::Target_info): New members isolate_execinstr
2858 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2859 * arm.cc (Target_arm::arm_info): Update initializer.
2860 * i386.cc (Target_i386::i386_info): Likewise.
2861 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2862 * sparc.cc (Target_sparc::sparc_info): Likewise.
2863 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2864 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2865 * layout.cc (Layout::attach_allocated_section_to_segment):
2866 Take new const Target* argument. If target->isolate_execinstr(), act
2868 (Layout::find_first_load_seg): Take new const Target* argument;
2869 if target->isolate_execinstr(), reject PF_X segments.
2870 (Layout::relaxation_loop_body): Update caller.
2871 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2872 reset file offset to zero when we hit LOAD_SEG, and then do a second
2873 loop over the segments before LOAD_SEG to reassign offsets after
2874 addresses have been determined. Handle target->rosegment_gap().
2875 (Layout::attach_section_to_segment): Take new const Target* argument;
2876 pass it to attach_allocated_section_to_segment.
2877 (Layout::make_output_section): Update caller.
2878 (Layout::attach_sections_to_segments): Take new const Target* argument;
2879 pass it to attach_section_to_segment.
2880 * gold.cc (queue_middle_tasks): Update caller.
2881 * layout.h (Layout): Update method decls with new arguments.
2883 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2884 Target_info pointer to use.
2885 (Target_arm::do_make_data_plt): New virtual method.
2886 (Target_arm::make_data_plt): New method that calls it.
2887 (Target_arm::make_plt_entry): Use it.
2888 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2889 for the section alignment.
2890 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2892 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2893 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2895 (Output_data_plt_arm::get_plt_entry_size): Call it.
2896 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2897 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2898 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2900 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2901 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2902 method instead of sizeof(plt_entry).
2903 (Output_data_plt_arm::add_entry): Likewise.
2904 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2905 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2907 (Target_arm::plt_entry_size): Likewise.
2908 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2910 (Output_data_plt_arm_standard): ... here, new class.
2911 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2912 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2913 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2915 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2916 Take additional argument for the PLT entry size.
2917 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2918 Use get_plt_entry_size method rather than plt_entry_size variable.
2919 (Output_data_plt_x86_64::reserve_slot): Likewise.
2920 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2921 (Output_data_plt_x86_64::add_entry): Likewise.
2922 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2923 (Output_data_plt_x86_64::address_for_global): Likewise.
2924 (Output_data_plt_x86_64::address_for_local): Likewise.
2925 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2926 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2927 Make method non-static.
2928 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2930 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2931 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2932 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2933 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2935 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2936 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2938 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2939 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2941 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2942 (Output_data_plt_x86_64::plt_entry_size)
2943 (Output_data_plt_x86_64::first_plt_entry)
2944 (Output_data_plt_x86_64::plt_entry)
2945 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2946 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2947 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2948 (Output_data_plt_x86_64_standard): ... here, new class.
2949 (Target_x86_64::Target_x86_64): Take optional argument for the
2950 Target_info pointer to use.
2951 (Target_x86_64::do_make_data_plt): New virtual method.
2952 (Target_x86_64::make_data_plt): New method to call it.
2953 (Target_x86_64::init_got_plt_for_update): Use that.
2954 Call this->plt_->add_eh_frame method here.
2955 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2956 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2957 rather than static method.
2958 (Target_x86_64::plt_entry_size): Likewise.
2959 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2960 rather than plt_entry_size variable. Move guts of PLT filling to...
2961 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2962 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2963 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2965 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2966 additional argument for the section alignment.
2967 Don't do add_eh_frame_for_plt here.
2968 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2969 non-static. Use get_plt_entry_size method rather than plt_entry_size
2971 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2973 (Output_data_plt_i386::get_plt_entry_size): Call it.
2974 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2975 (Output_data_plt_i386::add_eh_frame): New method to call it.
2976 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2978 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2979 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2981 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2982 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2983 method instead of plt_entry_size.
2984 (Output_data_plt_i386::plt_entry_size)
2985 (Output_data_plt_i386::plt_eh_frame_fde_size)
2986 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2987 (Output_data_plt_i386_standard): ... here, new class.
2988 (Output_data_plt_i386_exec): New class.
2989 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2990 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2991 (Output_data_plt_i386::exec_plt_entry): Move to ...
2992 (Output_data_plt_i386_exec::plt_entry): ... here.
2993 (Output_data_plt_i386_dyn): New class.
2994 (Output_data_plt_i386::first_plt_entry): Move to ...
2995 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2996 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2997 (Output_data_plt_i386_dyn::plt_entry): ... here.
2998 (Target_i386::Target_i386): Take optional argument for the Target_info
3000 (Target_i386::do_make_data_plt): New virtual method.
3001 (Target_i386::make_data_plt): New method to call it.
3002 (Target_i386::make_plt_section): Use that.
3003 Call this->plt_->add_eh_frame method here.
3004 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3005 rather than plt_entry_size variable.
3006 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3007 (Output_data_plt_i386::address_for_local): Likewise.
3008 (Output_data_plt_i386::do_write): Likewise.
3009 Move guts of PLT filling to...
3010 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3011 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3012 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3013 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3015 2012-05-01 Cary Coutant <ccoutant@google.com>
3017 * dwarf_reader.cc (Dwarf_die::read_attributes)
3018 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3019 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3020 * reduced_debug_output.cc
3021 (Output_reduced_debug_info_section::get_die_end): Remove
3022 DW_FORM_GNU_ref_index. Add default case.
3024 2012-04-26 Mark Wielaard <mjw@redhat.com>
3026 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3027 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3028 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3029 DW_AT_high_pc as offset from DW_AT_low_pc.
3031 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3032 * testsuite/Makefile.in: Regenerate.
3033 * testsuite/gdb_index_test_3.c: New test source file.
3034 * testsuite/gdb_index_test_3.sh: New test source file.
3036 2012-04-25 Ian Lance Taylor <iant@google.com>
3038 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3040 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3041 as a class, not a struct.
3042 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3043 (Target_arm::apply_cortex_a8_workaround): Likewise.
3044 * gc.h: Declare Reloc_types as a struct, not a class.
3045 * object.h: Declare Symbols_data as a struct.
3046 * reloc.h: Declare Read_relocs_data as a struct.
3047 * target.h: Declare Relocate_info as a struct.
3049 2012-04-24 David S. Miller <davem@davemloft.net>
3051 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3052 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3055 2012-04-24 Cary Coutant <ccoutant@google.com>
3057 * incremental-dump.cc (find_input_containing_global): Replace
3058 magic number with symbolic constant.
3059 (dump_incremental_inputs): Update version number.
3060 * incremental.cc (Output_section_incremental_inputs): Update version
3061 number; import symbolic constants from Incremental_inputs_reader.
3062 (Incremental_inputs::create_data_sections): Align relocations
3063 section correctly for 64-bit targets.
3064 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3065 constants; add padding.
3066 (Output_section_incremental_inputs::write_header): Add assert for
3068 (Output_section_incremental_inputs::write_input_files): Add assert
3069 for input_entry_size.
3070 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3071 add assert for object_info_size, input_section_entry_size,
3072 global_sym_entry_size.
3073 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3074 for data structure sizes; use them.
3075 (Incremental_input_entry_reader): Import symbolic constants from
3076 Incremental_inputs_reader; use them.
3078 2012-04-23 David S. Miller <davem@davemloft.net>
3080 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3082 (Target_sparc::Target_sparc): Initialize new fields.
3083 (Target_sparc::do_make_elf_object): New function.
3084 (Target_sparc::do_adjust_elf_header): New function.
3086 2012-04-23 Cary Coutant <ccoutant@google.com>
3088 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3089 CU range table of gdb index.
3091 2012-04-20 David S. Miller <davem@davemloft.net>
3093 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3096 2012-04-16 David S. Miller <davem@davemloft.net>
3098 * sparc.cc (Target_sparc::got_address): New function.
3099 (Sparc_relocate_functions::gdop_hix22): New function.
3100 (Sparc_relocate_functions::gdop_lox10): New function.
3101 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3103 (Target_sparc::Scan::local): Likewise if the global symbol is not
3104 preemptible and is not IFUNC.
3105 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3106 transformations for local and non-preemptible non-IFUNC global
3109 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3110 writing out 64-bit part of ranges.
3112 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3113 -fpic and -fpie respectively.
3114 * Makefile.in: Regenerate.
3116 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3117 (Target_sparc::Target_sparc): Initialize new field.
3118 (Target_sparc::do_plt_section_for_global): New function.
3119 (Target_sparc::do_plt_section_for_local): New function.
3120 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3121 (Target_sparc::make_plt_section): New function, broken out of
3122 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3123 (Target_sparc::make_plt_entry): Call make_plt_section.
3124 (Target_sparc::make_local_ifunc_plt_entry): New function.
3125 (Target_sparc::rela_ifunc_section): New function.
3126 (Target_sparc::plt_section): Remove const.
3127 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3128 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3129 and ifunc_count_ fields.
3130 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3131 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3132 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3133 (Output_data_plt_sparc::rela_ifunc): New function.
3134 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3135 (Output_data_plt_sparc::has_ifunc_section): New function.
3136 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3137 (Output_data_plt_sparc::address_for_global): New function.
3138 (Output_data_plt_sparc::address_for_local): New function.
3139 (Output_data_plt_sparc::plt_index_to_offset): New function.
3140 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3142 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3144 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3145 R_SPARC_JMP_IREL to switch.
3146 (Target_sparc::Scan::check_non_pic): Likewise.
3147 (Target_sparc::Scan::local): Handle IFUNC symbols.
3148 (Target_sparc::Scan::local): Likewise.
3149 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3150 and plt_address_for_local.
3151 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3152 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3154 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3155 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3156 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3157 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3159 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3160 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3162 * sparc.cc (Target_sparc::Scan::global): Likewise.
3163 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3165 2012-04-16 Cary Coutant <ccoutant@google.com>
3167 * archive.cc (Library_base::should_include_member): Check for
3168 --export-dynamic-symbol.
3169 * options.h (class General_options): Add --export-dynamic-symbol.
3170 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3171 --export-dynamic-symbol.
3172 (Symbol_table::gc_mark_undef_symbols): Likewise.
3173 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3175 2012-04-12 David S. Miller <davem@davemloft.net>
3177 * sparc.cc (Reloc::wdisp10): New relocation method.
3178 (Reloc::h34): Likewise.
3179 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3180 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3182 (Target_sparc::Scan::local): Likewise.
3183 (Target_sparc::Scan::global): Likewise.
3184 (Target_sparc::Relocate::relocate): Likewise.
3186 2012-04-09 Cary Coutant <ccoutant@google.com>
3188 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3191 2012-04-06 Ian Lance Taylor <iant@google.com>
3193 * timer.cc: #include <unistd.h>.
3195 2012-04-06 Roland McGrath <mcgrathr@google.com>
3197 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3198 * config.in: Regenerate.
3199 * configure: Regenerate.
3201 2012-04-05 Nick Clifton <nickc@redhat.com>
3203 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3204 (AM_LC_MESSAGES): Add.
3205 * aclocal.m4: Regenerate.
3206 * config.in: Regenerate.
3207 * configure: Regenerate.
3209 2012-03-21 Cary Coutant <ccoutant@google.com>
3211 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3212 * Makefile.in: Regenerate.
3213 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3214 (Sized_elf_reloc_mapper::symbol_section): New function.
3215 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3216 (make_elf_reloc_mapper): New function.
3217 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3218 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3219 (Dwarf_abbrev_table::do_get_abbrev): New function.
3220 (Dwarf_ranges_table::read_ranges_table): New function.
3221 (Dwarf_ranges_table::read_range_list): New function.
3222 (Dwarf_pubnames_table::read_section): New function.
3223 (Dwarf_pubnames_table::read_header): New function.
3224 (Dwarf_pubnames_table::next_name): New function.
3225 (Dwarf_die::Dwarf_die): New function.
3226 (Dwarf_die::read_attributes): New function.
3227 (Dwarf_die::skip_attributes): New function.
3228 (Dwarf_die::set_name): New function.
3229 (Dwarf_die::set_linkage_name): New function.
3230 (Dwarf_die::attribute): New function.
3231 (Dwarf_die::string_attribute): New function.
3232 (Dwarf_die::int_attribute): New function.
3233 (Dwarf_die::uint_attribute): New function.
3234 (Dwarf_die::ref_attribute): New function.
3235 (Dwarf_die::child_offset): New function.
3236 (Dwarf_die::sibling_offset): New function.
3237 (Dwarf_info_reader::check_buffer): New function.
3238 (Dwarf_info_reader::parse): New function.
3239 (Dwarf_info_reader::do_parse): New function.
3240 (Dwarf_info_reader::do_read_string_table): New function.
3241 (Dwarf_info_reader::lookup_reloc): New function.
3242 (Dwarf_info_reader::get_string): New function.
3243 (Dwarf_info_reader::visit_compilation_unit): New function.
3244 (Dwarf_info_reader::visit_type_unit): New function.
3245 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3246 Sized_elf_reloc_mapper.
3247 (Sized_dwarf_line_info::symbol_section): Remove function.
3248 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3249 (Sized_dwarf_line_info::read_line_mappings): Remove object
3250 parameter, adjust callers.
3251 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3252 * dwarf_reader.h: Include <sys/types.h>.
3253 (class Track_relocs): Remove forward declaration.
3254 (class Elf_reloc_mapper): New class.
3255 (class Sized_elf_reloc_mapper): New class.
3256 (class Dwarf_abbrev_table): New class.
3257 (class Dwarf_range_list): New class.
3258 (class Dwarf_ranges_table): New class.
3259 (class Dwarf_pubnames_table): New class.
3260 (class Dwarf_die): New class.
3261 (class Dwarf_info_reader): New class.
3262 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3263 (Sized_dwarf_line_info::symbol_section): Remove member function.
3264 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3266 * gdb-index.cc: New source file.
3267 * gdb-index.h: New source file.
3268 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3269 and .debug_types sections, call Layout::add_to_gdb_index.
3270 (Sized_relobj_incr::do_section_name): Implement.
3271 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3272 return type; Implement.
3273 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3275 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3276 parameter list and return type.
3277 (Sized_incr_dynobj::do_section_contents): Likewise.
3278 * layout.cc: Include gdb-index.h.
3279 (Layout::Layout): Initialize gdb_index_data_.
3280 (Layout::init_fixed_output_section): Check for .gdb_index section.
3281 (Layout::add_to_gdb_index): New function. Instantiate.
3282 * layout.h: Add forward declaration for class Gdb_index.
3283 (Layout::add_to_gdb_index): New member function.
3284 (Layout::gdb_index_data_): New data member.
3285 * main.cc: Include gdb-index.h.
3286 (main): Print statistics for gdb index.
3287 * object.cc (Object::section_contents): Move code into
3288 do_section_contents.
3289 (need_decompressed_section): Check for sections needed when building
3291 (build_compressed_section_map): Likewise.
3292 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3294 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3295 sections; call Layout::add_to_gdb_index.
3296 (Sized_relobj_file::do_decompressed_section_contents): Call
3297 do_section_contents directly.
3298 * object.h (Object::do_section_contents): Adjust parameter list and
3300 (Object::do_decompressed_section_contents): Call do_section_contents
3302 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3304 * options.h (class General_options): Add --gdb-index option.
3305 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3306 list and return type.
3307 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3308 * reloc.h (Track_relocs::checkpoint): New function.
3309 (Track_relocs::reset): New function.
3311 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3313 * testsuite/Makefile.in: Regenerate.
3314 * testsuite/gdb_index_test.cc: New test source file.
3315 * testsuite/gdb_index_test_1.sh: New test source file.
3316 * testsuite/gdb_index_test_2.sh: New test source file.
3318 2012-03-19 Doug Kwan <dougkwan@google.com>
3320 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3321 (Target_arm::do_finalize_sections): Remove code which defines
3322 __exidx_start and __exidx_end. Make symbol table parameter
3323 anonymous as it is not used.
3324 * gold.cc (queue_middle_tasks): Call target hook to define any
3325 target-specific symbols.
3326 * target.h (Target::define_standard_symbols): New method.
3327 (Target::do_define_standard_symbols): Same.
3328 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3329 * testsuite/Makefile.in: Regenerate.
3330 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3332 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3333 relocations are generated for __exidx_start and __exidx_end.
3335 2012-03-16 Doug Kwan <dougkwan@google.com>
3337 * testsuite/Makefile.am: Disable test initpri3b.
3338 * testsuite/Makefile.in: Regenerate.
3340 2012-03-15 Doug Kwan <dougkwan@google.com>
3342 * arm.cc (Target_arm::got_section): Make .got section read-only
3345 2012-03-15 Ian Lance Taylor <iant@google.com>
3348 * layout.cc (Layout::make_output_section): Correctly mark
3349 SHT_INIT_ARRAY, et. al., as relro.
3351 2012-03-14 Doug Kwan <dougkwan@google.com>
3353 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3354 dynamic relocations for protected symbols in shared objects.
3356 2012-03-13 Ian Lance Taylor <iant@google.com>
3358 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3359 keep the larger alignment.
3361 2012-03-12 Cary Coutant <ccoutant@google.com>
3363 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3364 handling of DW_LNE_define_file.
3366 2012-03-12 Cary Coutant <ccoutant@google.com>
3368 * reduced_debug_output.cc
3369 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3372 2012-02-29 Cary Coutant <ccoutant@google.com>
3374 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3376 2012-02-29 Cary Coutant <ccoutant@google.com>
3378 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3379 Call Object::decompressed_section_contents.
3380 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3382 (Sized_dwarf_line_info::buffer_start_): New data member.
3383 * merge.cc (Output_merge_data::do_add_input_section): Call
3384 Object::decompressed_section_contents.
3385 (Output_merge_string::do_add_input_section): Likewise.
3386 * object.cc (need_decompressed_section): New function.
3387 (build_compressed_section_map): Decompress sections needed later.
3388 (Sized_relobj_file::do_decompressed_section_contents): New function.
3389 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3390 * object.h (Object::decompressed_section_contents): New function.
3391 (Object::discard_decompressed_sections): New function.
3392 (Object::do_decompressed_section_contents): New function.
3393 (Object::do_discard_decompressed_sections): New function.
3394 (Compressed_section_info): New type.
3395 (Compressed_section_map): Include decompressed section contents.
3396 (Sized_relobj_file::do_decompressed_section_contents): New function.
3397 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3399 2012-02-16 Cary Coutant <ccoutant@google.com>
3401 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3402 * testsuite/Makefile.in: Regenerate.
3404 2012-02-14 Cary Coutant <ccoutant@google.com>
3406 * options.cc (General_options::finalize): Disallow -pie and -static.
3408 2012-02-03 Doug Kwan <dougkwan@google.com>
3410 * arm.cc (Arm_relocate_functions::abs8,
3411 Arm_relocate_functions::abs16): Use
3412 Bits::has_signed_unsigned_overflow32.
3413 (Arm_relocate_functions::thm_abs8): Correct range of
3415 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3418 2012-02-02 Doug Kwan <dougkwan@google.com>
3420 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3421 position independent outputs, not just shared objects.
3423 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3425 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3426 * configure: Regenerated.
3428 2012-01-27 Ian Lance Taylor <iant@google.com>
3430 * reloc.h (Bits): New class with static functions, copied from
3431 namespace utils in arm.cc.
3432 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3435 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3437 * incremental.cc (write_info_blocks): Correct relocation offset.
3439 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3441 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3442 (Relocate::tls_gd_to_le): Likewise.
3444 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3446 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3448 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3450 * configure.ac: Check if -mcmodel=medium works.
3451 * configure: Regenerated.
3453 2012-01-24 Cary Coutant <ccoutant@google.com>
3455 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3457 (read_unsigned_LEB_128_x): ... this new function.
3458 (read_signed_LEB_128): Replaced with inline definition and ...
3459 (read_signed_LEB_128_x): ... this new function.
3460 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3461 (read_unsigned_LEB_128): Add inline definition.
3462 (read_signed_LEB_128_x): New function.
3463 (read_signed_LEB_128): Add inline definition.
3464 * testsuite/Makefile.am (leb128_unittest): New unit test.
3465 * testsuite/Makefile.in: Regenerate.
3466 * testsuite/leb128_unittest.cc: New unit test.
3468 2012-01-23 Ian Lance Taylor <iant@google.com>
3471 * i386.cc (Target_i386::do_code_fill): When using a jmp
3472 instruction, pad with nop instructions.
3473 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3475 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3477 * x86_64.cc (gc_process_relocs): Add typename on types used in
3479 (scan_relocs): Likewise.
3480 (relocate_section): Likewise.
3481 (apply_relocation): Likewise.
3483 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3485 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3486 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3489 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3491 * x86_64.cc: Initial support for x32.
3493 2012-01-03 Cary Coutant <ccoutant@google.com>
3495 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3496 Use abstract base class for GOT.
3497 * gold/output.h (class Output_data_got_base): New abstract base class.
3498 (class Output_data_got): Derive from new base class, adjust ctors.
3499 (Output_data_got::reserve_slot): Make virtual; rename to
3500 do_reserve_slot; Adjust callers.
3501 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3502 pointer to abstract base class.
3503 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3505 2011-12-18 Ian Lance Taylor <iant@google.com>
3507 * object.h (Relobj::local_symbol_value): New function.
3508 (Relobj::local_plt_offset): New function.
3509 (Relobj::local_has_got_offset): New function.
3510 (Relobj::local_got_offset): New function.
3511 (Relobj::set_local_got_offset): New function.
3512 (Relobj::do_local_symbol_value): New pure virtual function.
3513 (Relobj::do_local_plt_offset): Likewise.
3514 (Relobj::do_local_has_got_offset): Likewise.
3515 (Relobj::do_local_got_offset): Likewise.
3516 (Relobj::do_set_local_got_offset): Likewise.
3517 (Sized_relobj::do_local_has_got_offset): Rename from
3518 local_has_got_offset.
3519 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3520 (Sized_relobj::do_set_local_got_offset): Rename from
3521 set_local_got_offset.
3522 (Sized_relobj_file::do_local_plt_offset): Rename from
3524 (Sized_relobj_file::do_local_symbol_value): New function.
3525 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3527 * output.cc (Output_data_got::Got_entry::write): Change object to
3528 Relobj. Use local_symbol_value.
3529 (Output_data_got::add_global_with_rel): Change rel_dyn to
3530 Output_data_reloc_generic*. Use add_global_generic.
3531 (Output_data_got::add_global_with_rela): Remove. Change all
3532 callers to use add_global_with_rel.
3533 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3534 Output_data_reloc_generic*. Use add_global_generic.
3535 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3536 callers to use add_global_pair_with_rel.
3537 (Output_data_got::add_local): Change object to Relobj*.
3538 (Output_data_got::add_local_plt): Likewise.
3539 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3540 change rel_dyn to Output_data_reloc_generic*. Use
3542 (Output_data_got::add_local_with_rela): Remove. Change all
3543 callers to use all_local_with_rel.
3544 (Output_data_got::add_local_pair_with_rel): Change object to
3545 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3546 add_output_section_generic.
3547 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3548 callers to use add_local_pair_with_rel.
3549 (Output_data_got::reserve_local): Change object to Relobj*.
3550 * output.h: (class Output_data_reloc_generic): Add pure virtual
3551 declarations for add_global_generic, add_local_generic,
3552 add_output_section_generic.
3553 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3554 functions for Output_data_reloc_generic. Update declarations for
3555 changes listed in output.cc.
3556 (class Output_data_got): Change template parameter to got_size.
3557 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3558 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3560 (Sized_relobj_incr::do_local_plt_offset): New function.
3561 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3564 2011-12-17 Cary Coutant <ccoutant@google.com>
3566 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3567 * resolve.cc (Symbol_table::resolve): Likewise.
3568 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3570 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3572 2011-12-16 Ian Lance Taylor <iant@google.com>
3574 * output.h (Output_data_reloc_generic::add): Only call
3575 add_dynamic_reloc if this is a dynamic reloc section.
3577 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3580 * target-reloc.h (apply_relocation): Replace <64, false> with
3583 2011-11-25 Nick Clifton <nickc@redhat.com>
3585 * po/it.po: New Italian translation.
3587 2011-11-17 Sterling Augustine <saugustine@google.com>
3589 * script.cc (script_include_directive): Implement.
3590 (read_script_file): New local variables name and search_path. Update
3591 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3592 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3593 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3595 2011-11-11 Sterling Augustine <saugustine@google.com>
3597 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3598 (file_or_sections_cmd): Likewise.
3600 2011-11-11 Doug Kwan <dougkwan@google.com>
3602 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3603 if --just-symbols is given.
3605 2011-11-10 Doug Kwan <dougkwan@google.com>
3608 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3609 when processing data relocs.
3610 * reloc.h (Relocate_functions::rel_unaligned): New method.
3611 (Relocate_functions::pcrel_unaligned): Ditto.
3612 (Relocate_functions::rel32_unaligned): Ditto.
3613 (Relocate_functions::pcrel32_unaligned): Ditto.
3615 2011-11-09 Doug Kwan <dougkwan@google.com>
3618 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3619 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3620 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3621 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3622 (Relocate_functions::rel_unaligned): New.
3623 (Relocate_functions::rel32_unaligned): New.
3624 * target-reloc.h (relocate_for_relocatable): Add code to handle
3625 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3626 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3627 arm_unaligned_reloc_r): New targets.
3628 * testsuite/Makefile.in: Regenerate.
3629 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3632 2011-11-02 Ian Lance Taylor <iant@google.com>
3634 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3636 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3637 * options.cc (General_options::finalize): Use library search path
3638 from configure script if specified. If not native and no sysroot,
3639 only search TOOLLIBDIR.
3640 * options.h (Search_directory::Search_directory): Change name to
3642 (General_options::add_to_library_path_with_sysroot): Change arg to
3644 * configure, Makefile.in, config.in: Rebuild.
3646 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3648 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3649 we are working around the ARM1176 Erratum.
3650 * options.h (General_options::fix_arm1176): Add option.
3651 * testsuite/Makefile.am: Add testcases, and keep current ones
3653 * testsuite/Makefile.in: Regenerate.
3654 * testsuite/arm_fix_1176.s: New file.
3655 * testsuite/arm_fix_1176.sh: Likewise.
3657 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3659 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3661 (Target_arm::may_use_blx): Remove method.
3662 (Target_arm::set_may_use_blx): Likewise.
3663 (Target_arm::may_use_v4t_interworking): New method.
3664 (Target_arm::may_use_v5t_interworking): Likewise.
3665 (Target_arm::may_use_blx_): Remove member variable.
3666 (Arm_relocate_functions::arm_branch_common): Check for v5T
3668 (Arm_relocate_functions::thumb_branch_common): Likewise.
3669 (Reloc_stub::stub_type_for_reloc): Likewise.
3670 (Target_arm::do_finalize_sections): Correct interworking checks.
3671 * testsuite/Makefile.am: Add new tests.
3672 * testsuite/Makefile.in: Regenerate.
3673 * testsuite/arm_farcall_arm_arm.s: New test.
3674 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3675 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3676 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3677 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3678 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3679 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3680 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3682 2011-10-31 Cary Coutant <ccoutant@google.com>
3685 * expression.cc (Expression::eval_with_dot): Add
3686 is_section_dot_assignment parameter.
3687 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3688 absolute and assigning to dot within a section.
3689 * script-sections.cc
3690 (Output_section_element_assignment::set_section_addresses): Pass
3691 dot_section to set_if_absolute.
3692 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3693 as is_section_dot_assignment flag to eval_with_dot.
3694 (Output_section_element_dot_assignment::set_section_addresses):
3696 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3697 parameter. Also set value if relative to dot_section; set the
3698 symbol's output_section.
3699 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3700 parameter. Adjust all callers.
3701 (Expression::eval_maybe_dot): Likewise.
3702 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3704 * testsuite/script_test_2.t: Test assignment of an absolute value
3705 to dot within an output section element.
3707 2011-10-31 Cary Coutant <ccoutant@google.com>
3709 * options.h (class General_options): Add --[no-]gnu-unique options.
3710 * symtab.cc (Symbol_table::sized_write_globals): Convert
3711 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3713 2011-10-31 Cary Coutant <ccoutant@google.com>
3716 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3717 unnecessary assertion.
3718 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3720 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3722 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3724 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3726 Change to just keep the section associated with symbol.
3727 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3728 they are externally visible and --export-dynamic is turned on.
3729 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3731 2011-10-19 Ian Lance Taylor <iant@google.com>
3734 * script-sections.cc
3735 (Output_section_element_dot_assignment::needs_output_section): New
3738 2011-10-19 Ian Lance Taylor <iant@google.com>
3741 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3742 --section-start option was seen.
3743 * options.h (General_options::any_section_start): New function.
3745 2011-10-18 David S. Miller <davem@davemloft.net>
3748 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3749 member to track relocation locations that have moved during TLS
3750 reloc optimizations.
3751 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3752 (Target_sparc::Relocate::relocate): Adjust view down by 4
3753 bytes if it matches reloc_adjust_addr_.
3754 (Target_sparc::Relocate::relocate_tls): Always move the
3755 __tls_get_addr call delay slot instruction forward 4 bytes when
3756 performing relaxation.
3758 2011-10-18 Cary Coutant <ccoutant@google.com>
3760 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3761 (Output_file::map_no_anonymous): Check for non-zero
3762 return code from posix_fallocate.
3764 2011-10-17 Cary Coutant <ccoutant@google.com>
3767 * plugin.cc (is_visible_from_outside): Check for symbols
3768 referenced from dynamic objects.
3769 * resolve.cc (Symbol_table::resolve): Don't count references
3770 from dynamic objects as references from real ELF files.
3771 * testsuite/plugin_test_2.sh: Adjust expected result.
3773 2011-10-17 Cary Coutant <ccoutant@google.com>
3775 * gold.cc: Include timer.h.
3776 (queue_middle_tasks): Stamp time.
3777 (queue_final_tasks): Likewise.
3778 * main.cc (main): Store timer in parameters. Print timers
3780 * parameters.cc (Parameters::Parameters): Initialize timer_.
3781 (Parameters::set_timer): New function.
3782 (set_parameters_timer): New function.
3783 * parameters.h (Parameters::set_timer): New function.
3784 (Parameters::timer): New function.
3785 (Parameters::timer_): New data member.
3786 (set_parameters_timer): New function.
3787 * timer.cc (Timer::stamp): New function.
3788 (Timer::get_pass_time): New function.
3789 * timer.h (Timer::stamp): New function.
3790 (Timer::get_pass_time): New function.
3791 (Timer::pass_times_): New data member.
3793 2011-10-17 Cary Coutant <ccoutant@google.com>
3795 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3796 task for members of lib groups.
3798 2011-10-17 Cary Coutant <ccoutant@google.com>
3801 * fileread.cc (File_read::find_view): Add assert.
3802 (File_read::make_view): Move bounds check (replace with assert)...
3803 (File_read::find_or_make_view): ... to here.
3805 2011-10-12 Cary Coutant <ccoutant@google.com>
3807 * output.cc (Output_file::open_base_file): Handle case where
3808 ::read returns less than requested size.
3810 2011-10-10 Cary Coutant <ccoutant@google.com>
3812 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3813 Initialize defined_count_.
3814 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3815 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3816 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3817 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3818 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3819 * incremental.h (Sized_relobj_incr::defined_count_): New data
3821 (Sized_incr_dynobj::defined_count_): New data member.
3822 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3823 Return zeroes instead of internal error.
3825 2011-10-10 Cary Coutant <ccoutant@google.com>
3828 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3829 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3830 * output.h (class Output_reloc): Add use_plt_offset flag.
3831 (Output_reloc::type_): Adjust size of bit field.
3832 (Output_reloc::use_plt_offset_): New bit field.
3833 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3834 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3835 flag. Adjust all callers.
3836 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3837 creating RELATIVE relocations.
3839 2011-10-10 Nick Clifton <nickc@redhat.com>
3841 * po/es.po: Updated Spanish translation.
3842 * po/fi.po: Updated Finnish translation.
3844 2011-10-03 Diego Novillo <dnovillo@google.com>
3846 * options.cc (parse_uint): Fix dereference of RETVAL.
3848 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3850 * layout.h (section_order_map_): New member.
3851 (get_section_order_map): New member function.
3852 * output.cc (Output_section::add_input_section): Check for patterns
3853 only when --section-ordering-file is specified.
3854 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3855 output_sections have been formed.
3856 * layout.cc (Layout_Layout): Initialize section_order_map_.
3857 * plugin.cc (update_section_order): Store order in order_map. Do not
3859 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3860 * testsuite/Makefile.in: Regenerate.
3861 * testsuite/plugin_section_order.c: New file.
3862 * testsuite/plugin_final_layout.cc: New file.
3863 * testsuite/plugin_final_layout.sh: New file.
3865 2011-09-29 Cary Coutant <ccoutant@google.com>
3867 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3869 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3870 symbols during incremental update.
3871 (Symbol_table::add_from_dynobj): Likewise.
3873 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3874 Ian Lance Taylor <iant@google.com>
3876 * symtab.cc (Symbol_table::define_special_symbol): Always
3877 canonicalize version string.
3879 2011-09-26 Cary Coutant <ccoutant@google.com>
3881 * gold.cc (queue_initial_tasks): Move option checks ...
3882 * options.cc (General_options::finalize): ... to here. Disable
3883 some options; make others fatal.
3885 2011-09-26 Cary Coutant <ccoutant@google.com>
3888 * plugin.cc (get_symbols_v2): New function.
3889 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3890 (is_referenced_from_outside): New function.
3891 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3892 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3893 (get_symbols): Pass version parameter.
3894 (get_symbols_v2): New function.
3895 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3897 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3898 (onload): Add LDPT_GET_SYMBOLS_V2.
3899 (all_symbols_read_hook): Use get_symbols_v2; check for
3900 LDPR_PREVAILING_DEF_IRONLY_EXP.
3901 * testsuite/plugin_test_3.sh: Update expected results.
3903 2011-09-23 Simon Baldwin <simonb@google.com>
3905 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3906 configuration options.
3907 * configure: Regenerate.
3908 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3909 * Makefile.in: Regenerate.
3910 * testsuite/Makefile.in: Regenerate.
3912 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3914 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3916 2011-09-19 Cary Coutant <ccoutant@google.com>
3918 * incremental.cc (can_incremental_update): Fix typo in comment.
3919 * incremental.h (can_incremental_update): Likewise.
3921 2011-09-18 Cary Coutant <ccoutant@google.com>
3923 * incremental.cc (can_incremental_update): New function.
3924 * incremental.h (can_incremental_update): New function.
3925 * layout.cc (Layout::init_fixed_output_section): Call it.
3926 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3927 * object.cc (Sized_relobj_file::do_layout): Call
3928 can_incremental_update.
3930 2011-09-13 Cary Coutant <ccoutant@google.com>
3932 * configure.ac: Check for glibc support for gnu_indirect_function
3933 support with static linking, setting automake conditional
3935 * Makefile.in: Regenerate.
3936 * configure: Regenerate.
3938 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3939 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3941 * testsuite/Makefile.in: Regenerate.
3943 2011-09-13 Cary Coutant <ccoutant@google.com>
3945 * incremental.cc (Sized_relobj_incr::do_layout): Call
3946 report_comdat_group for kept comdat sections.
3947 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3948 * testsuite/Makefile.in: Regenerate.
3949 * testsuite/incr_comdat_test_1.cc: New source file.
3950 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3951 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3952 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3954 2011-09-13 Ian Lance Taylor <iant@google.com>
3956 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3957 variable external_symbols_offset.
3959 2011-09-12 Ian Lance Taylor <iant@google.com>
3961 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3962 triggered if object has no symbols.
3964 2011-09-09 David S. Miller <davem@davemloft.net>
3966 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3967 (Output_fill_debug_line::do_write): Likewise.
3969 2011-08-29 Cary Coutant <ccoutant@google.com>
3971 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3972 casts to match formatting specs.
3973 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3975 2011-08-26 Cary Coutant <ccoutant@google.com>
3977 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3978 remaining hole size when allocating.
3979 (Layout::make_output_section): Set fill methods for debug sections.
3980 * layout.h (Free_list::Free_list_node): Move from private to
3982 (Free_list::set_min_hole_size): New function.
3983 (Free_list::begin, Free_list::end): New functions.
3984 (Free_list::min_hole_): New data member.
3985 * output.cc: Include dwarf.h.
3986 (Output_fill_debug_info::do_minimum_hole_size): New function.
3987 (Output_fill_debug_info::do_write): New function.
3988 (Output_fill_debug_line::do_minimum_hole_size): New function.
3989 (Output_fill_debug_line::do_write): New function.
3990 (Output_section::Output_section): Initialize new data member.
3991 (Output_section::set_final_data_size): Ensure patch space is larger
3992 than minimum hole size.
3993 (Output_section::do_write): Fill holes in debug sections.
3994 * output.h (Output_fill): New class.
3995 (Output_fill_debug_info): New class.
3996 (Output_fill_debug_line): New class.
3997 (Output_section::set_free_space_fill): New function.
3998 (Output_section::free_space_fill_): New data member.
3999 * testsuite/Makefile.am (incremental_test_3): Add
4000 --incremental-patch option.
4001 (incremental_test_4): Likewise.
4002 (incremental_test_5): Likewise.
4003 (incremental_test_6): Likewise.
4004 (incremental_copy_test): Likewise.
4005 (incremental_common_test_1): Likewise.
4006 * testsuite/Makefile.in: Regenerate.
4008 2011-08-26 Nick Clifton <nickc@redhat.com>
4010 * po/es.po: Updated Spanish translation.
4012 2011-08-01 Cary Coutant <ccoutant@google.com>
4014 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4015 * gold/testsuite/Makefile.in: Regenerate.
4016 * gold/testsuite/justsyms_exec.c: New source file.
4017 * gold/testsuite/justsyms_lib.c: New source file.
4019 2011-08-01 Cary Coutant <ccoutant@google.com>
4021 * layout.cc (Layout::set_segment_offsets): Don't realign text
4022 segment if -Ttext was specified.
4023 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4025 * object.h (Sized_relobj_file::e_type): New function.
4026 (Sized_relobj_file::e_type_): New data member.
4027 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4028 base address for ET_EXEC files.
4029 * target.cc (Target::do_make_elf_object_implementation): Allow
4030 ET_EXEC files with --just-symbols option.
4032 2011-07-28 Cary Coutant <ccoutant@google.com>
4034 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4035 Add thread_number parameter.
4036 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4037 * workqueue-threads.cc
4038 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4039 current thread if its thread number is greater than desired thread
4041 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4042 Add thread_number parameter.
4043 (Workqueue::should_cancel_thread): Likewise.
4044 (Workqueue::find_runnable_or_wait): Pass thread_number to
4045 should_cancel_thread.
4046 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4049 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4051 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4052 only after checking if it cannot be forced local.
4053 * symtab.h (is_externally_visible): Check if the symbol is not forced
4056 2011-07-15 Ian Lance Taylor <iant@google.com>
4058 * options.h (class General_options): Add --print-output-format.
4059 Move -EL next to -EB, for better --help output.
4060 * target-select.cc: Include <cstdio>, "options.h", and
4062 (Target_selector::do_target_bfd_name): New function.
4063 (print_output_format): New function.
4064 * target-select.h (class Target_selector): Update declarations.
4065 (Target_selector::target_bfd_name): New function.
4066 (print_output_format): Declare.
4067 * main.cc: Include "target-select.h".
4068 (main): Handle --print-output-format.
4069 * gold.cc: Include "target-select.h".
4070 (queue_initial_tasks): Handle --print-output-format when there are
4072 * parameters.cc (parameters_force_valid_target): Give a better
4073 error message if -EB/-EL does not match target.
4074 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4077 2011-07-15 Ian Lance Taylor <iant@google.com>
4079 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4080 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4081 (Output_data_plt_i386::do_write): Write address of .dynamic
4082 section to first entry in .got.plt section.
4083 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4084 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4086 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4087 section to first entry in .got.plt section.
4088 * layout.h (Layout::dynamic_section): New function.
4090 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4092 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4094 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4095 input_section_position_, and input_section_glob_.
4096 (read_layout_from_file): Call function section_ordering_specified.
4097 * layout.h (is_section_ordering_specified): New function.
4098 (section_ordering_specified): New function.
4099 (section_ordering_specified_): New boolean member.
4100 * main.cc(main): Call load_plugins after layout object is defined.
4101 * output.cc (Output_section::add_input_section): Use
4102 function section_ordering_specified to check if section ordering is
4104 * output.cc (Output_section::add_relaxed_input_section): Use
4105 function section_ordering_specified to check if section ordering is
4107 (Output_section::update_section_layout): New function.
4108 (Output_section::sort_attached_input_sections): Check if input section
4110 * output.h (Output_section::update_section_layout): New function.
4111 * plugin.cc (get_section_count): New function.
4112 (get_section_type): New function.
4113 (get_section_name): New function.
4114 (get_section_contents): New function.
4115 (update_section_order): New function.
4116 (allow_section_ordering): New function.
4117 (Plugin::load): Add the new interfaces to the transfer vector.
4118 (Plugin_manager::load_plugins): New parameter.
4119 (Plugin_manager::all_symbols_read): New parameter.
4120 (Plugin_manager::claim_file): New parameter. Save the elf object for
4122 (Plugin_manager::get_elf_object): New function.
4123 (Plugin_manager::get_view): Change to directly use the bool to check
4124 if get_view is called from claim_file_hook.
4125 * plugin.h (input_objects): New function
4126 (Plugin__manager::load_plugins): New parameter.
4127 (Plugin_manager::claim_file): New parameter.
4128 (Plugin_manager::get_elf_object): New function.
4129 (Plugin_manager::in_claim_file_handler): New function.
4130 (Plugin_manager::in_claim_file_handler_): New member.
4131 (layout): New function.
4132 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4133 handler with an extra parameter. Make the elf object before calling
4135 * testsuite/plugin_test.c (get_section_count): New function pointer.
4136 (get_section_type): New function pointer.
4137 (get_section_name): New function pointer.
4138 (get_section_contents): New function pointer.
4139 (update_section_order): New function pointer.
4140 (allow_section_ordering): New function pointer.
4141 (onload): Check if the new interfaces exist.
4143 2011-07-13 Ian Lance Taylor <iant@google.com>
4145 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4147 * x86_64.cc (Target_x86_64::got_section): Likewise.
4148 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4149 (relro_now_test_SOURCES): New variable.
4150 (relro_now_test_DEPENDENCIES): New variable.
4151 (relro_now_test_LDFLAGS): New variable.
4152 (relro_now_test_LDADD): New variable.
4153 (relro_now_test.so): New target.
4154 * testsuite/Makefile.in: Rebuild.
4156 2011-07-12 Ian Lance Taylor <iant@google.com>
4159 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4160 GLOB_DAT relocation rather than a RELATIVE relocation for a
4161 protected symbol when creating a shared library.
4162 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4163 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4164 * testsuite/protected_main_1.cc (main): Test that protected
4165 function has same address.
4167 2011-07-11 Ian Lance Taylor <iant@google.com>
4170 * options.h (class General_options): Add -Bgroup.
4171 * options.cc (General_options::finalize): If -Bgroup is set,
4172 default to --unresolved-symbols=report-all.
4173 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4174 * target-reloc.h (issue_undefined_symbol_error): Handle
4175 --unresolved-symbols=report-all.
4177 2011-07-08 Ian Lance Taylor <iant@google.com>
4180 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4181 if linker script discards key sections.
4182 (Layout::create_dynamic_symtab): Likewise.
4183 (Layout::assign_local_dynsym_offsets): Likewise.
4184 (Layout::sized_create_version_sections): Likewise.
4185 (Layout::create_interp): Likewise.
4186 (Layout::finish_dynamic_section): Likewise.
4187 (Layout::set_dynamic_symbol_size): Likewise.
4189 2011-07-08 Ian Lance Taylor <iant@google.com>
4192 * options.h (class General_options): Add --unresolved-symbols.
4193 * target-reloc.h (issue_undefined_symbol_error): Check
4194 --unresolved-symbols. Add comments.
4196 2011-07-08 Ian Lance Taylor <iant@google.com>
4198 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4199 expression more complex.
4201 2011-07-08 Ian Lance Taylor <iant@google.com>
4204 * target-reloc.h (issue_undefined_symbol_error): New inline
4205 function, broken out of relocate_section.
4206 (relocate_section): Call issue_undefined_symbol_error.
4207 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4208 there is no TLS segment if we are about to issue an undefined
4210 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4212 2011-07-08 Ian Lance Taylor <iant@google.com>
4215 * resolve.cc (Symbol_table::should_override): Add fromtype
4216 parameter. Change all callers. Give error when linking together
4217 TLS and non-TLS symbol.
4218 (Symbol_table::should_override_with_special): Add fromtype
4219 parameter. Change all callers.
4220 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4221 there is no TLS segment if we have reported some errors.
4222 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4224 2011-07-08 Ian Lance Taylor <iant@google.com>
4227 * target.h (Target::plt_address_for_global): New function.
4228 (Target::plt_address_for_local): New function.
4229 (Target::plt_section_for_global): Remove.
4230 (Target::plt_section_for_local): Remove.
4231 (Target::do_plt_address_for_global): New virtual function.
4232 (Target::do_plt_address_for_local): New virtual function.
4233 (Target::do_plt_section_for_global): Remove.
4234 (Target::do_plt_section_for_local): Remove.
4235 (Target::register_global_plt_entry): Add Symbol_table and Layout
4237 * output.cc (Output_data_got::Got_entry::write): Use
4238 plt_address_for_global and plt_address_for_local.
4239 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4240 address of output section.
4241 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4242 got_irelative_, and irelative_count_ fields. Update
4244 (Output_data_plt_i386::has_irelative_section): New function.
4245 (Output_data_plt_i386::entry_count): Add irelative_count_.
4246 (Output_data_plt_i386::set_final_data_size): Likewise.
4247 (class Target_i386): Add got_irelative_ and rel_irelative_
4248 fields. Update declarations.
4249 (Target_i386::Target_i386): Initialize new fields.
4250 (Target_i386::do_plt_address_for_global): New function replacing
4251 do_plt_section_for_global.
4252 (Target_i386::do_plt_address_for_local): New function replacing
4253 do_plt_section_for_local.
4254 (Target_i386::got_section): Create got_irelative_.
4255 (Target_i386::rel_irelative_section): New function.
4256 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4257 fields. Don't define __rel_iplt_{start,end}.
4258 (Output_data_plt_i386::add_entry): Add symtab and layout
4259 parameters. Change all callers. Use different PLT and GOT for
4261 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4262 layout parameters. Change all callers. Use different PLT and
4264 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4265 (Output_data_plt_i386::rel_irelative): New function.
4266 (Output_data_plt_i386::address_for_global): New function.
4267 (Output_data_plt_i386::address_for_local): New function.
4268 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4269 IRELATIVE GOT when changing IFUNC GOT entries.
4270 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4272 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4273 if we didn't create an IRELATIVE GOT.
4274 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4275 plt_address_for_local.
4276 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4277 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4278 got_irelative_, and irelative_count_ fields. Update
4280 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4281 Initialize new fields. Remove symtab parameter. Change all
4283 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4285 (Output_data_plt_x86_64::has_irelative_section): New function.
4286 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4287 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4288 fields. Update declarations.
4289 (Target_x86_64::Target_x86_64): Initialize new fields.
4290 (Target_x86_64::do_plt_address_for_global): New function replacing
4291 do_plt_section_for_global.
4292 (Target_x86_64::do_plt_address_for_local): New function replacing
4293 do_plt_section_for_local.
4294 (Target_x86_64::got_section): Create got_irelative_.
4295 (Target_x86_64::rela_irelative_section): New function.
4296 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4297 all callers. Don't create __rel_iplt_{start,end}.
4298 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4299 parameters. Change all callers. Use different PLT and GOT for
4301 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4302 layout parameters. Change all callers. Use different PLT and
4304 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4305 parameters. Change all callers. Use different PLT and GOT for
4307 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4308 (Output_data_plt_x86_64::rela_irelative): New function.
4309 (Output_data_plt_x86_64::address_for_global): New function.
4310 (Output_data_plt_x86_64::address_for_local): New function.
4311 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4312 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4313 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4314 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4316 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4318 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4319 symbols if we didn't create an IRELATIVE GOT.
4320 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4321 plt_address_for_local.
4322 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4323 * testsuite/ifuncvar1.c: New test file.
4324 * testsuite/ifuncvar2.c: New test file.
4325 * testsuite/ifuncvar3.c: New test file.
4326 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4327 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4328 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4329 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4330 * testsuite/Makefile.in: Rebuild.
4332 2011-07-07 Cary Coutant <ccoutant@google.com>
4334 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4335 (two_file_test_1_ndebug.o): Likewise.
4336 (two_file_test_1b_ndebug.o): Likewise.
4337 (two_file_test_2_ndebug.o): Likewise.
4338 (two_file_test_main_ndebug.o): Likewise.
4339 (incremental_test_2): Link with no-debug versions.
4341 2011-07-06 Cary Coutant <ccoutant@google.com>
4343 * gold/incremental.cc
4344 (Output_section_incremental_inputs::write_info_blocks): Check for
4345 hidden and internal symbols.
4347 2011-07-06 Cary Coutant <ccoutant@google.com>
4349 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4350 Check disposition for startup file.
4351 (Incremental_inputs::report_command_line): Ignore
4352 --incremental-startup-unchanged option.
4353 * options.cc (General_options::parse_incremental_startup_unchanged):
4355 (General_options::General_options): Initialize new data member.
4356 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4357 (General_options): Add --incremental-startup-unchanged option.
4358 (General_options::incremental_startup_disposition): New function.
4359 (General_options::incremental_startup_disposition_): New data member.
4361 2011-07-06 Cary Coutant <ccoutant@google.com>
4363 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4364 input file index to Script_info ctor.
4365 (Sized_incremental_binary::do_file_has_changed): Find the
4366 command-line argument for files named in scripts.
4367 * incremental.h (Script_info::Script_info): New ctor
4368 with input file index.
4369 (Script_info::input_file_index): New function.
4370 (Script_info::input_file_index_): New data member.
4371 (Incremental_binary::get_library): Add const.
4372 (Incremental_binary::get_script_info): Add const.
4373 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4374 * testsuite/Makefile.am (incremental_test_5): New test case.
4375 (incremental_test_6): New test case.
4376 * testsuite/Makefile.in: Regenerate.
4378 2011-07-06 Cary Coutant <ccoutant@google.com>
4380 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4381 debug output when command lines differ.
4383 2011-07-06 Cary Coutant <ccoutant@google.com>
4385 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4386 --incremental-patch option.
4387 * layout.cc (Free_list::allocate): Extend allocation beyond original
4389 (Layout::make_output_section): Mark sections that should get
4391 * options.cc (parse_percent): New function.
4392 * options.h (parse_percent): New function.
4393 (DEFINE_percent): New macro.
4394 (General_options): Add --incremental-patch option.
4395 * output.cc (Output_section::Output_section): Initialize new data
4397 (Output_section::add_input_section): Print section name when out
4399 (Output_section::add_output_section_data): Likewise.
4400 (Output_section::set_final_data_size): Add patch space when
4401 doing --incremental-full.
4402 (Output_section::do_reset_address_and_file_offset): Remove patch
4404 (Output_segment::set_section_list_addresses): Print debug output
4405 only if --incremental-update.
4406 * output.h (Output_section::set_is_patch_space_allowed): New function.
4407 (Output_section::is_patch_space_allowed_): New data member.
4408 (Output_section::patch_space_): New data member.
4409 * parameters.cc (Parameters::incremental_full): New function.
4410 * parameters.h (Parameters::incremental_full): New function
4411 * testsuite/Makefile.am (incremental_test_2): Add test for
4412 --incremental-patch option.
4413 * testsuite/Makefile.in: Regenerate.
4414 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4415 (t18): Remove function body.
4417 2011-07-05 Doug Kwan <dougkwan@google.com>
4420 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4421 Arm_Address type for relocation result.
4422 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4424 (Arm_relocate_functions::abs32): Use unaligned access.
4425 (Arm_relocate_functions::rel32): Ditto.
4426 (Arm_relocate_functions::prel31): Ditto.
4427 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4428 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4429 static data relocations.
4430 * testsuite/Makefile.in: Regnerate.
4431 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4433 2011-07-05 Ian Lance Taylor <iant@google.com>
4436 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4437 symbols if necessary.
4438 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4440 2011-07-05 Ian Lance Taylor <iant@google.com>
4443 * resolve.cc (Symbol::override_base_with_special): Simply override
4444 version with special symbol version, ignoring previous version.
4446 2011-07-05 Ian Lance Taylor <iant@google.com>
4448 * object.cc (Sized_relobj_file::include_section_group): Add
4449 information to comment about signature location.
4451 2011-07-02 Ian Lance Taylor <iant@google.com>
4454 * options.h (class General_options): Add -f and -F.
4455 * options.cc (General_options::finalize): Fatal error if -f/-F
4456 are used without -shared.
4457 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4459 2011-07-02 Ian Lance Taylor <iant@google.com>
4461 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4463 2011-07-01 Ian Lance Taylor <iant@google.com>
4467 * resolve.cc (Symbol::override_base_with_special): Don't override
4468 the version if the overriding symbol has a different name.
4469 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4470 all callers. If we give an error about an undefined version,
4471 define the base version if necessary.
4472 * dynobj.h (class Versions): Update declaration.
4473 * testsuite/weak_alias_test_5.cc: New file.
4474 * testsuite/weak_alias_test.script: New file.
4475 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4476 and versioned_alias have the right value, and call t2.
4477 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4478 weak_alias_test_5.so.
4479 (weak_alias_test_LDADD): Likewise.
4480 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4481 * testsuite/Makefile.in: Rebuild.
4483 2011-07-01 Ian Lance Taylor <iant@google.com>
4486 * options.h (class General_options): Support -z notext.
4487 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4489 (two_file_shared_nonpic.so): Likewise.
4490 (two_file_shared_mixed.so): Likewise.
4491 (two_file_shared_mixed_1.so): Likewise.
4492 (weak_undef_lib_nonpic.so): Likewise.
4493 (alt/weak_undef_lib_nonpic.so): Likewise.
4494 (tls_test_shared_nonpic.so): Likewise.
4495 * testsuite/Makefile.in: Rebuild.
4497 2011-07-01 Ian Lance Taylor <iant@google.com>
4500 * configure.ac: Test whether static linking works, setting
4501 the automake conditional HAVE_STATIC.
4502 * testsuite/Makefile.am: Disable tests using -static if
4503 HAVE_STATIC is not true.
4504 * configure, testsuite/Makefile.in: Rebuild.
4506 2011-07-01 Ian Lance Taylor <iant@google.com>
4509 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4510 Assert if we see DW_EH_PE_indirect.
4511 * target.h (Target::ehframe_datarel_base): New function.
4512 (Target::do_ehframe_datarel_base): New target function.
4513 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4514 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4517 2011-07-01 Ian Lance Taylor <iant@google.com>
4520 * options.h (class General_options): Add
4521 --ld-generated-unwind-info.
4522 * ehframe.cc (Fde::write): Add address parameter. Change all
4523 callers. If associated with PLT, fill in address and size.
4524 (Cie::set_output_offset): Only add merge mapping if there is an
4526 (Cie::write): Add address parameter. Change all callers.
4527 (Eh_frame::add_ehframe_for_plt): New function.
4528 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4529 input_offset_ fields into union u_, with new plt field.
4530 (Fde::Fde): Adjust for new union field.
4531 (Fde::Fde) [Output_data version]: New constructor.
4532 (Fde::add_mapping): Only add merge mapping if there is an object.
4533 (class Cie): Update declarations.
4534 (class Eh_frame): Declare add_ehframe_for_plt.
4535 * layout.cc (Layout::layout_eh_frame): Break out code into
4536 make_eh_frame_section, and call it.
4537 (Layout::make_eh_frame_section): New function.
4538 (Layout::add_eh_frame_for_plt): New function.
4539 * layout.h (class Layout): Update declarations.
4540 * merge.cc (Merge_map::add_mapping): Add assertion.
4541 * i386.cc: Include "dwarf.h".
4542 (class Output_data_plt_i386): Make first_plt_entry,
4543 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4544 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4545 and plt_eh_frame_fde.
4546 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4547 boundary. Call add_eh_frame_for_plt if appropriate.
4548 * x86_64.cc: Include "dwarf.h".
4549 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4550 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4551 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4552 and plt_eh_frame_fde.
4553 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4556 2011-06-29 Ian Lance Taylor <iant@google.com>
4559 * object.cc (Sized_relobj_file::layout_section): Change shdr
4560 parameter to be const.
4561 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4563 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4564 appropriate. Call layout_eh_frame_section.
4565 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4567 * object.h (class Sized_relobj_file): Update declarations.
4569 2011-06-29 Ian Lance Taylor <iant@google.com>
4572 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4574 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4576 2011-06-29 Ian Lance Taylor <iant@google.com>
4579 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4581 * layout.cc (Layout::layout_eh_frame): Likewise.
4583 2011-06-29 Ian Lance Taylor <iant@google.com>
4586 * layout.cc (Layout::symtab_section_shndx): New function.
4587 * layout.h (class Layout): Declare symtab_section_shndx.
4588 * output.cc (Output_section::write_header): Call it.
4590 2011-06-29 Ian Lance Taylor <iant@google.com>
4593 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4594 symbols which are not used in a relocation.
4596 2011-06-28 Ian Lance Taylor <iant@google.com>
4599 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4600 script create indistinguishable segments.
4601 (Layout::set_segment_offsets): Use stable_sort when sorting
4602 segments. Pass this to Compare_segments constructor.
4603 * layout.h (class Layout): Make segment_precedes non-static.
4604 (class Compare_segments): Change from struct to class. Add
4605 layout_ field. Add constructor.
4606 * script-sections.cc
4607 (Script_sections::attach_sections_using_phdrs_clause): Rename
4608 local orphan to is_orphan. Don't report failure to put empty
4609 section in segment. On attachment failure, report name of
4610 section, and attach to first PT_LOAD segment.
4612 2011-06-28 Ian Lance Taylor <iant@google.com>
4615 * target-select.cc (Target_selector::Target_selector): Add
4616 emulation parameter. Change all callers.
4617 (select_target_by_bfd_name): Rename from select_target_by_name.
4619 (select_target_by_emulation): New function.
4620 (supported_emulation_names): New function.
4621 * target-select.h (class Target_selector): Add emulation_ field.
4622 Update declarations.
4623 (Target_selector::recognize_by_bfd_name): Rename from
4624 recognize_by_name. Change all callers.
4625 (Target_selector::supported_bfd_names): Rename from
4626 supported_names. Change all callers.
4627 (Target_selector::recognize_by_emulation): New function.
4628 (Target_selector::supported_emulations): New function.
4629 (Target_selector::emulation): New function.
4630 (Target_selector::do_recognize_by_bfd_name): Rename from
4631 do_recognize_by_name. Change all callers.
4632 (Target_selector::do_supported_bfd_names): Rename from
4633 do_supported_names. Change all callers.
4634 (Target_selector::do_recognize_by_emulation): New function.
4635 (Target_selector::do_supported_emulations): New function.
4636 (select_target_by_bfd_name): Change name in declaration.
4637 (select_target_by_emulation): Declare.
4638 (supported_emulation_names): Declare.
4639 * parameters.cc (parameters_force_valid_target): Try to find
4640 target based on emulation from -m option.
4641 * options.h (class General_options): Change doc string for -m.
4642 * options.cc (help): Print emulations.
4643 (General_options::parse_V): Likewise.
4644 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4645 Add emulation parameter. Change all callers.
4647 2011-06-28 Ian Lance Taylor <iant@google.com>
4649 * target.h (class Target): Add osabi_ field.
4650 (Target::osabi): New function.
4651 (Target::set_osabi): New function.
4652 (Target::Target): Initialize osabi_.
4653 (Target::do_adjust_elf_header): Make pure virtual.
4654 (Sized_target::do_adjust_elf_header): Declare.
4655 * target.cc (Sized_target::do_adjust_elf_header): New function.
4656 (class Sized_target): Instantiate all versions.
4657 * freebsd.h (class Target_freebsd): Remove.
4658 (Target_selector_freebsd::do_recognize): Call set_osabi on
4660 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4661 (Target_selector_freebsd::set_osabi): Remove.
4662 * i386.cc (class Target_i386): Inherit from Sized_target rather
4663 than Target_freebsd.
4664 * x86_64.cc (class Target_x86_64): Likewise.
4666 2011-06-28 Ian Lance Taylor <iant@google.com>
4668 * target.h (Target::can_check_for_function_pointers): Rewrite.
4670 (Target::can_icf_inline_merge_sections): Likewise.
4671 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4672 (Target::Target_info): Add can_icf_inline_merge_sections field.
4673 (Target::do_can_check_for_function_pointers): New virtual
4675 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4676 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4677 from can_check_for_function_pointers, move in file.
4678 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4679 section_may_have_icf_unsafe_poineters, move in file.
4680 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4681 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4682 Rename from can_check_for_function_pointers, move in file.
4683 (Target_i386::can_icf_inline_merge_sections): Remove.
4684 (Target_i386::i386_info): Initialize
4685 can_icf_inline_merge_sections.
4686 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4687 Initialize can_icf_inline_merge_sections.
4688 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4689 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4690 Rename from can_check_for_function_pointers, move in file.
4691 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4692 (Target_x86_64::x86_64_info): Initialize
4693 can_icf_inline_merge_sections.
4694 * testsuite/testfile.cc (Target_test::test_target_info):
4696 * icf.cc (get_section_contents): Correct formatting.
4698 2011-06-27 Ian Lance Taylor <iant@google.com>
4700 * symtab.cc (Symbol::versioned_name): New function.
4701 (Symbol_table::add_to_final_symtab): Use versioned_name when
4703 (Symbol_table::sized_write_symbol): Likewise.
4704 * symtab.h (class Symbol): Declare versioned_name.
4705 * stringpool.h (class Stringpool_template): Add variant of add
4706 which takes a std::basic_string.
4707 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4708 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4709 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4710 (ver_test_12.o): New target.
4711 * testsuite/Makefile.in: Rebuild.
4713 2011-06-27 Doug Kwan <dougkwan@google.com>
4715 * arm.cc (Arm_relocate_functions::thm_jump8,
4716 Arm_relocate_functions::thm_jump11): Use a wider signed
4717 type to compute offset.
4718 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4720 * testsuite/Makefile.in: Regenerate.
4721 * testsuite/arm_branch_in_range.sh: Check test results of
4722 arm_thm_jump11 and arm_thm_jump8.
4723 * testsuite/arm_thm_jump11.s: New test source file.
4724 * testsuite/arm_thm_jump11.t: New linker script.
4725 * testsuite/arm_thm_jump8.s: New test source file.
4726 * testsuite/arm_thm_jump8.t: New linker script.
4728 2011-06-24 Ian Lance Taylor <iant@google.com>
4730 * layout.cc: Include "object.h".
4731 (ctors_sections_in_init_array): New static variable.
4732 (Layout::is_ctors_in_init_array): New function.
4733 (Layout::layout): Add entry to ctors_sections_in_init_array if
4735 * layout.h (class Layout): Declare is_ctors_in_init_array.
4736 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4737 is_ctors_reverse_view is set.
4738 (Sized_relobj_file::write_sections): Add layout parameter. Change
4739 all callers. Set is_ctors_reverse_view field of View_size.
4740 (Sized_relobj_file::reverse_words): New function.
4741 * object.h (Sized_relobj_file::View_size): Add
4742 is_ctors_reverse_view field.
4743 (class Sized_relobj_file): Update declarations.
4744 * testsuite/initpri3.c: New test.
4745 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4747 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4748 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4749 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4750 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4751 * testsuite/Makefile.in: Rebuild.
4753 2011-06-24 Cary Coutant <ccoutant@google.com>
4755 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4756 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4757 (debug_msg_cdebug.err): New targets.
4758 * testsuite/Makefile.in: Regenerate.
4759 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4760 Fix checks for link with shared library.
4762 2011-06-24 Doug Kwan <dougkwan@google.com>
4764 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4765 skip empty text sections.
4766 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4768 2011-06-22 Ian Lance Taylor <iant@google.com>
4771 * options.h (class General_options): Add --ctors-in-init-array.
4772 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4773 friends as SHT_PROGBITS for merging sections.
4774 (Layout::layout): Remove special handling of .init_array and
4775 friends. Don't sort if doing relocatable link. Sort for .ctors
4776 and .dtors if ctors_in_init_array.
4777 (Layout::make_output_section): Force correct section types for
4778 .init_array and friends. Don't sort if doing relocatable link,
4779 Don't sort .ctors and .dtors if ctors_in_init_array.
4780 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4781 (Layout::output_section_name): Add relobj parameter. Change all
4782 callers. Handle .ctors. and .dtors. in code rather than table.
4783 Handle .ctors and .dtors if ctors_in_init_array.
4784 (Layout::match_file_name): New function, moved from output.cc.
4785 * layout.h (class Layout): Update declarations.
4786 * output.cc: Include "layout.h".
4787 (Input_section_sort_entry::get_priority): New function.
4788 (Input_section_sort_entry::match_file_name): Just call
4789 Layout::match_file_name.
4790 (Output_section::Input_section_sort_init_fini_compare::operator()):
4791 Handle .ctors and .dtors. Sort by explicit priority rather than
4793 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4794 * testsuite/initpri2.c: New test.
4795 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4796 (check_PROGRAMS): Add initpri2.
4797 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4798 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4799 * configure, testsuite/Makefile.in: Rebuild.
4801 2011-06-19 Ian Lance Taylor <iant@google.com>
4804 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4805 .interp section to a PT_INTERP segment even if we have seen a
4806 --dynamic-linker option. Don't do it if we have seen a PHDRS
4807 clause in a linker script.
4808 (Layout::finalize): Don't create a .interp section if we've
4809 already create a PT_INTERP segment.
4810 (Layout::create_interp): Always call choose_output_section (revert
4811 patch of 2011-06-17). Don't create PT_INTERP segment.
4812 * script-sections.cc
4813 (Script_sections::create_note_and_tls_segments): Add a .interp
4814 section to a PT_INTERP segment even if we have seen a
4815 --dynamic-linker option.
4817 2011-06-18 Ian Lance Taylor <iant@google.com>
4819 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4820 merely because a non-PT_LOAD segment has a dynamic reloc.
4822 2011-06-18 Ian Lance Taylor <iant@google.com>
4824 * layout.cc (Layout::finish_dynamic_section): Don't create
4825 DT_FLAGS entry if not needed.
4827 2011-06-18 Ian Lance Taylor <iant@google.com>
4830 * layout.cc (Layout::layout_eh_frame): Correct handling of
4831 writable .eh_frame section.
4833 2011-06-17 Ian Lance Taylor <iant@google.com>
4836 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4837 symbol is redefined with the exact same object and value.
4839 2011-06-17 Ian Lance Taylor <iant@google.com>
4842 * layout.h (class Layout): Add interp_segment_ field.
4843 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4844 (Layout::attach_allocated_section_to_segment): If making shared
4845 library, put .interp section in PT_INTERP segment.
4846 (Layout::finalize): Also call create_interp if -dynamic-linker
4848 (Layout::create_interp): Assert that there is no PT_INTERP
4849 segment. If not using a SECTIONS clause, use make_output_section.
4850 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4851 * script-sections.cc
4852 (Script_sections::create_note_and_tls_segments): If making shared
4853 library, put .interp section in PT_INTERP segment.
4855 2011-06-17 Ian Lance Taylor <iant@google.com>
4857 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4858 when making a shared library.
4860 2011-06-17 Ian Lance Taylor <iant@google.com>
4862 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4863 parameter. Change all callers. Don't issue warning about PC32
4864 against locally defined symbol.
4866 2011-06-16 Ian Lance Taylor <iant@google.com>
4868 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4869 occurs in same object.
4871 2011-06-14 Alan Modra <amodra@gmail.com>
4873 * po/POTFILES.in: Regenerate.
4875 2011-06-09 Ian Lance Taylor <iant@google.com>
4877 * script-sections.cc
4878 (Orphan_output_section::set_section_addresses): For a relocatable
4879 link set address to 0.
4881 2011-06-09 Cary Coutant <ccoutant@google.com>
4884 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4885 used with --compress-debug-sections.
4886 * gold/object.cc (Sized_relobj_file::do_layout): Report
4887 uncompressed size of compressed input sections.
4889 2011-06-08 Cary Coutant <ccoutant@google.com>
4892 * testsuite/two_file_test_2_v1.cc: Change initialization of
4893 v2 to keep it in .data.
4895 2011-06-07 Cary Coutant <ccoutant@google.com>
4897 * common.cc (Symbol_table::do_allocate_commons_list): Call
4899 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4900 (Errors::fallback): New function.
4901 (gold_fallback): New function.
4902 * errors.h (Errors::fallback): New function.
4903 * gold.cc (gold_exit): Change status parameter to enum; adjust
4905 (queue_initial_tasks): Call gold_fallback.
4906 * gold.h: Include cstdlib.
4907 (Exit_status): New enum type.
4908 (gold_exit): Change status parameter to enum.
4909 (gold_fallback): New function.
4910 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4911 (Layout::create_symtab_sections): Likewise.
4912 (Layout::create_shdrs): Likewise.
4913 * main.cc (main): Adjust call to gold_exit.
4914 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4915 (Output_data_got::add_got_entry_pair): Likewise.
4916 (Output_section::add_input_section): Likewise.
4917 (Output_section::add_output_section_data): Likewise.
4918 (Output_segment::set_section_list_addresses): Likewise.
4919 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4921 2011-06-07 Cary Coutant <ccoutant@google.com>
4923 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4924 for incremental links.
4925 * output.cc (Output_segment::set_section_list_addresses): Remove
4926 FIXME and test for TLS or BSS.
4928 2011-06-07 Cary Coutant <ccoutant@google.com>
4930 * testsuite/Makefile.am: Add incremental_copy_test,
4931 incremental_common_test_1.
4932 * testsuite/Makefile.in: Regenerate.
4933 * testsuite/common_test_1_v1.c: New source file.
4934 * testsuite/common_test_1_v2.c: New source file.
4935 * testsuite/copy_test_v1.cc: New source file.
4937 2011-06-07 Cary Coutant <ccoutant@google.com>
4939 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4940 update, allocate common from bss section's free list.
4941 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4942 linker-defined symbols.
4943 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4944 Skip GOT and PLT entries that are no longer referenced.
4945 (Output_section_incremental_inputs::write_info_blocks): Mark
4946 linker-defined symbols.
4947 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4948 * output.cc (Output_section::allocate): New function.
4949 * output.h (Output_section::allocate): New function.
4950 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4951 linker-defined symbols.
4952 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4953 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4954 (Symbol::init_base_output_data): Likewise.
4955 (Symbol::init_base_output_segment): Likewise.
4956 (Symbol::init_base_constant): Likewise.
4957 (Sized_symbol::init_output_data): Likewise.
4958 (Sized_symbol::init_output_segment): Likewise.
4959 (Sized_symbol::init_constant): Likewise.
4960 (Symbol_table::do_define_in_output_data): Likewise.
4961 (Symbol_table::do_define_in_output_segment): Likewise.
4962 (Symbol_table::do_define_as_constant): Likewise.
4963 * symtab.h (Symbol::is_predefined): New function.
4964 (Symbol::init_base_output_data): Add is_predefined parameter.
4965 (Symbol::init_base_output_segment): Likewise.
4966 (Symbol::init_base_constant): Likewise.
4967 (Symbol::is_predefined_): New data member.
4968 (Sized_symbol::init_output_data): Add is_predefined parameter.
4969 (Sized_symbol::init_output_segment): Likewise.
4970 (Sized_symbol::init_constant): Likewise.
4971 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4973 2011-06-07 Cary Coutant <ccoutant@google.com>
4975 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4976 instead of emit_copy_reloc.
4977 (Copy_relocs::emit_copy_reloc): Refactor.
4978 (Copy_relocs::make_copy_reloc): New function.
4979 (Copy_relocs::add_copy_reloc): Remove.
4980 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4982 (Copy_relocs::make_copy_reloc): New function.
4983 (Copy_relocs::add_copy_reloc): Remove.
4984 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4985 unchanged input files.
4986 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4987 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4988 Reserve BSS space for COPY relocations.
4989 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4990 (Output_section_incremental_inputs::write_info_blocks): Record
4991 whether a symbol is copied from a shared object.
4992 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4993 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4994 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4995 (Incremental_input_entry_reader::get_output_symbol_index): Add
4997 (Incremental_binary::emit_copy_relocs): New function.
4998 (Incremental_binary::do_emit_copy_relocs): New function.
4999 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5001 (Sized_incremental_binary::add_copy_reloc): New function.
5002 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5003 (Sized_incremental_binary::Copy_reloc): New struct.
5004 (Sized_incremental_binary::Copy_relocs): New typedef.
5005 (Sized_incremental_binary::copy_relocs_): New data member.
5006 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5007 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5008 * target.h (Sized_target::emit_copy_reloc): New function.
5009 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5011 2011-06-02 Cary Coutant <ccoutant@google.com>
5014 * gold/archive.cc (Archive::Archive): Initialize new data member.
5015 (Archive::include_all_members): Return if archive has already been
5017 * gold/archive.h (Archive::include_all_members_): New data member.
5019 2011-06-02 Nick Clifton <nickc@redhat.com>
5021 * dynobj.h: Fix spelling mistake in comment.
5022 * output.cc: Likewise.
5024 2011-05-31 Doug Kwan <dougkwan@google.com>
5028 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5029 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5030 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5031 redundant arm_exidx_test.so.
5032 * testsuite/Makefile.in: Regenerate.
5033 (check_SCRIPTS): Add pr12826.sh
5034 (check_DATA): Add pr12826.stdout
5035 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5036 * testsuite/pr12826.sh: New file.
5037 * testsuite/pr12826_1.s: Ditto.
5038 * testsuite/pr12826_1.s: Ditto.
5040 2011-05-30 Ian Lance Taylor <iant@google.com>
5042 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5045 2011-05-29 Ian Lance Taylor <iant@google.com>
5048 * testsuite/Makefile.am: Use different file name for two_file_test
5049 temporary file for each incremental test.
5050 * testsuite/Makefile.in: Rebuild.
5052 2011-05-29 Ian Lance Taylor <iant@google.com>
5054 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5055 binary input file is empty.
5057 2011-05-27 Ian Lance Taylor <iant@google.com>
5059 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5060 (ver_test_9.so): Likewise.
5061 * testsuite/Makefile.in: Rebuild.
5063 2011-05-26 Cary Coutant <ccoutant@google.com>
5065 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5066 * incremental.cc (Incremental_inputs::report_input_section): Fix
5067 comment, indentation.
5068 (Incremental_inputs::report_comdat_group): New function.
5069 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5070 of data for incremental input file entry.
5071 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5072 group count, COMDAT group signatures.
5073 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5074 an unchanged input file.
5075 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5076 Initialize new data member.
5077 (Incremental_object_entry::add_comdat_group): New function.
5078 (Incremental_object_entry::get_comdat_group_count): New function.
5079 (Incremental_object_entry::get_comdat_signature_key): New function.
5080 (Incremental_object_entry::groups_): New data member.
5081 (Incremental_inputs::report_comdat_group): New function.
5082 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5083 data for incremental input file entry.
5084 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5085 (Incremental_input_entry_reader::get_input_section): Adjust size of
5086 data for incremental input file entry.
5087 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5088 (Incremental_input_entry_reader::get_comdat_group_signature): New
5090 * object.cc (Sized_relobj::include_section_group): Report kept
5091 COMDAT groups for incremental links.
5093 2011-05-24 David Meyer <pdox@google.com>
5095 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5096 with name parameter. Add found_name parameter.
5097 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5098 * dirsearch.h (class Dirsearch): Update declaration.
5100 2011-05-24 Ian Lance Taylor <iant@google.com>
5102 * archive.cc (Library_base::should_include_member): Pull in object
5103 from archive if it defines the entry symbol.
5104 * parameters.cc (Parameters::entry): New function.
5105 * parameters.h (class Parameters): Declare entry.
5106 * output.h (class Output_file_header): Remove entry_ field.
5107 * output.cc (Output_file_header::Output_file_header): Remove entry
5108 parameter. Change all callers.
5109 (Output_file_header::entry): Use parameters->entry.
5110 * gold.cc (queue_middle_tasks): Likewise.
5111 * plugin.cc (Plugin_hook::run): Likewise.
5113 2011-05-24 Cary Coutant <ccoutant@google.com>
5115 * gold.cc (queue_initial_tasks): Pass incremental base filename
5116 to Output_file::open_base_file; don't print error message.
5117 * incremental-dump.cc (main): Adjust call to
5118 Output_file::open_for_modification.
5119 * incremental-dump.cc (main): Likewise.
5120 * incremental.cc (Incremental_inputs::report_command_line):
5121 Ignore --incremental-base option when comparing command lines.
5122 Ignore parameter when given as separate argument.
5123 * options.h (class General_options): Add --incremental-base.
5124 * output.cc (Output_file::Output_file):
5125 (Output_file::open_base_file): Add base_name and writable parameters;
5126 read base file into new file; print error message here.
5127 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5129 * output.h (Output_file::open_for_modification): Rename to...
5130 (Output_file::open_base_file): ...this; add base_name and
5131 writable parameters; adjust all callers.
5132 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5134 * testsuite/Makefile.am (incremental_test_4): Test
5136 * testsuite/Makefile.in: Regenerate.
5138 2011-05-24 Cary Coutant <ccoutant@google.com>
5140 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5142 * testsuite/Makefile.in: Regenerate.
5143 * testsuite/two_file_test_1_v1.cc: New test source file.
5144 * testsuite/two_file_test_1b_v1.cc: New test source file.
5145 * testsuite/two_file_test_2_v1.cc: New test source file.
5147 2011-05-24 Cary Coutant <ccoutant@google.com>
5149 * dynobj.h (Dynobj::do_dynobj): New function.
5150 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5151 flag and soname for shared objects.
5152 * incremental.cc (Incremental_inputs::report_object): Make
5153 either Incremental_object_entry or Incremental_dynobj_entry; add
5154 soname to string table.
5155 (Incremental_inputs::report_input_section): Add assertion.
5156 (Output_section_incremental_inputs::set_final_data_size): Adjust
5157 type of input file entry for shared libraries; adjust size of
5158 shared library info entry.
5159 (Output_section_incremental_inputs::write_input_files): Write
5160 as_needed flag for shared libraries.
5161 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5162 of input file entry for shared libraries; write soname.
5163 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5164 soname from incremental info.
5165 * incremental.h (enum Incremental_input_flags): Add
5166 INCREMENTAL_INPUT_AS_NEEDED.
5167 (Incremental_input_entry::Incremental_input_entry): Initialize new
5169 (Incremental_input_entry::set_as_needed): New function.
5170 (Incremental_input_entry::as_needed): New function.
5171 (Incremental_input_entry::do_dynobj_entry): New function.
5172 (Incremental_input_entry::as_needed_): New data member.
5173 (Incremental_object_entry::Incremental_object_entry): Don't check
5175 (Incremental_object_entry::do_type): Likewise.
5176 (class Incremental_dynobj_entry): New class.
5177 (Incremental_input_entry_reader::as_needed): New function.
5178 (Incremental_input_entry_reader::get_soname): New function.
5179 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5180 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5181 size of shared library info entry.
5182 * layout.cc (Layout::finish_dynamic_section): Don't test for
5183 incremental link when adding DT_NEEDED entries.
5184 * object.h (Object::Object): Initialize new data member.
5185 (Object::dynobj): New function.
5186 (Object::set_as_needed): New function.
5187 (Object::as_needed): New function.
5188 (Object::do_dynobj): New function.
5189 (Object::as_needed_): New data member.
5191 2011-05-24 Cary Coutant <ccoutant@google.com>
5193 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5194 info; adjust display of GOT entries.
5195 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5196 vector of input objects; remove file_status_.
5197 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5198 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5199 got_plt reader; call target hooks to reserve GOT entries.
5200 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5201 of input file info header and GOT info entry.
5202 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5204 (Got_plt_view_info::got_descriptor): Remove.
5205 (Got_plt_view_info::sym_index): New data member.
5206 (Got_plt_view_info::input_index): New data member.
5207 (Local_got_offset_visitor::visit): Write input file index.
5208 (Global_got_offset_visitor::visit): Write 0 for input file index.
5209 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5210 with sym_index and input_index.
5211 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5212 incremental info GOT entry; replace got_descriptor with input_index.
5213 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5214 map from input file index to object.
5215 (Sized_relobj_incr::do_layout): Replace direct data member reference
5216 with accessor function.
5217 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5218 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5219 Adjust size of input file info header.
5220 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5221 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5222 (Incremental_input_entry_reader::get_input_section): Adjust size of
5223 input file info header.
5224 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5225 of incremental info GOT entry.
5226 (Incremental_got_plt_reader::get_got_desc): Remove.
5227 (Incremental_got_plt_reader::get_got_symndx): New function.
5228 (Incremental_got_plt_reader::get_got_input_index): New function.
5229 (Sized_incremental_binary::Sized_incremental_binary): Remove
5230 file_status_; add input_objects_.
5231 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5232 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5233 (Sized_incremental_binary::file_is_unchanged): Remove.
5234 (Sized_incremental_binary::set_input_object): New function.
5235 (Sized_incremental_binary::input_object): New function.
5236 (Sized_incremental_binary::file_status_): Remove.
5237 (Sized_incremental_binary::input_objects_): New data member.
5238 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5240 (Sized_relobj_incr::invalid_address): Move to base class.
5241 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5243 (Sized_relobj_incr::do_output_section_offset): Likewise.
5244 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5245 (Sized_relobj_incr::section_offsets_): Likewise.
5246 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5248 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5249 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5250 with accessor function.
5251 (Sized_relobj_file::do_layout): Likewise.
5252 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5253 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5254 (Sized_relobj_file::compute_final_local_value): Replace refs to
5255 section_offsets_ with accessor function.
5256 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5257 * object.h (Relobj::Relobj): Initialize new data members.
5258 (Relobj::add_dyn_reloc): New function.
5259 (Relobj::first_dyn_reloc): New function.
5260 (Relobj::dyn_reloc_count): New function.
5261 (Relobj::first_dyn_reloc_): New data member.
5262 (Relobj::dyn_reloc_count_): New data member.
5263 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5265 (Sized_relobj::Address): New typedef.
5266 (Sized_relobj::invalid_address): Move here from child class.
5267 (Sized_relobj::Sized_relobj): Initialize new data members.
5268 (Sized_relobj::sized_relobj): New function.
5269 (Sized_relobj::is_output_section_offset_invalid): Move here from
5271 (Sized_relobj::get_output_section_offset): Likewise.
5272 (Sized_relobj::local_has_got_offset): Likewise.
5273 (Sized_relobj::local_got_offset): Likewise.
5274 (Sized_relobj::set_local_got_offset): Likewise.
5275 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5276 (Sized_relobj::clear_got_offsets): New function.
5277 (Sized_relobj::section_offsets): Move here from child class.
5278 (Sized_relobj::do_output_section_offset): Likewise.
5279 (Sized_relobj::do_set_section_offset): Likewise.
5280 (Sized_relobj::Local_got_offsets): Likewise.
5281 (Sized_relobj::local_got_offsets_): Likewise.
5282 (Sized_relobj::section_offsets_): Likewise.
5283 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5285 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5287 (Sized_relobj_file::sized_relobj): New function
5288 (Sized_relobj_file::local_has_got_offset): Move to base class.
5289 (Sized_relobj_file::local_got_offset): Likewise.
5290 (Sized_relobj_file::set_local_got_offset): Likewise.
5291 (Sized_relobj_file::get_output_section_offset): Likewise.
5292 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5293 (Sized_relobj_file::do_output_section_offset): Likewise.
5294 (Sized_relobj_file::do_set_section_offset): Likewise.
5295 (Sized_relobj_file::Local_got_offsets): Likewise.
5296 (Sized_relobj_file::local_got_offsets_): Likewise.
5297 (Sized_relobj_file::section_offsets_): Likewise.
5298 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5300 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5301 (Output_reloc::get_symbol_index): Likewise.
5302 (Output_reloc::local_section_offset): Likewise.
5303 (Output_reloc::get_address): Likewise.
5304 (Output_reloc::symbol_value): Likewise.
5305 (Output_data_got::reserve_slot): Move to class definition.
5306 (Output_data_got::reserve_local): New function.
5307 (Output_data_got::reserve_slot_for_global): Remove.
5308 (Output_data_got::reserve_global): New function.
5309 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5310 (all constructors, two instantiations).
5311 (Output_reloc::get_relobj): New function (two instantiations).
5312 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5313 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5314 (Output_data_reloc::add_global): Adjust type of relobj.
5315 (Output_data_reloc::add_global_relative): Likewise.
5316 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5317 (Output_data_reloc::add_local): Likewise.
5318 (Output_data_reloc::add_local_relative): Likewise.
5319 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5320 (Output_data_reloc::add_local_section): Likewise.
5321 (Output_data_reloc::add_output_section): Likewise.
5322 (Output_data_reloc::add_absolute): Likewise.
5323 (Output_data_reloc::add_target_specific): Likewise.
5324 (Output_data_got::reserve_slot): Move definition here.
5325 (Output_data_got::reserve_local): New function.
5326 (Output_data_got::reserve_global): New function.
5327 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5328 section_offsets_ with accessor function.
5329 (Sized_relobj_file::write_sections): Likewise.
5330 (Sized_relobj_file::do_relocate_sections): Likewise.
5331 * target.h (Sized_target::reserve_local_got_entry): New function.
5332 (Sized_target::reserve_global_got_entry): New function.
5333 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5334 (Target_x86_64::reserve_global_got_entry): New function.
5335 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5337 2011-05-23 Cary Coutant <ccoutant@google.com>
5339 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5340 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5341 bit when checking got_type.
5342 * incremental.cc (Sized_incremental_binary::setup_readers):
5343 Store symbol table and string table locations; initialize bit vector
5344 of file status flags.
5345 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5347 (Sized_incremental_binary::do_process_got_plt): New function.
5348 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5349 (Output_section_incremental_inputs::set_final_data_size): Record
5350 file index for each input file.
5351 (Output_section_incremental_inputs::write_got_plt): Store file index
5352 instead of input entry offset for each GOT entry.
5354 (Incremental_input_entry::Incremental_input_entry): Initialize new
5356 (Incremental_input_entry::set_offset): Store file index.
5357 (Incremental_input_entry::get_file_index): New function.
5358 (Incremental_input_entry::file_index_): New data member.
5359 (Incremental_binary::process_got_plt): New function.
5360 (Incremental_binary::do_process_got_plt): New function.
5361 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5363 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5364 (Sized_incremental_binary::set_file_is_unchanged): New function.
5365 (Sized_incremental_binary::file_is_unchanged): New function.
5366 (Sized_incremental_binary::do_process_got_plt): New function.
5367 (Sized_incremental_binary::file_status_): New data member.
5368 (Sized_incremental_binary::main_symtab_loc_): New data member.
5369 (Sized_incremental_binary::main_strtab_loc_): New data member.
5370 * output.cc (Output_data_got::Got_entry::write): Add case
5372 (Output_data_got::add_global): Call add_got_entry.
5373 (Output_data_got::add_global_plt): Likewise.
5374 (Output_data_got::add_global_with_rel): Likewise.
5375 (Output_data_got::add_global_with_rela): Likewise.
5376 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5377 (Output_data_got::add_global_pair_with_rela): Likewise.
5378 (Output_data_got::add_local): Call add_got_entry.
5379 (Output_data_got::add_local_plt): Likewise.
5380 (Output_data_got::add_local_with_rel): Likewise.
5381 (Output_data_got::add_local_with_rela): Likewise.
5382 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5383 (Output_data_got::add_local_pair_with_rela): Likewise.
5384 (Output_data_got::reserve_slot): New function.
5385 (Output_data_got::reserve_slot_for_global): New function.
5386 (Output_data_got::add_got_entry): New function.
5387 (Output_data_got::add_got_entry_pair): New function.
5388 (Output_section::add_output_section_data): Edit FIXME.
5390 (Output_section_data_build::Output_section_data_build): New
5391 constructor with size parameter.
5392 (Output_data_space::Output_data_space): Likewise.
5393 (Output_data_got::Output_data_got): Initialize new data member; new
5394 constructor with size parameter.
5395 (Output_data_got::add_constant): Call add_got_entry.
5396 (Output_data_got::reserve_slot): New function.
5397 (Output_data_got::reserve_slot_for_global): New function.
5398 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5399 (Output_data_got::add_got_entry): New function.
5400 (Output_data_got::add_got_entry_pair): New function.
5401 (Output_data_got::free_list_): New data member.
5402 * target.h (Sized_target::init_got_plt_for_update): New function.
5403 (Sized_target::register_global_plt_entry): New function.
5404 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5405 Initialize new data member; call init; add constructor with PLT count.
5406 (Output_data_plt_x86_64::init): New function.
5407 (Output_data_plt_x86_64::add_relocation): New function.
5408 (Output_data_plt_x86_64::reserve_slot): New function.
5409 (Output_data_plt_x86_64::free_list_): New data member.
5410 (Target_x86_64::init_got_plt_for_update): New function.
5411 (Target_x86_64::register_global_plt_entry): New function.
5412 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5413 incremental updates.
5414 (Output_data_plt_x86_64::add_relocation): New function.
5415 * testsuite/object_unittest.cc (Object_test): Set default options.
5417 2011-05-16 Ian Lance Taylor <iant@google.com>
5419 * options.h (class General_options): Make -i a synonym for -r.
5421 2011-05-16 Ian Lance Taylor <iant@google.com>
5423 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5425 2011-05-10 Cary Coutant <ccoutant@google.com>
5427 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5430 2011-05-06 Ian Lance Taylor <iant@google.com>
5432 * layout.cc (Layout::layout): If the output section flags change,
5433 update the ordering.
5435 2011-04-25 Cary Coutant <ccoutant@google.com>
5437 * incremental-dump.cc (dump_incremental_inputs): Print local
5438 symbol info for each input file.
5440 (Output_section_incremental_inputs::set_final_data_size): Add local
5441 symbol info to input file entries in incremental info.
5442 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5443 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5444 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5445 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5447 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5448 (Sized_incr_relobj::do_relocate): Write the local symbols.
5449 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5450 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5451 Adjust size of input file header.
5452 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5453 (Incremental_inputs_reader::get_local_symbol_count): New function.
5454 (Incremental_inputs_reader::get_input_section): Adjust size of input
5456 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5457 (Sized_incr_relobj::This): New typedef.
5458 (Sized_incr_relobj::sym_size): New const data member.
5459 (Sized_incr_relobj::Local_symbol): New struct.
5460 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5461 (Sized_incr_relobj::do_local_symbol_offset): New function.
5462 (Sized_incr_relobj::local_symbol_count_): New data member.
5463 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5464 (Sized_incr_relobj::local_symbol_index_): New data member.
5465 (Sized_incr_relobj::local_symbol_offset_): New data member.
5466 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5467 (Sized_incr_relobj::local_symbols_): New data member.
5468 * object.h (Relobj::output_local_symbol_count): New function.
5469 (Relobj::local_symbol_offset): New function.
5470 (Relobj::do_output_local_symbol_count): New function.
5471 (Relobj::do_local_symbol_offset): New function.
5472 (Sized_relobj::do_output_local_symbol_count): New function.
5473 (Sized_relobj::do_local_symbol_offset): New function.
5475 2011-04-22 Vladimir Simonov <sv@sw.ru>
5477 * descriptors.cc (set_close_on_exec): New function.
5478 (Descriptors::open): Use set_close_on_exec.
5479 * output.cc (S_ISLNK): Define if not defined.
5481 2011-04-22 Cary Coutant <ccoutant@google.com>
5483 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5485 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5486 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5487 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5489 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5490 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5491 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5493 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5495 (Incremental_binary::apply_incremental_relocs): New function.
5496 (Incremental_binary::do_apply_incremental_relocs): New function.
5497 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5499 (Sized_incremental_binary::add_global_symbol): New function.
5500 (Sized_incremental_binary::global_symbol): New function.
5501 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5502 (Sized_incremental_binary::symbol_map_): New data member.
5503 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5504 * target.h (Sized_target::apply_relocation): New function.
5505 * target-reloc.h (apply_relocation): New function.
5506 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5508 2011-04-22 Doug Kwan <dougkwan@google.com>
5510 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5511 flag of a SHT_ARM_EXIDX section.
5512 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5513 * testsuite/Makefile.in: Regenerate.
5514 * testsuite/arm_exidx_test.s: New file.
5515 * testsuite/arm_exidx_test.sh: Same.
5517 2011-04-20 Cary Coutant <ccoutant@google.com>
5520 * archive.h (Incremental_archive_entry::Archive_member):
5521 Initialize arg_serial_ (second constructor).
5523 2011-04-17 Ian Lance Taylor <iant@google.com>
5525 * object.cc (Relocate_info::location): Simplify location string.
5526 * errors.cc (Errors::error_at_location): Don't print program
5528 (Errors::warning_at_location): Likewise.
5529 (Errors::undefined_symbol): Likewise.
5530 * testsuite/debug_msg.sh: Update accordingly.
5532 2011-04-14 Cary Coutant <ccoutant@google.com>
5534 * gold/layout.cc (Layout::symtab_section_offset): New function.
5535 * gold/layout.h (Layout::symtab_section_offset): New function.
5536 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5538 2011-04-12 Ian Lance Taylor <iant@google.com>
5540 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5541 with MREMAP_MAYMOVE.
5542 * output.h (class Output_file): Add map_is_allocated_ field.
5543 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5544 not available, provide stubs. If mremap is not available, #define
5546 (MREMAP_MAYMOVE): Define if not defined.
5547 (Output_file::Output_file): Initialize map_is_allocated_.
5548 (Output_file::resize): Check map_is_allocated_.
5549 (Output_file::map_anonymous): If mmap fails, use malloc.
5550 (Output_file::unmap): Don't do anything for an anonymous map.
5551 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5552 is not available, provide stubs.
5553 (File_read::View::~View): Use free rather than delete[].
5554 (File_read::make_view): Use malloc rather than new[]. If mmap
5556 (File_read::find_or_make_view): Use malloc rather than new[].
5557 * gold.h: Remove HAVE_REMAP code.
5558 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5559 exists. Rename mremap to gold_mremap. If mmap is not available
5561 * configure, config.in: Rebuild.
5563 2011-04-11 Ian Lance Taylor <iant@google.com>
5565 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5566 initialize local variable v.
5568 2011-04-11 Cary Coutant <ccoutant@google.com>
5570 * archive.cc (Archive::include_member): Adjust call to
5572 (Add_archive_symbols::run): Track argument serial numbers.
5573 (Lib_group::include_member): Likewise.
5574 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5575 * archive.h (Incremental_archive_entry::Archive_member):
5576 Initialize arg_serial_.
5577 (Archive_member::arg_serial_): New data member.
5578 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5579 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5581 (Sized_dynobj::do_for_all_local_got_entries): New function.
5582 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5584 * fileread.cc (get_mtime): New function.
5585 * fileread.h (get_mtime): New function.
5586 * gold.cc (queue_initial_tasks): Check for incremental update.
5587 (process_incremental_input): New function.
5588 (queue_middle_tasks): Don't force valid target for incremental
5590 * incremental-dump.cc (find_input_containing_global): Adjust
5591 size of symbol info entry.
5592 (dump_incremental_inputs): Dump argument serial number and
5593 in_system_directory flag; bias shndx by 1; print symbol names
5594 when dumping per-file symbol lists; use new symbol info readers.
5596 (Output_section_incremental_inputs:update_data_size): New function.
5597 (Sized_incremental_binary::setup_readers): Setup input readers
5598 for each input file; build maps for files added from libraries
5600 (Sized_incremental_binary::check_input_args): New function.
5601 (Sized_incremental_binary::do_check_inputs): Build map of argument
5602 serial numbers to input arguments.
5603 (Sized_incremental_binary::do_file_has_changed): Rename
5604 do_file_is_unchanged to this; compare file modification times.
5605 (Sized_incremental_binary::do_init_layout): New function.
5606 (Sized_incremental_binary::do_reserve_layout): New function.
5607 (Sized_incremental_binary::do_get_input_reader): Remove.
5608 (Sized_incremental_binary::get_symtab_view): New function.
5609 (Incremental_checker::can_incrementally_link_output_file): Remove.
5610 (Incremental_inputs::report_command_line): Exclude --debug options.
5611 (Incremental_inputs::report_archive_begin): Add parameter; track
5612 argument serial numbers; don't put input file entry for archive
5613 before archive members.
5614 (Incremental_inputs::report_archive_end): Put input file entry
5615 for archive after archive members.
5616 (Incremental_inputs::report_object): Add parameter; track argument
5617 serial numbers and in_system_directory flag.
5618 (Incremental_inputs::report_script): Add parameter; track argument
5620 (Output_section_incremental_inputs::set_final_data_size): Adjust
5621 size of symbol info entry; check for forwarding symbols.
5622 (Output_section_incremental_inputs::write_input_files): Write
5623 in_system_directory flag and argument serial number.
5624 (Output_section_incremental_inputs::write_info_blocks): Map section
5625 indices between incremental info and original input file; store
5626 input section index for each symbol.
5627 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5628 change operator() to visit().
5629 (class Global_got_offset_visitor): Likewise.
5630 (class Global_symbol_visitor_got_plt):
5631 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5633 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5634 (Sized_incr_relobj::do_read_symbols): New function.
5635 (Sized_incr_relobj::do_layout): New function.
5636 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5637 (Sized_incr_relobj::do_add_symbols): New function.
5638 (Sized_incr_relobj::do_should_include_member): New function.
5639 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5640 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5641 (Sized_incr_relobj::do_section_size): New function.
5642 (Sized_incr_relobj::do_section_name): New function.
5643 (Sized_incr_relobj::do_section_contents): New function.
5644 (Sized_incr_relobj::do_section_flags): New function.
5645 (Sized_incr_relobj::do_section_entsize): New function.
5646 (Sized_incr_relobj::do_section_address): New function.
5647 (Sized_incr_relobj::do_section_type): New function.
5648 (Sized_incr_relobj::do_section_link): New function.
5649 (Sized_incr_relobj::do_section_info): New function.
5650 (Sized_incr_relobj::do_section_addralign): New function.
5651 (Sized_incr_relobj::do_initialize_xindex): New function.
5652 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5653 (Sized_incr_relobj::do_read_relocs): New function.
5654 (Sized_incr_relobj::do_gc_process_relocs): New function.
5655 (Sized_incr_relobj::do_scan_relocs): New function.
5656 (Sized_incr_relobj::do_count_local_symbols): New function.
5657 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5658 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5659 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5660 (Sized_incr_relobj::do_relocate): New function.
5661 (Sized_incr_relobj::do_set_section_offset): New function.
5662 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5663 (Sized_incr_dynobj::do_read_symbols): New function.
5664 (Sized_incr_dynobj::do_layout): New function.
5665 (Sized_incr_dynobj::do_add_symbols): New function.
5666 (Sized_incr_dynobj::do_should_include_member): New function.
5667 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5668 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5669 (Sized_incr_dynobj::do_section_size): New function.
5670 (Sized_incr_dynobj::do_section_name): New function.
5671 (Sized_incr_dynobj::do_section_contents): New function.
5672 (Sized_incr_dynobj::do_section_flags): New function.
5673 (Sized_incr_dynobj::do_section_entsize): New function.
5674 (Sized_incr_dynobj::do_section_address): New function.
5675 (Sized_incr_dynobj::do_section_type): New function.
5676 (Sized_incr_dynobj::do_section_link): New function.
5677 (Sized_incr_dynobj::do_section_info): New function.
5678 (Sized_incr_dynobj::do_section_addralign): New function.
5679 (Sized_incr_dynobj::do_initialize_xindex): New function.
5680 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5681 (make_sized_incremental_object): New function.
5682 (Incremental_library::copy_unused_symbols): New function.
5683 (Incremental_library::do_for_all_unused_symbols): New function.
5684 * incremental.h (enum Incremental_input_flags): New type.
5685 (class Incremental_checker): Remove.
5686 (Incremental_input_entry::Incremental_input_entry): Add argument
5688 (Incremental_input_entry::arg_serial): New function.
5689 (Incremental_input_entry::set_is_in_system_directory): New function.
5690 (Incremental_input_entry::is_in_system_directory): New function.
5691 (Incremental_input_entry::arg_serial_): New data member.
5692 (Incremental_input_entry::is_in_system_directory_): New data member.
5693 (class Script_info): Move here from script.h.
5694 (Script_info::Script_info): Add filename parameter.
5695 (Script_info::filename): New function.
5696 (Script_info::filename_): New data member.
5697 (Incremental_script_entry::Incremental_script_entry): Add argument
5699 (Incremental_object_entry::Incremental_object_entry): Likewise.
5700 (Incremental_object_entry::add_input_section): Build list of input
5701 sections with map to original shndx.
5702 (Incremental_object_entry::get_input_section_index): New function.
5703 (Incremental_object_entry::shndx_): New data member.
5704 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5705 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5706 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5708 (Incremental_inputs::report_archive_begin): Likewise.
5709 (Incremental_inputs::report_object): Likewise.
5710 (Incremental_inputs::report_script): Likewise.
5711 (class Incremental_global_symbol_reader): New class.
5712 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5713 and store flags and input file type.
5714 (Incremental_input_entry_reader::arg_serial): New function.
5715 (Incremental_input_entry_reader::type): Extract type from flags.
5716 (Incremental_input_entry_reader::is_in_system_directory): New function.
5717 (Incremental_input_entry_reader::get_input_section_count): Call
5718 accessor function for type.
5719 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5720 function for type; adjust size of global symbol entry.
5721 (Incremental_input_entry_reader::get_global_symbol_count): Call
5722 accessor function for type.
5723 (Incremental_input_entry_reader::get_object_count): Likewise.
5724 (Incremental_input_entry_reader::get_object_offset): Likewise.
5725 (Incremental_input_entry_reader::get_member_count): Likewise.
5726 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5727 (Incremental_input_entry_reader::get_member_offset): Likewise.
5728 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5729 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5730 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5731 (Incremental_input_entry_reader::get_global_symbol_reader): New
5733 (Incremental_input_entry_reader::get_output_symbol_index): New
5735 (Incremental_input_entry_reader::type_): Remove.
5736 (Incremental_input_entry_reader::flags_): New data member.
5737 (Incremental_inputs_reader::input_file_offset): New function.
5738 (Incremental_inputs_reader::input_file_index): New function.
5739 (Incremental_inputs_reader::input_file): Call input_file_offset.
5740 (Incremental_inputs_reader::input_file_at_offset): New function.
5741 (Incremental_relocs_reader::get_r_type): Reformat.
5742 (Incremental_relocs_reader::get_r_shndx): Reformat.
5743 (Incremental_relocs_reader::get_r_offset): Reformat.
5744 (Incremental_relocs_reader::data): New function.
5745 (Incremental_binary::Incremental_binary): Initialize new data members.
5746 (Incremental_binary::check_inputs): Add cmdline parameter.
5747 (Incremental_binary::file_is_unchanged): Remove.
5748 (Input_reader::arg_serial): New function.
5749 (Input_reader::get_unused_symbol_count): New function.
5750 (Input_reader::get_unused_symbol): New function.
5751 (Input_reader::do_arg_serial): New function.
5752 (Input_reader::do_get_unused_symbol_count): New function.
5753 (Input_reader::do_get_unused_symbol): New function.
5754 (Incremental_binary::input_file_count): New function.
5755 (Incremental_binary::get_input_reader): Change signature to use
5756 index instead of filename.
5757 (Incremental_binary::file_has_changed): New function.
5758 (Incremental_binary::get_input_argument): New function.
5759 (Incremental_binary::get_library): New function.
5760 (Incremental_binary::get_script_info): New function.
5761 (Incremental_binary::init_layout): New function.
5762 (Incremental_binary::reserve_layout): New function.
5763 (Incremental_binary::output_file): New function.
5764 (Incremental_binary::do_check_inputs): New function.
5765 (Incremental_binary::do_file_is_unchanged): Remove.
5766 (Incremental_binary::do_file_has_changed): New function.
5767 (Incremental_binary::do_init_layout): New function.
5768 (Incremental_binary::do_reserve_layout): New function.
5769 (Incremental_binary::do_input_file_count): New function.
5770 (Incremental_binary::do_get_input_reader): Change signature.
5771 (Incremental_binary::input_args_map_): New data member.
5772 (Incremental_binary::library_map_): New data member.
5773 (Incremental_binary::script_map_): New data member.
5774 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5776 (Sized_incremental_binary::output_section): New function.
5777 (Sized_incremental_binary::inputs_reader): Add const.
5778 (Sized_incremental_binary::symtab_reader): Add const.
5779 (Sized_incremental_binary::relocs_reader): Add const.
5780 (Sized_incremental_binary::got_plt_reader): Add const.
5781 (Sized_incremental_binary::get_symtab_view): New function.
5782 (Sized_incremental_binary::Inputs_reader): New typedef.
5783 (Sized_incremental_binary::Input_entry_reader): New typedef.
5784 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5785 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5786 (Sized_incremental_binary::do_file_has_changed): New function.
5787 (Sized_incremental_binary::do_init_layout): New function.
5788 (Sized_incremental_binary::do_reserve_layout): New function.
5789 (Sized_input_reader::Inputs_reader): Remove.
5790 (Sized_input_reader::Input_entry_reader): Remove.
5791 (Sized_input_reader::do_arg_serial): New function.
5792 (Sized_input_reader::do_get_unused_symbol_count): New function.
5793 (Sized_input_reader::do_get_unused_symbol): New function.
5794 (Sized_incremental_binary::do_input_file_count): New function.
5795 (Sized_incremental_binary::do_get_input_reader): Change signature;
5796 use index instead of filename.
5797 (Sized_incremental_binary::section_map_): New data member.
5798 (Sized_incremental_binary::input_entry_readers_): New data member.
5799 (class Sized_incr_relobj): New class.
5800 (class Sized_incr_dynobj): New class.
5801 (make_sized_incremental_object): New function.
5802 (class Incremental_library): New class.
5803 * layout.cc (Free_list::num_lists): New static data member.
5804 (Free_list::num_nodes): New static data member.
5805 (Free_list::num_removes): New static data member.
5806 (Free_list::num_remove_visits): New static data member.
5807 (Free_list::num_allocates): New static data member.
5808 (Free_list::num_allocate_visits): New static data member.
5809 (Free_list::init): New function.
5810 (Free_list::remove): New function.
5811 (Free_list::allocate): New function.
5812 (Free_list::dump): New function.
5813 (Free_list::print_stats): New function.
5814 (Layout_task_runner::run): Resize output file for incremental updates.
5815 (Layout::Layout): Initialize new data members.
5816 (Layout::set_incremental_base): New function.
5817 (Layout::init_fixed_output_section): New function.
5818 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5819 incremental updates.
5820 (Layout::create_gold_note): Do not create gold note section for
5821 incremental updates.
5822 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5823 for incremental updates.
5824 (Layout::set_section_offsets): For incremental updates, allocate space
5826 (Layout::create_symtab_sections): Layout with offsets relative to
5827 start of section; for incremental updates, allocate space from free
5829 (Layout::create_shdrs): For incremental updates, allocate space from
5831 (Layout::finish_dynamic_section): For incremental updates, do not
5832 check --as-needed (fixed in subsequent patch).
5833 * layout.h (class Free_list): New class.
5834 (Layout::set_incremental_base): New function.
5835 (Layout::incremental_base): New function.
5836 (Layout::init_fixed_output_section): New function.
5837 (Layout::allocate): New function.
5838 (Layout::incremental_base_): New data member.
5839 (Layout::free_list_): New data member.
5840 * main.cc (main): Print Free_list statistics.
5841 * object.cc (Relobj::finalize_incremental_relocs): Add
5842 clear_counts parameter; clear counts only when clear_counts is set.
5843 (Sized_relobj::Sized_relobj): Initialize new base class.
5844 (Sized_relobj::do_layout): Don't report special sections.
5845 (Sized_relobj::do_for_all_local_got_entries): New function.
5846 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5847 symtab_off to all symbol table offsets.
5848 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5849 * object.h (class Got_offset_list): Move to top of file.
5850 (Object::Object): Allow case where input_file == NULL.
5851 (Object::~Object): Likewise.
5852 (Object::input_file): Assert that input_file != NULL.
5853 (Object::lock): Allow case where input_file == NULL.
5854 (Object::unlock): Likewise.
5855 (Object::is_locked): Likewise.
5856 (Object::token): Likewise.
5857 (Object::release): Likewise.
5858 (Object::is_incremental): New function.
5859 (Object::get_mtime): New function.
5860 (Object::for_all_local_got_entries): New function.
5861 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5862 (Object::set_is_in_system_directory): New function.
5863 (Object::is_in_system_directory): New function.
5864 (Object::do_is_incremental): New function.
5865 (Object::do_get_mtime): New function.
5866 (Object::do_for_all_local_got_entries): New function.
5867 (Object::is_in_system_directory_): New data member.
5868 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5869 (class Sized_relobj_base): New class.
5870 (class Sized_relobj): Derive from Sized_relobj_base.
5871 (class Sized_relobj::Symbols): Redeclare from base class.
5872 (class Sized_relobj::local_got_offset_list): Remove.
5873 (class Sized_relobj::Output_sections): Redeclare from base class.
5874 (class Sized_relobj::do_for_all_local_got_entries): New function.
5875 (class Sized_relobj::write_local_symbols): Add offset parameter.
5876 (class Sized_relobj::local_symbol_offset_): Update comment.
5877 (class Sized_relobj::local_dynsym_offset_): Update comment.
5878 * options.cc (Input_arguments::add_file): Remove const.
5879 * options.h (Input_file_argument::Input_file_argument):
5880 Initialize arg_serial_ (all constructors).
5881 (Input_file_argument::set_arg_serial): New function.
5882 (Input_file_argument::arg_serial): New function.
5883 (Input_file_argument::arg_serial_): New data member.
5884 (Input_arguments::Input_arguments): Initialize file_count_.
5885 (Input_arguments::add_file): Remove const.
5886 (Input_arguments::number_of_input_files): New function.
5887 (Input_arguments::file_count_): New data member.
5888 (Command_line::number_of_input_files): Call
5889 Input_arguments::number_of_input_files.
5890 * output.cc (Output_segment_headers::Output_segment_headers):
5892 (Output_section::Input_section::current_data_size): New function.
5893 (Output_section::Output_section): Initialize new data members.
5894 (Output_section::add_input_section): Don't do merge sections for
5895 an incremental link; allocate space from free list for an
5897 (Output_section::add_output_section_data): Allocate space from
5898 free list for an incremental update.
5899 (Output_section::update_data_size): New function.
5900 (Output_section::set_fixed_layout): New function.
5901 (Output_section::reserve): New function.
5902 (Output_segment::set_section_addresses): Remove const.
5903 (Output_segment::set_section_list_addresses): Remove const; allocate
5904 space from free list for an incremental update.
5905 (Output_segment::set_offset): Adjust size of RELRO segment for an
5907 * output.h (Output_data::current_data_size): Move here from
5909 (Output_data::pre_finalize_data_size): New function.
5910 (Output_data::update_data_size): New function.
5911 (Output_section_headers::update_data_size): new function.
5912 (Output_section_data_build::current_data_size): Move to Output_data.
5913 (Output_data_strtab::update_data_size): New function.
5914 (Output_section::current_data_size): Move to Output_data.
5915 (Output_section::set_fixed_layout): New function.
5916 (Output_section::has_fixed_layout): New function.
5917 (Output_section::reserve): New function.
5918 (Output_section::update_data_size): New function.
5919 (Output_section::has_fixed_layout_): New data member.
5920 (Output_section::free_list_): New data member.
5921 (Output_segment::set_section_addresses): Remove const.
5922 (Output_segment::set_section_list_addresses): Remove const.
5923 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5925 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5927 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5928 parameter when calling Add_symbols constructor; store argument
5929 serial number for members of a lib group.
5930 (Add_symbols::locks): Allow case where token == NULL.
5931 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5932 (Read_member::~Read_member): New function.
5933 (Read_member::is_runnable): New function.
5934 (Read_member::locks): New function.
5935 (Read_member::run): New function.
5936 (Check_script::~Check_script): New function.
5937 (Check_script::is_runnable): New function.
5938 (Check_script::locks): New function.
5939 (Check_script::run): New function.
5940 (Check_library::~Check_library): New function.
5941 (Check_library::is_runnable): New function.
5942 (Check_library::locks): New function.
5943 (Check_library::run): New function.
5944 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5945 (Add_symbols::library_): New data member.
5946 (class Read_member): New class.
5947 (class Check_script): New class.
5948 (class Check_library): New class.
5949 * reloc.cc (Read_relocs::is_runnable): Allow case where
5951 (Read_relocs::locks): Likewise.
5952 (Scan_relocs::locks): Likewise.
5953 (Relocate_task::locks): Likewise.
5954 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5956 (Sized_relobj::incremental_relocs_scan): Fix comment.
5957 (Sized_relobj::do_relocate): Pass output file offset to
5958 write_local_symbols.
5959 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5960 from class declaration.
5961 * script.cc (read_input_script): Allocate Script_info; pass
5962 argument serial number to report_script.
5963 * script.h (class Script_info): Move to incremental.h.
5964 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5965 * symtab.h (Symbol_table::add_from_incrobj): New function.
5966 (Symbol_table::set_file_offset): New function.
5968 2011-04-05 Cary Coutant <ccoutant@google.com>
5970 * incremental-dump.cc (dump_incremental_inputs): Change signature
5971 to take a Sized_incremental_binary; change caller. Use readers
5972 in Sized_incremental_binary.
5974 (Sized_incremental_binary::find_incremental_inputs_sections):
5975 Rename do_find_incremental_inputs_sections to this.
5976 (Sized_incremental_binary::setup_readers): New function.
5977 (Sized_incremental_binary::do_check_inputs): Check
5978 has_incremental_info_ flag; move setup code to setup_readers;
5980 (Sized_incremental_binary::do_file_is_unchanged): New function.
5981 (Sized_incremental_binary::do_get_input_reader): New function.
5982 * incremental.h (class Incremental_binary): Move to end of file.
5983 (Incremental_binary::file_is_unchanged): New function.
5984 (Incremental_binary::do_file_is_unchanged): New function.
5985 (Incremental_binary::Input_reader): New class.
5986 (Incremental_binary::get_input_reader): New function.
5987 (class Sized_incremental_binary): Move to end of file.
5988 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5989 input section reader classes.
5990 (Sized_incremental_binary::has_incremental_info): New function.
5991 (Sized_incremental_binary::inputs_reader): New function.
5992 (Sized_incremental_binary::symtab_reader): New function.
5993 (Sized_incremental_binary::relocs_reader): New function.
5994 (Sized_incremental_binary::got_plt_reader): New function.
5995 (Sized_incremental_binary::do_file_is_unchanged): New function.
5996 (Sized_incremental_binary::Sized_input_reader): New class.
5997 (Sized_incremental_binary::get_input_reader): New function.
5998 (Sized_incremental_binary::find_incremental_inputs_sections):
5999 Rename do_find_incremental_inputs_sections to this.
6000 (Sized_incremental_binary::setup_readers): New function.
6001 (Sized_incremental_binary::has_incremental_info_): New data member.
6002 (Sized_incremental_binary::inputs_reader_): New data member.
6003 (Sized_incremental_binary::symtab_reader_): New data member.
6004 (Sized_incremental_binary::relocs_reader_): New data member.
6005 (Sized_incremental_binary::got_plt_reader_): New data member.
6006 (Sized_incremental_binary::current_input_file_): New data member.
6008 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6011 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6014 2011-03-30 Cary Coutant <ccoutant@google.com>
6016 * archive.cc (Archive::include_member): Adjust call to report_object.
6017 (Add_archive_symbols::run): Add script_info to call to
6018 report_archive_begin.
6019 (Lib_group::include_member): Adjust call to report_object.
6020 (Add_lib_group_symbols::run): Adjust call to report_object.
6021 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6022 blocks. Add object count for script input files.
6023 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6024 script_info parameter; change all callers.
6025 (Incremental_inputs::report_object): Add script_info parameter;
6027 (Incremental_inputs::report_script): Store backpointer to
6028 incremental info entry.
6029 (Output_section_incremental_inputs::set_final_data_size): Record
6030 additional information for scripts.
6031 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6032 * incremental.h (Incremental_script_entry::add_object): New function.
6033 (Incremental_script_entry::get_object_count): New function.
6034 (Incremental_script_entry::get_object): New function.
6035 (Incremental_script_entry::objects_): New data member; adjust
6037 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6038 (Incremental_inputs::report_object): Add script_info parameter.
6039 (Incremental_inputs_reader::get_object_count): New function.
6040 (Incremental_inputs_reader::get_object_offset): New function.
6041 * options.cc (Input_arguments::add_file): Return reference to
6043 * options.h (Input_argument::set_script_info): New function.
6044 (Input_argument::script_info): New function.
6045 (Input_argument::script_info_): New data member; adjust all
6047 (Input_file_group::add_file): Return reference to new input argument.
6048 (Input_file_lib::add_file): Likewise.
6049 (Input_arguments::add_file): Likewise.
6050 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6051 * script.cc (Parser_closure::Parser_closure): Add script_info
6052 parameter; adjust all callers.
6053 (Parser_closure::script_info): New function.
6054 (Parser_closure::script_info_): New data member.
6055 (read_input_script): Report scripts earlier to incremental info.
6056 (script_add_file): Set script_info in Input_argument.
6057 (script_add_library): Likewise.
6058 * script.h (Script_options::Script_info): Rewrite class.
6060 2011-03-29 Cary Coutant <ccoutant@google.com>
6062 * archive.cc (Library_base::should_include_member): Move
6063 method here from class Archive.
6064 (Archive::Archive): Initialize base class.
6065 (Archive::should_include_member): Move to base class.
6066 (Archive::do_for_all_unused_symbols): New function.
6067 (Add_archive_symbols::run): Remove redundant access to
6069 (Lib_group::Lib_group): Initialize base class.
6070 (Lib_group::do_filename): New function.
6071 (Lib_group::include_member): Pass pointer to Lib_group to
6073 (Lib_group::do_for_all_unused_symbols): New function.
6074 (Add_lib_group_symbols::run): Report archive information for
6076 * archive.h (class Library_base): New base class.
6077 (class Archive): Derive from Library_base.
6078 (Archive::filename): Move to base class.
6079 (Archive::set_incremental_info): Likewise.
6080 (Archive::incremental_info): Likewise.
6081 (Archive::Should_include): Likewise.
6082 (Archive::should_include_member): Likewise.
6083 (Archive::Armap_entry): Remove.
6084 (Archive::Unused_symbol_iterator): Remove.
6085 (Archive::unused_symbols_begin): Remove.
6086 (Archive::unused_symbols_end): Remove.
6087 (Archive::do_filename): New function.
6088 (Archive::do_get_mtime): New function.
6089 (Archive::do_for_all_unused_symbols): New function.
6090 (Archive::task_): Move to base class.
6091 (Archive::incremental_info_): Likewise.
6092 (class Lib_group): Derive from Library_base.
6093 (Lib_group::do_filename): New function.
6094 (Lib_group::do_get_mtime): New function.
6095 (Lib_group::do_for_all_unused_symbols): New function.
6096 (Lib_group::task_): Move to base class.
6097 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6099 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6101 * incremental.cc (Incremental_inputs::report_archive_begin):
6102 Use Library_base; call library's get_mtime; add incremental inputs
6103 entry before members.
6104 (class Unused_symbol_visitor): New class.
6105 (Incremental_inputs::report_archive_end): Use Library_base; use
6106 visitor class to record unused symbols; don't add incremental inputs
6107 entry after members.
6108 (Incremental_inputs::report_object): Use Library_base.
6110 (Incremental_archive_entry::Incremental_archive_entry): Remove
6111 unused Archive parameter.
6112 (Incremental_inputs::report_archive_begin): Use Library_base.
6113 (Incremental_inputs::report_archive_end): Likewise.
6114 (Incremental_inputs::report_object): Likewise.
6115 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6117 * object.h (Object::for_all_global_symbols): New function.
6118 (Object::do_for_all_global_symbols): New function.
6119 (Sized_relobj::do_for_all_global_symbols): New function.
6120 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6122 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6125 2011-03-27 Ian Lance Taylor <iant@google.com>
6127 * archive.cc (Archive::interpret_header): Return -1 if something
6128 goes wrong. Change callers accordingly.
6130 2011-03-25 Cary Coutant <ccoutant@google.com>
6132 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6133 * testsuite/Makefile.in: Regenerate.
6135 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6137 * plugin.cc (get_view): New.
6138 (Plugin::load): Pass get_view to the plugin.
6139 (Plugin_manager::get_view): New.
6141 2011-03-21 Ian Lance Taylor <iant@google.com>
6143 * testsuite/final_layout.sh: Rewrite to not use dc.
6144 * testsuite/relro_test.sh: Fail if dc is not present.
6146 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6148 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6150 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6151 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6153 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6154 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6156 2011-03-14 Ian Lance Taylor <iant@google.com>
6158 * script-sections.cc (Sort_output_sections::script_compare):
6159 Rename from is_before, change return type.
6160 (Sort_output_sections::operator()): Adjust accordingly.
6162 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6165 * testsuite/odr_violation2.cc: Add comment to make all error line
6166 numbers double digits.
6167 * testsuite/debug_msg.sh: Adjust expected errors.
6169 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6171 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6172 but mark earlier ones as non-canonical
6173 (offset_to_iterator): Update search target and example
6174 (do_addr2line): Return extra lines in a vector*
6175 (format_file_lineno): Extract from do_addr2line
6176 (one_addr2line): Add vector* out-param
6177 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6178 when a lineno entry appeared last for its instruction
6179 (Dwarf_line_info): Add vector* out-param
6180 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6181 * symtab.cc (Odr_violation_compare): Include the lineno in the
6183 (linenos_from_loc): New. Combine the canonical line for an
6184 address with its other lines.
6185 (True_if_intersect): New. Helper functor to make
6186 std::set_intersection a query.
6187 (detect_odr_violations): Compare sets of lines instead of just
6188 one line for each function. This became less deterministic, but
6189 has fewer false positives.
6190 * symtab.h: Declarations.
6191 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6192 mix an optimized and non-optimized object in the same binary
6193 (odr_violation2.so): Same.
6194 * testsuite/Makefile.in: Regenerate from Makefile.am.
6195 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6196 * testsuite/debug_msg.sh: Update line numbers and add
6198 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6199 non-optimized context.
6200 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6201 isn't inlined, and use OdrDerived in an optimized context.
6202 * testsuite/odr_header1.h: Defines OdrDerived, where
6203 optimization will change the
6204 first-instruction-in-the-destructor's file and line number.
6205 * testsuite/odr_header2.h: Defines OdrBase.
6207 2011-03-09 Ian Lance Taylor <iant@google.com>
6209 * fileread.cc (File_read::clear_views): Don't delete the whole
6212 2011-03-08 Ian Lance Taylor <iant@google.com>
6215 * fileread.cc: #include <climits>.
6216 (GOLD_IOV_MAX): Define.
6217 (File_read::read_multiple): Limit number of entries by iov_max.
6218 * fileread.h (class File_read): Always set max_readv_entries to
6221 2011-03-07 Ian Lance Taylor <iant@google.com>
6224 * options.h (class General_options): Add -dy and -dn.
6226 2011-03-02 Cary Coutant <ccoutant@google.com>
6228 * testsuite/script_test_9.t: Add TLS segment.
6230 2011-03-02 Simon Baldwin <simonb@google.com>
6232 * configure.ac: Add check for gnu_indirect_function support in
6233 the toolchain building binutils.
6234 * configure: Rebuild.
6236 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6238 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6239 plugin only symbols.
6240 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6241 in plugin files as not needed in the symbol table.
6243 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6245 * output.cc (Output_section::add_input_section): Delay fill
6246 generation for section ordering.
6248 2011-02-09 Ian Lance Taylor <iant@google.com>
6251 * object.h (class Sized_relobj): Remove clear_local_symbols.
6252 * reloc.cc (Sized_relobj::do_relocate): Don't call
6253 clear_local_symbols.
6255 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6257 * plugin.cc (is_visible_from_outside): Return true for symbols
6260 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6262 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6265 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6267 * icf.h (is_section_foldable_candidate): Change type of parameter
6269 * icf.cc (Icf::find_identical_sections): Change type of local variable
6270 section_name to be std::string.
6271 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6273 2011-01-25 Ian Lance Taylor <iant@google.com>
6275 * script.cc (script_add_extern): Rewrite to use
6276 add_symbol_reference.
6278 2011-01-25 Doug Kwan <dougkwan@google.com>
6280 * icf.cc (get_section_contents): Always lock section's object.
6282 2011-01-24 Ian Lance Taylor <iant@google.com>
6284 * options.h (class General_options): Accept
6285 --no-detect-odr-violations.
6287 2011-01-24 Ian Lance Taylor <iant@google.com>
6289 * version.cc (version_string): Bump to 1.11.
6291 2011-01-24 Ian Lance Taylor <iant@google.com>
6293 * plugin.cc (class Plugin_rescan): Define new class.
6294 (Plugin_manager::claim_file): Set any_claimed_.
6295 (Plugin_manager::save_archive): New function.
6296 (Plugin_manager::save_input_group): New function.
6297 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6299 (Plugin_manager::new_undefined_symbol): New function.
6300 (Plugin_manager::rescan): New function.
6301 (Plugin_manager::rescannable_defines): New function.
6302 (Plugin_manager::add_input_file): Set any_added_.
6303 * plugin.h (class Plugin_manager): define new fields rescannable_,
6304 undefined_symbols_, any_claimed_, and any_added_. Declare
6305 Plugin_rescan as friend. Declare new functions.
6306 (Plugin_manager::Rescannable): Define type.
6307 (Plugin_manager::Rescannable_list): Define type.
6308 (Plugin_manager::Undefined_symbol_list): Define type.
6309 (Plugin_manager::Plugin_manager): Initialize new fields.
6310 * archive.cc (Archive::defines_symbol): New function.
6311 (Add_archive_symbols::run): Pass archive to plugins if any.
6312 * archive.h (class Archive): Declare defines_symbol.
6313 * readsyms.cc (Input_group::~Input_group): New function.
6314 (Finish_group::run): Pass input_group to plugins if any.
6315 * readsyms.h (class Input_group): Declare destructor.
6316 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6319 2011-01-10 Ian Lance Taylor <iant@google.com>
6321 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6323 (Layout::set_segment_offsets): Reset increase_relro before calling
6324 set_section_addresses a second time.
6326 2011-01-04 Cary Coutant <ccoutant@google.com>
6328 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6329 sections before NOBITS sections.
6331 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6333 * version.cc (print_version): Update copyright to 2011.
6335 2010-12-23 Cary Coutant <ccoutant@google.com>
6337 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6338 of OS to this->add. Add OD parameter to second form of the function.
6340 2010-12-20 Ian Lance Taylor <iant@google.com>
6342 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6343 second of two consecutive entries with same offset.
6345 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6347 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6348 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6349 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6350 to avoid unneeded links against $(LDADD).
6351 * testsuite/Makefile.in: Regenerate.
6353 2010-12-15 Ian Lance Taylor <iant@google.com>
6356 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6357 for R_X86_64_32 and R_X86_64_PC32.
6358 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6359 ver_matching_def_pic.o.
6360 (ver_matching_def_pic.o): New target.
6362 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6364 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6365 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6366 Move definition before File_read::View member definitions.
6367 (File_read::View::~View): Initialize and hold lock before
6368 updating current_mapped_bytes.
6370 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6372 * dwarf_reader.cc: Remove outdated comment.
6373 * gold-threads.cc: Fix typo in error message.
6374 * archive.cc: Fix typos in comments.
6375 * archive.h: Likewise.
6376 * arm-reloc-property.cc: Likewise.
6377 * arm-reloc-property.h: Likewise.
6378 * arm-reloc.def: Likewise.
6380 * attributes.h: Likewise.
6381 * cref.cc: Likewise.
6382 * ehframe.cc: Likewise.
6383 * fileread.h: Likewise.
6385 * i386.cc: Likewise.
6387 * incremental.h: Likewise.
6388 * int_encoding.cc: Likewise.
6389 * layout.h: Likewise.
6390 * main.cc: Likewise.
6391 * merge.h: Likewise.
6392 * object.cc: Likewise.
6393 * object.h: Likewise.
6394 * options.cc: Likewise.
6395 * readsyms.cc: Likewise.
6396 * reduced_debug_output.cc: Likewise.
6397 * reloc.cc: Likewise.
6398 * script-sections.cc: Likewise.
6399 * sparc.cc: Likewise.
6400 * symtab.h: Likewise.
6401 * target-reloc.h: Likewise.
6402 * target.cc: Likewise.
6403 * target.h: Likewise.
6404 * timer.cc: Likewise.
6405 * timer.h: Likewise.
6406 * x86_64.cc: Likewise.
6408 2010-12-09 Cary Coutant <ccoutant@google.com>
6410 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6412 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6413 parameter; change all callers.
6414 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6415 * options.h (warn_execstack): New option.
6417 2010-12-07 Doug Kwan <dougkwan@google.com>
6419 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6420 like function call relocations.
6422 2010-12-07 Ian Lance Taylor <iant@google.com>
6424 * archive.cc (Archive::get_elf_object_for_member): Permit
6425 punconfigured to be NULL.
6426 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6427 (Archive::include_member): Pass NULL to get_elf_object_for_member
6428 if we searched for the archive and this is the first included
6431 2010-12-01 Ian Lance Taylor <iant@google.com>
6433 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6434 track_relocs_type_ field.
6435 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6436 Set track_relocs_type_.
6437 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6438 contents when using RELA relocs.
6439 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6441 * reloc.cc (Track_relocs::next_addend): New function.
6442 * reloc.h (class Track_relocs): Declare next_addend.
6444 2010-12-01 Ian Lance Taylor <iant@google.com>
6446 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6449 2010-12-01 Ian Lance Taylor <iant@google.com>
6451 * README: Update compilers known to work and fail.
6453 2010-11-23 Matthias Klose <doko@ubuntu.com>
6455 * configure.in: For --enable-gold, handle value `default' instead of
6456 `both*'. Always install ld as ld.bfd, install as ld if gold is
6458 * configure: Regenerate.
6460 2010-11-18 Doug Kwan <dougkwan@google.com>
6462 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6463 and right_alignment to be zero. Store result alignment only if it is
6464 greater than existing alignment.
6466 2010-11-16 Cary Coutant <ccoutant@google.com>
6469 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6470 Check for ".zdebug_line".
6472 2010-11-16 Doug Kwan <dougkwan@google.com>
6473 Cary Coutant <ccoutant@google.com>
6475 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6476 by reference; adjust all callers.
6477 * output.cc (Output_segment::set_section_addresses): Adjust references
6478 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6480 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6481 end at page boundary.
6483 2010-11-16 Cary Coutant <ccoutant@google.com>
6486 * layout.cc (Layout::choose_output_section): Transform names of
6487 compressed sections even when using a script with a SECTIONS clause.
6488 (Layout::output_section_name): Remove code to transform
6489 compressed debug section names.
6490 * output.cc (Output_section::add_input_section): Use uncompressed
6491 section size when tracking input sections.
6493 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6495 * symtab.h (Symbol::NON_PIC_REF): Remove.
6496 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6497 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6498 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6499 (Symbol::use_plt_offset): Take a flags argument and pass it
6500 directly to needs_dynamic_reloc. Restrict check for undefined
6501 weak symbols to function calls.
6502 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6503 (Target_arm::Scan::global): Use it.
6504 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6505 (Target_arm::Relocate::relocate): Likewise.
6506 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6507 parameter with an r_type parameter. Use get_reference_flags
6509 (Target_arm::Relocate::relocate): Update accordingly.
6510 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6511 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6512 (Target_i386::Scan::global): Likewise.
6513 (Target_i386::Relocate::relocate): Likewise.
6514 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6515 parameter with an r_type parameter. Use get_reference_flags
6517 (Target_i386::Relocate::relocate): Update accordingly.
6518 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6519 (Target_powerpc::Scan::global): Use it.
6520 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6521 (Target_powerpc::Relocate::relocate): Likewise.
6522 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6523 (Target_sparc::Scan::global): Use it.
6524 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6525 (Target_sparc::Relocate::relocate): Likewise.
6526 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6527 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6528 (Target_x86_64::Scan::global): Likewise.
6529 (Target_x86_64::Relocate::relocate): Likewise.
6531 2010-11-08 Doug Kwan <dougkwan@google.com>
6532 Cary Coutant <ccoutant@google.com>
6534 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6535 (Arm_exidx_merge_section::section_contents_): New data member.
6536 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6537 (Arm_input_section::~Arm_input_section): De-allocate memory.
6538 (Arm_input_section::original_contents_): New data member.
6539 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6540 in parameters instead of calling Object::section_contents without
6542 (Arm_output_section::group_section): New parameter TASK. Pass it
6543 to callees that need locking objects.
6544 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6545 to lock EXIDX input sections. Fix a formatting issue. Call
6546 Arm_exidx_merged_section::build_contents to create merged section
6548 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6549 to lock object of stub table owner.
6550 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6551 TEXT_SIZE to initialize data member TEXT_SIZE_.
6552 (Arm_exidx_input_section::addralign): Fix typo in comment.
6553 (Arm_exidx_input_section::text_size): New method.
6554 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6555 that require locking objects. Lock objects before scanning for stubs
6556 and updating local symbols.
6557 (Arm_input_section<big_endian>::init): Copy contents of original
6559 (Arm_input_section<big_endian>::do_write): Use saved contents of
6560 original input section instead of calling Object::section_contents
6562 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6563 size without calling Object::section_size().
6564 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6565 for size. Allocate a buffer for merged EXIDX entries.
6566 (Arm_exidx_merged_section::build_contents): New method.
6567 (Arm_exidx_merged_section::do_write): Move merge section contents
6568 building code to Arm_exidx_merged_section::build_contetns. Write
6569 out contetns in buffer instead of building it on the fly.
6570 (Arm_relobj::make_exidx_input_section): Also pass text section size
6571 to Arm_exidx_input_section constructor.
6572 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6573 (Arm_dynobj::do_read_symbols): Fix memory leak.
6574 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6575 * target.h: (class Task): Add forward declaration.
6576 (Target::relax): Add new parameter TASK and pass it to
6578 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6580 2010-11-05 Cary Coutant <ccoutant@google.com>
6583 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6584 object when reading from the file.
6585 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6587 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6588 when reading section contents.
6589 (get_section_contents): Likewise.
6590 (icf::find_identical_sections): Likewise.
6591 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6592 object when reading from the file.
6593 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6594 the object when doing deferred section layout.
6596 2010-11-03 Nick Clifton <nickc@redhat.com>
6599 * script.h (class Symbol_assignment: name): New member. Returns
6600 the name of the symbol.
6601 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6602 Returns true if the given symbol name is on the list of
6603 assignments wating to be processed.
6604 * archive.cc (should_incldue_member): If the symbol is undefined,
6605 check to see if it is on the list of symbols pending assignment.
6607 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6609 * script-sections.cc (Script_sections::find_memory_region): Check
6610 for a NULL output section pointer.
6612 2010-10-29 Doug Kwan <dougkwan@google.com>
6614 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6615 Output_section::add_relaxed_input_section.
6616 * output.cc (Output_section::add_relaxed_input_section): Add new
6617 arguments LAYOUT and NAME. Set section order index.
6618 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6619 Copy section order index.
6620 * output.h (Output_section::add_relaxed_input_section): Add new
6621 arguments LAYOUT and NAME.
6623 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6625 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6626 NATIVE_OR_CROSS_LINKER.
6627 * testsuite/Makefile.in: Regenerate.
6629 2010-10-20 Doug Kwan <dougkwan@google.com>
6631 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6632 without SHF_LINK_ORDER flags.
6633 * layout.cc (Layout::choose_output_section): Do not filter
6634 SHF_LINK_ORDER flag in a relocatable link.
6636 2010-10-17 Cary Coutant <ccoutant@google.com>
6638 * output.h (Output_segment::set_section_addresses): Change function
6639 signature. Update all callers.
6640 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6642 (Output_segment::set_section_addresses): Align after last TLS
6643 section. Add padding before last relro section instead of after.
6645 2010-10-17 Doug Kwan <dougkwan@google.com>
6647 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6648 GOT output section to be writable.
6650 2010-10-14 Cary Coutant <ccoutant@google.com>
6652 * debug.h (DEBUG_INCREMENTAL): New flag.
6653 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6654 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6656 * incremental.cc (report_command_line): Ignore all forms of
6658 * layout.cc (Layout::Layout): Check parameters for incremental link
6660 * options.cc (General_options::parse_incremental): New function.
6661 (General_options::parse_no_incremental): New function.
6662 (General_options::parse_incremental_full): New function.
6663 (General_options::parse_incremental_update): New function.
6664 (General_options::incremental_mode_): New data member.
6665 (General_options::finalize): Check incremental_mode_.
6666 * options.h (General_options): Update help text for --incremental.
6667 Add --no-incremental, --incremental-full, --incremental-update.
6668 (General_options::Incremental_mode): New enum type.
6669 (General_options::incremental_mode): New function.
6670 (General_options::incremental_mode_): New data member.
6671 * parameters.cc (Parameters::incremental_mode_): New data member.
6672 (Parameters::set_options): Set incremental_mode_.
6673 (Parameters::set_incremental_full): New function.
6674 (Parameters::incremental): New function.
6675 (Parameters::incremental_update): New function.
6676 (set_parameters_incremental_full): New function.
6677 * parameters.h (Parameters::set_incremental_full): New function.
6678 (Parameters::incremental): New function.
6679 (Parameters::incremental_update): New function.
6680 (Parameters::incremental_mode_): New data member.
6681 (set_parameters_incremental_full): New function.
6682 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6683 incremental link mode.
6684 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6685 (Sized_relobj::do_relocate_sections): Likewise.
6686 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6688 * testsuite/Makefile.in: Regenerate.
6689 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6691 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6693 * script-sections.h (class Script_sections): Make
6694 Sections_elements typedef public.
6695 * script-sections.cc (class Sort_output_sections): Add elements_
6696 field. Add constructor which sets it; change all callers.
6697 (Sort_output_sections::is_before): New function.
6698 (Sort_output_sections::operator()): Call is_before.
6699 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6701 * testsuite/script_test_10.sh: New test. Test script section
6703 * testsuite/script_test_10.t: Likewise.
6704 * testsuite/script_test_10.s: Likewise.
6705 * testsuite/Makefile.am: Wrap the cross linker tests and the
6706 common tests into NATIVE_OR_CROSS_LINKER.
6707 (check_SCRIPTS): Add script_test_10.sh.
6708 (check_DATA): Add script_test_10.stdout.
6709 (script_test_10.o, script_test_10): New targets.
6710 (script_test_10.stdout): New target.
6711 * configure, testsuite/Makefile.in: Regenerate.
6713 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6715 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6716 error for the deprecated relocations.
6717 (Target_arm::Scan::global): Likewise.
6718 (Target_arm::Relocate::relocate): Likewise.
6720 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6722 * fileread.cc (Input_file::find_file): Initialize *found_name
6723 and *namep when using the fallback search for case 4.
6725 2010-10-11 Cary Coutant <ccoutant@google.com>
6727 * options.h (class General_options): Redefine -z lazy as an alias for
6728 the negation of -z now.
6730 2010-10-11 Ian Lance Taylor <iant@google.com>
6732 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6735 2010-10-06 Nick Clifton <nickc@redhat.com>
6737 * script-sections.cc(class Memory_region): Remove
6738 current_lma_offset_ field. Rename current_vma_offset_ to
6739 current_offset_. Add last_section_ field.
6740 (Memory_region::get_current_vma_address): Rename to
6741 get_current_address.
6742 (Memory_region::get_current_lma_address): Delete.
6743 (Memory_region::increment_vma_offset): Rename to
6745 (Memory_region::increment_lma_offset): Delete.
6746 (Memory_region::attributes_compatible): New method. Returns
6747 true if the provided section is compatible with the region.
6748 (Memory_region::get_last_section): New method. Returns the last
6749 section to use the region.
6750 (Memory_region::set_last_section): New method. Stores the last
6751 section to use the region.
6752 (Script_sections::block_in_region): New method. Returns true if
6753 a block of memory is contained within a region.
6754 (Script_sections::find_memory_region): New method. Locates a
6755 memory region to be used to set a VMA or LMA address.
6756 (Output_section_definition::set_section_addresses): Add code to
6757 check for addresses set by memory regions.
6758 (Output_segment::set_section_addresses): Remove memory region
6760 (Script_sections::create_segment): Add a warning if a header
6761 segment is created outside of any region.
6762 * script-sections.h (class Script_sections): Add prototypes for
6763 find_memory_region and block_in_region methods.
6764 * testsuite/memory_test.s: Use .long instead of .word.
6765 * testsuite/memory_test.t: Add some more output sections.
6766 * testsuite/memory_test.sh: Update expected output.
6768 2010-10-02 Doug Kwan <dougkwan@google.com>
6770 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6771 defintion to symtab.h
6772 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6773 declaration to defintion.
6775 2010-10-01 Nick Clifton <nickc@redhat.com>
6777 * expression.cc (eval): Replace dummy argument with NULL.
6778 (eval_maybe_dot): Check for a NULL result section pointer.
6779 (Symbol_expression::value): Likewise.
6780 (Dot_expression::value): Likewise.
6781 (BINARY_EXPRESSION): Likewise.
6782 (Max_expression::value): Likewise.
6783 (Min_expression::value): Likewise.
6784 (Absolute_expression::value): Likewise.
6785 (Addr_expression::value_from_output_section): Likewise.
6786 (Loaddddr_expression::value_from_output_section): Likewise.
6787 (Segment_start_expression::value): Likewise.
6788 * script-sections.cc
6789 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6791 (Sections_elememt_dot_assignment::set_section_addresses):
6793 (Output_data_expression::do_write_to_buffer): Likewise.
6794 (Output_section_definition::finalize_symbols): Likewise.
6795 (Output_section_definition::set_section_addresses): Likewise.
6797 2010-09-30 Doug Kwan <dougkwan@google.com>
6799 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6801 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6803 * target.h (Target::can_icf_inline_merge_sections): New virtual
6805 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6807 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6809 * icf.cc (get_section_contents): Inline merge sections only when
6812 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6814 * configure: Regenerate.
6816 2010-09-17 Ian Lance Taylor <iant@google.com>
6818 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6819 * testsuite/Makefile.am (memory_test.o): New target.
6820 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6822 * testsuite/Makefile.in: Rebuild.
6824 2010-09-17 Doug Kwan <dougkwan@google.com>
6826 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6827 defintion if relocation uses GOT entries of the symbol.
6828 * testsuite/icf_safe_test.sh: Fix test.
6829 * testsuite/icf_safe_so_test.sh: Fix test.
6831 2010-09-16 Cary Coutant <ccoutant@google.com>
6833 * script_sections.cc (class Memory_region): Remove "NULL" from
6834 vector initializations.
6836 2010-09-15 Cary Coutant <ccoutant@google.com>
6838 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6839 Resolve forwarding symbols.
6841 2010-09-15 Doug Kwan <dougkwan@google.com>
6843 * gold/testsuite/script_test_3.t: Add ARM special sections.
6844 * gold/testsuite/script_test_4.t: Same.
6845 * gold/testsuite/script_test_5.t: Same.
6846 * gold/testsuite/script_test_6.t: Same.
6847 * gold/testsuite/script_test_7.t: Same.
6848 * gold/testsuite/script_test_7.t: Same.
6849 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6851 2010-09-14 Cary Coutant <ccoutant@google.com>
6853 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6854 (Target_x86_64::Relocate::relocate_tls): Replace check for
6855 saw_tls_block_reloc_ with test for executable section.
6857 2010-09-12 Cary Coutant <ccoutant@google.com>
6859 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6860 position-independent executables to shared libraries need dynamic
6862 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6863 position-independent executables.
6864 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6865 * testsuite/Makefile.in: Regenerate.
6867 2010-09-10 Nick Clifton <nickc@redhat.com>
6870 * testsuite/memory_test.t: Discard any sections that are not
6873 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6876 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6877 "This::" to work around a bug in gcc 4.2.
6879 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6881 2010-09-09 Rafael Espindola <espindola@google.com>
6883 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6884 sections with different PF_X flags in the same segment.
6885 (Layout::find_first_load_seg): Search all segments to find the first
6887 * options.h (rosegment): New.
6889 2010-09-08 Rafael Espindola <espindola@google.com>
6891 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6893 2010-09-08 Doug Kwan <dougkwan@google.com>
6895 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6896 (Arm_relobj::do_relocate_sections): Add new parameter for output
6897 file to match the parent.
6898 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6899 of local symbols instead of input values. Update code to track
6900 changes in gold::relocate_section.
6901 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6902 (Sized_relobj::compute_final_local_value_internal): New methods.
6903 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6904 body into private version of Sized_relobj::compute_final_local_value.
6905 Call the inline method.
6906 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6907 merged symbol value if there is one.
6908 (Symbol_value::has_output_value): New method defintiion.
6909 (Sized_relobj::Compute_final_local_value_status): New enum type.
6910 (Sized_relobj::compute_final_local_value): New methods.
6911 (Sized_relobj::compute_final_local_value_internal): New methods.
6912 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6913 and arm_cortex_a8.sh.
6914 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6915 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6917 * Makefile.in: Regenerate.
6918 * testsuite/arm_bl_out_of_range.s: Update test.
6919 * testsuite/thumb_bl_out_of_range.s: Ditto.
6920 * testsuite/thumb_blx_out_of_range.s: Ditto.
6921 * testsuite/arm_branch_out_of_range.sh: New file.
6922 * testsuite/arm_cortex_a8.sh: Ditto.
6923 * testsuite/arm_cortex_a8_b.s: Ditto.
6924 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6925 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6926 * testsuite/arm_cortex_a8_bl.s: Ditto.
6927 * testsuite/arm_cortex_a8_blx.s: Ditto.
6928 * testsuite/arm_cortex_a8_local.s: Ditto.
6929 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6930 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6932 2010-09-08 Rafael Espindola <espindola@google.com>
6934 * Makefile.am (memory_test.stdout): Run readelf with -W.
6935 * Makefile.in: Regenerate.
6936 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6939 2010-09-08 Rafael Espindola <espindola@google.com>
6941 * script-sections.cc (Script_sections::add_memory_region): Convert
6942 field precision to int.
6943 * script.cc (script_set_section_region, script_set_section_region):
6944 Convert field precision to int.
6946 2010-09-08 Rafael Espindola <espindola@google.com>
6948 * arm.cc (do_finalize_sections): Create the __exidx_start and
6949 __exdix_end symbols even when the section is missing.
6951 2010-09-08 Nick Clifton <nickc@redhat.com>
6953 * README: Remove claim that MEMORY is not supported.
6954 * expression.cc (script_exp_function_origin)
6955 (script_exp_function_length): Move from here to ...
6956 * script.cc: ... here.
6957 (script_set_section_region, script_add_memory)
6958 (script_parse_memory_attr, script_include_directive): New
6960 * script-sections.cc
6961 (class Memory_region): New class.
6962 (class Output_section_definition): Add set_memory_region,
6963 set_section_vma, set_section_lma and get_section_name methods.
6964 (class Script_Sections): Add add_memory_region,
6965 find_memory_region, find_memory_region_origin,
6966 find_memory_region_length and set_memory_region methods.
6967 Have set_section_addresses method walk the list of set memory
6969 Extend the print methos to display memory regions.
6970 * script-sections.h: Add prototypes for new methods.
6971 Add enum for MEMORY region attributes.
6972 * yyscript.y: Add support for parsing MEMORY regions.
6973 * script-c.h: Add prototypes for new functions.
6974 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6975 * testsuite/Makefile.in: Regenerate.
6976 * testsuite/memory_test.sh: New script.
6977 * testsuite/memory_test.s: New assembler source file.
6978 * testsuite/memory_test.t: New linker script.
6980 2010-08-27 Doug Kwan <dougkwan@google.com>
6982 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6983 reference override an existing dynamic weak reference.
6984 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6985 * testsuite/Makefile.in: Regenerate.
6986 * testsuite/dyn_weak_ref.sh: New file.
6987 * testsuite/dyn_weak_ref_1.c: Ditto.
6988 * testsuite/dyn_weak_ref_2.c: Ditto.
6990 2010-08-27 Ian Lance Taylor <iant@google.com>
6992 * incremental.h (class Incremental_input_entry): Add virtual
6995 2010-08-27 Ian Lance Taylor <iant@google.com>
6997 * testsuite/start_lib_test_3.c: Mark t3 as used.
6999 2010-08-27 Nick Clifton <nickc@redhat.com>
7001 * options.cc (version_script): Fix small typo in previous
7004 2010-08-25 Nick Clifton <nickc@redhat.com>
7006 * archive.cc: Formatting fixes: Remove whitespace between
7007 typename and following asterisk. Remove whitespace between
7008 function name and opening parenthesis.
7009 * archive.h: Likewise.
7011 * attributes.cc: Likewise.
7012 * attributes.h: Likewise.
7013 * common.cc: Likewise.
7014 * copy-relocs.cc: Likewise.
7015 * dirsearch.h: Likewise.
7016 * dynobj.cc: Likewise.
7017 * ehframe.cc: Likewise.
7018 * ehframe.h: Likewise.
7019 * expression.cc: Likewise.
7020 * fileread.cc: Likewise.
7021 * fileread.h: Likewise.
7023 * gold-threads.cc: Likewise.
7024 * gold.cc: Likewise.
7025 * i386.cc: Likewise.
7027 * incremental-dump.cc: Likewise.
7028 * incremental.cc: Likewise.
7029 * layout.cc: Likewise.
7030 * layout.h: Likewise.
7031 * main.cc: Likewise.
7032 * merge.cc: Likewise.
7033 * merge.h: Likewise.
7034 * object.cc: Likewise.
7035 * object.h: Likewise.
7036 * options.cc: Likewise.
7037 * options.h: Likewise.
7038 * output.cc: Likewise.
7039 * output.h: Likewise.
7040 * plugin.cc: Likewise.
7041 * plugin.h: Likewise.
7042 * powerpc.cc: Likewise.
7043 * reloc.cc: Likewise.
7044 * script-c.h: Likewise.
7045 * script-sections.cc: Likewise.
7046 * script.cc: Likewise.
7047 * stringpool.cc: Likewise.
7048 * symtab.cc: Likewise.
7049 * symtab.h: Likewise.
7050 * target.cc: Likewise.
7051 * timer.cc: Likewise.
7052 * timer.h: Likewise.
7053 * version.cc: Likewise.
7054 * x86_64.cc: Likewise.
7056 2010-08-24 Nick Clifton <nickc@redhat.com>
7059 * layout.cc (segment_precedes): Sort segments by their physical
7060 addresses, if they have been set.
7062 2010-08-23 Cary Coutant <ccoutant@google.com>
7064 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7066 (Lib_group::include_member): Unlock object after deleting its
7068 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7071 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7072 Cary Coutant <ccoutant@google.com>
7074 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7075 constructor, and set_blocker.
7076 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7078 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7079 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7080 * testsuite/Makefile.am (start_lib_test): New test case.
7081 * testsuite/Makefile.in: Regenerate.
7082 * testsuite/start_lib_test_main.c: New file.
7083 * testsuite/start_lib_test_1.c: New file.
7084 * testsuite/start_lib_test_2.c: New file.
7085 * testsuite/start_lib_test_3.c: New file.
7087 2010-08-19 Ian Lance Taylor <iant@google.com>
7089 * Makefile.in: Rebuild with automake 1.11.1.
7090 * aclocal.m4: Likewise.
7091 * testsuite/Makefile.in: Likewise.
7093 2010-08-19 Ian Lance Taylor <iant@google.com>
7096 * i386.cc (class Output_data_plt_i386): Update declarations.
7097 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7098 local_ifuncs_ fields.
7099 (Target_i386::do_plt_section_for_global): New function.
7100 (Target_i386::do_plt_section_for_local): New function.
7101 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7102 parameter; change all callers. Initialize global_ifuncs_ and
7103 local_ifuncs_. If doing a static link define __rel_iplt_start and
7105 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7106 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7107 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7109 (Target_i386::make_plt_section): New function, broken out of
7110 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7111 (Target_i386::make_plt_entry): Call make_plt_section.
7112 (Target_i386::make_local_ifunc_plt_entry): New function.
7113 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7114 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7115 R_386_IRELATIVE to switch.
7116 (Target_i386::Scan::global): Likewise.
7117 (Target_i386::Relocate::relocate): Likewise.
7118 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7120 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7121 (Target_x86_64::do_plt_section_for_global): New function.
7122 (Target_x86_64::do_plt_section_for_local): New function.
7123 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7124 parameter; change all callers. If doing a static link define
7125 __rela_iplt_start and __rela_iplt_end.
7126 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7127 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7128 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7130 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7131 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7133 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7134 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7135 R_X86_64_IRELATIVE to switch.
7136 (Target_x86_64::Scan::global): Likewise.
7137 (Target_x86_64::Relocate::relocate): Likewise.
7138 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7140 * target.h (class Target): Add plt_section_for_global and
7141 plt_section_for_local functions. Add do_plt_section_for_global
7142 and do_plt_section_for_local virtual functions.
7143 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7144 clarifying comments.
7145 (Symbol::use_plt_offset): Handle IFUNC symbol.
7146 * object.cc (Sized_relobj::Sized_relobj): Initialize
7148 (Sized_relobj::local_has_plt_offset): New function.
7149 (Sized_relobj::local_plt_offset): New function.
7150 (Sized_relobj::set_local_plt_offset): New function.
7151 (Sized_relobj::do_count): Handle IFUNC symbol.
7152 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7153 a bit away from input_shndx_ field. Add set_is_func_symbol and
7154 is_ifunc_symbol functions.
7155 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7156 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7157 local_plt_offsets_ field.
7158 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7159 * output.h (class Output_section_data): Add non-const
7160 output_section function.
7161 (class Output_data_got): Update declarations.
7162 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7163 Add use_plt_offset parameter to global and local constructors.
7164 Change all callers. Change local_sym_index_ field to 31 bits.
7165 Change GSYM_CODE and CONSTANT_CODE accordingly.
7166 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7167 doing a static link don't set sh_link field.
7168 (Output_data_got::Got_entry::write): Use PLT offset if
7170 (Output_data_got::add_global_plt): New function.
7171 (Output_data_got::add_local_plt): New function.
7172 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7173 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7174 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7175 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7176 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7178 * testsuite/ifunc-sel.h: New file.
7179 * testsuite/ifuncmain1.c: New file.
7180 * testsuite/ifuncmain1vis.c: New file.
7181 * testsuite/ifuncmod1.c: New file.
7182 * testsuite/ifuncdep2.c: New file.
7183 * testsuite/ifuncmain2.c: New file.
7184 * testsuite/ifuncmain3.c: New file.
7185 * testsuite/ifuncmod3.c: New file.
7186 * testsuite/ifuncmain4.c: New file.
7187 * testsuite/ifuncmain5.c: New file.
7188 * testsuite/ifuncmod5.c: New file.
7189 * testsuite/ifuncmain6pie.c: New file.
7190 * testsuite/ifuncmod6.c: New file.
7191 * testsuite/ifuncmain7.c: New file.
7192 * configure, testsuite/Makefile.in: Rebuild.
7194 2010-08-18 Ian Lance Taylor <iant@google.com>
7197 (Output_section_incremental_inputs::write_input_files): Add cast
7198 to avoid signed/unsigned comparison warning.
7199 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7201 2010-08-12 Cary Coutant <ccoutant@google.com>
7203 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7205 2010-08-13 Ian Lance Taylor <iant@google.com>
7207 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7209 2010-08-12 Cary Coutant <ccoutant@google.com>
7210 Doug Kwan <dougkwan@google.com>
7212 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7213 defintion overrides non-weak undef, remember that the original undef
7215 * symtab.cc (Symbol_table::sized_write_global): For undef without
7216 an original weak binding, set binding to global in output.
7217 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7218 * testsuite/Makefile.in: Regenerate.
7219 * testsuite/strong_ref_weak_def.sh: New file.
7220 * testsuite/strong_ref_weak_def_1.c: Ditto.
7221 * testsuite/strong_ref_weak_def_2.c: Ditto.
7223 2010-08-12 Cary Coutant <ccoutant@google.com>
7225 * testsuite/incremental_test.sh: Rewrite.
7226 * testsuite/incremental_test_1.c: Rewrite.
7227 * testsuite/incremental_test_2.c: Rewrite.
7229 2010-08-12 Cary Coutant <ccoutant@google.com>
7231 * arm.cc (Target_arm::got_size): Add const.
7232 (Target_arm::got_entry_count): New function.
7233 (Target_arm::plt_entry_count): New function.
7234 (Target_arm::first_plt_entry_offset): New function.
7235 (Target_arm::plt_entry_size): New function.
7236 (Output_data_plt_arm::entry_count): New function.
7237 (Output_data_plt_arm::first_plt_entry_offset): New function.
7238 (Output_data_plt_arm::get_plt_entry_size): New function.
7239 * i386.cc (Target_i386::got_size): Add const.
7240 (Target_i386::got_entry_count): New function.
7241 (Target_i386::plt_entry_count): New function.
7242 (Target_i386::first_plt_entry_offset): New function.
7243 (Target_i386::plt_entry_size): New function.
7244 (Output_data_plt_i386::entry_count): New function.
7245 (Output_data_plt_i386::first_plt_entry_offset): New function.
7246 (Output_data_plt_i386::get_plt_entry_size): New function.
7247 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7248 find_incremental_inputs_sections. Dump incremental_got_plt section.
7249 * incremental.cc: Include target.h.
7250 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7251 parameter. Adjust all callers. Find incremental_got_plt section.
7252 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7254 (Output_section_incremental_inputs::set_final_data_size): Calculate
7255 size of incremental_got_plt section.
7256 (Output_section_incremental_inputs::do_write): Write the
7257 incremental_got_plt section.
7258 (Got_plt_view_info): New struct.
7259 (Local_got_offset_visitor): New class.
7260 (Global_got_offset_visitor): New class.
7261 (Global_symbol_visitor_got_plt): New class.
7262 (Output_section_incremental_inputs::write_got_plt): New function.
7263 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7264 Add parameter. Adjust all callers.
7265 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7266 (Incremental_inputs::got_plt_section): New function.
7267 (Incremental_inputs::got_plt_section_): New data member.
7268 (Incremental_got_plt_reader): New class.
7269 * layout.cc (Layout::create_incremental_info_sections): Add the
7270 incremental_got_plt section.
7271 * object.h (Got_offset_list::get_list): New function.
7272 (Got offset_list::for_all_got_offsets): New function.
7273 (Sized_relobj::local_got_offset_list): New function.
7274 * powerpc.cc (Target_powerpc::got_size): Add const.
7275 (Target_powerpc::got_entry_count): New function.
7276 (Target_powerpc::plt_entry_count): New function.
7277 (Target_powerpc::first_plt_entry_offset): New function.
7278 (Target_powerpc::plt_entry_size): New function.
7279 (Output_data_plt_powerpc::entry_count): New function.
7280 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7281 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7282 * sparc.cc (Target_sparc::got_size): Add const.
7283 (Target_sparc::got_entry_count): New function.
7284 (Target_sparc::plt_entry_count): New function.
7285 (Target_sparc::first_plt_entry_offset): New function.
7286 (Target_sparc::plt_entry_size): New function.
7287 (Output_data_plt_sparc::entry_count): New function.
7288 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7289 (Output_data_plt_sparc::get_plt_entry_size): New function.
7290 * symtab.h (Symbol::got_offset_list): New function.
7291 (Symbol_table::for_all_symbols): New function.
7292 * target.h (Sized_target::got_entry_count): New function.
7293 (Sized_target::plt_entry_count): New function.
7294 (Sized_target::plt_entry_size): New function.
7295 * x86_64.cc (Target_x86_64::got_size): Add const.
7296 (Target_x86_64::got_entry_count): New function.
7297 (Target_x86_64::plt_entry_count): New function.
7298 (Target_x86_64::first_plt_entry_offset): New function.
7299 (Target_x86_64::plt_entry_size): New function.
7300 (Output_data_plt_x86_64::entry_count): New function.
7301 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7302 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7304 2010-08-12 Cary Coutant <ccoutant@google.com>
7306 * archive.cc: Include incremental.h.
7307 (Archive::Archive): Initialize incremental_info_.
7308 (Archive::include_member): Record archive members in incremental info.
7309 (Add_archive_symbols::run): Record begin and end of an archive in
7311 (Lib_group::include_member): Record objects in incremental info.
7312 * archive.h (Incremental_archive_entry): Forward declaration.
7313 (Archive::set_incremental_info): New member function.
7314 (Archive::incremental_info): New member function.
7315 (Archive::Unused_symbol_iterator): New class.
7316 (Archive::unused_symbols_begin): New member function.
7317 (Archive::unused_symbols_end): New member function.
7318 (Archive::incremental_info_): New data member.
7319 * incremental-dump.cc (find_input_containing_global): New function.
7320 (dump_incremental_inputs): Dump new incremental info sections.
7321 * incremental.cc: Include symtab.h.
7322 (Output_section_incremental_inputs): New class.
7323 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7324 new incremental info sections.
7325 (Sized_incremental_binary::do_check_inputs): Likewise.
7326 (Incremental_inputs::report_archive): Remove.
7327 (Incremental_inputs::report_archive_begin): New function.
7328 (Incremental_inputs::report_archive_end): New function.
7329 (Incremental_inputs::report_object): New function.
7330 (Incremental_inputs::finalize_inputs): Remove.
7331 (Incremental_inputs::report_input_section): New function.
7332 (Incremental_inputs::report_script): Rewrite.
7333 (Incremental_inputs::finalize): Do nothing but finalize string table.
7334 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7335 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7336 (Incremental_inputs::create_data_sections): New function.
7337 (Incremental_inputs::relocs_entsize): New function.
7338 (Output_section_incremental_inputs::set_final_data_size): New function.
7339 (Output_section_incremental_inputs::do_write): New function.
7340 (Output_section_incremental_inputs::write_header): New function.
7341 (Output_section_incremental_inputs::write_input_files): New function.
7342 (Output_section_incremental_inputs::write_info_blocks): New function.
7343 (Output_section_incremental_inputs::write_symtab): New function.
7344 * incremental.h (Incremental_script_entry): Forward declaration.
7345 (Incremental_object_entry): Forward declaration.
7346 (Incremental_archive_entry): Forward declaration.
7347 (Incremental_inputs): Forward declaration.
7348 (Incremental_inputs_header_data): Remove.
7349 (Incremental_inputs_header): Remove.
7350 (Incremental_inputs_header_write): Remove.
7351 (Incremental_inputs_entry_data): Remove.
7352 (Incremental_inputs_entry): Remove.
7353 (Incremental_inputs_entry_write): Remove.
7354 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7355 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7356 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7357 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7359 (Incremental_input_entry): New class.
7360 (Incremental_script_entry): New class.
7361 (Incremental_object_entry): New class.
7362 (Incremental_archive_entry): New class.
7363 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7364 (Incremental_inputs::report_inputs): Remove.
7365 (Incremental_inputs::report_archive): Remove.
7366 (Incremental_inputs::report_archive_begin): New function.
7367 (Incremental_inputs::report_archive_end): New function.
7368 (Incremental_inputs::report_object): Change prototype.
7369 (Incremental_inputs::report_input_section): New function.
7370 (Incremental_inputs::report_script): Change prototype.
7371 (Incremental_inputs::get_reloc_count): New function.
7372 (Incremental_inputs::set_reloc_count): New function.
7373 (Incremental_inputs::create_data_sections): New function.
7374 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7375 (Incremental_inputs::inputs_section): New function.
7376 (Incremental_inputs::symtab_section): New function.
7377 (Incremental_inputs::relocs_section): New function.
7378 (Incremental_inputs::get_stringpool): Add const.
7379 (Incremental_inputs::command_line): Add const.
7380 (Incremental_inputs::inputs): Remove.
7381 (Incremental_inputs::command_line_key): New function.
7382 (Incremental_inputs::input_file_count): New function.
7383 (Incremental_inputs::input_files): New function.
7384 (Incremental_inputs::relocs_entsize): New function.
7385 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7386 (Incremental_inputs::finalize_inputs): Remove.
7387 (Incremental_inputs::Input_info): Remove.
7388 (Incremental_inputs::lock_): Remove.
7389 (Incremental_inputs::inputs_): Change type.
7390 (Incremental_inputs::inputs_map_): Remove.
7391 (Incremental_inputs::current_object_entry_): New data member.
7392 (Incremental_inputs::inputs_section_): New data member.
7393 (Incremental_inputs::symtab_section_): New data member.
7394 (Incremental_inputs::relocs_section_): New data member.
7395 (Incremental_inputs::reloc_count_): New data member.
7396 (Incremental_inputs_reader): New class.
7397 (Incremental_symtab_reader): New class.
7398 (Incremental_relocs_reader): New class.
7399 * layout.cc (Layout::finalize): Move finalization of incremental info
7400 and creation of incremental info sections to follow finalization of
7401 symbol table. Set offsets for postprocessing sections.
7402 (Layout::create_incremental_info_sections): Call
7403 Incremental_inputs::create_data_sections. Add incremental symtab
7404 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7405 sections to layout after input sections.
7406 * layout.h (struct Timespec): Forward declaration.
7407 (Layout::incremental_inputs): Add const.
7408 (Layout::create_incremental_info_sections): Add parameter.
7409 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7410 * object.cc: Include incremental.h.
7411 (Relobj::finalize_incremental_relocs): New function.
7412 (Sized_relobj::do_layout): Record input sections in incremental info.
7413 * object.h (Object::output_section): New function.
7414 (Object::output_section_offset): Moved from Relobj.
7415 (Object::get_incremental_reloc_base): New function.
7416 (Object::get_incremental_reloc_count): New function.
7417 (Object::do_output_section): New function.
7418 (Object::do_output_section_offset): Moved from Relobj.
7419 (Object::do_get_incremental_reloc_base): New function.
7420 (Object::do_get_incremental_reloc_count): New function.
7421 (Object::Object): Initialize new data members.
7422 (Relobj::output_section): Renamed do_output_section and moved to
7424 (Relobj::output_section_offset): Moved to Object.
7425 (Relobj::do_get_incremental_reloc_base): New function.
7426 (Relobj::do_get_incremental_reloc_count): New function.
7427 (Relobj::allocate_incremental_reloc_counts): New function.
7428 (Relobj::count_incremental_reloc): New function.
7429 (Relobj::finalize_incremental_relocs): New function.
7430 (Relobj::next_incremental_reloc_index): New function.
7431 (Relobj::reloc_counts_): New data member.
7432 (Relobj::reloc_bases_): New data member.
7433 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7434 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7435 (Sized_relobj::incremental_relocs_scan): New function.
7436 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7437 (Sized_relobj::incremental_relocs_write): New function.
7438 (Sized_relobj::incremental_relocs_write_reltype): New function.
7439 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7441 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7442 archives and object files elsewhere.
7443 (Add_symbols::run): Report object files here.
7444 (Finish_group::run): Report end of archive at end of group.
7445 * reloc.cc: Include layout.h, incremental.h.
7446 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7447 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7448 (Sized_relobj::incremental_relocs_scan): New function.
7449 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7450 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7451 (Sized_relobj::incremental_relocs_write): New function.
7452 (Sized_relobj::incremental_relocs_write_reltype): New function.
7453 * script.cc (read_input_script): Rewrite test for incremental link.
7454 Change call to Incremental_inputs::report_script.
7455 * symtab.h (Symbol_table::first_global_index): New function.
7456 (Symbol_table::output_count): New function.
7458 2010-08-12 Doug Kwan <dougkwan@google.com>
7460 * arm.cc (Target_arm::merge_object_attributes): Check command line
7461 options --no-wchar-size-warning and --no-enum-size-warning.
7462 * options.h (General_options): Add ld-compatible options
7463 --no-enum-size-warning and --no-wchar-size-warning.
7465 2010-08-04 Ian Lance Taylor <iant@google.com>
7467 * x86_64.cc (Target_x86_64::Scan::local): Use
7468 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7469 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7470 (Target_x86_64::Scan::global): Likewise.
7471 (Target_x86_64::Relocate::relocate): Likewise.
7472 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7475 2010-08-03 Cary Coutant <ccoutant@google.com>
7477 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7478 to reserve space in merged_strings vector. Keep total input size
7480 (Output_merge_string::do_print_merge_stats): Print total input size.
7481 * merge.h (Output_merge_string): Add input_size_ field.
7482 * stringpool.cc (Stringpool_template::string_length): Move
7483 implementations out of Stringpool_template class and place in
7485 * stringpool.h (string_length): Move out of Stringpool_template.
7487 2010-08-03 Ian Lance Taylor <iant@google.com>
7490 * layout.cc (relaxation_loop_body): If address of load segment is
7491 set, adjust address to include headers if possible.
7493 2010-08-03 Ian Lance Taylor <iant@google.com>
7495 * version.cc (version_string): Bump to 1.10.
7497 2010-08-03 Ian Lance Taylor <iant@google.com>
7500 * layout.h (enum Output_section_order): Define.
7501 (class Layout): Update declarations.
7502 * layout.cc (Layout::get_output_section): Add order parameter.
7503 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7504 is_first_non_relro parameters. Change all callers.
7505 (Layout::choose_output_section): Likewise.
7506 (Layout::add_output_section_data): Likewise.
7507 (Layout::make_output_section): Likewise. Set order.
7508 (Layout::default_section_order): New function.
7509 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7510 * output.cc (Output_section::Output_section): Initialize order_.
7511 Don't initialize deleted fields.
7512 (Output_segment::Output_segment): Don't initialize deleted
7514 (Output_segment::add_output_section_to_load): New function
7515 replacing add_output_section. Change all callers to call this or
7516 add_output_section_to_nonload.
7517 (Output_segment::add_output_section_to_nonload): New function.
7518 (Output_segment::remove_output_section): Rewrite.
7519 (Output_segment::add_initial_output_data): Likewise.
7520 (Output_segment::has_any_data_sections): Likewise.
7521 (Output_segment::is_first_section_relro): Likewise.
7522 (Output_segment::maximum_alignment): Likewise.
7523 (Output_segment::has_dynamic_reloc): New function replacing
7524 dynamic_reloc_count. Change all callers.
7525 (Output_segment::has_dynamic_reloc_list): New function replacing
7526 dynamic_reloc_count_list. Change all callers.
7527 (Output_segment::set_section_addresses): Rewrite.
7528 (Output_segment::set_offset): Rewrite.
7529 (Output_segment::find_first_and_last_list): Remove.
7530 (Output_segment::set_tls_offsets): Rewrite.
7531 (Output_segment::first_section_load_address): Likewise.
7532 (Output_segment::output_section_count): Likewise.
7533 (Output_segment::section_with_lowest_load_address): Likewise.
7534 (Output_segment::write_section_headers): Likewise.
7535 (Output_segment::print_sections_to_map): Likewise.
7536 * output.h (class Output_data): Remove dynamic_reloc_count_
7537 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7538 (Output_data::add_dynamic_reloc): Rewrite.
7539 (Output_data::has_dynamic_reloc): New function.
7540 (Output_data::dynamic_reloc_count): Remove.
7541 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7542 is_last_relro_, is_first_non_relro_, is_interp_,
7543 is_dynamic_linker_section_ fields. Add order and set_order
7544 functions. Remove is_relro_local, set_is_relro_local,
7545 is_last_relro, set_is_last_relro, is_first_non_relro,
7546 set_is_first_non_relro functions, is_interp, set_is_interp,
7547 is_dynamic_linker_section, and set_is_dynamic_linker_section
7549 (class Output_segment): Change Output_data_list from std::list to
7550 std:;vector. Add output_lists_ field. Remove output_data_ and
7551 output_bss_ fields. Update declarations.
7553 2010-08-02 Ian Lance Taylor <iant@google.com>
7555 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7556 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7557 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7559 2010-08-02 Ian Lance Taylor <iant@google.com>
7562 * script.cc (Script_options::Script_options): Initialize
7563 symbol_definitions_ and symbol_references_.
7564 (Script_options::add_symbol_assignment): Update
7565 symbol_definitions_ and symbol_references_.
7566 (Script_options::add_symbol_reference): New function.
7567 (script_symbol): New function.
7568 * script.h (class Script_options): Add symbol_definitions_ and
7569 symbol_references_ fields.
7570 (Script_options::referenced_const_iterator): New type.
7571 (Script_options::referenced_begin): New function.
7572 (Script_options::referenced_end): New function.
7573 (Script_options::is_referenced): New function.
7574 (Script_options::any_unreferenced): New function.
7575 * script-c.h (script_symbol): Declare.
7576 * yyscript.y (exp): Call script_symbol.
7577 * symtab.cc: Include "script.h".
7578 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7579 Change all callers. Check symbols referenced by scripts.
7580 (Symbol_table::add_undefined_symbols_from_command_line): Add
7581 layout parameter. Change all callers.
7582 (Symbol_table::do_add_undefined_symbols_from_command_line):
7583 Likewise. Break out loop body. Check symbols referenced by
7585 (Symbol_table::add_undefined_symbol_from_command_line): New
7586 function broken out of
7587 do_add_undefined_symbols_from_command_line.
7588 * symtab.h (class Symbol_table): Update declarations.
7589 * archive.cc: Include "layout.h".
7590 (Archive::should_include_member): Add layout parameter. Change
7591 all callers. Check for symbol mentioned in expression.
7592 * archive.h (class Archive): Update declaration.
7593 * object.cc (Sized_relobj::do_should_include_member): Add layout
7595 * object.h (Object::should_include_member): Add layout parameter.
7597 (Object::do_should_include_member): Add layout parameter.
7598 (class Sized_relobj): Update declaration.
7599 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7601 * dynobj.h (class Sized_dynobj): Update declaration.
7602 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7604 * plugin.h (class Sized_pluginobj): Update declaration.
7606 2010-08-02 Ian Lance Taylor <iant@google.com>
7609 * output.cc (Output_segment::set_offset): Search for the first and
7610 last sections rather than assuming that the list is in order.
7611 (Output_segment::find_first_and_last_list): New function.
7612 * output.h (class Output_segment): Update declarations.
7613 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7614 (relro_strip_test_SOURCES): New variable.
7615 (relro_strip_test_DEPENDENCIES): New variable.
7616 (relro_strip_test_LDFLAGS): New variable.
7617 (relro_strip_test_LDADD): New variable.
7618 (relro_strip_test.so): New target.
7620 2010-08-02 Ian Lance Taylor <iant@google.com>
7622 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7623 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7624 (Target_i386::got_tlsdesc_section): New function.
7625 (Target_i386::got_section): Create space for GOT entries for
7626 TLSDESC relocations.
7627 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7629 (Target_i386::Scan::global): Likewise.
7630 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7632 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7633 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7634 (Target_x86_64::got_tlsdesc_section): New function.
7635 (Target_x86_64::got_section): Create space for GOT entries for
7636 TLSDESC relocations.
7637 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7639 (Target_x86_64::Scan::global): Likewise.
7640 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7643 2010-08-02 Ian Lance Taylor <iant@google.com>
7645 * testsuite/final_layout.sh: Use dc to convert from hex to
7648 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7650 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7651 paramter to the call to gold::gc_process_relocs.
7652 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7653 paramter to the call to gold::gc_process_relocs.
7654 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7655 parameter to the call to gold::gc_process_relocs.
7656 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7657 template parameter to the call to gold::gc_process_relocs.
7658 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7659 paramter to the call to gold::gc_process_relocs.
7660 * gc.h (get_embedded_addend_size): New function.
7661 (gc_process_relocs): Save the size of the reloc for use by ICF.
7662 * icf.cc (get_section_contents): Get the addend from the text section
7663 for SHT_REL relocation sections.
7664 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7665 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7666 * int_encoding.h (read_from_pointer): New overloaded function.
7667 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7668 * testsuite/icf_sht_rel_addend_test.sh: New file.
7669 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7670 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7672 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7674 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7675 * Makefile.in: Regenerate.
7676 * testsuite/Makefile.in: Regenerate.
7678 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7680 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7681 * gold/testsuite/debug_msg.cc: Likewise.
7682 * gold/testsuite/odr_violation1.cc
7683 * gold/testsuite/odr_violation2.cc
7685 2010-07-21 Cary Coutant <ccoutant@google.com>
7687 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7688 string, and length fields.
7689 (Output_merge_string::Merged_strings_list): New type.
7690 (Output_merge_string::Merged_strings_lists): New typedef.
7691 (Output_merge_string): Replace merged_strings_ with
7692 merged_strings_lists_.
7693 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7694 Merged_strings_list per input object and section. Don't store pointer
7695 to the string. Don't store length with each merged string entry.
7696 (Output_merge_string::finalize_merged_data): Loop over list of merged
7697 strings lists. Recompute length of each merged string.
7699 2010-07-15 Cary Coutant <ccoutant@google.com>
7701 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7704 2010-07-14 Ian Lance Taylor <iant@google.com>
7706 * descriptors.cc (Descriptors::open): Report correct name in error
7709 2010-07-13 Doug Kwan <dougkwan@google.com>
7711 * arm.cc (Arm_input_section::Arm_input_section): For a
7712 SHT_ARM_EXIDX section, always keeps the input sections.
7713 (Arm_input_section::set_exidx_section_link): New method.
7714 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7715 has_errors_ to false.
7716 (Arm_exidx_input_section::has_errors,
7717 Arm_exidx_input_section::set_has_errors): New methods.
7718 (Arm_exidx_input_section::has_errors_): New data member.
7719 (Arm_relobj::get_exidx_shndx_list): New method.
7720 (Arm_output_section::append_text_sections_to_list): Do not skip
7721 section without SHF_EXECINSTR.
7722 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7724 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7725 section header. Make error messages more verbose. Check for
7726 a non-executable section linked to an EXIDX section.
7727 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7728 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7729 check that there is no deferred EXIDX section if we exit early.
7730 Instead of not making an EXIDX section in case of an error, make one
7731 and set the has_errors flag of it.
7732 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7733 in a relocatable link.
7734 (Target_arm::do_relax): Look for the EXIDX output section instead of
7735 assuming that it is called .ARM.exidx.
7736 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7737 section list. Do not check for SHF_EXECINSTR section flags but
7738 skip any input section with errors.
7739 * output.cc (Output_section::Output_section): Initialize
7740 always_keeps_input_sections_ to false.
7741 (Output_section::add_input_section): Check for
7742 always_keeps_input_sections_.
7743 * output.h (Output_section::always_keeps_input_sections,
7744 Output_section::set_always_keeps_input_sections): New methods.
7745 (Output_section::always_keeps_input_sections): New data member.
7747 2010-07-13 Rafael Espindola <espindola@google.com>
7749 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7750 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7752 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7753 Ian Lance Taylor <iant@google.com>
7755 * output.h (Output_section_lookup_maps::add_merge_section):
7756 Correct check of whether value was inserted.
7757 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7758 (Output_section_lookup_maps::add_relaxed_input_section):
7760 * arm.cc (Target_arm::got_section): Remove used local os.
7761 * i386.cc (Target_i386::got_section): Likewise.
7762 * x86_64.cc (Target_x86_64::got_section): Likewise.
7763 * sparc.cc (Target_sparc::got_section): Likewise.
7764 (Target_sparc::relocate): Remove unused local have_got_offset.
7765 * powerpc.cc (Target_powerpc::relocate): Likewise.
7767 2010-07-13 Ian Lance Taylor <iant@google.com>
7769 * compressed_output.cc (zlib_decompress): Fix signature in
7772 * archive.cc (Archive::include_member): Unlock an external member
7773 of a thin archive. Don't bother to delete an object we know is
7776 2010-07-12 Cary Coutant <ccoutant@google.com>
7778 * compressed_output.cc (zlib_decompress): New function.
7779 (get_uncompressed_size): New function.
7780 (decompress_input_section): New function.
7781 * compressed_output.h (get_uncompressed_size): New function.
7782 (decompress_input_section): New function.
7783 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7784 Handle compressed debug sections.
7785 * layout.cc (is_compressed_debug_section): New function.
7786 (Layout::output_section_name): Map compressed section names to
7788 * layout.h (is_compressed_debug_section): New function.
7789 (is_debug_info_section): Recognize compressed debug sections.
7790 * merge.cc: Include compressed_output.h.
7791 (Output_merge_data::do_add_input_section): Handle compressed
7793 (Output_merge_string::do_add_input_section): Handle compressed
7795 * object.cc: Include compressed_output.h.
7796 (Sized_relobj::Sized_relobj): Initialize new data members.
7797 (build_compressed_section_map): New function.
7798 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7799 * object.h (Object::section_is_compressed): New method.
7800 (Object::do_section_is_compressed): New method.
7801 (Sized_relobj::Compressed_section_map): New type.
7802 (Sized_relobj::do_section_is_compressed): New method.
7803 (Sized_relobj::compressed_sections_): New data member.
7804 * output.cc (Output_section::add_input_section): Handle compressed
7806 * reloc.cc: Include compressed_output.h.
7807 (Sized_relobj::write_sections): Handle compressed debug sections.
7809 2010-07-08 Cary Coutant <ccoutant@google.com>
7811 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7812 weak when resolving to a dynamic def.
7813 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7814 for weak undef/dynamic def cases. Adjust callers.
7815 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7816 undef_binding_weak_.
7817 (Symbol_table::sized_write_globals): Adjust symbol binding.
7818 (Symbol_table::sized_write_symbol): Add binding parameter.
7819 * symtab.h (Symbol::set_undef_binding): New method.
7820 (Symbol::is_undef_binding_weak): New method.
7821 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7822 (Symbol_table::should_override): Add new parameter.
7823 (Symbol_table::sized_write_symbol): Add new parameter.
7825 * testsuite/weak_undef_file1.cc: Add new test case.
7826 * testsuite/weak_undef_file2.cc: Fix header comment.
7827 * testsuite/weak_undef_test.cc: Add new test case.
7829 2010-06-29 Doug Kwan <dougkwan@google.com>
7831 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7832 Initialize USE_SYMBOL_.
7833 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7835 (Arm_reloc_property::uses_symbol_): New data member declaration.
7836 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7837 uses symbol value and symbol is undefined but not weakly undefined.
7839 2010-06-28 Rafael Espindola <espindola@google.com>
7841 * plugin.cc (Plugin::load): Use dlerror.
7843 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7845 * symtab.cc (detect_odr_violations): When reporting an ODR
7846 violation, report an object where the symbol is defined.
7848 2010-06-25 Doug Kwan <dougkwan@google.com>
7850 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7851 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7853 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7854 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7855 target hook to detect function points.
7856 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7857 * icf.h (Icf::check_section_for_function_pointers): Change type of
7858 parameter SECTION_NAME to const reference to std::string. Use
7859 target hook to determine if section may have unsafe pointers.
7860 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7863 2010-06-21 Rafael Espindola <espindola@google.com>
7865 * fileread.cc (Input_file::find_fie): New
7866 (Input_file::open): Use Input_file::find_fie.
7867 * fileread.h (Input_file::find_fie): New
7868 * plugin.cc (set_extra_library_path): New.
7869 (Plugin::load): Add set_extra_library_path to the transfer vector.
7870 (Plugin_manager::set_extra_library_path): New.
7871 (Plugin_manager::add_input_file): Use the extra search path if set.
7872 (set_extra_library_path(): New.
7873 * plugin.h (Plugin_manager): Add set_extra_library_path and
7876 2010-06-19 Cary Coutant <ccoutant@google.com>
7878 * layout.cc (gdb_sections): Add .debug_types.
7879 (lines_only_debug_sections): Likewise.
7881 2010-06-18 Rafael Espindola <espindola@google.com>
7883 * plugin.cc (add_input_file,add_input_library)
7884 (Plugin_manager::add_input_file): Make filename arguments const.
7885 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7888 2010-06-16 Doug Kwan <dougkwan@google.com>
7890 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7891 .ARM.attributes section if we have not merged any input
7892 attributes sections.
7894 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7896 * arm.cc: Allow combining objects with no EABI version
7899 2010-06-15 Rafael Espindola <espindola@google.com>
7901 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7903 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7905 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7906 (struct iovec): Correct !HAVE_READV definition.
7908 2010-06-10 Cary Coutant <ccoutant@google.com>
7910 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7911 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7913 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7916 * symtab.h (Symbol::is_placeholder): New member function.
7917 * target-reloc.h (relocate_section): Check for placeholder symbols.
7919 * testsuite/Makefile.am (plugin_test_8): New test.
7920 (plugin_test_9): New test.
7921 * testsuite/Makefile.in: Regenerate.
7923 2010-06-09 Nick Clifton <nickc@redhat.com>
7925 * yyscript.y (input_list_element): Allow strings prefixed with
7926 the '-' character. Treat these as libraries.
7927 * script.cc (script_add_library): New function. Adds a library
7928 specified by "-l<name>" found in an input script.
7929 * script-c.h: Add prototype for script_add_library.
7931 2010-06-07 Doug Kwan <dougkwan@google.com>
7933 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7934 Restrict stub-group size to be within long conditional branch
7935 range when working around cortex-A8 erratum.
7937 2010-06-07 Damien Diederen <dd@crosstwine.com>
7939 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7942 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7946 (Output_section::Input_section_sort_entry::compare_section_ordering):
7947 Change to return non-zero correctly.
7948 (Output_section::Input_section_sort_section_order_index_compare
7949 ::operator()): Change to fix ambiguity in comparisons.
7951 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7953 * gold.h (is_wildcard_string): New function.
7954 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7955 (Layout::layout_eh_frame): Ditto.
7956 (Layout::find_section_order_index): New method.
7957 (Layout::read_layout_from_file): New method.
7958 * layout.h (Layout::find_section_order_index): New method.
7959 (Layout::read_layout_from_file): New method.
7960 (Layout::input_section_position_): New private member.
7961 (Layout::input_section_glob_): New private member.
7962 * main.cc (main): Call read_layout_from_file here.
7963 * options.h (--section-ordering-file): New option.
7964 * output.cc (Output_section::input_section_order_specified_): New
7966 (Output_section::Output_section): Initialize new member.
7967 (Output_section::add_input_section): Add new parameter.
7968 Keep input sections when --section-ordering-file is used.
7969 (Output_section::set_final_data_size): Sort input sections when
7970 section ordering file is specified.
7971 (Output_section::Input_section_sort_entry): Add new parameter.
7973 (Output_section::Input_section_sort_entry::compare_section_ordering):
7975 (Output_section::Input_section_sort_compare::operator()): Change to
7976 consider section_order_index.
7977 (Output_section::Input_section_sort_init_fini_compare::operator()):
7978 Change to consider section_order_index.
7979 (Output_section::Input_section_sort_section_order_index_compare
7980 ::operator()): New method.
7981 (Output_section::sort_attached_input_sections): Change to sort
7982 according to section order when specified.
7983 (Output_section::add_input_section<32, true>): Add new parameter.
7984 (Output_section::add_input_section<64, true>): Add new parameter.
7985 (Output_section::add_input_section<32, false>): Add new parameter.
7986 (Output_section::add_input_section<64, false>): Add new parameter.
7987 * output.h (Output_section::add_input_section): Add new parameter.
7988 (Output_section::input_section_order_specified): New
7990 (Output_section::set_input_section_order_specified): New method.
7991 (Input_section::Input_section): Initialize section_order_index_.
7992 (Input_section::section_order_index): New method.
7993 (Input_section::set_section_order_index): New method.
7994 (Input_section::section_order_index_): New member.
7995 (Input_section::Input_section_sort_section_order_index_compare): New
7997 (Output_section::input_section_order_specified_): New member.
7998 * script-sections.cc (is_wildcard_string): Delete and move modified
8000 (Output_section_element_input::Output_section_element_input): Modify
8001 call to is_wildcard_string.
8002 (Output_section_element_input::Input_section_pattern
8003 ::Input_section_pattern): Ditto.
8004 (Output_section_element_input::Output_section_element_input): Ditto.
8005 * testsuite/Makefile.am (final_layout): New test case.
8006 * testsuite/Makefile.in: Regenerate.
8007 * testsuite/final_layout.cc: New file.
8008 * testsuite/final_layout.sh: New file.
8010 2010-06-01 Rafael Espindola <espindola@google.com>
8012 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8014 2010-06-01 Rafael Espindola <espindola@google.com>
8016 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8017 visibility of symbols.
8019 2010-05-27 Doug Kwan <dougkwan@google.com>
8021 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8022 from start of output section instead of address for a local symbol
8023 in a merged or relaxed section when doing a relocatable link.
8025 2010-05-26 Rafael Espindola <espindola@google.com>
8028 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8029 adding sections the garbage collector removed.
8030 * gold/testsuite/Makefile.am: Add test.
8031 * gold/testsuite/Makefile.in: Regenerate.
8032 * gold/testsuite/plugin_test_7.sh: New.
8033 * gold/testsuite/plugin_test_7_1.c: New.
8034 * gold/testsuite/plugin_test_7_2.c: New.
8036 2010-05-26 Rafael Espindola <espindola@google.com>
8038 * script-sections.cc (Output_section_definition::set_section_addresses):
8039 Check for --section-start.
8041 2010-05-26 Doug Kwan <dougkwan@google.com>
8043 * arm.cc (Arm_scan_relocatable_relocs): New class.
8044 (Target_arm::relocate_special_relocatable): New method.
8045 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8046 (Arm_relocate_functions::thumb_branch_common): Same.
8047 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8048 instead of Default_scan_relocatable_relocs.
8049 * target-reloc.h (relocate_for_relocatable): Let target handle
8050 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8051 * target.h (Sized_target::relocate_special_relocatable): New method.
8053 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8055 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8057 2010-05-23 Doug Kwan <dougkwan@google.com>
8059 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8061 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8062 with a direct branch, not a conditional branch, to a stub.
8063 * merge.cc (Output_merge_base::record_input_section): New method
8065 (Output_merge_data::do_add_input_section): Record input section if
8066 keeps-input-sections flag is set.
8067 (Output_merge_string::do_add_input_section): Ditto.
8068 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8069 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8071 (Output_merge_base::keeps_input_sections,
8072 Output_merge_base::set_keeps_input_sections,
8073 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8075 (Output_merge_base::Input_sections): New type declaration.
8076 (Output_merge_base::input_sections_begin,
8077 Output_merge_base::input_sections_end,
8078 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8079 (Output_merge_base::bool keeps_input_sections_,
8080 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8081 Output_merge_base::input_sections_): New data members.
8082 (Output_merge_data::do_set_keeps_input_sections): New method
8084 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8085 * output.cc (Output_section::Input_section::relobj): Move method
8086 defintion from class declaration to here and handle merge sections.
8087 (Output_section::Input_section::shndx): Ditto.
8088 (Output_section::Output_section): Remove initializations of removed
8089 data members and initialize new data member LOOKUP_MAPS_.
8090 (Output_section::add_input_section): Set keeps-input-sections flag
8091 for a newly created merge output section as appropriate. Adjust code
8092 to use Output_section_lookup_maps class.
8093 (Output_section::add_relaxed_input_section): Adjst code for lookup
8094 maps code refactoring.
8095 (Output_section::add_merge_input_section): Add a new parameter
8096 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8097 class. If adding input section to a newly created merge output
8098 section fails, remove the new merge section.
8099 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8100 Adjust code for use of the Output_section_lookup_maps class.
8101 (Output_section::find_merge_section): Ditto.
8102 (Output_section::build_lookup_maps): New method defintion.
8103 (Output_section::find_relaxed_input_section): Adjust code to use
8104 Output_section_lookup_maps class.
8105 (Output_section::get_input_sections): Export merge sections. Adjust
8106 code to use Output_section_lookup_maps class.
8107 (Output_section:::add_script_input_section): Adjust code to use
8108 Output_section_lookup_maps class. Update lookup maps for merge
8110 (Output_section::discard_states): Use Output_section_lookup_maps.
8111 (Output_section::restore_states): Same.
8112 * output.h (Merge_section_properties): Move class defintion out of
8114 (Output_section_lookup_maps): New class.
8115 (Output_section::Input_section::is_merge_section): New method
8117 (Output_section::Input_section::relobj): Move defintion out of class
8118 defintion. Declare method only.
8119 (Output_section::Input_section::shndx): Ditto.
8120 (Output_section::Input_section::output_merge_base): New method defintion.
8121 (Output_section::Input_section::u2_.pomb): New union field.
8122 (Output_section::Merge_section_by_properties_map,
8123 Output_section::Output_section_data_by_input_section_map,
8124 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8126 (Output_section::add_merge_input_section): Add new parameter
8127 KEEPS_INPUT_SECTIONS.
8128 (Output_section::build_lookup_maps): New method declaration.
8129 (Output_section::merge_section_map_,
8130 Output_section::merge_section_by_properties_map_,
8131 Output_section::relaxed_input_section_map_,
8132 Output_section::is_relaxed_input_section_map_valid_): Remove data
8134 (Output_section::lookup_maps_): New data member.
8136 2010-05-21 Doug Kwan <dougkwan@google.com>
8139 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8140 avoid a compilation error.
8142 2010-05-19 Rafael Espindola <espindola@google.com>
8144 * script-sections.cc (Output_section_definition::allocate_to_segment):
8145 Update the phdrs_list even when the output section is NULL.
8146 * testsuite/Makefile.am: Add test.
8147 * testsuite/Makefile.in: Regenerate.
8148 * testsuite/script_test_9.cc: New.
8149 * testsuite/script_test_9.sh: New.
8150 * testsuite/script_test_9.t: New.
8152 2010-05-19 Doug Kwan <dougkwan@google.com>
8154 * arm.cc (Arm_input_section::original_size): New method.
8155 (Arm_input_section::do_addralign): Add a cast.
8156 (Arm_input_section::do_output_offset): Remove static cast.
8157 (Arm_input_section::original_addralign,
8158 Arm_input_section::original_size_): Change type to uint32_t.
8159 (Arm_input_section::init): Add safe casts for section alignment
8161 (Arm_input_section::set_final_data_size): Do not set address and
8162 offset of stub table.
8163 (Arm_output_section::fix_exidx_coverage): Change use of of
8164 Output_section::Simple_input_section to that of
8165 Output_section::Input_section.
8166 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8167 except for the first pass.
8168 * output.cc (Output_section::get_input_sections): Change type of
8169 input_sections to std::list<Input_section>.
8170 (Output_section::add_script_input_section): Rename from
8171 Output_section::add_simple_input_section. Change type of SIS
8172 parameter from Simple_input_section to Input_section.
8173 * output.h (Output_section::Simple_input_section): Remove class.
8174 (Output_section::Input_section): Change class visibility to public.
8175 (Output_section::Input_section::addralign): Use stored alignments
8176 for special input sections if set.
8177 (Output_section::Input_section::set_addralign): New method.
8178 (Output_section::get_input_sections): Change parameter type from
8179 list of Simple_input_section to list of Input_section.
8180 (Output_section::add_script_input_section): Rename from
8181 Output_section::add_simple_input_section. Change first parameter's
8182 type from Simple_input_section to Input_section and remove the
8183 second and third parameters.
8184 * script-sections.cc (Input_section::Input_section_list): Change
8185 type to list of Output_section::Input_section/
8186 (Input_section_info::Input_section_info): Change parameter type of
8187 INPUT_SECTION to Output_section::Input_section.
8188 (Input_section_info::input_section): Change return type.
8189 (Input_section_info::input_section_): Change type to
8190 Output_section::Input_section.
8191 (Output_section_element_input::set_section_addresses): Adjust code
8192 to use Output_section::Input_section instead of
8193 Output_section::Simple_input_section. Adjust code for renaming
8194 of Output_section::add_simple_input_section.
8195 (Orphan_output_section::set_section_addresses): Ditto.
8197 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8199 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8200 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8202 2010-05-18 Rafael Espindola <espindola@google.com>
8204 * options.cc (General_options::finalize): Handle -nostdlib.
8205 * options.h (nostdlib): New option.
8206 * script.cc (script_add_search_dir): Handle -nostdlib.
8208 2010-05-12 Doug Kwan <dougkwan@google.com>
8210 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8211 attributes section only if there no attributes section after merging.
8212 (Target_arm::merge_object_attributes): Move value of
8213 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8214 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8215 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8216 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8217 and arm_attr_merge_7.stdout.
8218 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8219 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8220 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8221 arm_attr_merge_7b.o): New rules.
8222 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8224 * testsuite/Makefile.in: Regenerate.
8225 * testsuite/arm_attr_merge.sh: New file.
8226 * testsuite/arm_attr_merge_[67][ab].s: Same.
8228 2010-05-05 Nick Clifton <nickc@redhat.com>
8230 * po/es.po: Updated Spanish translation.
8232 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8234 * Makefile.am (install-exec-local): Properly install gold as
8235 default cross linker.
8236 * Makefile.in: Regenerated.
8238 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8239 Nick Clifton <nickc@redhat.com>
8241 * configure.ac (install_as_default): Define and set to false
8242 unless --enable-gold or --enable-gold=both/gold has been
8244 * configure: Regenerate.
8246 * Makefile.am (install-exec-local): Install the executable as
8247 'ld.gold'. If install_as_default is true then also install it as
8249 * Makefile.in: Regenerated.
8251 2010-04-24 Ian Lance Taylor <iant@google.com>
8253 * layout.cc (Layout::layout_reloc): In relocatable link don't
8254 combine reloc sections for grouped sections.
8256 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8258 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8259 sections that are not ordinary to icf.
8260 * icf.cc (get_section_contents): Handle relocation pointing to section
8261 with no object or shndx information.
8262 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8263 * testsuite/Makefile.in: Regenerate.
8264 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8265 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8267 2010-04-22 Ian Lance Taylor <iant@google.com>
8269 * expression.cc (Expression::Expression_eval_info): Add
8270 result_alignment_pointer field.
8271 (Expression::eval_with_dot): Add result_alignment_pointer
8272 parameter. Change all callers.
8273 (Expression::eval_maybe_dot): Likewise.
8274 (class Binary_expression): Add alignment_pointer parameter to
8275 left_value and right_value. Change all callers.
8276 (BINARY_EXPRESSION): Set result alignment.
8277 (class Trinary_expression): Add alignment_pointer parameter to
8278 arg2_value and arg3_value. Change all callers.
8279 (Trinary_cond::value): Set result alignment.
8280 (Max_expression::value, Min_expression::value): Likewise.
8281 (Align_expression::value): Likewise.
8282 * script-sections.cc (class Sections_element): Add dot_alignment
8283 parameter to set_section_addresses virtual function. Update
8285 (class Output_section_element): Likewise.
8286 (Script_sections::create_segments): Add dot_alignment parameter.
8288 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8289 (Script_sections::set_phdrs_clause_addresses): Likewise.
8290 * script-sections.h: Update declarations.
8291 * script.h: Update declarations.
8292 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8294 * testsuite/script_test_3.t: Set large alignment.
8295 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8296 segment has expected alignment.
8298 2010-04-22 Nick Clifton <nickc@redhat.com>
8300 * po/gold.pot: Updated by the Translation project.
8301 * po/vi.po: Updated Vietnamese translation.
8303 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8305 * testsuite/Makefile.am (check_PROGRAMS): Add
8306 icf_virtual_function_folding_test.
8307 * testsuite/Makefile.in: Regenerated.
8309 2010-04-15 Andrew Haley <aph@redhat.com>
8311 * options.h (merge_exidx_entries): New option.
8312 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8313 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8314 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8315 (Target_arm::merge_exidx_entries): New function.
8316 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8317 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8318 to Arm_exidx_fixup constructor.
8319 Add new arg, merge_exidx_entries.
8320 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8321 Arm_output_section::fix_exidx_coverage.
8323 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8325 * icf.cc (get_section_contents): Check for preemptible functions.
8326 Ignore addend when appropriate.
8327 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8329 (add_from_relobj): Check for section folded.
8330 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8331 * symtab.h (should_add_dynsym_entry): Add new parameter.
8332 * target-reloc.h (scan_relocs): Check for section folded.
8333 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8334 Check reloc types for function pointers in shared objects.
8335 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8337 (icf_preemptible_functions_test): New test case.
8338 (icf_string_merge_test): New test case.
8339 * testsuite.Makefile.in: Regenerate.
8340 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8341 bar_glob. Refactor code.
8342 * testsuite/icf_preemptible_functions_test.cc: New file.
8343 * testsuite/icf_preemptible_functions_test.sh: New file.
8344 * testsuite/icf_string_merge_test.cc: New file.
8345 * testsuite/icf_string_merge_test.sh: New file.
8346 * testsuite/icf_virtual_function_folding_test.cc: New file.
8347 * testsuite/icf_virtual_function_folding_test.sh: New file.
8349 2010-04-14 Doug Kwan <dougkwan@google.com>
8351 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8352 for local symbol recounting if we remove a section due to ICF.
8353 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8354 there are no regular objects in input.
8356 2010-04-13 Doug Kwan <dougkwan@google.com>
8358 * arm.cc (Arm_input_section::set_final_data_size): Compute
8359 accurate final data size instead of using current data size.
8361 2010-04-09 Doug Kwan <dougkwan@google.com>
8363 * layout.cc (Layout::choose_output_section): Handle script section
8365 (Layout::make_output_section_for_script): Add section type parameter.
8366 Handle script section types.
8367 * layout.h (Layout::make_output_section_for_script): Add section
8369 * output.cc (Output_section::Output_section): Initialize data member
8371 (Output_section::do_reset_address_and_file_offset): Do not set address
8372 to 0 if section is a NOLOAD section.
8373 * output.h (Output_section::is_noload): New method.
8374 (Output_section::set_is_noload): Ditto.
8375 (Output_section::is_noload_): New data member.
8376 * script-c.h (Script_section_type): New enum type.
8377 (struct Parser_output_section_header): Add new file section_type.
8378 * script-sections.cc (Sections_element::output_section_name): Add
8379 parameter for returning script section type.
8380 (Output_section_definition::output_section_name): Ditto.
8381 (Output_section_definition::section_type)P; New method.
8382 (Output_section_definiton::script_section_type_name): Ditto.
8383 (Output_section_definition::script_section_type_): New data member.
8384 (Output_section_definition::Output_section_definition): Initialize
8385 data member Output_section_definition::script_section_type_.
8386 (Output_section_definition::create_sections): Pass script section type
8387 to Layout::make_output_section_for_script.
8388 (Output_section_definition::output_section_name): Return script
8389 section type to caller.
8390 (Output_section_definition::set_section_address): Do not advance
8391 dot value and load address if section type is NOLOAD. Set address
8392 of NOLOAD sections regardless of section flags.
8393 (Output_section_definition::print): Print section type if it is
8394 not SCRIPT_SECTION_TYPE_NONE.
8395 (Output_section_definition::section_type): New method.
8396 (Output_section_definition::script_section_type_name): Ditto.
8397 (Script_sections::output_section_name): Add new parameter
8398 PSECTION_TYPE for returning script section type. Pass it to
8399 section elements. Handle discard sections.
8400 (Sort_output_sections::operator()): Handle NOLOAD sections.
8401 * script-sections.h (Script_sections::Section_type): New enum type.
8402 (Script_sections::output_section_name): Add a new parameter for
8403 returning script section type.
8404 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8406 * yyscript.y (union): Add new field SECTION_TYPE.
8407 (COPY, DSECT, INFO, NOLOAD): New tokens.
8408 (opt_address_and_section_type): Change type to output_section_header.
8409 (section_type): New non-terminal
8410 (section_header): Handle section type.
8411 (opt_address_and_section_type): Return section type value.
8413 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8415 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8416 * testsuite/plugin_common_test_2.c (foo): Likewise.
8418 2010-04-08 Doug Kwan <dougkwan@google.com>
8420 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8422 * output.cc (Output_section::add_merge_input_section): Simplify
8423 code and return status of Output_merge_base::add_input_section.
8424 Update merge section map only if Output_merge_base::add_input_section
8427 2010-04-07 Doug Kwan <dougkwan@google.com>
8429 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8430 if section is marked as containing instructions but has no mapping
8432 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8433 correct section index.
8434 (Arm_relobj::find_linked_text_section): Ditto.
8436 2010-04-07 Cary Coutant <ccoutant@google.com>
8438 * archive.cc (include_member): Destroy Read_symbols_data object before
8440 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8441 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8442 (Read_symbols_data::~Read_symbols_data) New destructor.
8443 (Section_relocs::Section_relocs) New constructor.
8444 (Section_relocs::~Section_relocs) New destructor.
8445 (Read_relocs_data::Read_relocs_data) New constructor.
8446 (Read_relocs_data::~Read_relocs_data) New destructor.
8447 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8448 pointers to NULL after deleting.
8450 2010-04-07 Doug Kwan <dougkwan@google.com>
8452 * arm.cc: Replace "endianity" with "endianness" in comments.
8453 (Arm_exidx_cantunwind): Ditto.
8454 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8455 (Arm_relobj::merge_flags_and_attributes): New method.
8456 (Arm_relobj::merge_flags_and_attributes_): New data member.
8457 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8458 (Arm_relobj::scan_sections_for_stubs): Ditto.
8459 (Arm_relobj::do_read_symbols): Check to see if we really want to
8460 merge processor-specific flags and attributes. Exit early if
8461 an object is empty except for section names and the undefined symbol.
8462 (Target_arm::do_finalize_sections): Move check for ELF format to
8463 Arm_relobj::do_read_symbols. Merge processor specific flags and
8464 attributes from a regular object only when we have determined that
8465 it is aapropriate. Do not create an .ARM.attributes section in
8466 output if there is no regular input object.
8467 (Target_arm::merge_processor_specific_flags): Check
8468 --warn-mismatch before printing any error.
8469 (Target_arm::merge_object_attributes): Ditto.
8470 * gold.cc (queue_middle_tasks): Handle the case in which there is
8471 no regular object in input.
8472 * options.cc (General_options::parse_EB): New method.
8473 (General_options::parse_EL): Same.
8474 (General_options::General_options): Initialize endianness_.
8475 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8477 (General_options::Endianness): New enum.
8478 (General_options::endianness): New method.
8479 (General_options::endianness_): New data member.
8480 * parameters.cc (Parameters::set_options): Check target endianness.
8481 (Parameters::set_target_once): Ditto.
8482 (Parameters::check_target_endianness): New method.
8483 (parameters_force_valid_target): If either -EL or -EB is specified,
8484 use it to define endianness of default target.
8485 * parameters.h (Parameters::check_target_endianness): New method
8487 * target.h (class Target): Change "endianity" to "endianness"
8490 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8492 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8493 * configure: Regenerate.
8494 * Makefile.in: Regenerate.
8495 * testsuite/Makefile.in: Regenerate.
8497 2010-04-06 Cary Coutant <ccoutant@google.com>
8500 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8501 prevailing definitions of common symbols.
8502 * testsuite/plugin_test_6.sh: New test case.
8503 * testsuite/plugin_common_test_1.c: New test case.
8504 * testsuite/plugin_common_test_2.c: New test case.
8505 * testsuite/Makefile.am (plugin_test_6): New test case.
8506 * testsuite/Makefile.in: Regenerate.
8508 2010-04-06 Nick Clifton <nickc@redhat.com>
8510 * po/vi.po: New Vietnamese translation.
8512 2010-03-30 Doug Kwan <dougkwan@google.com>
8514 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8516 2010-03-25 Doug Kwan <dougkwan@google.com>
8518 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8519 to avoid a conversion warning on a 32-bit host.
8521 2010-03-24 Ian Lance Taylor <iant@google.com>
8523 * testsuite/script_test_3.t: Add a TLS segment.
8524 * testsuite/Makefile.am (check_PROGRAMS): Add
8525 tls_phdrs_script_test.
8526 (tls_phdrs_script_test_SOURCES): Define.
8527 (tls_phdrs_script_test_DEPENDENCIES): Define.
8528 (tls_phdrs_script_test_LDFLAGS): Define.
8529 (tls_phdrs_script_test_LDADD): Define.
8530 * testsuite/Makefile.in: Rebuild.
8532 2010-03-23 Cary Coutant <ccoutant@google.com>
8534 * fileread.cc (find_or_make_view): Fix comment.
8536 2010-03-23 Ian Lance Taylor <iant@google.com>
8538 * script-sections.cc (class Orphan_section_placement): Define
8539 PLACE_TLS and PLACE_TLS_BSS.
8540 (Orphan_section_placement::Orphan_section_placement): Initialize
8542 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8543 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8544 (tls_script_test_SOURCES): Define.
8545 (tls_script_test_DEPENDENCIES): Define.
8546 (tls_script_test_LDFLAGS): Define.
8547 (tls_script_test_LDADD): Define.
8548 * testsuite/Makefile.in: Rebuild.
8550 2010-03-22 Doug Kwan <dougkwan@google.com>
8552 * arm.cc (Arm_relocate_functions::abs8,
8553 Arm_relocate_functions::abs16): Use correct check for overflow
8554 specified in the ARM ELF specs.
8555 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8556 target of a BLX instruction specially.
8557 (Reloc_stub::stub_type_for_reloc): Ditto.
8558 (Relocate::relocate): Use symbolic names instead of numeric relocation
8559 codes to report error.
8560 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8562 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8563 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8564 thumb2_blx_out_of_range.stdout
8565 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8566 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8567 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8568 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8569 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8570 thumb2_blx_in_range, thumb2_blx_in_range.o,
8571 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8572 thumb2_blx_out_of_range.o): New rules.
8573 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8574 thumb2_blx_in_range and thumb2_blx_out_of_range.
8575 * testsuite/Makefile.in: Regenerate.
8576 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8577 * testsuite/thumb_blx_in_range.s: New file.
8578 * testsuite/thumb_blx_out_of_range.s: New file.
8580 2010-03-22 Rafael Espindola <espindola@google.com>
8582 * archive.cc (Should_include): Move to archive.h.
8583 (should_include_member): Make it a member of Archive.
8585 (Add_lib_group_symbols): New.
8586 * archive.h: Include options.h.
8587 (Archive_member): Moved from Archive.
8588 (Should_include): Moved from archive.cc.
8590 (Add_lib_group_symbols): New.
8591 * dynobj.cc (do_should_include_member): New.
8592 * dynobj.h (do_should_include_member): New.
8593 * gold.cc (queue_initial_tasks): Update call to queue.
8594 * main.cc (main): Print lib group stats.
8595 * object.cc (do_should_include_member): New.
8596 * object.h: Include archive.h.
8597 (Object::should_include_member): New.
8598 (Object::do_should_include_member): New.
8599 (Sized_relobj::do_should_include_member): New.
8600 * options.cc (General_options::parse_start_lib): New.
8601 (General_options::parse_end_lib): New.
8602 (Input_arguments::add_file): Handle lib groups.
8603 (Input_arguments::start_group): Check we are not in a lib.
8604 (Input_arguments::start_lib): New.
8605 (Input_arguments::end_lib): New.
8606 * options.h (General_options): Add start_lib and end_lib.
8607 (Input_argument::lib_): New.
8608 (Input_argument::lib): New.
8609 (Input_argument::is_lib): New.
8610 (Input_file_lib): New.
8611 (Input_arguments::in_lib_): New.
8612 (Input_arguments::in_lib): New.
8613 (Input_arguments::start_lib): New.
8614 (Input_arguments::end_lib_): New.
8615 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8616 in unused members as preempted.
8617 (Sized_pluginobj::do_should_include_member): New.
8618 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8619 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8621 (Read_symbols::do_whole_lib_group): New.
8622 (Read_symbols::do_lib_group): New.
8623 (Read_symbols::do_read_symbols): Handle lib groups.
8624 (Read_symbols::get_name): Handle lib groups.
8625 * readsyms.h (Read_symbols): Add an archive member pointer.
8626 (Read_symbols::do_whole_lib_group): New.
8627 (Read_symbols::do_lib_group): New.
8628 (Read_symbols::member_): New.
8629 * script.cc (read_input_script): Update call to queue_soon.
8631 2010-03-19 Doug Kwan <dougkwan@google.com>
8633 * arm.cc (Stub_table::Stub_table): Initialize new data members
8634 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8635 (Stub_table::add_reloc_stub): Assign stub offset and update
8636 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8637 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8639 (Stub_table::update_data_size_and_addralign): Use
8640 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8641 instead of going over all reloc stubs.
8642 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8643 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8644 Stringpool_template::offset_ to size of Stringpool_char.
8645 (Stringpool_template::new_key_offset): Remove code to initialize
8646 Stringpool_template::offset_.
8647 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8648 Stringpool_template::offset_ to zero.
8650 2010-03-15 Doug Kwan <dougkwan@google.com>
8652 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8654 (Stringpool_template::new_key_offset): New method.
8655 (Stringpool_template::add_string): Assign offsets when adding new
8657 (Stringpool_template::set_string_offsets): Do not set string offsets
8658 when not optimizing.
8659 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8661 (Chunked_vector::clear): Clear size_.
8662 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8663 (Chunked_vector::size): Return size_.
8664 (Chunked_vector::push_back): Use size_ to find insert position.
8665 (Chunked_vector::size_): New data member.
8666 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8667 (Stringpool_template::new_key_offset): New method declaration.
8668 (Stringpool_template::offset_): New data member.
8670 2010-03-15 Rafael Espindola <espindola@google.com>
8672 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8673 Add_symbols' constructor.
8674 * readsyms.h (Add_symbols): Remove the input_group member.
8676 2010-03-10 Ian Lance Taylor <iant@google.com>
8678 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8679 target to ask whether a reference to a symbol requires a stack
8681 * target.h (Target::is_call_to_non_split): New function.
8682 (Target::do_is_call_to_non_split): Declare virtual function.
8683 * target.cc: Include "symtab.h".
8684 (Target::do_is_call_to_non_split): New function.
8685 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8687 2010-03-10 Cary Coutant <ccoutant@google.com>
8689 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8690 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8691 (File_read::open[2]): Add whole_file_view_ to list of views.
8692 (File_read::make_view): Remove test of whole_file_view_.
8693 (File_read::find_or_make_view): Create whole_file_view_ if
8695 (File_read::clear_views): Replace bool parameter with enum;
8696 adjust all callers. Don't delete views with permanent data;
8697 do delete cached views and views from archives if
8698 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8699 if clearing the corresponding view.
8700 * fileread.h (File_read::Clear_views_mode): New enum.
8701 (File_read::View::is_permanent_view): New method.
8702 (File_read::clear_views): Replace bool parameter
8703 with enum; adjust all callers.
8704 * options.h (General_options): Change keep_files_mapped option;
8705 add map_whole_files.
8706 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8708 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8711 2010-03-10 David S. Miller <davem@davemloft.net>
8713 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8715 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8717 * icf.cc (get_section_contents): Add '@' marker after processing the
8720 2010-03-08 Doug Kwan <dougkwan@google.com>
8722 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8723 due to a conversion warning.
8724 (Arm_relobj::update_output_local_symbol_count): Check for local
8725 symbol with unset output index.
8727 2010-03-05 Ian Lance Taylor <iant@google.com>
8729 * options.h (class General_options): Add --spare-dynamic-tags.
8730 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8731 --spare-dynamic-tags.
8733 2010-03-05 Ian Lance Taylor <iant@google.com>
8735 * incremental.cc: Include "libiberty.h".
8737 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8739 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8740 function, is_info_ member.
8741 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8742 (Versions::Versions): Update caller.
8743 (Versions::define_base_version): Likewise.
8744 (Versions::add_def): Likewise.
8746 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8748 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8749 (Scan::possible_function_pointer_reloc): New function.
8750 (Scan::local_reloc_may_be_function_pointer): Change to call
8751 possible_function_pointer_reloc.
8752 (Scan::global_reloc_may_be_function_pointer): Ditto.
8753 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8754 relocations in ".data.rel.ro._ZTV" section.
8755 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8756 * testsuite/icf_safe_so_test.cc: Ditto.
8757 * testsuite/icf_safe_test.cc: Ditto.
8758 * testsuite/icf_safe_test.sh: Ditto.
8760 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8761 Ian Lance Taylor <iant@google.com>
8763 * target-reloc.h (relocate_section): Check the symbol table index
8764 for -1U before setting the local symbol index.
8765 (scan_relocatable_relocs): If copying the relocation, record that
8766 the local symbol is required.
8767 * object.h (Symbol_value::is_output_symtab_index_set): New
8769 (Symbol_value::may_be_discarded_from_output_symtab): New
8771 (Symbol_value::has_output_symtab_entry): New function.
8772 (Symbol_value::needs_output_symtab_entry): Remove.
8773 (Symbol_value::output_symtab_index): Make sure the symbol index is
8775 (Symbol_value::set_output_symtab_index): Make sure the symbol
8776 index is not set. Make sure the new index is valid.
8777 (Symbol_value::set_must_have_output_symtab_entry): New function.
8778 (Symbol_value::has_output_dynsym_entry): New function.
8779 (Symbol_value::set_output_dynsym_index): Make sure the new index
8781 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8782 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8783 local symbol if permitted.
8784 (Sized_relobj::do_finalize_local_symbols): Call
8785 is_output_symtab_index_set rather than needs_output_symtab_entry.
8786 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8787 rather than needs_output_symtab_entry. Call
8788 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8789 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8790 is_output_symtab_index_set rather than needs_output_symtab_entry.
8791 * testsuite/discard_locals_relocatable_test.c: New file.
8792 * testsuite/discard_locals_test.sh: Test -r.
8793 * testsuite/Makefile.am (check_DATA): Add
8794 discard_locals_relocatable_test1.syms,
8795 discard_local_relocatable_test2.syms.
8796 (MOSTLYCLEANFILES): Likewise. Also add
8797 discard_locals_relocatable_test1.lout and
8798 discard_locals_relocatable_test2.out.
8799 (discard_locals_relocatable_test1.syms): New target.
8800 (discard_locals_relocatable_test.o): New target.
8801 (discard_locals_relocatable_test1.out): New target.
8802 (discard_locals_relocatable_test2.syms): New target.
8803 (discard_locals_relocatable_test2.out): New target.
8804 (various): Add missing ../ld-new dependencies.
8805 * testsuite/Makefile.in: Rebuild.
8807 2010-03-03 Nick Clifton <nickc@redhat.com>
8809 * po/fi.po: New Finnish translation.
8811 2010-03-01 Doug Kwan <dougkwan@google.com>
8813 * layout.cc (Layout::Layout): Force section types of .init_array*,
8814 .preinit_array* and .fini_array* sections.
8815 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8816 Fix check of return value of std::string::find.().
8817 (Output_section::Input_section_sort_compare::operator()): Remove
8818 comment about .init_array.
8819 (Output_section::Input_section_sort_init_fini_compare::operator()):
8821 (Output_section::sort_attached_input_sections): Handle .init_array
8822 and .fini_array specially.
8823 * output.h (Output_section::Inut_section_sort_compare): Update
8825 (Output_section::Input_section_sort_init_fini_compare): New struct.
8827 2010-02-26 Doug Kwan <dougkwan@google.com>
8829 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8830 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8831 * testsuite/debug_msg.sh: Avoid matching source line number for
8832 use of global variable undef_int.
8834 2010-02-26 Doug Kwan <dougkwan@google.com>
8836 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8837 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8838 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8839 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8840 * options.cc (General_options::General_options): Initialize member
8842 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8843 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8844 and rm_no_fix_v4bx.stdout
8845 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8846 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8847 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8848 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8849 and arm_no_fix_v4bx.
8850 * Makefile.in: Regenerate.
8851 * testsuite/arm_fix_v4bx.s: New file.
8852 * testsuite/arm_fix_v4bx.sh: Ditto.
8854 2010-02-24 Doug Kwan <dougkwan@google.com>
8856 * arm.cc (Target_arm::got_section): Make the .got section the first
8857 non RELRO section in the data segment.
8858 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8859 suffixes of section names.
8861 2010-02-24 Doug Kwan <dougkwan@google.com>
8863 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8864 flags and attributes merging if an input file is a binary file.
8865 * fileread.cc (Input_file::open): Record format of original file.
8866 * fileread.h (Input_file::Format): New enum type.
8867 (Input_file::Input_file): Initialize data member format_.
8868 (Input_file::format): New method definition.
8869 (Input_file::format_):: New data member.
8871 2010-02-24 Doug Kwan <dougkwan@google.com>
8873 * arm.cc (Arm_output_data_got): New class.
8874 (ARM_TCB_SIZE): New constant
8875 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8876 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8877 If user uses a script with a SECTIONS clause, issue only a warning
8878 for a misplaced EXIDX input section. Otherwise, issue an error.
8879 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8881 (Target_arm::got_mode_index_entry): Handle static linking.
8882 (Target_arm::Scan::local): Ditto.
8883 (Target_arm::Scan::global): Ditto.
8884 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8885 all incorrectly implemented relocations.
8886 (Target_arm::fix_exidx_coverage): Pass layout to
8887 Arm_output_section::fix_exidx_coverage.
8888 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8889 from ".ARM.exidx." and ".ARM.extab.".
8891 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8893 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8894 section if it does not already exist.
8895 * attributes.cc (Attributes_section_data::Attributes_section_data):
8896 Don't crash if size is zero.
8898 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8899 Ian Lance Taylor <iant@google.com>
8901 * gold.cc (queue_middle_tasks): If no input files were opened,
8903 * workqueue.h (Task_function::Task_function): Assert that there is
8906 2010-02-22 Doug Kwan <dougkwan@google.com>
8908 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8909 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8910 types to avoid warnings due to different uint64_t implementations
8913 2010-02-21 Doug Kwan <dougkwan@google.com>
8915 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8916 handling of the maximum backward branch offset.
8917 (Arm_relocate_functions::thumb_branch_common): Ditto.
8918 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8919 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8920 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8921 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8922 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8923 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8924 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8925 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8926 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8927 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8928 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8929 thumb2_bl_out_of_range.o): New rules.
8930 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8931 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8932 thumb2_bl_out_of_range
8933 * testsuite/Makefile.in: Regenerate.
8934 * testsuite/arm_bl_in_range.s: New file.
8935 * testsuite/arm_bl_out_of_range.s: Ditto.
8936 * testsuite/arm_branch_in_range.sh: Ditto.
8937 * testsuite/arm_branch_range.t: Ditto.
8938 * testsuite/thumb2_branch_range.t: Ditto.
8939 * testsuite/thumb_bl_in_range.s: Ditto.
8940 * testsuite/thumb_bl_out_of_range.s: Ditto.
8941 * testsuite/thumb_branch_range.t: Ditto.
8943 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8945 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8946 Add reloc offset information.
8947 * icf.cc (get_section_contents): Change iterators to point to the new
8948 vectors. Add reloc offset information to the contents.
8949 * icf.h (Icf::Sections_reachable_info): New typedef.
8950 (Icf::Sections_reachable_list): New typedef.
8951 (Icf::Offset_info): New typedef.
8952 (Icf::Reloc_info): New struct typedef.
8953 (Icf::Reloc_info_list): New typedef.
8954 (Icf::symbol_reloc_list): Delete method.
8955 (Icf::addend_reloc_list): Delete method.
8956 (Icf::section_reloc_list): Delete method.
8957 (Icf::reloc_info_list): New method.
8958 (Icf::reloc_info_list_): New member.
8960 2010-02-19 Doug Kwan <dougkwan@google.com>
8962 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8963 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8964 * arm.cc (Arm_relocation_functions): New forward declaration.
8965 (Target_arm::Target_arm): Initialize new data members
8966 got_mod_index_offset_ and tls_base_symbol_defined_.
8967 (Target_arm::Relocate::relocate_tls): New method.
8968 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8969 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8971 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8972 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8973 (Target_arm::got_mod_index_offset_,
8974 Target_arm::tls_base_symbol_defined_): New data members.
8975 (Target_arm::Scan::local, Target::Scan::global,
8976 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8979 2010-02-18 Doug Kwan <dougkwan@google.com>
8981 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8982 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8983 text section as a parameter becuase some broken tools may not set
8984 the link in section header.
8985 (Target_arm::has_got_section): New method.
8986 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8987 without any mapping symbol as data only. Remove warning.
8988 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8989 link in its section header, try to discover the link by inspecting the
8990 REL31 relocation at the beginning of the section.
8991 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8993 (Target_arm::Scan::global): Treat any reference to the symbol
8994 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8996 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8998 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8999 (Scan::global_reloc_may_be_function_pointer): New function.
9000 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9001 (Scan::global_reloc_may_be_function_pointer): New function.
9002 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9003 (Scan::global_reloc_may_be_function_pointer): New function.
9004 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9005 (Scan::global_reloc_may_be_function_pointer): New function.
9006 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9007 (Scan::global_reloc_may_be_function_pointer): New function.
9008 (Scan::possible_function_pointer_reloc): New function.
9009 (Target_x86_64::can_check_for_function_pointers): New function.
9010 * gc.h (gc_process_relocs): Scan relocation types to determine if
9011 function pointers were taken for targets that support it.
9012 * icf.cc (Icf::find_identical_sections): Include functions for
9013 folding in safe ICF whose pointer is not taken.
9014 * icf.h (Secn_fptr_taken_set): New typedef.
9015 (fptr_section_id_): New member.
9016 (section_has_function_pointers): New function.
9017 (set_section_has_function_pointers): New function.
9018 (check_section_for_function_pointers): New function.
9019 * options.h: Fix comment for safe ICF option.
9020 * target.h (can_check_for_function_pointers): New function.
9021 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9022 Modify icf_safe_test for X86-64.
9023 * testsuite/Makefile.in: Regenerate.
9024 * testsuite/icf_safe_so_test.cc: New file.
9025 * testsuite/icf_safe_so_test.sh: New file.
9026 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9027 (main): Change to take pointer to function kept_func_3.
9028 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9029 folding is done correctly for X86-64.
9031 2010-02-12 David S. Miller <davem@davemloft.net>
9033 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9034 is_symbolless parameter.
9035 (Output_reloc<SHT_REL>::is_symbolless): New.
9036 (Output_reloc<SHT_REL>::is_symbolless_): New.
9037 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9038 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9039 (Output_reloc<SHT_RELA>::is_symbolless): New.
9040 (Output_data_reloc::add_global): Handle is_symbolless.
9041 (Output_data_reloc::add_global_relative): Likewise.
9042 (Output_data_reloc::add_local): Likewise.
9043 (Output_data_reloc::add_local_relative): Likewise.
9044 (Output_data_reloc::add_symbolless_global_addend): New.
9045 (Output_data_reloc::add_symbolless_local_addend): New.
9046 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9048 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9049 instead of ->is_relative_
9050 (Output_reloc::write): Likewise.
9051 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9052 (Output_reloc::write_rel): Simplify.
9054 * sparc.cc (Target_sparc::Scan::local): Use
9055 ->add_symbolless_local_addend as needed.
9056 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9057 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9058 based upon relocation offset.
9060 2010-02-11 Doug Kwan <dougkwan@google.com>
9062 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9063 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9064 beginning of function.
9065 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9066 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9067 parameter is_32bit in calls to should_apply_static_reloc.
9068 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9069 (check_DATA): Add arm_abs_global.stdout.
9070 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9071 arm_abs_global.stdout): New rules.
9072 (MOSTLLYCLEANFILES): Add arm_abs_global
9073 * Makefile.in: Regenerate.
9074 * testsuite/arm_abs_global.s: New file.
9075 * testsuite/arm_abs_global.sh: Ditto.
9076 * testsuite/arm_abs_lib.s: Ditto.
9078 2010-02-11 Ian Lance Taylor <iant@google.com>
9080 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9082 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9083 Allocate_commons_task first.
9084 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9085 task, rather than symtab_lock_.
9086 (Gc_process_relocs::~Gc_process_relocs): New function.
9087 (Gc_process_relocs::is_runnable): Check this_blocker_.
9088 (Gc_process_relocs::locks): Use next_blocker_ rather than
9090 (Scan_relocs::~Scan_relocs): New function.
9091 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9093 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9095 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9096 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9097 constructor accordingly.
9098 (class Gc_process_relocs): Likewise.
9099 (class Scan_relocs): Likewise.
9100 * common.h (class Allocate_commons_task): Remove symtab_lock_
9101 field, and corresponding constructor parameter.
9102 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9104 (Allocate_commons_task::locks): Likewise.
9106 2010-02-11 Ian Lance Taylor <iant@google.com>
9108 * gold-threads.h (class Once): Define.
9109 (class Initialize_lock): Rewrite as child of Once.
9110 * gold-threads.cc (class Once_initialize): Define.
9111 (once_pointer_control): New static variable.
9112 (once_pointer, once_arg): New static variables.
9113 (c_run_once): New static function.
9114 (Once::Once, Once::run_once, Once::internal_run): New functions.
9115 (class Initialize_lock_once): Remove.
9116 (initialize_lock_control): Remove.
9117 (initialize_lock_pointer): Remove.
9118 (initialize_lock_once): Remove.
9119 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9120 (Initialize_lock::initialize): Rewrite.
9121 (Initialize_lock::do_run_once): New function.
9122 * archive.cc (Archive::interpret_header): Only clear name if it is
9124 * fileread.cc: Include "gold-threads.h"
9125 (file_counts_lock): New static variable.
9126 (file_counts_initialize_lock): Likewise.
9127 (File_read::release): Only increment counts when using --stats.
9128 Use a lock around the increment.
9129 * parameters.cc (class Set_parameters_target_once): Define.
9130 (set_parameters_target_once): New static variable.
9131 (Parameters::Parameters): Move here from parameters.h.
9132 (Parameters::set_target): Rewrite.
9133 (Parameters::set_target_once): New function.
9134 (Parameters::clear_target): Move here and rewrite.
9135 * parameters.h (class Parameters): Update declarations. Add
9136 set_parameters_target_once_ field.
9137 (Parameters::Parameters): Move to parameters.cc.
9138 (Parameters::clear_target): Likewise.
9139 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9141 (Start_group::~Start_group): New function.
9142 (Start_group::is_runnable): New function.
9143 (Start_group::locks, Start_group::run): New functions.
9144 (Finish_group::run): Change saw_undefined to size_t.
9145 * readsyms.h (class Start_group): Define.
9146 (class Finish_group): Change saw_undefined_ field to size_t.
9147 (Finish_group::Finish_group): Remove saw_undefined and
9148 this_blocker parameters. Change all callers.
9149 (Finish_group::set_saw_undefined): New function.
9150 (Finish_group::set_blocker): New function.
9151 * symtab.h (class Symbol_table): Change saw_undefined to return
9152 size_t. Change saw_undefined_ field to size_t.
9153 * target-select.cc (Set_target_once::do_run_once): New function.
9154 (Target_selector::Target_selector): Initialize set_target_once_
9155 field. Don't initialize lock_ and initialize_lock_ fields.
9156 (Target_selector::instantiate_target): Rewrite.
9157 (Target_selector::set_target): New function.
9158 * target-select.h (class Set_target_once): Define.
9159 (class Target_selector): Update declarations. Make
9160 Set_target_once a friend. Remove lock_ and initialize_lock_
9161 fields. Add set_target_once_ field.
9163 2010-02-10 Ian Lance Taylor <iant@google.com>
9165 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9167 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9168 (queue_middle_tasks): Add all blockers before queueing any tasks.
9169 (queue_final_tasks): Likewise.
9170 * token.h (Task_token::add_blockers): New function.
9171 * object.h (Input_objects::number_of_relobjs): New function.
9173 2010-02-10 Ian Lance Taylor <iant@google.com>
9175 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9176 shared, not if not position independent.
9177 * x86_64.cc (Relocate::relocate_tls): Likewise.
9178 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9179 (tls_pie_pic_test): New target.
9180 * testsuite/Makefile.in: Rebuild.
9182 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9183 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9184 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9185 * testsuite/Makefile.in: Rebuild.
9187 2010-02-09 David S. Miller <davem@davemloft.net>
9189 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9190 R_SPARC_RELATIVE using ->add_local_relative().
9191 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9193 * output.h (Output_data_dynamic::add_section_size): New method
9194 that takes two Output_data objects.
9195 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9196 entry param. Handle it in initializers.
9197 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9198 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9199 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9201 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9202 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9203 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9204 for dynrel_includes_plt.
9205 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9206 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9207 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9209 (Target_sparc::do_finalize_sections): Update to pass true for
9210 dynrel_includes_plt.
9211 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9212 output before .rela.plt
9213 (Target_powerpc::do_finalize_sections): Update to pass true for
9214 dynrel_includes_plt when 32-bit.
9216 2010-02-08 Doug Kwan <dougkwan@google.com>
9218 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9220 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9221 Arm_relobj::scan_section_for_cortex_a8_stubs,
9222 Arm_relobj::do_relocation_section): Instead of calling
9223 Output_section::output_address, use faster
9224 Arm_relobj::simple_input_section_output_address.
9226 2010-02-08 David S. Miller <davem@davemloft.net>
9228 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9229 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9230 relocation helper function.
9232 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9233 just like R_SPARC_GOT{10,13,22}.
9234 (Target_sparc::Scan::local): Likewise.
9235 (Target_sparc::Relocate:relocate): Likewise.
9237 2010-02-06 Ian Lance Taylor <iant@google.com>
9239 * configure.ac: Rewrite targetobjs duplicate removal code to use
9240 only shell constructs.
9241 * configure: Rebuild.
9243 2010-02-05 Doug Kwan <dougkwan@google.com>
9246 * arm.cc (Arm_relobj::section_is_scannable): New method.
9247 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9248 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9250 2010-02-04 Doug Kwan <dougkwan@google.com>
9253 * arm-reloc-property.cc (cstdio): Include.
9254 * configure.ac (targetobjs): Remove duplicates.
9255 * configure: Regenerate.
9256 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9257 big and little endian version for a given address size.
9259 2010-02-03 Doug Kwan <dougkwan@google.com>
9261 * arm-reloc-property.cc
9262 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9264 * arm-reloc-property.h
9265 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9266 New method definition.
9267 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9269 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9271 (GOT_PREL): Change implemented to Y.
9272 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9273 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9274 (Arm_relocate_functions::movw_abs_nc): Remove method.
9275 (Arm_relocate_functions::movt_abs): Ditto.
9276 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9277 (Arm_relocate_functions::thm_movt_abs): Ditto.
9278 (Arm_relocate_functions::movw_rel_nc): Ditto.
9279 (Arm_relocate_functions::movw_rel): Ditto.
9280 (Arm_relocate_functions::movt_rel): Ditto.
9281 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9282 (Arm_relocate_functions:thm_movw_rel): Ditto.
9283 (Arm_relocate_functions:thm_movt_rel): Ditto.
9284 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9285 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9286 New method definitions.
9287 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9288 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9289 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9290 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9291 (Target_arm::Relocate::relocate): Check for non-static or
9292 unimplemented relocation code and exit early. Change calls to
9293 Target_arm::reloc_uses_thumb_bit and
9294 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9295 instead. Refactor code to handle similar relocations to increase
9296 code sharing. Remove check for unsupported relocation code in switch
9298 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9299 relocation property table to find out size. Change error message to
9300 print out the name of a relocation code instead of the numeric value.
9301 (Target_arm::scan_reloc_for_stub): Use relocation property table
9302 instead of calling Target_arm::reloc_uses_thumb_bit().
9304 2010-02-02 Doug Kwan <dougkwan@google.com>
9306 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9307 types of relaxed input section.
9309 2010-02-02 Doug Kwan <dougkwan@google.com>
9311 * Makefile.am (HFILES): Add arm-reloc-property.h.
9313 (TARGETSOURCES): Add arm-reloc-property.cc
9314 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9315 (libgold_a_SOURCES): $(DEFFILES)
9316 * Makefile.in: Regenerate.
9317 * arm-reloc-property.cc: New file.
9318 * arm-reloc-property.h: New file.
9319 * arm-reloc.def: New file.
9320 * arm.cc: Update comments.
9321 (arm-reloc-property.h): New included header.
9322 (arm_reloc_property_table): New global variable.
9323 (Target_arm::do_select_as_default_target): New method definition.
9324 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9325 arm-reloc-property to targ_extra_obj.
9326 * parameters.cc (set_parameters_target): Call
9327 Target::select_as_default_target().
9328 * target.h (Target::select_as_default_target): New method definition.
9329 (Target::do_select_as_default_target): Same.
9331 2010-02-01 Doug Kwan <dougkwan@google.com>
9333 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9334 first_output_text_section_.
9335 (Arm_exidx_fixup::first_output_text_section): New method definition.
9336 (Arm_exidx_fixup::first_output_text_section_): New data member.
9337 (Arm_exidx_fixup::process_exidx_section): Record the first text
9338 output section seen.
9339 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9340 and entsize in output section header.
9342 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9344 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9345 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9346 (Arm_relocate_functions::thm_alu11): New Method.
9347 (Arm_relocate_functions::thm_pc8): New Method.
9348 (Arm_relocate_functions::thm_pc12): New Method.
9349 (Target_arm::Scan::local): Handle the relocations.
9350 (Target_arm::Scan::global): Likewise.
9351 (Target_arm::Relocate::relocate): Likewise.
9352 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9354 2010-01-29 Doug Kwan <dougkwan@google.com>
9356 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9357 of relocation types as ld.
9359 2010-01-29 Doug Kwan <dougkwan@google.com>
9361 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9363 (Arm_relocate_functions::thumb_branch_common): Ditto.
9364 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9365 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9366 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9367 Arm_relocate_functions::jump24): Remove.
9368 (Target_arm::Relocate::relocate): Adjust code to call
9369 Arm_relocation_functions::arm_branch_common and
9370 Arm_relocation_functions::thumb_branch_common instead of their removed
9371 wrappers. Merge switch-cases together to reduce source code size.
9373 2010-01-29 Doug Kwan <dougkwan@google.com>
9375 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9376 output_local_symbol_count_needs_update_.
9377 (Arm_relobj::output_local_symbol_count_needs_update,
9378 Arm_relobj::set_output_local_symbol_count_needs_update,
9379 Arm_relobj::update_output_local_symbol_count): New methods.
9380 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9382 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9383 of pointed function as in a R_ARM_PREL31 relocation.
9384 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9385 for output local symbol count updating.
9386 (Target_arm::do_relax): Update output local symbol counts in objects
9388 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9390 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9392 * arm.cc: Added support for the ARM relocations:
9393 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9394 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9395 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9397 (Arm_relocate_functions::movw_rel): New method.
9398 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9399 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9401 (Arm_relocate_functions::thm_movw_rel): New method.
9402 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9404 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9406 (Target_arm::Scan::global): Likewise.
9407 (Target_arm::Relocate::relocate): Likewise.
9408 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9411 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9413 * arm.cc: Added support for ARM group relocations.
9414 (Target_arm::reloc_needs_sym_origin): New method.
9415 (Arm_relocate_functions::calc_grp_kn): New method.
9416 (Arm_relocate_functions::calc_grp_residual): New method.
9417 (Arm_relocate_functions::calc_grp_gn): New method.
9418 (Arm_relocate_functions::arm_grp_alu): New Method.
9419 (Arm_relocate_functions::arm_grp_ldr): New Method.
9420 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9421 (Arm_relocate_functions::arm_grp_ldc): New Method.
9422 (Target_arm::Scan::local): Handle the ARM group relocations.
9423 (Target_arm::Scan::global): Likewise.
9424 (Target_arm::Relocate::relocate): Likewise.
9425 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9428 2010-01-26 Doug Kwan <dougkwan@google.com>
9430 * arm.cc (set): Include.
9431 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9433 (Arm_output_section::Text_section_list): New type.
9434 (Arm_output_section::append_text_sections_to_list): New method.
9435 (Arm_output_section::fix_exidx_coverage): Ditto.
9436 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9437 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9438 Relobj::set_section_offset() instead of
9439 Sized_relobj::invalidate_section_offset().
9440 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9441 parameter for section headers. Ignore relocation sections for
9442 unallocated sections and EXIDX sections.
9443 (Target_arm::fix_exidx_coverage): New method.
9444 (Target_arm::output_section_address_less_than): New type.
9445 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9446 linked text section instead of the EXIDX section.
9447 (Arm_output_section::create_stub_group): Add an assertion to check
9448 that this is not an EXIDX output section.
9449 (Arm_output_section::append_text_sections_to_list): New method.
9450 (Arm_output_section::fix_exidx_coverage): Ditto.
9451 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9452 Arm_relobj::section_needs_reloc_stub_scanning.
9453 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9455 (Target_arm::fix_exidx_coverage): New method.
9456 * object.h (Relobj::set_output_section): New method.
9457 (Sized_relobj::invalidate_section_offset): Remove method.
9458 (Sized_relobj::do_invalidate_section_offset): Remove method.
9459 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9461 2010-01-25 Doug Kwan <dougkwan@google.com>
9463 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9464 Fix warning due to signed and unsigned comparison on a 32-bit host.
9466 2010-01-22 Doug Kwan <dougkwan@google.com>
9468 * arm.cc (Target_arm::do_relax): Record an output section for section
9469 offset adjustment it contains any stub table that has changed.
9470 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9471 offsets in an output section if necessary.
9472 * output.cc (Output_section::Output_section): Initialize
9473 section_offsets_need_adjustments_.
9474 (Output_section::add_input_section_for_script): Renamed to
9475 Output_section::add_simple_input_section.
9476 (Output_section::save_states): Add a comment.
9477 (Output_section::discard_states): New method defintion.
9478 (Output_section::adjust_section_offsets): Same.
9479 * output.h (Output_section::add_input_section_for_script): Renamed to
9480 Output_section::add_simple_input_section.
9481 (Output_section::discard_states): New method declaration.
9482 (Output_section::adjust_section_offsets): Same.
9483 (Output_section::section_offsets_need_adjustment,
9484 Output_section::set_section_offsets_need_adjustment): New method
9486 (Output_section::section_offsets_need_adjustment_): New data member.
9487 * script-sections.cc
9488 (Output_section_element_input::set_section_address): Adjust code for
9489 renaming of Output_section::add_input_section_for_script.
9490 (Orphan_output_section::set_section_address): Same.
9492 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9494 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9495 Fix_v4bx enum values .
9496 * gold/options.h (General_options): New option definitions.
9497 (General_options::fix_v4bx): New method.
9498 (General_options::Fix_v4bx): New enum.
9499 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9500 (General_options::parse_fix_v4bx_interworking): New method.
9502 2010-01-22 Doug Kwan <dougkwan@google.com>
9504 * arm.cc (Arm_exidx_fixup): New class.
9506 2010-01-21 Doug Kwan <dougkwan@google.com>
9508 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9510 (Arm_exidx_section_offset_map): New type.
9512 2010-01-21 Doug Kwan <dougkwan@google.com>
9514 * arm.cc (Arm_exidx_input_section): New class.
9515 (Arm_relobj::exidx_input_section_by_link,
9516 Arm_relobj::exidx_input_section_by_shndx,
9517 Arm_relobj::make_exidx_input_section): New methods.
9518 (read_arm_attributes_section): Remove.
9519 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9520 information about them.
9521 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9524 2010-01-20 Doug Kwan <dougkwan@google.com>
9526 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9527 Input_section_specifier to Section_id.
9528 (Target_arm::new_arm_input_section: Adjust code for change of key
9530 (Target_arm::find_arm_input_section): Ditto.
9531 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9532 (Section_id): Remove.
9533 (Garbage_collection::Section_id_hash): Remove.
9534 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9535 (Section_id): Remove.
9536 (Icf::Section_id_hash): Remove.
9537 * object.h (Section_id, Const_section_id, Section_id_hash,
9538 Const_section_id_hash): New type definitions.
9539 * output.cc (Output_section::add_relaxed_input_section): Change to
9540 use Const_section_id instead of Input_section_specifier as key type.
9541 (Output_section::add_merge_input_section): Ditto.
9542 (Output_section::build_relaxation_map): Change to use Section_id
9543 instead of Input_section_specifier as key type.
9544 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9546 (Output_section::convert_input_sections_to_relaxed_sections): Change
9547 to use Const_section_id instead of Input_section_specifier as key type.
9548 (Output_section::find_merge_section): Ditto.
9549 (Output_section::find_relaxed_input_section): Ditto.
9550 * output.h (Input_section_specifier): Remove class.
9551 (Output_section::Output_section_data_by_input_section_map): Change
9552 key type to Const_section_id.
9553 (Output_section::Output_relaxed_input_section_by_input_section_map):
9555 (Output_section::Relaxation_map): Change key type to Section_id.
9557 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9559 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9560 (class Arm_v4bx_stub): New class.
9561 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9562 (Stub_factory::make_arm_v4bx_stub): New method.
9563 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9564 (Stub_table::empty): Handle v4bx stubs.
9565 (Stub_table::add_arm_v4bx_stub): New method.
9566 (Stub_table::find_arm_v4bx_stub): New method.
9567 (Arm_relocate_functions::v4bx): New method.
9568 (Target_arm::fix_v4bx): New method.
9569 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9570 (Stub_table::relocate_stubs): Likewise.
9571 (Stub_table::do_write): Likewise.
9572 (Stub_table::update_data_size_and_addralign): Likewise.
9573 (Stub_table::finalize_stubs): Likewise.
9574 (Target_arm::Scan::local): Likewise.
9575 (Target_arm::Scan::global): Likewise.
9576 (Target_arm::do_finalize_sections): Likewise.
9577 (Target_arm::Relocate::relocate): Likewise.
9578 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9580 (Target_arm::scan_reloc_for_stub): Likewise.
9581 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9583 2010-01-19 Ian Lance Taylor <iant@google.com>
9585 * output.cc (Output_section_headers::do_sized_write): Write large
9586 segment count to sh_info field.
9587 (Output_file_header::do_sized_write): For large segment count,
9588 write PN_XNUM to e_phnum field.
9590 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9592 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9593 (Arm_relocate_functions::thm_jump8): New function.
9594 (Arm_relocate_functions::thm_jump11): New function.
9595 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9597 (Target_arm::Scan::global): Likewise.
9598 (Target_arm::Relocate::relocate): Likewise.
9599 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9602 2010-01-14 Doug Kwan <dougkwan@google.com>
9604 * arm.cc (map, utility): Include headers.
9605 (Target_arm::apply_cortex_a8_workaround): New method.
9606 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9607 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9608 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9609 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9610 the --[no-]fix-cortex-a8 command line options.
9611 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9612 (Target_arm::relocate_stub): Use addend in instruction template.
9613 * options.h (DEFINE_bool): Set the user-set flag.
9614 (General_options): Add --[no-]-fix-cortex options.
9615 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9616 : Update fast look-up map after conversion.
9618 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9620 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9621 in the first pass of do_layout.
9623 2010-01-13 Doug Kwan <dougkwan@google.com>
9625 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9626 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9627 apparent compiler problem of not folding static constant integral
9628 data members of elfcpp::Elf_sizes<32>.
9630 2010-01-13 Doug Kwan <dougkwan@google.com>
9632 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9633 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9634 Arm_relobj::scan_section_for_cortex_a8_erratum,
9635 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9636 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9637 sections to scan for relocation stubs into a new method
9638 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9639 relocation and Cortex-A8 stub scanning.
9640 (Target_arm::do_relax): Force stubs to be after stubbed sections
9641 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9642 the beginning of a new relaxation pass. Update a comment.
9643 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9645 2010-01-12 Ian Lance Taylor <iant@google.com>
9647 * target-reloc.h (visibility_error): New inline function.
9648 (relocate_section): Call visibility_error.
9649 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9650 (MOSTLYCLEANFILES): Likewise.
9651 (protected_4_pic.o, protected_3.err): New targets.
9652 * testsuite/protected_4.cc: New file.
9654 2010-01-12 Doug Kwan <dougkwan@google.com>
9656 * arm.cc (Cortex_a8_reloc): New class.
9657 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9658 and cortex_a8_relocs_info_.
9659 (Target_arm::fix_cortex_a8): New method definition.
9660 (Target_arm::Cortex_a8_relocs_info): New type.
9661 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9662 New data member declarations.
9663 (Target_arm::scan_reloc_for_stub): Record information about
9664 relocations for THUMB branches that might be exempted from the
9665 Cortex-A8 workaround.
9666 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9667 at the beginning of a relaxation pass.
9669 2010-01-12 Doug Kwan <dougkwan@google.com>
9671 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9672 (Arm_relobj::Mapping_symbol_position,
9673 Arm_reloj::Mapping_symbol_position_less,
9674 Arm_relobj::Mapping_symbols_info): New types.
9675 (Target_arm::is_mapping_symbol_name): New method definition.
9676 (Arm_relobj::do_count_local_symbols): Save information about mapping
9679 2010-01-11 Doug Kwan <dougkwan@google.com>
9681 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9682 Arm_relocate_functions::thumb32_branch_upper,
9683 Arm_relocate_functions::thumb32_branch_lower,
9684 Arm_relocate_functions::thumb32_cond_branch_offset,
9685 Arm_relocate_functions::thumb32_cond_branch_upper,
9686 Arm_relocate_functions::thumb32_cond_branch_lower,
9687 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9688 branch offset encoding.
9689 (Arm_relocate_functions::thumb_branch_common): Use new branch
9690 offset encoding methods to avoid code duplication.
9691 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9692 (Stub_addend_reader::operator()): Use new branch encoding method
9693 to avoid code duplication.
9695 2010-01-11 Doug Kwan <dougkwan@google.com>
9697 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9698 (Target_arm::do_finalize_sections): Define special EXIDX section
9699 symbols only if referenced.
9700 * gc.h (Garbage_collection::add_reference): New method.
9701 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9704 2010-01-11 Ian Lance Taylor <iant@google.com>
9706 * script.cc (Version_script_info::build_expression_list_lookup):
9707 Change complaing about duplicate wildcard match from error to
9710 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9712 (Version_script_info::Version_script_info): Initialize globs_,
9713 default_version_, default_is_global_, and exact_. Don't
9714 initialize globals_ or locals_.
9715 (Version_script_info::build_lookup_tables): Build local symbols
9717 (Version_script_info::unquote): New function.
9718 (Version_script_info::add_exact_match): New function.
9719 (Version_script_info::build_expression_list_lookup): Remove lookup
9720 parameter. Add is_global parameter. Change all callers. Handle
9721 wildcard pattern specially. Unquote pattern. Call
9723 (Version_script_info::get_name_to_match): New function.
9724 (Version_script_info::get_symbol_version): New function.
9725 (Version_script_info::get_symbol_version_helper): Remove.
9726 (Version_script_info::check_unmatched_names): Call unquote.
9727 * script.h (class Version_script_info): Change get_symbol_version
9728 to be non-inline and add is_global parameter; change all callers.
9729 Rewrite symbol_is_local. Update declarations. Define struct
9730 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9731 Remove globals_ and locals_ members. Add exact_, globs_,
9732 default_version_, is_global_.
9733 (Version_script_info::Glob): Remove pattern, add expression and
9734 is_global. Update constructor. Change all callers.
9735 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9737 (Versions::symbol_section_contents): If a symbol is undefined, or
9738 defined in a dynamic object, set the version index to
9740 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9742 (Symbol_table::add_from_pluginobj): Likewise.
9743 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9745 2010-01-11 Doug Kwan <dougkwan@google.com>
9747 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9748 (incremental_dump_LDADD): Add linking option for libintl.
9749 * Makefile.in: Regenerate.
9751 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9754 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9756 * testsuite/Makefile.in: Regenerated.
9758 2010-01-10 Doug Kwan <dougkwan@google.com>
9760 * options.h (DEFINE_var): Use parentheses around argument varname__
9761 in macro body to avoid any unintended subsequent substitutions.
9763 2010-01-10 Ian Lance Taylor <iant@google.com>
9765 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9766 candidates before doing symbol resolution.
9768 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9769 ODR candidates if only one is weak.
9771 2010-01-08 Ian Lance Taylor <iant@google.com>
9773 * script.cc (Version_script_info::build_expression_list_lookup):
9774 Don't warn about ambiguous version, just record the ambiguity.
9775 (Version_script_info::get_symbol_version_helper): Give error if
9776 version is ambiguous.
9778 2010-01-08 Doug Kwan <dougkwan@google.com>
9780 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9781 prev_data_size_ and prev_addralign_. Remove initializer for
9782 deleted data member has_been_changed_.
9783 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9784 to determine if the table is empty.
9785 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9787 (Stub_table::add_reloc_stub): Define method in class definition
9788 instead of just declaring it there.
9789 (Stub_table::add_cortex_a8_stub): New method definition.
9790 (Stub_table::update_data_size_and_addralign): Ditto.
9791 (Stub_table::finalize_stubs): Ditto.
9792 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9793 (Stub_table::do_addralign_): Return address alignment in the
9794 (Stub_table::do_reset_address_and_file_offset): Define method in
9795 class definition instead of declaring it there. Set current data
9796 size to be the data size of the previous pass.
9797 (Stub_table::set_final_data_size): Use current data size as the
9799 (Stub_table::relocate_stub): Change parameter type of stub from
9800 Reloc_stub pointer to Stub pointer.
9801 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9802 (Stub_table::Cortex_a8_stub_list): New typedef.
9803 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9804 Stub_table::prev_addralign_): New data member.
9805 (Arm_relobj::Arm_relobj): Initialize data member
9806 section_has_cortex_a8_workaround_.
9807 (Arm_relobj::section_has_cortex_a8_workaround,
9808 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9810 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9812 (Target_arm::relocate_stub): Change parameter type of stub from
9813 Reloc_stub pointer to Stub pointer.
9814 (Insn_template::size, Insn_template::alignment): Handle
9815 THUMB16_SPECIAL_TYPE.
9816 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9817 Stub_table::update_data_size_and_addralign,
9818 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9820 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9821 (Stub_table::do_write): Ditto.
9822 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9824 2010-01-08 Ian Lance Taylor <iant@google.com>
9827 * symtab.h (class Symbol): Remove fields is_target_special_ and
9828 has_plt_offset_. Add field is_defined_in_discarded_section_.
9829 (Symbol::is_defined_in_discarded_section): New function.
9830 (Symbol::set_is_defined_in_discarded_section): New function.
9831 (Symbol::has_plt_offset): Rewrite.
9832 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9833 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9834 Don't initialize is_target_special_ or has_plt_offset_.
9835 Initialize is_defined_in_discarded_section_.
9836 (Symbol_table::add_from_relobj): If appropriate, set
9837 is_defined_in_discarded_section.
9838 * resolve.cc (Symbol::override_base_with_special): Don't test
9839 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9840 * target-reloc.h (relocate_section): Do special handling for
9841 symbols defined in discarded sections for global symbols as well
9844 2010-01-08 Ian Lance Taylor <iant@google.com>
9846 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9847 the SHT_SYMTAB case.
9849 2010-01-08 Ian Lance Taylor <iant@google.com>
9851 * object.cc (Sized_relobj::do_layout): Don't get confused if
9852 layout_eh_frame returns NULL.
9854 2010-01-08 Ian Lance Taylor <iant@google.com>
9857 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9858 dynamic symbol table, use the normal symbol table.
9859 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9862 2010-01-08 Ian Lance Taylor <iant@google.com>
9865 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9868 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9870 * version.cc (print_version): Change to "Copyright 2010".
9872 2010-01-08 Ian Lance Taylor <iant@google.com>
9876 * i386.cc (class Target_i386): Change return type of plt_section
9878 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9879 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9880 tls_desc_rel_ field.
9881 (Output_data_plt_i386::rel_tls_desc): New function.
9882 (Target_i386::rel_tls_desc_section): New function.
9883 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9884 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9885 R_386_TLS_DESC reloc in rel_tls_desc_section.
9886 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9887 Define struct Tlsdesc_info.
9888 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9889 (Target_x86_64::do_reloc_symbol_index): New function.
9890 (Target_x86_64::add_tlsdesc_info): New function.
9891 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9892 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9894 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9896 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9897 (Target_x86_64::rela_tlsdesc_section): New function.
9898 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9900 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9901 (Target_x86_64::do_reloc_addend): New function.
9902 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9903 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9904 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9905 (Output_reloc::type): New function.
9906 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9907 (Output_reloc::is_target_specific): New function.
9908 (Output_reloc::target_arg): New function.
9909 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9910 absolute relocs and target specific relocs.
9911 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9912 add_target_specific.
9913 (class Output_data_reloc) [SHT_RELA]: Likewise.
9914 * output.cc (Output_reloc::Output_reloc): Add four new versions
9915 for absolute relocs and target specific relocs.
9916 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9917 (Output_reloc::get_symbol_index): Likewise.
9918 (Output_reloc::local_section_offset): Check that local_sym_index_
9919 is not TARGET_CODE or 0.
9920 (Output_reloc::symbol_value): Likewise.
9921 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9923 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9924 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9926 * layout.cc (add_target_dynamic_tags): Use output section for
9927 DT_PLTRELSZ and DT_JMPREL.
9929 2010-01-07 Ian Lance Taylor <iant@google.com>
9932 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9934 (class Output_data_reloc_generic): Define.
9935 (class Output_data_reloc_base): Change base class to
9936 Output_data_reloc_generic. Change add() method to call
9937 bump_relative_reloc_count for a relative reloc. Remove
9939 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9941 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9942 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9944 * layout.h (class Layout): Update declaration.
9946 2010-01-07 Ian Lance Taylor <iant@google.com>
9948 * output.h (class Output_data): Add const version of
9949 output_section and do_output_section.
9950 (class Output_section_data): Add const version of
9952 (class Output_section): Likewise.
9953 * layout.cc (Layout::add_target_dynamic_tags): New function.
9954 * layout.h (class Layout): Update declarations.
9955 * arm.cc (Target_arm::do_finalize_sections): Use
9956 add_target_dynamic_tags.
9957 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9958 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9959 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9960 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9962 2010-01-07 Ian Lance Taylor <iant@google.com>
9965 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9968 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9969 Ian Lance Taylor <iant@google.com>
9972 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9973 Xindex::read_symtab_xindex.
9975 2010-01-07 Doug Kwan <dougkwan@google.com>
9977 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9978 (Insn_template::thumb16_bcond_insn): New method declaration.
9979 (Insn_template): Fix spelling.
9980 (Stub::thumb16_special): New method declaration.
9981 (Stub::do_write): Define virtual method which was previously pure
9983 (Stub::do_thumb16_special): New method declaration.
9984 (Stub::do_fixed_endian_write): New template member.
9985 (Reloc_stub::do_write): Remove.
9986 (Reloc_stub::do_fixed_endian_write): Remove.
9987 (Cortex_a8_stub): New class definition.
9988 (Stub_factory::make_cortex_a8_stub): New method definition.
9989 (Stub_factory::Stub_factory): Add missing static storage class
9990 qualifier for elf32_arm_stub_a8_veneer_blx.
9992 2010-01-07 Ian Lance Taylor <iant@google.com>
9995 * options.h (class General_options): Add --warn-unresolved-symbols
9996 and --error-unresolved-symbols.
9997 * errors.cc (Errors::undefined_symbol): Implement
9998 --warn-unresolved-symbols.
10000 * options.h (class General_options): Add -z text and -z textoff.
10001 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10003 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10005 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10006 (Garbage_collection::cident_sections): New function.
10007 (Garbage_collection::add_cident_section): New function.
10008 (Garbage_collection::cident_sections_): New member.
10009 (gc_process_relocs): Add references to sections whose names are C
10011 * gold.h (cident_section_start_prefix): New constant.
10012 (cident_section_stop_prefix): New constant.
10013 (is_cident): New function.
10014 * layout.cc (Layout::define_section_symbols): Replace string constants
10015 with the newly defined constants.
10016 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10018 * testsuite/Makefile.am: Add gc_orphan_section_test.
10019 * testsuite/Makefile.in: Regenerate.
10020 * testsuite/gc_orphan_section_test.cc: New file.
10021 * testsuite/gc_orphan_section_test.sh: New file.
10023 2010-01-06 Ian Lance Taylor <iant@google.com>
10026 * options.h (class General_options): Add --warn-shared-textrel.
10027 * layout.cc (Layout::finish_dynamic_section): Implement
10028 --warn-shared-textrel.
10031 * options.h (class General_options): Add --warn-multiple-gp.
10033 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10035 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10036 $(THREADSLIB) and $(LIBDL).
10037 * Makefile.in: Rebuild.
10039 2010-01-06 Ian Lance Taylor <iant@google.com>
10042 * options.cc (General_options::parse_section_start): New function.
10043 (General_options::section_start): New function.
10044 (General_options::General_options): Initialize all members.
10045 * options.h: Include <map>
10046 (class General_options): Add --section-start. Add section_starts_
10048 * layout.cc (Layout::attach_allocated_section_to_segment): If
10049 --section-start was used, set the address of the segment. Remove
10050 local sort_sections.
10051 (Layout::relaxation_loop_body): If the address of the load segment
10052 has been set by --section-start, don't use it.
10053 * output.h (Output_segment::update_flags_for_output_section): New
10055 * output.cc (Output_segment::add_output_section): Call
10056 update_flags_for_output_section.
10058 2010-01-05 Ian Lance Taylor <iant@google.com>
10061 * options.h (class General_options): Add --undefined-version.
10062 * script.cc (struct Version_expression): Add was_matched_by_symbol
10064 (Version_script_info::matched_symbol): New function.
10065 (Version_script_info::get_symbol_version_helper): Call
10067 (Version_script_info::check_unmatched_names): New function.
10068 * script.h (class Version_script_info): Update declarations.
10069 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10071 * options.h (class General_options): Use DEFINE_bool_alias for
10072 allow_multiple_definition.
10073 * resolve.cc (Symbol_table::should_override): Don't test
10074 allow_multiple_definition.
10077 * options.h (class General_options): Add --cref.
10078 * main.cc (main): Print cref table if --cref. Don't close mapfile
10079 until after printing cref table.
10080 * cref.cc: Include "symtab.h".
10081 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10082 (Cref_table_compare::operator()): New function.
10083 (Cref_inputs::gather_cref): New function.
10084 (filecol): New static const.
10085 (Cref_inputs::print_cref): New function.
10086 (Cref::print_cref): New function.
10087 * cref.h: Include <cstdio>.
10088 (class Cref): Update declarations.
10089 * mapfile.h (Mapfile::file): New function.
10090 * object.h (class Object): Define Symbols. Declare virtual
10091 do_get_global_symbols.
10092 (Object::get_global_symbols): New function.
10093 * object.cc (Input_objects::add_object): Pass object to cref_ if
10095 (Input_objects::archive_start): Likewise.
10096 (Input_objects::archive_stop): Likewise.
10097 (Input_objects::print_cref): New function.
10098 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10099 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10101 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10103 * plugin.h (class Sized_pluginobj): Update declarations.
10105 2010-01-05 Ian Lance Taylor <iant@google.com>
10107 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10108 to is_default_version. Rename insdef to insdefault.
10109 (Symbol_table::add_from_relobj): Rename def to is_default_version
10110 and local to is_forced_local.
10111 (Symbol_table::add_from_pluginobj): Likewise.
10112 (Symbol_table::add_from_dynobj): Likewise.
10113 (Symbol_table::define_special_symbol): Rename insdef to
10116 2010-01-04 Ian Lance Taylor <iant@google.com>
10119 * options.h (class General_options): Add
10120 --allow-multiple-definition and -z muldefs.
10121 * resolve.cc (Symbol_table::should_override): Don't warn about a
10122 multiple symbol definition if --allow-multiple-definition or -z
10126 * options.h (class General_options): Add --add-needed and
10127 --copy-dt-needed-entries. Tweak --as-needed help entry.
10128 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10129 error if --copy-dt-needed-entries aka --add-needed is used and
10130 would cause a change in behaviour.
10133 * options.h (class General_options): Add -G as a short version of
10134 --shared. Add no-op options -assert, -g, and -i.
10136 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10138 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10139 check for .text or .gnu.linkonce.t sections.
10140 * icf.cc (Icf::find_identical_sections): Ditto.
10141 Change the detection for mangled function name within the section
10143 * icf.h (is_section_foldable_candidate): New function.
10145 2009-12-30 Ian Lance Taylor <iant@google.com>
10148 * options.h (class General_options): Permit two dashes with
10149 --retain-symbols-file.
10151 2009-12-30 Ian Lance Taylor <iant@google.com>
10154 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10155 don't put the file header and segment headers in the text
10159 * common.cc (Sort_commons::operator()): Stabilize sort when both
10161 (Symbol_table::do_allocate_commons_list): When allocating common
10162 symbols, skip a symbol which is no longer common.
10163 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10164 an object before checking its type.
10165 * testsuite/common_test_2.c: New file.
10166 * testsuite/common_test_3.c: New file.
10167 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10168 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10169 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10170 (common_test_2_pic.o, common_test_2.so): New targets.
10171 (common_test_3_pic.o, common_test_3.so): New targets.
10172 * testsuite/Makefile.in: Rebuild.
10175 * script.cc (read_input_script): If we see a new SECTIONS clause,
10176 and we have added an input section, give an error.
10177 * layout.h (class Layout): Add have_added_input_section function.
10178 Add have_added_input_section_ field.
10179 * layout.cc (Layout::Layout): Initialize
10180 have_added_input_section_.
10181 (Layout::layout): Set have_added_input_section_.
10182 (Layout::layout_eh_frame): Likewise.
10184 2009-12-30 Ian Lance Taylor <iant@google.com>
10187 * options.h (class General_options): Add --sort-common option.
10188 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10189 * common.cc (Sort_common): Add sort_order parameter to
10190 constructor. Add sort_order_ field.
10191 (Sort_commons::operator): Check sort_order_.
10192 (Symbol_table::allocate_commons): Determine the sort order.
10193 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10194 Change all callers.
10195 (Symbol_table::do_allocate_commons_list): Likewise.
10197 2009-12-30 Ian Lance Taylor <iant@google.com>
10200 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10201 symbols from this object, don't change the visibility of an
10203 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10205 2009-12-30 Ian Lance Taylor <iant@google.com>
10208 * script.h (class Version_script_info): Define Language enum.
10209 Update declarations. Define Glob, Exact, and Lookup types. Add
10210 new fields globals_, locals_, and is_finalized_.
10211 * script.cc: Various formatting fixes.
10212 (class Parser_closure): Change language_stack_ from a vector of
10213 std::string to one of Version_script_info::Language. Adjust all
10215 (class Lazy_demangler): Remove.
10216 (struct Version_expression): Change language from std::string to
10217 Version_script_info::Language.
10218 (Version_script_info::Version_script_info): New function.
10219 (Version_script_info::~Version_script_info): Don't call clear.
10220 (Version_script_info::finalize): New function.
10221 (Version_script_info::build_lookup_tables): New function.
10222 (Version_script_info::build_expression_list_lookup): New
10224 (Version_script_info::get_symbol_version_helper): Rewrite to use
10226 (Version_script_info::print_expression_list): Adjust to use
10227 Version_script_info::Language.
10228 (script_push_lex_into_version_mode): Check that the version script
10229 has not been finalized.
10230 (version_script_push_lang): Change language string to
10231 Version_script_info::Language.
10232 * options.cc (Command_line::version_script): New function.
10233 * options.h (class General_options): Add finalize_dynamic_list
10234 function. Change version_script from declaration to definition.
10235 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10236 * testsuite/version_script.map: Remove duplicate def of foo.
10237 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10238 version_script.map.
10239 * testsuite/Makefile.in: Rebuild.
10241 2009-12-30 Ian Lance Taylor <iant@google.com>
10244 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10245 if the input symbol index is 0, make the output symbol index 0.
10247 2009-12-30 Ian Lance Taylor <iant@google.com>
10250 * options.h (class General_options): Add -x/--discard-all.
10251 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10252 --discard-all. If the local symbol needs a dynamic entry, check
10253 that before handling --discard-locals.
10255 2009-12-30 Ian Lance Taylor <iant@google.com>
10258 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10260 (Output_segment::add_output_section): Don't change the flags if
10261 the type is PT_TLS.
10264 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10265 GNU hash table if they need a dynamic value. Otherwise, don't add
10266 them if they are defined in a dynamic object or are forced local.
10268 2009-12-29 Ian Lance Taylor <iant@google.com>
10271 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10272 .gnu.hash table for a 32-bit target.
10275 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10276 regular and a dynamic object only needs a dynamic symbol table
10277 entry if it is externally visible.
10280 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10281 constructor. Add global_offset_table_ field.
10282 (Target_i386::got_section): Set global_offset_table_.
10283 (Target_i386::do_finalize_sections): Set global_offset_table_
10285 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10286 in constructor. Add global_offset_table_ field.
10287 (Target_x86_64::got_section): Set global_offset_table_.
10288 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10291 * layout.cc (Layout::Layout): Initialize increase_relro_.
10292 (Layout::get_output_section): Add is_relro, is_last_relro, and
10293 is_first_non_relro parameters. Change all callers.
10294 (Layout::choose_output_section): Likewise.
10295 (Layout::add_output_section_data): Likewise.
10296 (Layout::make_output_section): Likewise.
10297 (Layout::set_segment_offsets): Clear increase_relro when using a
10299 * layout.h (class Layout): Add increase_relro method. Add
10300 increase_relro_ field. Update declarations.
10301 * output.cc (Output_section::Output_section): Initialize
10302 is_last_relro_ and is_first_non_relro_.
10303 (Output_segment::add_output_section): Group relro sections is
10304 do_sort is true. Handle is_last_relro and is_first_non_relro.
10305 (Output_segment::maximum_alignment): Remove relro handling.
10306 (Output_segment::set_section_addresses): Add increase_relro
10307 parameter. Change all callers. Add initial alignment to align
10308 relro sections on separate page. Remove old relro handling.
10309 (Output_segment::set_section_list_addresses): Remove in_relro
10310 parameter. Change all callers.
10311 (Output_segment::set_offset): Add increase parameter. Change all
10312 callers. Remove old relro handling.
10313 * output.h (class Output_section): Add new methods: is_last_relro,
10314 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10315 Add is_last_relro_ and is_first_non_relro_ fields.
10316 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10317 Create separate .got.plt section. Call increase_relro.
10318 * x86_64.cc (Target_x86_64::got_section): Likewise.
10319 * testsuite/relro_script_test.t: Add .got.plt.
10322 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10323 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10324 (Layout::finalize): Call set_dynamic_symbol_size.
10325 (Layout::set_dynamic_symbol_size): New function.
10326 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10327 set_dynamic_symbol_size.
10330 * output.h (class Output_section): Add is_entsize_zero_ field.
10331 * output.cc (Output_section::Output_section): Initialize
10333 (Output_section::set_entsize): If two different entsizes are
10334 requested, force it to zero.
10335 (Output_section::add_input_section): Set flags for .debug_str
10336 before updating section flags. Set entsize.
10337 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10338 and SHF_STRING if all input sections have those flags.
10340 2009-12-29 Rafael Espindola <espindola@google.com>
10342 * main.cc (main): Fix the sys time reporting.
10343 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10346 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10348 * options.cc (General_options::parse_version): Allow -v to exit
10349 without an error if there is nothing to link.
10351 2009-12-29 Ian Lance Taylor <iant@google.com>
10353 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10354 using a version of gcc before 4.1.
10355 * configure: Rebuild.
10357 2009-12-28 Chris Demetriou <cgd@google.com>
10359 * attributes.cc (Output_attributes_section_data::do_write): Use
10360 std::vector::front rather than std::vector::data.
10362 2009-12-28 Ian Lance Taylor <iant@google.com>
10364 * symtab.h (class Symbol_table): Add enum Defined.
10365 * resolve.cc (Symbol_table::should_override): Add defined
10366 parameter. Change all callers. Test whether object is NULL
10367 before calling a method on it.
10368 (Symbol_table::report_resolve_problem): Add defined parameter.
10369 Change all callers.
10370 (Symbol_table::should_override_with_special): Likewise.
10371 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10372 parameter. Change all callers.
10373 (Symbol_table::do_define_in_output_data): Likewise.
10374 (Symbol_table::define_in_output_segment): Likewise.
10375 (Symbol_table::do_define_in_output_segment): Likewise.
10376 (Symbol_table::define_as_constant): Likewise.
10377 (Symbol_table::do_define_as_constant): Likewise.
10378 * script.h (class Symbol_assignment): Add is_defsym parameter to
10379 constructor; change all callers.
10380 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10381 parameter. Change all callers. Add is_defsym_ field.
10382 (class Parser_closure): Add parsing_defsym parameter to
10383 constructor; change all callers. Add parsing_defsym accessor
10384 function. Add parsing_defsym_ field.
10386 2009-12-28 Ian Lance Taylor <iant@google.com>
10388 * gold.cc (queue_middle_tasks): Fix formatting.
10389 * object.cc (Relobj::is_section_name_included): Likewise.
10391 2009-12-23 Ian Lance Taylor <iant@google.com>
10393 * i386.cc (Target_i386::do_calls_non_split): Recognize
10394 -fsplit-stack prologue for a function with a static chain.
10395 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10396 -fsplit-stack prologue when using %r11.
10398 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10400 * options.cc (General_options::parse_version): Make -v continue and do
10401 the link like GNU ld does.
10403 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10405 * Makefile.am (CCFILES): Add timer.cc.
10406 (HFILES): Add timer.h.
10407 * configure.ac: Check for sysconf and times.
10408 * main.cc: include timer.h.
10409 (main): Use Timer instead of get_run_time.
10412 * workqueue.cc: include timer.h.
10413 (Workqueue::find_and_run_task):
10414 Report user, sys and wall time.
10415 * Makefile.in: Regenerate.
10416 * config.in: Regenerate.
10417 * configure: Regenerate.
10419 2009-12-16 Doug Kwan <dougkwan@google.com>
10421 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10423 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10424 relaxed input sections.
10425 * output.cc (Output_section::find_relaxed_input_section): Change
10426 return type to Output_relaxed_input_section pointer. Adjust code
10427 for new type of relaxed_input_section_map_.
10428 * output.h (Output_section::find_relaxed_input_section): Change
10429 return type to Output_relaxed_input_section pointer.
10430 (Output_section::Output_relaxed_input_section_by_input_section_map):
10432 (Output_section::relaxed_input_section_map_): Change type to
10433 Output_section::Output_relaxed_input_section_by_input_section_map.
10434 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10437 2009-12-15 Ian Lance Taylor <iant@google.com>
10439 * layout.cc (Layout::create_shstrtab): Only write out after input
10440 sections if we are compressing debug sections.
10442 2009-12-15 Ian Lance Taylor <iant@google.com>
10444 * archive.cc (Archive::add_symbols): Only look up a symbol without
10445 a version if there is, in fact, a version.
10447 2009-12-14 Ian Lance Taylor <iant@google.com>
10449 Revert -Wshadow changes, all changes from:
10450 2009-12-11 Doug Kwan <dougkwan@google.com>
10451 2009-12-11 Nick Clifton <nickc@redhat.com>
10452 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10454 2009-12-11 Doug Kwan <dougkwan@google.com>
10456 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10458 * attributes.cc (Object_attribute::size): Ditto.
10459 (Attributes_section_data::size): Ditto.
10460 (Attributes_section_data::Attributes_section_data): Ditto.
10461 (Output_attributes_section_data::do_write): Ditto.
10462 * attributes.h (Object_attribute::set_type): Ditto.
10463 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10465 2009-12-11 Nick Clifton <nickc@redhat.com>
10467 * archive.cc: Fix shadowed variable warnings.
10468 * arm.cc: Likewise.
10469 * compressed_output.cc: Likewise.
10470 * compressed_output.h: Likewise.
10471 * configure: Likewise.
10472 * dwarf_reader.cc: Likewise.
10473 * dynobj.cc: Likewise.
10474 * dynobj.h: Likewise.
10475 * ehframe.cc: Likewise.
10476 * ehframe.h: Likewise.
10477 * errors.cc: Likewise.
10478 * expression.cc: Likewise.
10479 * fileread.cc: Likewise.
10480 * fileread.h: Likewise.
10481 * freebsd.h: Likewise.
10482 * i386.cc: Likewise.
10483 * icf.cc: Likewise.
10484 * incremental.h: Likewise.
10485 * layout.cc: Likewise.
10486 * layout.h: Likewise.
10487 * mapfile.cc: Likewise.
10488 * merge.cc: Likewise.
10489 * merge.h: Likewise.
10490 * object.cc: Likewise.
10491 * object.h: Likewise.
10492 * options.h: Likewise.
10493 * output.cc: Likewise.
10494 * output.h: Likewise.
10495 * parameters.cc: Likewise.
10496 * plugin.cc: Likewise.
10497 * powerpc.cc: Likewise.
10498 * reduced_debug_output.cc: Likewise.
10499 * reduced_debug_output.h: Likewise.
10500 * reloc.cc: Likewise.
10501 * reloc.h: Likewise.
10502 * resolve.cc: Likewise.
10503 * script-sections.cc: Likewise.
10504 * script.cc: Likewise.
10505 * script.h: Likewise.
10506 * sparc.cc: Likewise.
10507 * symtab.cc: Likewise.
10508 * symtab.h: Likewise.
10509 * target-select.cc: Likewise.
10510 * target-select.h: Likewise.
10511 * token.h: Likewise.
10512 * workqueue.cc: Likewise.
10513 * workqueue.h: Likewise.
10514 * x86_64.cc: Likewise.
10516 2009-12-10 Doug Kwan <dougkwan@google.com>
10518 * arm.cc (attributes.h): New include.
10519 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10520 (Arm_relobj::~Arm_relobj): Delete object pointed by
10521 attributes_section_data_.
10522 (Arm_relobj::attributes_section_data): New method definition.
10523 (Arm_relobj::attributes_section_data_): New data member declaration.
10524 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10525 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10526 attributes_section_data_.
10527 (Arm_dynobj::attributes_section_data): New method definition.
10528 (Arm_dynobj::attributes_section_data_): New data member declaration.
10529 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10530 initialization value of may_use_blx_ to false.
10531 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10532 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10533 object attributes to compute results instead of hard-coding.
10534 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10535 Target_arm::get_secondary_compatible_arch,
10536 Target_arm::set_secondary_compatible_arch
10537 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10538 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10539 New method declarations.
10540 (Target_arm::get_aeabi_object_attribute): New method definition.
10541 (Target_arm::attributes_section_data_): New data member declaration.
10542 (read_arm_attributes_section): New template definition.
10543 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10544 (Arm_dynobj::do_read_symbols): Ditto.
10545 (Target_arm::do_finalize_sections): Merge attributes sections from
10546 input. Check for BLX use after attributes section merging.
10547 Fix __exidx_start and __exidx_end visibility. Create an
10548 .ARM.attributes section if necessary.
10549 (Target_arm::get_secondary_compatible_arch,
10550 Target_arm::set_secondary_compatible_arch,
10551 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10552 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10553 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10554 New method definitions.
10556 2009-12-09 Ian Lance Taylor <iant@google.com>
10558 * plugin.cc (Plugin::load): Don't cast from void* to a function
10561 2009-12-09 Ian Lance Taylor <iant@google.com>
10563 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10564 information fields.
10566 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10568 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10569 Replace two_file_shared_1.so with two_file_shared_2.so.
10570 * testsuite/Makefile.in: Regenerated.
10572 2009-12-08 Doug Kwan <dougkwan@google.com>
10574 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10575 (HFILES): Add attributes.h and int_encoding.h.
10576 * Makefile.in: Regenerate.
10577 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10578 function definitions to int_encoding.cc
10579 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10580 prototypes to int_encoding.h
10581 * reduced_debug_output.cc (int_encoding.h): New include.
10582 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10583 function definitions to int_encoding.cc
10584 (insert_into_vector, read_from_pointer): Move template definitions to
10586 * attributes.cc: New file.
10587 * attributes.h: New file.
10588 * int_encoding.cc: New file.
10589 * int_encoding.h: New file.
10591 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10594 * incremental-dump.cc (dump_incremental_inputs): New.
10595 (main): Use dump_incremental_inputs.
10597 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10600 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10601 checking elfcpp::STT_FUNC.
10602 (Target_i386::Relocate::relocate): Likewise.
10603 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10605 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10606 symbols from shared libraries into normal FUNC symbols.
10608 * symtab.h (Symbol): Add is_func and use it.
10610 2009-12-05 Doug Kwan <dougkwan@google.com>
10612 * arm.cc (Target_arm::arm_info): Initialize new fields
10613 attributes_section and attributes_vendor.
10614 * i386.cc (Target_i386::i386_info): Same.
10615 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10616 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10617 fields attributes_section and attributes_vendor.
10618 * sparc.cc (Target_sparc::sparc_info): Same.
10619 * target.h (Target::attributes_section, Target::attributes_vendor,
10620 Target::is_attributes_section, Target::attribute_arg_type,
10621 Target::attributes_order): New method definitions.
10622 (Target::Target_info::attributes_section,
10623 Target::Target_info::attributes_vendor): New fields.
10624 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10625 virtual method definitions.
10626 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10627 attributes_section and attributes_vendor.
10628 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10630 2009-12-05 Doug Kwan <dougkwan@google.com>
10632 * arm.cc: Update comments about interworking and stub generation.
10633 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10634 considered as non-PIC.
10635 (Arm_relocate_functions::base_abs): Fix formatting.
10636 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10637 of function to use GOT entry address instead of offset.
10638 (Target_arm::Scan::global): Issue an error if a symbol would need a
10639 PLT does not get one because it is untyped. Remove code to create
10640 dynamic symbols for relative branches.
10641 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10642 takes unsigned integer instead of boolean.
10644 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10646 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10647 (two_file_test_LDADD): Likewise.
10648 (common_test_1_LDADD): Likewise.
10649 (exception_test_LDADD) Likewise.
10650 (weak_test_LDADD): Likewise.
10651 (many_sections_test_LDADD): Likewise.
10652 (initpri1_LDADD): Likewise.
10653 (script_test_1_LDADD): Likewise.
10654 (script_test_2_LDADD): Likewise.
10655 (justsyms_LDADD): Likewise.
10656 (binary_test_LDADD): Likewise.
10657 (large_LDADD): Likewise.
10658 * testsuite/Makefile.in: Regenerated.
10660 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10662 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10663 (Symbol_table::override_with_special): Likewise.
10664 (Symbol_table::add_from_object): Likewise.
10666 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10668 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10669 Don't set the data_offset twice.
10671 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10673 * testsuite/Makefile.in: Regenerate.
10675 2009-12-03 Doug Kwan <dougkwan@google.com>
10677 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10678 (Target_arm::do_finalize_sections): Add parameter for symbol table
10679 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10680 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10681 parameter for symbol table pointer.
10682 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10683 an additional parameter for a pointer to symbol table.
10684 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10685 parameter for a symbol table pointer.
10686 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10687 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10689 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10690 parameter for a symbol table pointer.
10692 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10694 * incremental.cc (Incremental_inputs_header)
10695 (Incremental_inputs_header_write, Incremental_inputs_entry)
10696 (Incremental_inputs_entry_write): Move ...
10697 * incremental.h (Incremental_inputs_header)
10698 (Incremental_inputs_header_write, Incremental_inputs_entry)
10699 (Incremental_inputs_entry_write): here.
10701 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10703 * incremental.cc (make_sized_incremental_binary): Set the target.
10704 Error if it is incompatible.
10705 * output.h (Output_file): Add filename method.
10707 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10709 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10710 from the get_* methods.
10712 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10714 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10715 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10716 Write 0 for the data_offset of scripts.
10718 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10720 * testsuite/Makefile.am: Add the incremental_test.sh test.
10721 * testsuite/incremental_test.sh: New.
10722 * testsuite/incremental_test_1.c: New.
10723 * testsuite/incremental_test_2.c: New.
10725 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10727 * incremental-dump.cc (main): Fix typos.
10729 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10732 * incremental-dump.cc (main): Use llu to print 64 bit values.
10734 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10735 H.J. Lu <hongjiu.lu@intel.com>
10737 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10739 (incremental_dump_LDADD): Likewise.
10740 * Makefile.in: Regenerated.
10742 2009-11-25 Doug Kwan <dougkwan@google.com>
10746 2009-11-25 Doug Kwan <dougkwan@google.com>
10748 * arm.cc (Target_arm::Target_arm): Move method definition
10749 outside of class definition. Add code to handle
10750 --target1-rel, --target1-abs and --target2= options.
10751 (Target_arm::get_reloc_reloc_type): Change method to be
10752 non-static and const.
10753 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10754 New data member declaration.
10755 (Target_arm::Scan::local, Target_arm::Scan::global,
10756 Target_arm::Relocate::relocate,
10757 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10758 Adjust call to Target_arm::get_real_reloc_type.
10759 (Target_arm::get_real_reloc_type): Use command line options
10760 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10761 * options.h (--target1-rel, --target1-abs, --target2): New
10764 2009-11-25 Doug Kwan <dougkwan@google.com>
10766 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10767 class definition. Add code to handle --target1-rel, --target1-abs
10768 and --target2= options.
10769 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10771 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10772 member declaration.
10773 (Target_arm::Scan::local, Target_arm::Scan::global,
10774 Target_arm::Relocate::relocate,
10775 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10776 call to Target_arm::get_real_reloc_type.
10777 (Target_arm::get_real_reloc_type): Use command line options to
10778 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10779 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10782 2009-11-25 Doug Kwan <dougkwan@google.com>
10784 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10785 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10786 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10788 (Arm_relocate_functions::thm_call): Replace body with a call to
10789 Arm_relocate_functions::thumb_branch_common.
10790 (Arm_relocate_functions::thm_jump24,
10791 Arm_relocate_functions::thm_xpc22): New method definitions.
10792 (Arm_relocate_functions::thumb_branch_common): New method definition.
10793 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10795 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10796 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10798 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10800 * Makefile.am: Build incremental-dump
10801 * Makefile.in: Regenerate.
10802 * incremental-dump.cc: New.
10803 * incremental.cc (Incremental_inputs_header_data,
10804 Incremental_inputs_entry_data): Move to incremental.h
10805 * incremental.h: (Incremental_inputs_header_data,
10806 Incremental_inputs_entry_data): Move from incremental.cc
10808 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10810 * incremental.cc (Incremental_inputs_header,
10811 Incremental_inputs_header_write, Incremental_inputs_entry,
10812 Incremental_inputs_entry_write): Add a typedef with the data type.
10814 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10816 * incremental.cc (Incremental_inputs_header,
10817 Incremental_inputs_header_write, Incremental_inputs_entry,
10818 Incremental_inputs_entry_write): Update comment about which
10819 type has the filed descriptions.
10821 2009-11-15 Doug Kwan <dougkwan@google.com>
10823 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10824 (Arm_relocate_functions::arm_branch_common): Change method defintion
10825 in class definition to a method declaration and update list of formal
10827 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10828 Arm_relocation_functions::jump24): Adjust call to
10829 Arm_relocate_functions::arm_branch_common. Update list of formal
10831 (Arm_relocate_functions::xpc25): New method definition.
10832 (Arm_relocate_functions::arm_branch_common): Move method defintion
10833 out from class definition. Use stubs for mode-switching and extending
10835 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10836 specially. Change code to enable use of stubs in ARM branches.
10838 2009-11-10 Doug Kwan <dougkwan@google.com>
10840 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10841 in method declaration.
10842 (Target_arm::relocate_stub): New method declaration.
10843 (Target_arm::default_target): Change to return a pointer instead of
10845 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10846 Target_arm::default_target.
10847 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10849 (Target_arm::relocate_section): Adjust view.
10850 (Target_arm::relocate_stub): New method definition.
10852 2009-11-10 Doug Kwan <dougkwan@google.com>
10854 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10856 * incremental.cc (open_incremental_binary): Initialized local
10857 variables to avoid warnings.
10858 * object.cc (make_elf_object): Ditto.
10859 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10862 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10865 * testsuite/plugin_test.c: Include "config.h".
10867 2009-11-09 Doug Kwan <dougkwan@google.com>
10869 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10870 (arm_symbol_value): Remove.
10871 (Arm_relocate_functions::arm_branch_common,
10872 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10873 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10874 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10875 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10876 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10877 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10878 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10879 Arm_relocate_functions::thm_mobw_abs_nc,
10880 Arm_relocate_functions::thm_mov_abs,
10881 Arm_relocate_functions::movw_prel_nc,
10882 Arm_relocate_functions::thm_movt_abs,
10883 Arm_relocate_functions::movt_prel,
10884 Arm_relocate_functions::thm_movw_prel_nc,
10885 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10886 (Target_arm::Relocate::relocate): Only decompose address into two
10887 parts if relocation type uses the thumb-bit and pass the actual
10888 bit instead of a flag indicating that the thumb-bit is used. Adjust
10889 calls to methods in Arm_relocate_functions for this change.
10891 2009-11-08 Ian Lance Taylor <iant@google.com>
10894 * reloc.cc: Instantiate
10895 Sized_relobj::initialize_input_to_output_maps and
10896 Sized_relobj:free_input_to_output_maps.
10898 2009-11-06 Ian Lance Taylor <iant@google.com>
10901 * defstd.cc (in_segment): Set only_if_ref true for "end".
10903 2009-11-06 Doug Kwan <dougkwan@google.com>
10905 * arm.cc (class Reloc_stub): Correct a comment.
10906 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10907 (Target_arm::scan_section_for_stubs): New method declaration.
10908 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10909 Change methods from private to protected.
10910 (Target_arm::do_may_relax): New method definition.
10911 (Target_arm::do_relax, Target_arm::group_sections,
10912 Target_arm::scan_reloc_for_stub,
10913 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10914 (Target_arm::arm_input_section_map_): New data member declaration.
10915 (Target_arm::scan_reloc_for_stub,
10916 Target_arm::scan_reloc_section_for_stubs,
10917 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10918 Target_arm::do_relax): New method definitions.
10920 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10922 * configure.ac: Check for (struct stat)::st_mtim
10923 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10924 * config.in: Regenerate.
10925 * configure: Regenerate.
10927 2009-11-05 Ian Lance Taylor <iant@google.com>
10930 * output.cc (Output_segment::add_output_section): Add missing
10933 2009-11-04 Ian Lance Taylor <iant@google.com>
10936 * object.h (class Object): Add is_needed and set_is_needed
10937 methods. Add is_needed_ field. Make bool fields into bitfields.
10938 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10939 defined in a dynamic object and referenced by a regular object,
10940 set is_needed for the dynamic object.
10941 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10942 if the file is marked with as_needed and it is not needed.
10944 2009-11-04 Ian Lance Taylor <iant@google.com>
10947 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10948 tags if data is discarded by linker script.
10949 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10950 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10951 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10952 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10954 2009-11-04 Ian Lance Taylor <iant@google.com>
10956 * layout.cc (Layout::get_output_section): Add is_interp and
10957 is_dynamic_linker_section parameters. Change all callers.
10958 (Layout::choose_output_section): Likewise.
10959 (Layout::make_output_section): Likewise.
10960 (Layout::add_output_section_data): Add is_dynamic_linker_section
10961 parameter. Change all callers.
10962 * layout.h (class Layout): Update declarations.
10963 * output.h (class Output_section): Add is_interp, set_is_interp,
10964 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10965 Add is_interp_, is_dynamic_linker_section_ fields. Change
10966 generate_code_fills_at_write_ to a bitfield.
10967 * output.cc (Output_section::Output_sections): Initialize new
10969 (Output_segment::add_output_section): Add do_sort parameter.
10970 Change all callers.
10972 2009-11-03 Ian Lance Taylor <iant@google.com>
10975 * options.h (class General_options): Add --warn-common.
10976 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10977 merging two common symbols.
10978 (Symbol_table::should_override): Handle --warn-common when merging
10979 a common symbol with a defined symbol. Use report_resolve_problem
10980 for multiple definitions.
10981 (Symbol_table::report_resolve_problem): New function.
10982 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10984 2009-11-03 Doug Kwan <dougkwan@google.com>
10986 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10988 (Target_arm::stub_factory): New method definition.
10989 (Target_arm::new_arm_input_section,
10990 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10991 Target_arm::reloc_uses_thumb_bit): New method declarations.
10992 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10993 New type definitions.
10994 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10995 member declarations.
10996 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10997 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10998 New method definitions.
11000 2009-11-03 Ian Lance Taylor <iant@google.com>
11002 * options.h (class General_options): Add --warn_constructors.
11004 2009-11-03 Ian Lance Taylor <iant@google.com>
11007 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11008 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11010 2009-11-03 Ian Lance Taylor <iant@google.com>
11013 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11014 --msgid-bugs-address.
11015 (install-pdf): New target.
11016 (install-data_yes): Look up one directory to find mkinstalldirs.
11018 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11020 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11023 2009-10-30 Doug Kwan <dougkwan@google.com>
11025 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11027 2009-10-30 Doug Kwan <dougkwan@google.com>
11029 * arm.cc (Stub_addend_reader): New struct template definition
11030 and partial specializations.
11031 (Stub_addend_reader::operator()): New method definition for a
11032 partially specialized template.
11034 2009-10-30 Doug Kwan <dougkwan@google.com>
11036 * arm.cc (Arm_relobj::processor_specific_flags): New method
11038 (Arm_relobj::do_read_symbols): New method declaration.
11039 (Arm_relobj::processor_specific_flags_): New data member declaration.
11040 (Arm_dynobj): New class definition.
11041 (Target_arm::do_finalize_sections): Add input_objects parameter.
11042 (Target_arm::do_adjust_elf_header): New method declaration.
11043 (Target_arm::are_eabi_versions_compatible,
11044 (Target_arm::merge_processor_specific_flags): New method declaration.
11045 (Target_arm::do_make_elf_object): New overloaded method definitions
11047 (Arm_relobj::do_read_symbols): New method definition.
11048 (Arm_dynobj::do_read_symbols): Ditto.
11049 (Target_arm::do_finalize_sections): Add input_objects parameters.
11050 Merge processor-specific flags from all input objects.
11051 (Target_arm::are_eabi_versions_compatible,
11052 Target_arm::merge_processor_specific_flags,
11053 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11054 New method definitions.
11055 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11056 Input_objects pointer type parameter.
11057 * layout.cc (Layout::finalize): Pass input objects to target's.
11058 finalize_sections function.
11059 * output.cc (Output_file_header::do_sized_write): Set ELF file
11060 header's processor-specific flags.
11061 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11062 Input_objects pointer type parameter.
11063 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11064 * target.h (Input_objects): New forward class declaration.
11065 (Target::processor_specific_flags,
11066 Target::are_processor_specific_flags_sect): New method definitions.
11067 (Target::finalize_sections): Add input_objects parameter.
11068 (Target::Target): Initialize processor_specific_flags_ and
11069 are_processor_specific_flags_set_.
11070 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11072 (Target::set_processor_specific_flags): New method definition.
11073 (Target::processor_specific_flags_,
11074 Target::are_processor_specific_flags_set_): New data member
11076 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11077 Input_objects pointer type parameter.
11079 2009-10-30 Doug Kwan <dougkwan@google.com>
11081 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11083 2009-10-28 Ian Lance Taylor <iant@google.com>
11085 * object.h (class Relobj): Drop options parameter from
11086 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11087 do_scan_relocs, do_relocate. Change all callers.
11088 (class Sized_relobj): Drop options parameters from
11089 do_gc_process_relocs, do_scan_relocs, do_relocate,
11090 do_relocate_sections, relocate_sections, emit_relocs_scan,
11091 emit_relocs_scan_reltype. Change all callers.
11092 (struct Relocate_info): Remove options field and all references to
11094 * reloc.h (class Read_relocs): Remove options constructor
11095 parameter and options_ field. Change all callers.
11096 (class Gc_process_relocs, class Scan_relocs): Likewise.
11097 (class Relocate_task): Likewise.
11098 * target-reloc.h (scan_relocs): Remove options parameter. Change
11100 (scan_relocatable_relocs): Likewise.
11101 * target.h (class Sized_target): Remove options parameter from
11102 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11104 * gc.h (gc_process_relocs): Remove options parameter. Change all
11106 * arm.cc: Update functions to remove options parameters.
11107 * i386.cc: Likewise.
11108 * powerpc.cc: Likewise.
11109 * sparc.cc: Likewise.
11110 * x86_64.cc: Likewise.
11111 * testsuite/testfile.cc: Likewise.
11113 2009-10-28 Doug Kwan <dougkwan@google.com>
11115 * arm.cc (Arm_relobj): New class definition.
11116 (Arm_relobj::scan_sections_for_stubs,
11117 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11118 New method definitions.
11120 2009-10-28 Cary Coutant <ccoutant@google.com>
11122 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11123 (Plugin::cleanup_done_): New member.
11124 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11125 (Plugin_manager::cleanup_done_): Remove.
11126 (Plugin_manager::add_input_file): Edit error message.
11127 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11128 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11130 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11132 * fileread.cc: (File_read::View::~View): Use the new
11133 data_ownership_ filed.
11134 (File_read::~File_read): Dispose the new whole_file_view_.
11135 (File_read::open): Mmap the whole file if needed.
11136 (File_read::open): Use whole_file_view_ instead of contents_.
11137 (File_read::find_view): Use whole_file_view_ if applicable.
11138 (File_read::do_read): Use whole_file_view_ instead of contents_.
11139 (File_read::make_view): Use whole_file_view_ instead of contents_,
11140 update File_read::View::View call.
11141 (File_read::find_or_make_view): Update File_read::View::View
11143 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11145 (File_read::View::Data_ownership): New enum.
11146 (File_read::View::View): Replace bool mapped_ with Data_ownership
11148 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11149 (File_read::View::data_ownership_): New field.
11150 (File_read::contents_): Remove (replaced by whole_file_view_).
11151 (File_read::whole_file_view_): New field.
11152 * options.h (class General_options): Add --keep-files-mapped.
11154 2009-10-27 Cary Coutant <ccoutant@google.com>
11156 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11157 * testsuite/Makefile.am (plugin_test_5): New test case.
11158 * testsuite/Makefile.in: Regenerate.
11160 2009-10-25 Doug Kwan <dougkwan@google.com>
11162 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11163 from private to protected to allow access by child class.
11164 (Sized_relobj::do_relocate_sections): New method declaration.
11165 (Sized_relobj::relocate_sections): Virtualize.
11166 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11167 Sized_relobj::relocate_sections. Instantiate template explicitly
11168 for different target sizes and endianity.
11170 2009-10-24 Doug Kwan <dougkwan@google.com>
11172 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11173 (Arm_input_section::as_arm_input_section): New method.
11174 (Arm_output_section): New class definition.
11175 (Arm_output_section::create_stub_group,
11176 Arm_output_section::group_sections): New method definitions.
11178 2009-10-22 Doug Kwan <dougkwan@google.com>
11180 * arm.cc (Arm_input_section): New class definition.
11181 (Arm_input_section::init, Arm_input_section:do_write,
11182 Arm_input_section::set_final_data_size,
11183 Arm_input_section::do_reset_address_and_file_offset): New method
11186 2009-10-21 Doug Kwan <dougkwan@google.com>
11188 * arm.cc (Stub_table, Arm_input_section): New forward class
11190 (Stub_table): New class defintion.
11191 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11192 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11193 New method definition.
11195 2009-10-21 Doug Kwan <dougkwan@google.com>
11197 * arm.cc: Update copyright comments.
11198 (Target_arm): New forward class template declaration.
11199 (Arm_address): New type.
11200 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11201 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11202 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11204 (Insn_template): Same.
11205 (DEF_STUBS): New macro.
11206 (Stub_type): New enum type.
11207 (Stub_template): New class definition.
11209 (Reloc_stub): Same.
11210 (Stub_factory): Same.
11211 (Target_arm::Target_arm): Initialize may_use_blx_ and
11212 should_force_pic_veneer_.
11213 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11214 Target_arm::should_force_pic_veneer,
11215 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11216 Target_arm::using_thumb_only, Target_arm:;default_target): New
11218 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11219 New data member declarations.
11220 (Insn_template::size, Insn_template::alignment): New method defintions.
11221 (Stub_template::Stub_template): New method definition.
11222 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11223 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11224 (Stub_factory::Stub_factory): New method definition.
11225 * gold.h (string_hash): New template.
11226 * output.h (Input_section_specifier::hash_value): Use
11228 (Input_section_specifier::string_hash): Remove.
11229 * stringpool.cc (Stringpool_template::string_hash): Use
11232 2009-10-20 Doug Kwan <dougkwan@google.com>
11234 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11235 symbols of relaxed input sections.
11236 * output.h (Output_section::find_relaxed_input_section): Make
11239 2009-10-16 Doug Kwan <dougkwan@google.com>
11241 * dynobj.cc (Versions::Versions): Initialize version_script_.
11242 Only insert base version symbol definition for a shared object
11243 if version script defines any version versions.
11244 (Versions::define_base_version): New method definition.
11245 (Versions::add_def): Check that base version is not needed.
11246 (Versions::add_need): Define base version lazily.
11247 * dynobj.h (Versions::define_base_version): New method declaration.
11248 (Versions::needs_base_version_): New data member declaration.
11249 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11250 (check_DATA): Add no_version_test.stdout.
11251 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11253 * testsuite/Makefile.in: Regenerate.
11254 * testsuite/no_version_test.c: New file.
11255 * testsuite/no_version_test.sh: Ditto.
11257 2009-10-16 Doug Kwan <dougkwan@google.com>
11259 * expression.cc (class Segment_start_expression): New class definition.
11260 (Segment_start_expression::value): New method definition.
11261 (script_exp_function_segment_start): Return a new
11262 Segment_start_expression.
11263 * gold/script-c.h (script_saw_segment_start_expression): New function
11265 * script-sections.cc (Script_sections::Script_sections): Initialize
11266 SAW_SEGMENT_START_EXPRESSION_ to false.
11267 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11268 and -Tbbs options to specify section addresses if given in
11269 command line and no SEGMENT_START expression is seen in a script.
11270 * script-sections.h (Script_sections::saw_segment_start_expression,
11271 Script_sections::set_saw_segment_start_expression): New method
11273 (Script_sections::saw_segment_start_expression_): New data member
11275 * script.cc (script_saw_segment_start_expression): New function.
11276 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11277 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11278 script_test_7.sh and script_test_8.sh.
11279 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11280 script_test_8.stdout.
11281 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11282 (script_test_6, script_test_6.stdout, script_test_7,
11283 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11284 * Makefile.in: Regenerate.
11285 * testsuite/script_test_6.sh: New file.
11286 * testsuite/script_test_6.t: Same.
11287 * testsuite/script_test_7.sh: Same.
11288 * testsuite/script_test_7.t: Same.
11289 * testsuite/script_test_8.sh: Same.
11291 2009-10-16 Doug Kwan <dougkwan@google.com>
11293 * output.cc (Output_segment::set_section_list_address): Cast
11294 expressions to unsigned long long type to avoid format warnings.
11296 2009-10-15 Ian Lance Taylor <iant@google.com>
11298 * script.cc (Script_options::add_symbol_assignment): Always add a
11299 dot assignment to script_sections_.
11300 * script-sections.cc (Script_sections::add_dot_assignment):
11301 Initialize if necessary.
11303 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11304 program headers with no load segment if there is a linker script.
11306 * layout.cc (Layout::set_segment_offsets): Align the file offset
11307 to the segment aligment for -N or -n with no load segment.
11308 * output.cc (Output_segment::add_output_section): Don't crash if
11309 the first section is a TLS section.
11310 (Output_segment::set_section_list_addresses): Print an error
11311 message if the address moves backward in a linker script.
11312 * script-sections.cc
11313 (Output_section_element_input::set_section_addresses): Don't
11314 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11315 (Orphan_output_section::set_section_addresses): Likewise.
11317 2009-10-15 Doug Kwan <dougkwan@google.com>
11319 * layout.cc (Layout::finish_dynamic_section): Generate tags
11320 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11321 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11322 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11324 2009-10-14 Ian Lance Taylor <iant@google.com>
11326 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11328 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11329 data_shdr fields of relinfo.
11330 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11331 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11332 R_386_TLS_LDO_32, adjust based on section flags.
11333 (Target_i386::Relocate::fix_up_ldo): Remove.
11335 2009-10-13 Ian Lance Taylor <iant@google.com>
11337 Add support for -pie.
11338 * options.h (class General_options): Add -pie and
11340 (General_options::output_is_position_independent): Test -pie.
11341 (General_options::output_is_executable): Return true if not shared
11342 and not relocatable.
11343 (General_options::output_is_pie): Remove.
11344 * options.cc (General_options::finalize): Reject incompatible uses
11346 * gold.cc (queue_middle_tasks): A -pie link is not static.
11347 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11348 * symtab.cc (Symbol::final_value_is_known): Return false if
11349 output_is_position_independent.
11350 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11351 output_is_position_independent.
11352 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11353 output_is_position_independent.
11354 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11355 output_is_position_independent.
11356 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11358 (basic_pie_test.o, basic_pie_test): New targets.
11359 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11360 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11361 (two_file_pie_test): New target.
11362 * testsuite/Makefile.in: Rebuild.
11363 * README: Remove note saying that -pie is not supported.
11365 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11367 * options.h (class General_options): Add -init and -fini.
11368 * layout.cc (Layout::finish_dynamic_section): Emit
11369 given init and fini functions.
11371 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11373 * gc.h (gc_process_relocs): Check if icf is enabled using new
11375 * gold.cc (queue_initial_tasks): Likewise.
11376 (queue_middle_tasks): Likewise.
11377 * object.cc (do_layout): Likewise.
11378 * symtab.cc (is_section_folded): Likewise.
11379 * main.cc (main): Likewise.
11380 * reloc.cc (Read_relocs::run): Likewise.
11381 (Sized_relobj::do_scan_relocs): Likewise.
11382 * icf.cc (is_function_ctor_or_dtor): New function.
11383 (Icf::find_identical_sections): Check if function is ctor or dtor when
11384 safe icf is chosen.
11385 * options.h (General_options::icf): Change option to be an enum.
11386 (Icf_status): New enum.
11387 (icf_enabled): New method.
11388 (icf_safe_folding): New method.
11389 (set_icf_status): New method.
11390 (icf_status_): New variable.
11391 * (options.cc) (General_options::finalize): Set icf_status_.
11392 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11393 icf_test and icf_keep_unique_test to use the --icf enum flag.
11394 * testsuite/icf_safe_test.sh: New file.
11395 * testsuite/icf_safe_test.cc: New file.
11397 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11399 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11400 includes to gc.h and icf.h.
11401 * arm.cc: Include gc.h.
11402 * gold.cc: Likewise.
11403 * i386.cc: Likewise.
11404 * powerpc.cc: Likewise.
11405 * sparc.cc: Likewise.
11406 * x86_64.cc: Likewise.
11407 * gc.h: Include icf.h.
11409 2009-10-11 Ian Lance Taylor <iant@google.com>
11411 * plugin.cc: Include "gold.h" before other header files.
11413 2009-10-10 Chris Demetriou <cgd@google.com>
11415 * options.h (Input_file_argument::Input_file_type): New enum.
11416 (Input_file_argument::is_lib_): Replace with...
11417 (Input_file_argument::type_): New member.
11418 (Input_file_argument::Input_file_argument): Take Input_file_type
11419 'type' rather than boolean 'is_lib' as second argument.
11420 (Input_file_argument::is_lib): Use type_.
11421 (Input_file_argument::is_searched_file): New function.
11422 (Input_file_argument::may_need_search): Handle is_searched_file.
11423 * options.cc (General_options::parse_library): Support -l:filename.
11424 (General_options::parse_just_symbols): Update for Input_file_argument
11426 (Command_line::process): Likewise.
11427 * archive.cc (Archive::get_file_and_offset): Likewise.
11428 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11429 * script.cc (read_script_file, script_add_file): Likewise.
11430 * fileread.cc (Input_file::Input_file): Likewise.
11431 (Input_file::will_search_for): Handle is_searched_file.
11432 (Input_file::open): Likewise.
11433 * readsyms.cc (Read_symbols::get_name): Likewise.
11434 * testsuite/Makefile.am (searched_file_test): New test.
11435 * testsuite/Makefile.in: Regenerate.
11436 * testsuite/searched_file_test.cc: New file.
11437 * testsuite/searched_file_test_lib.cc: New file.
11439 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11440 Ian Lance Taylor <iant@google.com>
11442 * descriptor.cc: Include <cstdio> and "binary-io.h".
11443 (Descriptors::open): Open the files in binary mode always.
11444 * script.cc (Lex::get_token): Treat \r as whitespace.
11446 2009-10-09 Ian Lance Taylor <iant@google.com>
11448 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11450 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11451 Ian Lance Taylor <iant@google.com>
11453 * configure.ac: Check for readv function also.
11454 * fileread.cc (readv): Define if not HAVE_READV.
11455 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11457 * config.in: Regenerate.
11458 * configure: Regenerate.
11460 2009-10-09 Doug Kwan <dougkwan@google.com>
11462 * layout.cc (Layout::make_output_section): Call target hook to make
11463 ordinary output section.
11464 (Layout::finalize): Adjust parameter list of call the
11465 Target::may_relax().
11466 * layout.h (class Layout::section_list): New method.
11467 * merge.h (Output_merge_base::entsize): Change visibility to public.
11468 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11470 (Output_merge_string::do_is_string): New method.
11471 * object.cc (Sized_relobj::do_setup): renamed from
11472 Sized_relobj::set_up.
11473 * object.h (Sized_relobj::adjust_shndx,
11474 Sized_relobj::initializ_input_to_output_maps,
11475 Sized_relobj::free_input_to_output_maps): Change visibilities to
11477 (Sized_relobj::setup): Virtualize.
11478 (Sized_relobj::do_setup): New method declaration.
11479 (Sized_relobj::invalidate_section_offset,
11480 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11481 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11482 * options.cc (parse_int): New function.
11483 * options.h (parse_int): New declaration.
11484 (DEFINE_int): New macro.
11485 (stub_group_size): New option.
11486 * output.cc (Output_section::Output_section): Initialize memebers
11487 merge_section_map_, merge_section_by_properties_map_,
11488 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11489 (Output_section::add_input_section): Handled deferred code-fill
11490 generation and remove an old comment.
11491 (Output_section::add_relaxed_input_section): New method definition.
11492 (Output_section::add_merge_input_section): Use merge section by
11493 properties map to speed to search. Update merge section maps
11495 (Output_section::build_relaxation_map): New method definition.
11496 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11498 (Output_section::relax_input_section): Renamed to
11499 Output_section::convert_input_sections_to_relaxed_sections and change
11500 interface to take a vector of pointers to relaxed sections.
11501 (Output_section::find_merge_section,
11502 Output_section::find_relaxed_input_section): New method definitions.
11503 (Output_section::is_input_address_mapped,
11504 Output_section::output_offset, Output_section::output_address):
11505 Use output section data maps to speed up searching.
11506 (Output_section::find_starting_output_address): Add comments.
11507 (Output_section::do_write,
11508 Output_section::write_to_postprocessing_buffer): Do code-fill
11509 generation as appropriate.
11510 (Output_section::get_input_sections): Invalidate relaxed input section
11512 (Output_section::restore_states): Adjust type of checkpoint .
11513 Invalidate relaxed input section map.
11514 * output.h (Output_merge_base): New class declaration.
11515 (Input_section_specifier): New class defintion.
11516 (class Output_relaxed_input_section) Change base class to
11517 Output_section_data_build.
11518 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11519 base class initializer.
11520 (Output_section::add_relaxed_input_section): New method declaration.
11521 (Output_section::Input_section): Change visibility to protected.
11522 (Output_section::Input_section::relobj,
11523 Output_section::Input_section::shndx): Handle relaxed input sections.
11524 Output_section::input_sections) Change visibility to protected. Also
11525 define overload to return a non-const pointer.
11526 (Output_section::Merge_section_properties): New class defintion.
11527 (Output_section::Merge_section_by_properties_map,
11528 Output_section::Output_section_data_by_input_section_map,
11529 Output_section::Relaxation_map): New types.
11530 (Output_section::relax_input_section): Rename method to
11531 Output_section::convert_input_sections_to_relaxed_sections and change
11532 interface to take a vector of relaxed section pointers.
11533 (Output_section::find_merge_section,
11534 Output_section::find_relaxed_input_section,
11535 Output_section::build_relaxation_map,
11536 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11537 New method declarations.
11538 (Output_section::merge_section_map_
11539 Output_section::merge_section_by_properties_map_,
11540 Output_section::relaxed_input_section_map_,
11541 Output_section::is_relaxed_input_section_map_valid_,
11542 Output_section::generate_code_fills_at_write_): New data members.
11543 * script-sections.cc
11544 (Output_section_element_input::set_section_addresses): Call
11545 current_data_size and addralign methods of relaxed input sections.
11546 (Orphan_output_section::set_section_addresses): Call current_data_size
11547 and addralign methods of relaxed input sections.
11548 * symtab.cc (Symbol_table::compute_final_value): Extract template
11549 from the body of Symbol_table::sized_finalize_symbol.
11550 (Symbol_table::sized_finalized_symbol): Call
11551 Symbol_table::compute_final_value.
11552 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11553 (Symbol_table::compute_final_value): New templated method declaration.
11554 * target.cc (Target::do_make_output_section): New method defintion.
11555 * target.h (Target::make_output_section): New method declaration.
11556 (Target::relax): Add more parameters for input objects, symbol table
11557 and layout. Adjust call to do_relax.
11558 (Target::do_make_output_section): New method declaration.
11559 (Target::do_relax): Add parameters for input objects, symbol table
11562 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11564 * pread.c: Include stdio.h.
11566 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11568 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11571 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11573 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11574 Change read_shndx type to unsigned int.
11575 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11577 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11578 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11579 Change read_shndx type to unsigned int.
11580 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11582 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11583 * layout.cc (Layout::create_symtab_sections): Cast the result of
11584 local_symcount * symsize to off_t in the gold_assert.
11586 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11588 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11589 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11591 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11592 (Arm_relocate_functions::thm_abs5): New function.
11593 (Arm_relocate_functions::abs12): New function.
11594 (Arm_relocate_functions::abs16): New function.
11595 (Arm_relocate_functions::base_abs): New function.
11596 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11597 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11598 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11600 (Scan::global): Likewise.
11601 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11602 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11603 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11604 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11607 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11609 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11610 (Arm_relocate_functions::movt_prel): New function.
11611 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11612 (Arm_relocate_functions::thm_movt_prel): New function.
11613 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11614 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11615 (Scan::global, Relocate::relocate): Likewise.
11616 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11618 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11620 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11621 Incremental_checker.
11622 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11624 (class Incremental_inputs_header): New class.
11625 (Incremental_inputs_header_writer): Edit comment.
11626 (Incremental_inputs_entry): New class.
11627 (Incremental_inputs_entry_writer): Edit comment.
11628 (Sized_incremental_binary::do_find_incremental_inputs_section):
11629 Add *strtab_shndx parameter, fill it.
11630 (Sized_incremental_binary::do_check_inputs): New method.
11631 (Incremental_checker::can_incrementally_link_output_file): Use
11632 Sized_incremental_binary::check_inputs.
11633 (Incremental_inputs::report_command_line): Save command line in
11636 (Incremental_binary::find_incremental_inputs_section): New
11638 (Incremental_binary::do_find_incremental_inputs_section): Add
11639 strtab_shndx parameter.
11640 (Incremental_binary::do_check_inputs): New pure virtual method.
11641 (Sized_incremental_binary::do_check_inputs): Declare.
11642 (Incremental_checker::Incremental_checker): Add incremental_inputs
11643 parameter, use it to initialize incremental_inputs_.
11644 (Incremental_checker::incremental_inputs_): New field.
11645 (Incremental_checker::command_line): New method.
11646 (Incremental_checker::inputs): New method.
11647 (Incremental_checker::command_line_): New field.
11649 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11651 * incremental.cc: Include <cstdarg> and "target-select.h".
11652 (vexplain_no_incremental): New function.
11653 (explain_no_incremental): New function.
11654 (Incremental_binary::error): New method.
11655 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11657 (make_sized_incremental_binary): New function.
11658 (open_incremental_binary): New function.
11659 (can_incrementally_link_file): Add checks if output is ELF and has
11661 * incremental.h: Include "elfcpp_file.h" and "output.h".
11662 (Incremental_binary): New class.
11663 (Sized_incremental_binary): New class.
11664 (open_incremental_binary): Declare.
11665 * object.cc (is_elf_object): Use
11666 elfcpp::Elf_recognizer::is_elf_file.
11667 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11668 * output.h (Output_file::filesize): New method.
11670 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11672 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11674 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11675 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11677 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11679 (Arm_relocate_functions::movw_abs_nc): New function.
11680 (Arm_relocate_functions::movt_abs): New function.
11681 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11682 (Arm_relocate_functions::thm_movt_abs): New function.
11683 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11684 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11685 (Scan::global): Likewise.
11686 (Relocate::relocate): Likewise.
11687 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11689 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11691 * arm.cc (Arm_relocate_functions::got_prel) New function.
11692 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11693 (Relocate::relocate): Likewise.
11694 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11696 2009-10-06 Ian Lance Taylor <iant@google.com>
11698 * options.h (class General_options): Define
11699 split_stack_adjust_size parameter.
11700 * object.h (class Object): Add uses_split_stack_ and
11701 has_no_split_stack_ fields. Add uses_split_stack and
11702 has_no_split_stack accessor functions. Declare
11703 handle_split_stack_section.
11704 (class Reloc_symbol_changes): Define.
11705 (class Sized_relobj): Define Function_offsets. Declare
11706 split_stack_adjust, split_stack_adjust_reltype, and
11708 * object.cc (Object::handle_split_stack_section): New function.
11709 (Sized_relobj::do_layout): Call handle_split_stack_section.
11710 * dynobj.cc (Sized_dynobj::do_layout): Call
11711 handle_split_stack_section.
11712 * reloc.cc (Sized_relobj::relocate_sections): Call
11713 split_stack_adjust for executable sections in split_stack
11714 objects. Pass reloc_map to relocate_section.
11715 (Sized_relobj::split_stack_adjust): New function.
11716 (Sized_relobj::split_stack_adjust_reltype): New function.
11717 (Sized_relobj::find_functions): New function.
11718 * target-reloc.h: Include "object.h".
11719 (relocate_section): Add reloc_symbol_changes parameter. Change
11721 * target.h (class Target): Add calls_non_split method. Declare
11722 do_calls_non_split virtual method. Declare match_view and
11724 * target.cc: Include "elfcpp.h".
11725 (Target::do_calls_non_split): New function.
11726 (Target::match_view): New function.
11727 (Target::set_view_to_nop): New function.
11728 * gold.cc (queue_middle_tasks): Give an error if mixing
11729 split-stack and non-split-stack objects with -r.
11730 * i386.cc (Target_i386::relocate_section): Add
11731 reloc_symbol_changes parameter.
11732 (Target_i386::do_calls_non_split): New function.
11733 * x86_64.cc (Target_x86_64::relocate_section): Add
11734 reloc_symbol_changes parameter.
11735 (Target_x86_64::do_calls_non_split): New function.
11736 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11738 * powerpc.cc (Target_powerpc::relocate_section): Add
11739 reloc_symbol_changes parameter.
11740 * sparc.cc (Target_sparc::relocate_section): Add
11741 reloc_symbol_changes parameter.
11742 * configure.ac: Call AM_CONDITIONAL for the default target.
11743 * configure: Rebuild.
11744 * testsuite/Makefile.am (TEST_AS): New variable.
11745 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11746 (check_DATA): Add split_i386 and split_x86_64 files.
11747 (SPLIT_DEFSYMS): Define.
11748 (split_i386_[1234n].o): New targets.
11749 (split_i386_[124]): New targets.
11750 (split_i386_[1234r].stdout): New targets.
11751 (split_x86_64_[1234n].o): New targets.
11752 (split_x86_64_[124]): New targets.
11753 (split_x86_64_[1234r].stdout): New targets.
11754 (MOSTLYCLEANFILES): Add new executables.
11755 * testsuite/split_i386.sh: New file.
11756 * testsuite/split_x86_64.sh: New file.
11757 * testsuite/split_i386_1.s: New file.
11758 * testsuite/split_i386_2.s: New file.
11759 * testsuite/split_i386_3.s: New file.
11760 * testsuite/split_i386_4.s: New file.
11761 * testsuite/split_i386_n.s: New file.
11762 * testsuite/split_x86_64_1.s: New file.
11763 * testsuite/split_x86_64_2.s: New file.
11764 * testsuite/split_x86_64_3.s: New file.
11765 * testsuite/split_x86_64_4.s: New file.
11766 * testsuite/split_x86_64_n.s: New file.
11767 * testsuite/testfile.cc (Target_test): Update relocation_section
11769 * testsuite/Makefile.in: Rebuild.
11771 2009-10-06 Ian Lance Taylor <iant@google.com>
11773 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11774 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11775 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11776 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11777 the address on ldo_addrs_.
11778 (Target_i386::Relocate::fix_up_ldo): New function.
11780 2009-10-06 Rafael Espindola <espindola@google.com>
11782 * plugin.cc (add_input_library): New.
11783 (Plugin::load): Add add_input_library to tv.
11784 (Plugin_manager::add_input_file): Add the is_lib argument.
11785 (add_input_file): Update call to Plugin_manager::add_input_file.
11786 (add_input_library): New.
11787 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11789 2009-09-30 Doug Kwan <dougkwan@google.com>
11791 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11792 symbol and call Symbol::may_need_copy_reloc to determine if
11793 a copy reloc is needed.
11794 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11795 nocopyreloc is given in command line.
11796 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11797 given in command line.
11798 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11799 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11800 of the removed Target_i386::may_need_copy_reloc.
11801 * options.h (copyreloc): New option with default value false.
11802 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11803 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11804 instead of the removed Target_powerpc::may_need_copy_reloc.
11805 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11806 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11807 instead of the removed Target_sparc::may_need_copy_reloc.
11808 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11809 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11810 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11811 instead of the removed Target_x86_64::may_need_copy_reloc.
11813 2009-09-30 Ian Lance Taylor <iant@google.com>
11815 * object.h (class Object): Remove target_ field, and target,
11816 sized_target, and set_target methods.
11817 (Object::sized_target): Remove.
11818 (class Sized_relobj): Update declarations. Remove sized_target.
11819 * object.cc (Sized_relobj::setup): Remove target parameter.
11820 Change all callers.
11821 (Input_objects::add_object): Don't do anything with the target.
11822 (make_elf_sized_object): Add punconfigured parameter. Change all
11823 callers. Set or test parameter target.
11824 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11825 Change all callers.
11826 * parameters.cc (Parameters::set_target): Change parameter type to
11828 (Parameters::default_target): Remove.
11829 (set_parameters_target): Change parameter type to be non-const.
11830 (parameters_force_valid_target): New function.
11831 (parameters_clear_target): New function.
11832 * parameters.h (class Parameters): Update declarations. Remove
11833 default_target method. Add sized_target and clear_target
11834 methods. Change target_ to be non-const.
11835 (set_parameters_target): Update declaration.
11836 (parameters_force_valid_target): Declare.
11837 (parameters_clear_target): Declare.
11838 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11839 as NULL if we aren't searching.
11840 (Add_symbols::run): Don't check for compatible target.
11841 * fileread.cc (Input_file::open_binary): Call
11842 parameters_force_valid_target.
11843 * gold.cc (queue_middle_tasks): Likewise.
11844 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11845 set_target on object.
11846 * dynobj.h (class Sized_dynobj): Update declarations.
11847 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11848 make_elf_object returns NULL.
11849 (Archive::include_member): Don't check whether object target is
11851 * output.cc (Output_section::add_input_section): Get target from
11853 (Output_section::relax_input_section): Likewise.
11854 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11856 (Sized_relobj::do_scan_relocs): Likewise.
11857 (Sized_relobj::relocate_sections): Likewise.
11858 * resolve.cc (Symbol_table::resolve): Likewise.
11859 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11860 parameter. Change all callers.
11861 (Symbol_table::add_from_object): Get target from parameters.
11862 (Symbol_table::add_from_relobj): Don't check object target.
11863 (Symbol_table::add_from_dynobj): Likewise.
11864 (Symbol_table::define_special_symbol): Get target from
11866 * symtab.h (class Symbol_table): Update declaration.
11867 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11868 parameter. Change all callers. Clear parameter target.
11869 (Binary_test): Test target here.
11870 * testsuite/object_unittest.cc (gold_testsuite): Remove
11871 target_test_pointer parameter. Change all callers.
11872 (Object_test): Test target here.
11874 2009-09-26 Ian Lance Taylor <iant@google.com>
11876 * testsuite/initpri1.c: Don't try to use constructor priorities if
11877 compiling with gcc before 4.3.
11879 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11881 * testsuite/retain_symbols_file_test.sh (check_present): Change
11882 output file name to retain_symbols_file_test.stdout.
11883 (check_absent): Likewise.
11885 2009-09-18 Craig Silverstein <csilvers@google.com>
11887 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11888 * options.cc: Include <cerrno> and <fstream>.
11889 (General_options::finalize): Parse -retain-symbols-file tag.
11890 * options.h: New flag.
11891 (General_options): New method should_retain_symbol, new
11892 variable symbols_to_retain.
11893 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11894 should_retain_symbol map.
11895 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11896 * testsuite/Makefile.in: Regenerate.
11897 * testsuite/retain_symbols_file_test.sh: New file.
11899 2009-09-18 Nick Clifton <nickc@redhat.com>
11901 * po/es.po: Updated Spanish translation.
11903 2009-09-17 Doug Kwan <dougkwan@google.com>
11905 * debug.h (DEBUG_RELAXATION): New constant.
11906 (DEBUG_ALL): Add DEBUG_RELAXATION.
11907 (debug_string_to_enum): Add relaxation debug option.
11909 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11910 Layout::Relaxation_debug_check::read_sections,
11911 Layout::Relaxation_debug_check::read_sections): New method definitions.
11912 (Layout::Layout): Initialize data members
11913 record_output_section_data_from_scrips_,
11914 script_output_section_data_list_ and relaxation_debug_check_.
11915 (Layout::save_segments, Layout::restore_segments,
11916 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11917 Layout::relaxation_loop_body): New method definitions.
11918 (Layout::finalize): Support relaxation. Move section layout code to
11919 Layout::relaxation_loop_body.
11920 (Layout::set_asection_address_from_script): Move code for orphan
11921 section placement out.
11922 (Layout::place_orphan_sections_in_script): New method definition.
11923 * layout.h (Output_segment_headers, Output_file_header):
11924 New forward class declarations.
11925 (Layout::~Layout): Define.
11926 (Layout::new_output_section_data_from_script): New method definition.
11927 (Layout::place_orphan_sections_in_script): New method declaration.
11928 (Layout::Segment_states): New type declaration.
11929 (Layout::save_segments, Layout::restore_segments,
11930 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11931 Layout::relaxation_loop_body): New method declarations.
11932 (Layout::Output_section_data_list): New type declaration.
11933 (Layout::Relaxation_debug_check): New class definition.
11934 (Layout::record_output_section_data_from_script_,
11935 Layout::script_output_section_data_list_, Layout::segment_states_,
11936 Layout::relaxation_debug_check_): New data members.
11937 * output.cc: (Output_section_headers::do_size): New method definition.
11938 (Output_section_headers::Output_section_headers): Move size
11939 computation to Output_section_headers::do_size.
11940 (Output_segment_headers::do_size): New method definition.
11941 (Output_file_header::Output_file_header): Move size computation to
11942 Output_file_header::do_size and call it.
11943 (Output_file_header::do_size): New method definition.
11944 (Output_data_group::Output_data_group): Adjust call to
11945 Output_section_data.
11946 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11947 (Output_symtab_xindex::do_write): Add array bound check.
11948 (Output_section::Input_section::print_to_mapfile): Handle
11949 RELAXED_INPUT_SECTION_CODE.
11950 (Output_section::Output_section): Initialize data member checkpoint_.
11951 (Output_section::~Output_section): Delete checkpoint object pointed
11953 (Output_section::add_input_section): Always add an Input_section if
11955 (Output_section::add_merge_input_section): Add assert.
11956 (Output_section::relax_input_section): New method definition.
11957 (Output_section::set_final_data_size): Set load address to zero for
11958 an unallocated section.
11959 (Output_section::do_address_and_file_offset_have_reset_values):
11960 New method definition.
11961 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11962 Handle relaxed input section.
11963 (Output_section::sort_attached_input_sections): Checkpoint input
11964 section list lazily.
11965 (Output_section::get_input_sections): Change type of input_sections to
11966 list of Simple_input_section pointers. Checkpoint input section list
11967 lazily. Also handle relaxed input sections.
11968 (Output_section::add_input_section_for_script): Take a reference to
11969 a Simple_input_section object instead of Relobj pointer and section
11970 index as parameter. Handle relaxed input sections.
11971 (Output_section::save_states, Output_section::restore_states): New
11972 method definitions.
11973 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11974 (Output_data::is_data_size_fixed): New method definition.
11975 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11977 (Output_data::address_and_file_offset_have_reset_values): New method
11979 (Output_data::do_address_and_file_offset_have_reset_values): New method
11981 (Output_data::set_data_size): Check that data size is not fixed.
11982 (Output_data::fix_data_size): New method definition.
11983 (Output_data::is_data_size_fixed_): New data member.
11984 (Output_section_headers::set_final_data_size): New method definition.
11985 (Output_section_headers::do_size): New method declaration.
11986 (Output_segment_headers::set_final_data_size): New method definition.
11987 (Output_segment_headers::do_size): New method declaration.
11988 (Output_file_header::set_final_data_size)::New method definition.
11989 (Output_file_header::do_size)::New method declaration.
11990 (Output_section_data::Output_section_data): Add new parameter
11991 is_data_size_fixed and use it to fix data size.
11992 (Output_data_const::Output_data_const): Adjust call to base class
11993 constructor and fix data size.
11994 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11995 base class constructor and fix data size.
11996 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11997 base class constructor and fix data size.
11998 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11999 class constructor and fix data size.
12000 (Output_data_group::set_final_data_size): New method definition.
12001 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12002 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12003 class constructor and fix data size.
12004 (Output_relaxed_input_section): New class definition.
12005 (Output_section::Simple_input_section): New class definition.
12006 (Output_section::get_input_sections): Adjust parameter list.
12007 (Output_section::add_input_section_for_script): Same.
12008 (Output_section::save_states, Output_section::restore_states,
12009 Output_section::do_address_and_file_offset_have_reset_values,
12010 (Output_section::Input_section::Input_section): Handle
12011 RELAXED_INPUT_SECTION_CODE. Add new overload for
12012 Output_relaxed_input_section.
12013 (Output_section::Input_section::is_input_section,
12014 Output_section::Input_section::set_output_section): Handle relaxed
12016 (Output_section::Input_section::is_relaxed_input_section,
12017 Output_section::Input_section::output_section_data,
12018 Output_section::Input_section::relaxed_input_section): New method
12020 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12022 (Output_section::Input_section::u1_): Update comments.
12023 (Output_section::Input_section::u2_): Add new union member poris.
12024 (Output_section::Checkpoint_output_section): New classs definition.
12025 (Output_section::relax_input_section): New method declaration.
12026 (Output_section::checkpoint_): New data member.
12027 (Output_segment): Update comments.
12028 (Output_segment::Output_segment): Un-privatize copy constructor.
12029 (Output_segment::operator=): Un-privatize.
12030 * script-sections.cc (Output_section_element::Input_section_list):
12031 Change element type to Output_section::Simple_input_section.
12032 (Output_section_element_dot_assignment::set_section_addresses):
12033 Register output section data for relaxation clean up.
12034 (Output_data_exression::Output_data_expression): Adjust call to base
12035 constructor to fix data size.
12036 (Output_section_element_data::set_section_addresses): Register
12037 Output_data_expression object for relaxation clean up.
12038 (struct Input_section_info): Replace Relobj pointer and section index
12039 pair with Output_section::Simple_input_section and Convert struct to a
12041 (Input_section_sorter::operator()): Adjust access to
12042 Input_section_info data member to use accessors.
12043 (Output_section_element_input::set_section_addresses): Use layout
12044 parameter. Adjust code to use Output_section::Simple_input_section
12045 and Input_secction_info classes. Register filler for relaxation
12047 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12048 and section index pair with Output_section::Simple_input_section
12049 class. Adjust code accordingly.
12050 (Phdrs_element::release_segment): New method definition.
12051 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12053 (Script_sections::release_segments): New method definition.
12054 * gold/script-sections.h (Script_sections::release_segments): New
12055 method declaration.
12056 * gold/target.h (Target::may_relax, Target::relax,
12057 Target::do_may_relax, Target::do_relax): New method definitions.
12059 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12061 * arm.cc (has_signed_unsigned_overflow): New function.
12062 (Arm_relocate_functions::abs8): New function.
12063 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12064 (Target_arm::Scan::global): Likewise.
12065 (Target_arm::relocate::relocate): Likewise.
12066 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12069 2009-09-16 Cary Coutant <ccoutant@google.com>
12071 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12072 * testsuite/Makefile.in: Regenerate.
12074 2009-09-11 Nick Clifton <nickc@redhat.com>
12076 * po/gold.pot: Updated by the Translation project.
12078 2009-09-08 Cary Coutant <ccoutant@google.com>
12080 * output.cc (Output_file::open): Add execute permission to empty file.
12081 * testsuite/Makefile.am (permission_test): New test.
12082 * testsuite/Makefile.in: Regenerate.
12084 2009-09-02 Ian Lance Taylor <iant@google.com>
12086 * output.cc (Output_file::resize): Call map_no_anonymous rather
12089 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12091 * gold.cc: Include "incremental.h".
12092 (queue_initial_tasks): Call Incremental_checker methods.
12093 * incremental.cc: Include "output.h".
12094 (Incremental_checker::can_incrementally_link_output_file): New
12096 * incremental.h (Incremental_checker): New class.
12098 * output.cc (Output_file::open_for_modification): New method.
12099 (Output_file::map_anonymous): Changed return type to bool. Record
12100 map in base_ field.
12101 (Output_file::map_no_anonymous): New method, broken out of map.
12102 (Output_file::map): Use map_no_anonymous and map_anonymous.
12103 * output.h (class Output_file): Update declarations.
12105 2009-08-24 Cary Coutant <ccoutant@google.com>
12107 * options.h (Command_line::Pre_options): New class.
12108 (Command_line::pre_options): New member.
12109 * options.cc (gold::options::ready_to_register): New variable.
12110 (One_option::register_option): Do nothing if not registering options.
12111 Assert if same short option registered twice.
12112 (General_options::General_options): Turn off option registration when
12114 (Command_line::Pre_options::Pre_options): New constructor.
12116 2009-08-24 Cary Coutant <ccoutant@google.com>
12118 * options.h (General_options::no_keep_memory): Remove incorrect
12121 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12123 * Makefile.am (am__skiplex, am__skipyacc): New.
12124 * Makefile.in: Regenerate.
12126 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12128 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12129 (INCLUDES): ... this.
12130 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12131 (AM_CPPFLAGS): Renamed from ...
12132 (INCLUDE): ... this.
12133 * Makefile.in, testsuite/Makefile.in: Regenerate.
12135 * Makefile.in: Regenerate.
12136 * aclocal.m4: Likewise.
12137 * config.in: Likewise.
12138 * configure: Likewise.
12139 * testsuite/Makefile.in: Likewise.
12141 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12142 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12143 * Makefile.in: Regenerate.
12144 * testsuite/Makefile.in: Regenerate.
12146 2009-08-19 Cary Coutant <ccoutant@google.com>
12148 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12149 symbols in shared libraries overridden by hidden or internal symbols
12150 in the main program.
12152 2009-08-19 Chris Demetriou <cgd@google.com>
12154 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12155 checking source file names in error messages.
12157 2009-08-18 Doug Kwan <dougkwan@google.com>
12159 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12160 an elcpp::Ehdr as parameter. Adjust call to set_target.
12161 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12162 an elfcpp::Ehdr as parameter.
12163 * object.cc (Object::set_target): Remove the version that looks up
12164 a target and sets it.
12165 (Sized_relobj::setup): Take a Target object instead of
12166 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12167 (make_elf_sized_object): Find target and ask target to
12168 make an ELF object.
12169 * object.h: (Object::set_target): Remove the version that looks up
12170 a target and sets it.
12171 (Sized_relobj::setup): Take a Target object instead of
12172 an elfcpp:Ehdr as parameter.
12173 * target.cc: Include dynobj.h.
12174 (Target::do_make_elf_object_implementation): New.
12175 (Target::do_make_elf_object): New.
12176 * target.h (Target::make_elf_object): New template declaration.
12177 (Target::do_make_elf_object): New method declarations.
12178 (Target::do_make_elf_object_implementation): New template declaration.
12180 2009-08-14 Ian Lance Taylor <iant@google.com>
12182 * gold.h (FUNCTION_NAME): Define.
12183 (gold_unreachable): Use FUNCTION_NAME.
12185 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12187 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12188 symbol in the --keep-unique list is not found.
12190 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12192 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12193 been maked as --keep-unique.
12194 (Icf::unfold_section): New function.
12195 * icf.h (Icf::unfold_section): New function.
12196 * options.h (General_options::keep_unique): New option.
12197 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12198 * testsuite/Makefile.in: Regenerate.
12199 * testsuite/icf_keep_unique_test.sh: New file.
12200 * testsuite/icf_keep_unique_test.cc: New file.
12202 2009-08-12 Cary Coutant <ccoutant@google.com>
12205 * resolve.cc (Symbol_table::resolve): Check for references from
12206 dynamic objects to hidden and internal symbols.
12207 * testsuite/Makefile.am (hidden_test.sh): New test.
12208 * testsuite/Makefile.in: Regenerate.
12209 * testsuite/hidden_test.sh: New script.
12210 * testsuite/hidden_test_1.c: New test source.
12211 * testsuite/hidden_test_main.c: New test source.
12213 2009-08-11 Doug Kwan <dougkwan@google.com>
12215 * arm.cc: Update comments.
12216 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12217 segment to locate the .ARM.exidx section if present.
12219 2009-08-09 Doug Kwan <dougkwan@google.com>
12221 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12224 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12225 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12228 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12230 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12231 valid tls_segment only for non-debug-section relocations.
12232 * testsuite/Makefile.am: Add gc_tls_test.
12233 * testsuite/Makefile.in: Regenerate.
12234 * testsuite/gc_tls_test.cc: New file.
12235 * testsuite/gc_tls_test.sh: New file.
12237 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12239 * icf.cc: New file.
12241 * Makefile.am (CCFILES): Add icf.cc.
12242 (HFILES): Add icf.h
12243 * Makefile.in: Regenerate.
12244 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12245 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12246 section, symbol and addend information for the relocs.
12247 * gold.cc (queue_middle_tasks): Call identical code folding.
12248 * gold.h: Add defines for multimap.
12249 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12250 to the call of finalize_local_symbols.
12251 * main.cc (main): Create object of class Icf.
12252 * object.cc (Sized_relobj::do_layout): Allow this function to be
12253 called twice during icf.
12254 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12255 to sections marked as identical by icf.
12256 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12258 (Sized_relobj::do_section_entsize): New function.
12259 * object.h (Object::section_entsize): New function.
12260 (Object::do_section_entsize): New pure virtual function.
12261 (Relobj::finalize_local_symbols): Add new parameter.
12262 (Relobj::do_section_entsize): New function.
12263 * options.h (General_options::icf): New option.
12264 (General_options::icf_iterations): New option.
12265 (General_options::print_icf_sections): New option.
12266 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12267 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12268 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12270 * symtab.cc (Symbol_table::is_section_folded): New function.
12271 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12272 to sections marked as identical by icf.
12273 * symtab.h (Symbol_table::set_icf): New function.
12274 (Symbol_table::icf): New function.
12275 (Symbol_table::is_section_folded): New function.
12276 (Symbol_table::icf_): New data member.
12277 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12278 * testsuite/Makefile.am: Add commands to build icf_test.
12279 * testsuite/Makefile.in: Regenerate.
12280 * testsuite/icf_test.sh: New file.
12281 * testsuite/icf_test.cc: New file.
12283 2009-07-24 Chris Demetriou <cgd@google.com>
12285 * layout.cc (is_compressible_debug_section): Fix incorrect
12286 comment about compressed section names.
12288 2009-07-20 Ian Lance Taylor <ian@airs.com>
12291 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12293 2009-07-16 Ian Lance Taylor <iant@google.com>
12296 * layout.h: #include <map>.
12297 (class Kept_section): Change from struct to class. Add accessors
12298 and setters. Add section size to Comdat_group mapping. Change
12299 Comdat_group to std::map. Add is_comdat_ field. Add
12300 linkonce_size field in union.
12301 (class Layout): Update declaration of find_or_add_kept_section.
12302 Don't declare find_kept_object.
12303 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12304 parameter. Add object, shndx, is_comdat, and is_group_name
12305 parameters. Change all callers. Adjust for new Kept_section.
12306 (Layout::find_kept_object): Remove.
12307 * object.cc (Sized_relobj::include_section_group): Update use of
12308 Kept_section. Rename secnum to shndx. Only record
12309 Kept_comdat_section if sections are the same size.
12310 (Sized_relobj::include_linkonce_section): Update use of
12311 Kept_section. Only record Kept_comdat_section if sections are the
12312 same size. Set size of linkonce section.
12313 (Sized_relobj::map_to_kept_section): Update call to
12314 get_kept_comdat_section.
12315 * object.h (class Sized_relobj): Rename fields in
12316 Kept_comdat_section to drop trailing underscores; change object
12317 field to Relobj*. Change Kept_comdat_section_table to store
12318 struct rather than pointer.
12319 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12320 Add kept_object and kept_shndx parameters. Change all callers.
12321 (Sized_relobj::get_kept_comdat_section): Change return type to
12322 bool. Add kept_object and kept_shndx parameters. Change all
12324 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12325 Layout::find_or_add_kept_section.
12327 2009-07-09 Ian Lance Taylor <iant@google.com>
12329 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12330 Reserve space in the hash table.
12332 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12334 * fileread.cc (File_read::get_mtime): New method.
12335 * fileread.h (Timespec): New structure.
12336 (File_read::get_mtime): New method.
12337 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12338 Renamed from timestamp_nsec.
12339 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12341 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12343 (Incremental_inputs::report_archive): Save mtime; style fix.
12344 (Incremental_inputs::report_obejct): Save mtime; style fix.
12345 (Incremental_inputs::report_script): Save mtime; style fix.
12346 (Incremental_inputs::finalize_inputs): Style fix.
12347 (Incremental_inputs::finalize): Style fix.
12348 (Incremental_inputs::create_input_section_data): Store inputs
12350 * incremental.h (Incremental_inputs::report_script): Add mtime
12352 (Incremental_inputs::Input_info::Input_info): Intialize only one
12354 (Incremental_inputs::Input_info::archive): Move to nameless
12356 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12357 (Incremental_inputs::Input_info::script): Move to nameless union.
12358 (Incremental_inputs::mtime): New field.
12359 * script.cc (read_input_script): Pass file mtime to
12361 * script.h (Script_info::inputs): Style fix.
12363 2009-07-01 Ian Lance Taylor <ian@airs.com>
12365 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12368 2009-06-24 Ian Lance Taylor <iant@google.com>
12371 * layout.cc (Layout::choose_output_section): If we find an
12372 existing section, update the flags.
12373 (Layout::create_notes): New function, broken out of
12375 (Layout::finalize): Don't create note sections.
12376 (Layout::create_note): Don't crash if linker script discards
12378 (Layout::create_gold_note): Likewise.
12379 (Layout::create_build_id): Likewise. Don't set
12380 after_input_sections on the section.
12381 (Layout::create_executable_stack_info): Remove target parameter.
12383 * layout.h (class Layout): Declare create_notes. Update
12384 declaration of create_executable_stack_info.
12385 * gold.cc (queue_middle_tasks): Call create_notes.
12386 * output.cc (Output_section::update_flags_for_input_section): Move
12387 here from output.h. If SHF_ALLOC flag is newly set, mark address
12389 * output.h (Output_data::mark_address_invalid): New function.
12390 (class Output_section): Only declare, not define,
12391 update_flags_for_input_section. Remove set_flags.
12393 2009-06-24 Ian Lance Taylor <iant@google.com>
12395 * script-sections.cc (Output_section_definition::
12396 set_section_addresses): Rename shadowing local load_address to
12399 2009-06-24 Ian Lance Taylor <iant@google.com>
12402 * reloc.cc (relocate_sections): Skip empty relocation sections.
12404 2009-06-23 Ian Lance Taylor <iant@google.com>
12407 * layout.cc (Layout::create_note): Use choose_output_section
12408 rather than make_output_section.
12410 2009-06-23 Ian Lance Taylor <iant@google.com>
12413 * options.cc (General_options::parse_V): Set printed_version_.
12414 (General_options::General_options): Initialize printed_version_.
12415 * options.h (class General_options): Add printed_version_ field.
12416 * gold.cc (queue_initial_tasks): If there are no input files,
12417 don't give a fatal error if we printed the version information.
12418 (queue_middle_tasks): If using -r with a shared object, give a
12419 fatal error rather than an ordinary error.
12421 2009-06-23 Ian Lance Taylor <iant@google.com>
12424 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12425 (Layout::make_output_section): Set have_stabstr_section_ if we see
12426 a .stab*str section.
12427 (Layout::finalize): Call link_stabs_sections.
12428 (Layout::link_stabs_sections): New file.
12429 * layout.h (class Layout): Add have_stabstr_section_ field.
12430 Declare link_stabs_sections.
12432 2009-06-23 Doug Kwan <dougkwan@google.com>
12434 * Makefile.am (libgold_a_LIBADD): New.
12435 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12436 * Makefile.in: Regenerate.
12437 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12438 * configure: Regenerate.
12439 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12440 * fileread.cc: Include sys/state.h
12441 * gold.h: Declare memmem and strndup if found missing.
12442 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12444 2009-06-23 Ian Lance Taylor <iant@google.com>
12446 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12447 * configure: Rebuild.
12449 2009-06-23 Ian Lance Taylor <iant@google.com>
12452 * object.cc (Object::section_contents): Don't try to get a view if
12453 the section has length zero.
12454 (Object::handle_gnu_warning_section): If the section is empty, use
12455 the name of the section as the warning.
12457 2009-06-23 Ian Lance Taylor <iant@google.com>
12460 * stringpool.h (class Stringpool_template): Add optimize_ field.
12461 (Stringpool_template::set_optimize): New function.
12462 * stringpool.cc (Stringpool_template::Stringpool_template):
12463 Initialize optimize_ field.
12464 (Stringpool_template::set_string_offsets): Test local optimize
12465 fild rather than parameter.
12466 * layout.cc (Layout::Layout): Call set_optimize on the section
12469 2009-06-22 Ian Lance Taylor <iant@google.com>
12472 * yyscript.y: Parse TARGET.
12473 * script.cc (script_set_target): New function.
12474 * script-c.h (script_set_target): Declare.
12475 * options.cc (General_options::string_to_object_format): Rename
12476 from string_to_object_format in anonymous namespace. Change
12478 * options.h (class General_options): Declare
12479 string_to_object_format.
12481 2009-06-22 Ian Lance Taylor <iant@google.com>
12483 * script-sections.cc (Script_sections::create_segments): Don't put
12484 program headers in a PT_LOAD segment if -n or -N.
12486 2009-06-22 Ian Lance Taylor <iant@google.com>
12489 * options.h (class General_options): Add -z lazy and -z now. Sort
12490 -z options into alphabetical order.
12491 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12493 2009-06-21 Ian Lance Taylor <iant@google.com>
12495 * layout.cc (Layout::make_output_section): Call
12496 Target::new_output_section.
12497 (Layout::attach_allocated_section_to_segment): Put large section
12498 sections in a separate load segment with the large segment flag
12500 (Layout::segment_precedes): Sort large data segments after other
12502 (align_file_offset): New static function.
12503 (Layout::set_segment_offsets): Use align_file_offset.
12504 * output.h (class Output_section): Add is_small_section_ and
12505 is_large_section_ fields.
12506 (Output_section::is_small_section): New function.
12507 (Output_section::set_is_small_section): New function.
12508 (Output_section::is_large_section): New function.
12509 (Output_section::set_is_large_section): New function.
12510 (Output_section::is_large_data_section): New function.
12511 (class Output_segment): Add is_large_data_segment_ field.
12512 (Output_segment::is_large_data_segment): New function.
12513 (Output_segment::set_is_large_data_segment): New function.
12514 * output.cc (Output_section::Output_section): Initialize new
12516 (Output_segment::Output_segment): Likewise.
12517 (Output_segment::add_output_section): Add assertion that large
12518 data sections always go in large data segments. Force small data
12519 sections to the end of the list of data sections. Force small BSS
12520 sections to the start of the list of BSS sections. For large BSS
12521 sections to the end of the list of BSS sections.
12522 * symtab.h (class Symbol): Declare is_common_shndx.
12523 (Symbol::is_defined): Check Symbol::is_common_shndx.
12524 (Symbol::is_common): Likewise.
12525 (class Symbol_table): Define enum Commons_section_type. Update
12526 declarations. Add small_commons_ and large_commons_ fields.
12527 * symtab.cc (Symbol::is_common_shndx): New function.
12528 (Symbol_table::Symbol_table): Initialize new fields.
12529 (Symbol_table::add_from_object): Put small and large common
12530 symbols in the right list.
12531 (Symbol_table::sized_finalized_symbol): Check
12532 Symbol::is_common_shndx.
12533 (Symbol_table::sized_write_globals): Likewise.
12534 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12535 common symbol lists. Don't call do_allocate_commons_list if the
12537 (Symbol_table::do_allocate_commons_list): Remove is_tls
12538 parameter. Add comons_section_type parameter. Change all
12539 callers. Handle small and large common symbols.
12540 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12541 Symbol::is_common_shndx.
12542 * resolve.cc (symbol_to_bits): Likewise.
12543 * target.h (Target::small_common_shndx): New function.
12544 (Target::small_common_section_flags): New function.
12545 (Target::large_common_shndx): New function.
12546 (Target::large_common_section_flags): New function.
12547 (Target::new_output_section): New function.
12548 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12549 small_common_section_flags, and large_common_section_flags
12551 (Target::do_new_output_section): New virtual function.
12552 * arm.cc (Target_arm::arm_info): Initialize new fields.
12553 * i386.cc (Target_i386::i386_info): Likewise.
12554 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12556 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12557 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12558 (Target_x86_64::do_new_output_section): New function.
12559 * configure.ac: Define conditional MCMODEL_MEDIUM.
12560 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12561 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12562 (large_LDFLAGS): Define.
12563 * testsuite/large.c: New file.
12564 * testsuite/testfile.cc (Target_test::test_target_info):
12565 Initialize new fields.
12566 * configure, testsuite/Makefile.in: Rebuild.
12568 2009-06-05 Doug Kwan <dougkwan@google.com>
12570 * Makefile.am (CCFILES): Add target.cc.
12571 * Makefile.in: Regenerate.
12572 * i386.cc (class Target_i386): Define new virtual method to
12573 override do_is_local_label_name in parent.
12574 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12575 local symbols if --discard-locals or -X is given.
12576 * options.h (class General_options): Declare new options
12577 '--discard-locals' and '-X' for discarding locals.
12578 * target.h (class Target): Define new methods is_local_label_name.
12579 Declare new virtual method do_is_local_label_name.
12580 * target.cc: New file.
12581 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12582 (check_SCRIPTS): Add discard_locals_test.sh.
12583 (check_DATA): Add discard_local_tests.syms.
12584 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12585 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12586 * testsuite/Makefile.in: Regenerate.
12587 * testsuite/discard_locals_test.c: New file.
12588 * testsuite/discard_locals_test.sh: Same.
12590 2009-06-05 Doug Kwan <dougkwan@google.com>
12592 * object.cc (Sized_relobj::Sized_relobj): Initialize
12593 discarded_eh_frame_shndx_ to -1U.
12594 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12596 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12597 a discarded .eh_frame section.
12598 (Sized_relobj::do_finalize_local_symbols): Ditto.
12599 * object.h (class Sized_relobj): Declare new member
12600 discarded_eh_frame_shndx_.
12601 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12602 (local_labels_test.o, local_labels_test): New rules.
12603 * testsuite/Makefile.in: Regenerate.
12605 2009-06-04 Doug Kwan <dougkwan@google.com>
12607 * layout.cc (Layout::section_name_mapping): Add mapping for
12608 special ARM sections.
12610 2009-06-03 Doug Kwan <dougkwan@google.com>
12612 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12613 (utils::has_overflow): Same.
12615 2009-06-03 Ian Lance Taylor <iant@google.com>
12617 * layout.cc (Layout::section_name_mapping): New array, replacing
12618 Layout::linkonce_mapping.
12619 (Layout::section_name_mapping_count): New variable, replacing
12620 Layout::linkonce_mapping_count.
12621 (Layout::linkonce_output_name): Remove.
12622 (Layout::output_section_name): Rewrite.
12623 * layout.h (class Layout): Rename Linkonce_mapping to
12624 Section_name_mapping, linkonce_mapping to section_name_mapping,
12625 linkonce_mapping_count to section_name_mapping_count. Don't
12626 declare linkonce_output_name.
12628 2009-06-03 Doug Kwan <dougkwan@google.com>
12630 * gold/arm.cc (namespace utils): New.
12631 (Target_arm::reloc_is_non_pic): Define new method.
12632 (class Arm_relocate_functions): New.
12633 (Target_arm::Relocate::relocate): Handle relocation types used by
12636 2009-06-03 Ian Lance Taylor <iant@google.com>
12638 * arm.cc (Target_arm::scan::global): Use || instead of |.
12640 2009-06-02 Doug Kwan <dougkwan@google.com>
12642 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12643 issued_non_pic_error_.
12644 (class Target_arm::Scan): Declare new method check_non_pic.
12645 Define new method symbol_needs_plt_entry.
12646 Declare new data member issued_non_pic_error_.
12647 (class Target_arm::Relocate): Declare new method
12648 should_apply_static_reloc.
12649 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12650 (Target_arm::Scan::check_non_pic): Define new method.
12651 (Target_arm::Scan::local): Handle a small subset of reloc types used
12653 (Target_arm::Scan::local): Same.
12654 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12656 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12658 * incremental.cc (Incremental_inputs::report_command_line): Filter
12659 out --incremental-* options.
12661 2009-05-29 Doug Kwan <dougkwan@google.com>
12663 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12665 (class Target_arm): Update comment.
12666 (Target_arm::Target_arm): Initialize new data members GOT_,
12667 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12668 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12669 and Target_arm::rel_dyn_section.
12670 Declare new_enum Target_arm::Got_type.
12671 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12673 Update commments for member do_dynsym_value.
12674 (Target_arm::got_size, Target_arm::plt_section,
12675 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12676 new methods inside class defintion.
12677 (Target_arm::got_section): Define new method.
12678 (Target_arm::rel_dyn_section): Same.
12679 (Output_data_plt_arm): New template class.
12680 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12681 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12682 (Output_data_plt_arm::add_entry): Same.
12683 (Output_data_plt_arm::first_plt_entry): Define new
12684 static data member for PLT instruction template.
12685 (Output_data_plt_arm::plt_entry): Same.
12686 (Output_data_plt_arm::do_write): Define new method.
12687 (Target_arm::make_plt_entry): Same.
12688 (Target_arm::do_finalize_sections): Same.
12689 (Target_arm::do_dynsym_value): Same.
12691 2009-05-28 Doug Kwan <dougkwan@google.com>
12693 * Makefile.am (TARGETSOURCES): Add arm.cc.
12694 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12695 * Makefile.in: Regenerate.
12696 * arm.cc: New file.
12697 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12699 2009-05-26 Doug Kwan <dougkwan@google.com>
12701 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12702 (General_options::check_excluded_libs): Strip off directories in
12703 archive name before matching like GNU ld does.
12704 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12705 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12706 (exclude_libs_test_LDFLAGS): Add linker option
12707 -Wl,--exclude-libs,libexclude_libs_test_3
12708 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12709 an explicit archive without using -l.
12710 (alt/libexclude_libs_test_3.a): New make rule.
12711 * testsuite/Makefile.in: Regenerate.
12712 * testsuite/exclude_libs_test.c : Declare lib3_default().
12714 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12715 * exclude_libs_test_3.c: New file.
12717 2009-05-26 Nick Clifton <nickc@redhat.com>
12719 * po/id.po: New Indonesian translation.
12720 * po/gold.pot: Updated template file.
12722 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12724 * testsuite/Makefile.am: Add -ffunction-sections to compile
12725 gc_comdat_test files. Add -Wl,--gc-sections to build
12727 * testsuite/Makefile.in: Regenerate.
12728 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12730 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12732 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12733 kept comdat section was garbage collected.
12734 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12735 * testsuite/Makefile.in: Regenerate.
12736 * testsuite/gc_comdat_test.sh: New file.
12737 * testsuite/gc_comdat_test_1.cc: New file.
12738 * testsuite/gc_comdat_test_2.cc: New file.
12740 2009-05-19 Doug Kwan <dougkwan@google.com>
12742 * archive.cc (Archive::Archive): Move constructor from archive.h
12743 to here. Initialize no_export_.
12744 (Archive::get_elf_object_for_member): Set no_export flag of object.
12745 * archive.h (Archive::Archive): Move constructor body to
12747 (Archive::no_export): New method.
12748 (Archive::no_export_): New field.
12749 * object.h (Object::Object): Initialize no_export_ to false.
12750 (Object::no_export, Object::set_no_export): New methods.
12751 (Object::no_export_): New field.
12752 * options.cc (General_options::parse_exclude_libs): New method.
12753 (General_options::check_excluded_libs) Same.
12754 * options.h (exclude_libs): New option.
12755 (General_options::check_excluded_libs): New method declaration.
12756 (General_options::excluded_libs_): New field.
12757 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12758 default or protected visibility if an object has no-export flag set.
12759 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12760 (check_SCRIPTS): Add exclude_libs_test.sh.
12761 (check_DATA): Add exclude_libs_test.syms.
12762 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12763 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12764 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12765 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12766 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12767 libexclude_libs_test_2.a): New rules.
12768 * testsuite/Makefile.in: Regenerate.
12769 * testsuite/exclude_libs_test.c: New file.
12770 * testsuite/exclude_libs_test.sh: Ditto.
12771 * testsuite/exclude_libs_test_1.c: Ditto.
12772 * testsuite/exclude_libs_test_2.c: Ditto.
12774 2009-05-15 Ian Lance Taylor <iant@google.com>
12776 * configure.ac: Check for declarations for cases where libiberty.h
12777 checks HAVE_DECL_xxx.
12778 * configure, config.in: Rebuild.
12780 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12782 * gold.h (Incremental_argument_list): Remove (invalid) forward
12784 * incremental.cc (Incremental_inputs::report_achive): New method.
12785 (Incremental_inputs::report_object): New method.
12786 (Incremental_inputs::report_script): New method.
12787 (Incremental_inputs::finalize_inputs): New method.
12788 (Incremental_inputs::finalize): Call finalize_inputs().
12789 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12790 Create inputs entries.
12791 * incremental.h (Incremental_input_type): New enum.
12792 (Incremental_inputs::Incremental_input): Initialize new fields.
12793 (Incremental_inputs::report_inputs): New method.
12794 (Incremental_inputs::report_achive): New method.
12795 (Incremental_inputs::report_object): New method.
12796 (Incremental_inputs::report_script): New method.
12797 (Incremental_inputs::finalize_inputs): New method.
12798 (Incremental_inputs::Input_info): New struct.
12799 (Incremental_inputs::Input_info_map): New typedef.
12800 (Incremental_inputs::lock_): New field.
12801 (Incremental_inputs::Inputs_): New field.
12802 (Incremental_inputs::Inputs_map): New field.
12803 * main.cc (main): Call Incremental_input::report_inputs.
12804 * options.h (Input_argument_list): Typedef moved from
12806 (Input_file_group::Files): Remove, use ::Input_argument_list.
12807 (Input_file_group::Input_argument_list): Remove, use
12808 ::Input_argument_list.
12809 * plugin.cc (Plugin_manager::add_input_file): Add error in
12811 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12813 * script.cc (read_input_script): Call
12814 Incremental_input::report_script.
12815 * script.h (Script_info): New class.
12817 2009-04-27 Ian Lance Taylor <iant@google.com>
12819 * x86_64.cc (do_adjust_output_section): Set entsize to
12822 2009-04-23 Elliott Hughes <enh@google.com>
12824 * output.cc (Output_file::close): After short writes, continue
12825 writing from the correct offset in the buffer being written.
12827 2009-04-23 Chris Demetriou <cgd@google.com>
12829 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12830 * configure: Regenerate.
12831 * config.in: Regenerate.
12832 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12833 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12835 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12837 * incremental.cc (Incremental_inputs_header_data): Renamed from
12838 Incremental_input_header_data.
12839 (Incremental_inputs_header_data::data_size): New field.
12840 (Incremental_inputs_header_data::put_input_file_count): Renamed
12841 from input_file_count.
12842 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12843 from command_line_offset.
12844 (Incremental_inputs_header_data::put_reserved): Renamed from
12846 (Incremental_inputs_entry_data): Renamed from
12847 Incremental_input_entry_data.
12848 (Incremental_inputs_entry_data::data_size): New field.
12849 (Incremental_inputs::report_command_line): New method.
12850 (Incremental_inputs::finalize): New method.
12851 (Incremental_inputs::create_incremental_inputs_data): New method.
12852 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12853 * incremental.h: New file.
12854 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12855 (Layout::finalize): Create incremental inputs section in
12856 incremental builds.
12857 (Layout::create_incremental_info_sections): New method.
12858 * layout.h (Layout::incremental_inputs): New method.
12859 (Layout::create_incremental_info_sections): New method.
12860 (Layout::incremental_inputs_): New field.
12861 * main.cc (main): Notify Incremental_input of the command line.
12863 2009-04-01 Ian Lance Taylor <iant@google.com>
12864 Mikolaj Zalewski <mikolajz@google.com>
12866 * gold.h (reserve_unordered_map): Define, three versions, one for
12867 each version of Unordered_map.
12868 * layout.cc (Layout::Layout): Remove options parameter. Add
12869 number_of_input_files parameter. Don't initialize options_.
12870 Initialize number_of_input_files_ and resized_signatures_. Move
12871 sections_are_attached_.
12872 (Layout::layout_group): Reserve space for group_signatures_.
12873 (Layout::find_or_add_kept_section): Change name parameter to be a
12874 reference. Resize signatures_ map when it gets large enough.
12875 (Layout::layout_eh_frame): Use parameters->options() instead of
12877 (Layout::make_output_section): Likewise.
12878 (Layout::attach_allocated_section_to_segment): Likewise.
12879 (Layout::finalize, Layout::create_executable_stack): Likewise.
12880 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12881 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12882 * layout.h (class Layout): Update declarations. Remove options_
12883 field. Add number_of_input_files_ and resized_signatures_
12884 fields. Move sections_are_attached_ field.
12885 * main.cc (main): Pass number of input files to Layout
12886 constructor. Don't pass options.
12888 2009-03-30 Ian Lance Taylor <iant@google.com>
12890 * ffsll.c (ffsll): Correct implementation.
12892 2009-03-27 Ian Lance Taylor <iant@google.com>
12894 * ffsll.c: New file.
12895 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12896 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12897 * ftruncate.c (ftruncate): Declare before definition.
12898 * mremap.c (mremap): Likewise.
12899 * pread.c (pread): Likewise.
12900 * configure, Makefile.in, config.in: Rebuild.
12902 * mremap.c: New file.
12903 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12904 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12905 (mremap): Declare if HAVE_MREMAP is not defined.
12906 * configure, Makefile.in, config.in: Rebuild.
12908 2009-03-27 Cary Coutant <ccoutant@google.com>
12910 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12911 position independent.
12912 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12913 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12915 2009-03-24 Cary Coutant <ccoutant@google.com>
12917 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12919 (needs_dynamic_reloc): Likewise.
12921 2009-03-24 Ian Lance Taylor <iant@google.com>
12923 * yyscript.y (file_cmd): Recognize EXTERN.
12924 (extern_name_list, extern_name_list_body): New nonterminals.
12925 * script.cc (script_add_extern): Define.
12926 * script-c.h (script_add_extern): Declare.
12928 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12930 * object.cc (is_elf_object): Define.
12931 * object.h (is_elf_object): Declare.
12932 * archive.cc (Archive::get_elf_object_for_member): Call
12934 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12936 2009-03-24 Elliott Hughes <enh@google.com>
12938 * output.cc (Output_file::map_anonymous): Define.
12939 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12940 try an anonymous one. Report the size if the mmap fails.
12941 * output.h (class Output_file): Declare map_anonymous.
12943 2009-03-24 Ian Lance Taylor <iant@google.com>
12945 * target-select.cc (instantiate_target): Don't acquire the lock if
12946 the instantiated_target_ field has already been set.
12948 2009-03-23 Ian Lance Taylor <iant@google.com>
12950 * gold-threads.h (class Initialize_lock): Define.
12951 * gold-threads.cc (class Initialize_lock_once): Define.
12952 (initialize_lock_control): New static variable.
12953 (initialize_lock_pointer): New static variable.
12954 (initialize_lock_once): New static function.
12955 (Initialize_lock::Initialize_lock): Define.
12956 (Initialize_lock::initialize): Define.
12957 * target-select.h: Include "gold-threads.h".
12958 (class Target_selector): Add lock_ and initialize_lock_ fields.
12959 Don't define instantiate_target, just declare it.
12960 * target-select.cc (Target_selector::Target_selector): Initialize
12962 (Target_selector::instantiate_target): Define.
12963 * descriptors.h: Include "gold-threads.h".
12964 (class Descriptors): Add initialize_lock_ field.
12965 * descriptors.cc (Descriptors::Descriptors): Initialize new
12967 (Descriptors::open): Use initialize_lock_ field
12968 * errors.h (class Errors): Add initialize_lock_ field.
12969 * errors.cc (Errors::Errors): Initialize new field.
12970 (Errors::initialize_lock): Use initialize_lock_ field.
12971 * powerpc.cc (class Target_selector_powerpc): Remove
12972 instantiated_target_ field. In do_recognize call
12973 instantiate_target rather than do_instantiate_target. In
12974 do_instantiate_target just allocate a new target.
12975 * sparc.cc (class Target_selector_sparc): Likewise.
12977 * freebsd.h: New file.
12978 * i386.cc: Include "freebsd.h".
12979 (Target_i386): Derive from Target_freebsd rather than
12981 (Target_selector_i386): Derive from Target_selector_freebsd rather
12982 than Target_selector.
12983 * x86_64.cc: Include "freebsd.h".
12984 (Target_x86_64): Derive from Target_freebsd rather than
12986 (Target_selector_x86_64): Derive from Target_selector_freebsd
12987 rather than Target_selector.
12988 * target.h (class Target): Add adjust_elf_header and
12989 do_adjust_elf_header.
12990 * output.cc (Output_file_header:: do_sized_write): Call target
12991 adjust_elf_header routine.
12992 * configure.tgt: Set targ_osabi.
12993 * configure.ac: Define GOLD_DEFAULT_OSABI.
12994 * parameters.cc (Parameters::default_target): Pass
12995 GOLD_DEFAULT_OSABI to select_target.
12996 * target-select.h (class Target_selector): Make instantiate_target
12997 protected rather than private.
12998 * Makefile.am (HFILES): Add freebsd.h.
12999 * configure, Makefile.in, config.in: Rebuild.
13001 * merge.cc (do_add_input_section): Correct pend value. Change
13002 message about last entry not being null terminated from error to
13005 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13007 * incremental.cc: New file.
13008 * Makefile.am (CCFILES): Add incremental.cc.
13009 * Makefile.in: Rebuild.
13011 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13013 * layout.cc (Layout::output_section_name): Preserve names
13014 of '.note.' sections.
13016 2009-03-19 Ian Lance Taylor <iant@google.com>
13018 * descriptors.cc (Descriptors::open): Check that the options are
13019 valid before using them.
13021 2009-03-18 Ian Lance Taylor <iant@google.com>
13023 * script-sections.h: Include <list>.
13024 (class Script_sections): Change Sections_elements from std::vector
13025 to std::list. Typedef public Elements_iterator. Add
13026 orphan_section_placement_, data_segment_align_start_, and
13027 saw_data_segment_align_ fields. Remove data_segment_align_index_
13029 * script-sections.cc (class Orphan_section_placement): New class.
13030 (class Sections_element): Add virtual functions is_relro and
13031 orphan_section_init. Remove virtual function place_orphan_here.
13032 (class Output_section_definition): Add is_relro and
13033 orphan_section_init. Remove place_orphan_here.
13034 (class Orphan_output_section): Likewise.
13035 (Script_sections::Script_sections): Update for field changes.
13036 (Script_sections::data_segment_align): Set saw_data_segment_align_
13037 and data_segment_align_start_, not data_segment_align_index.
13038 (Script_sections::data_segment_relro_end): Check
13039 saw_data_segment_align_. Use data_segment_align_start_ rather
13040 than data_segment_align_index_.
13041 (Script_sections::place_orphan): Rewrite to use
13042 Orphan_section_placement.
13044 2009-03-17 Ian Lance Taylor <iant@google.com>
13046 * archive.cc (Archive::add_symbols): Check for a version attached
13047 to the symbol name in the archive map.
13048 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13049 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13050 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13051 (ver_test_11.a): New target.
13052 * testsuite/Makefile.in: Rebuild.
13054 * configure.ac: Check for chsize and posix_fallocate. Replace
13056 * ftruncate.c: New file, from gnulib.
13057 * output.cc (posix_fallocate): Define dummy version if not
13058 HAVE_POSIX_FALLOCATE.
13059 (Output_file::map): Call posix_fallocate rather than lseek and
13061 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13062 * configure, Makefile.in, config.in: Rebuild.
13064 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13066 * layout.h (Layout::create_note): Add section_name parameter.
13067 * layout.cc (Layout::create_note): Likewise.
13068 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13070 2009-03-17 Ian Lance Taylor <iant@google.com>
13072 * descriptors.cc: Include "options.h".
13073 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13074 (Descriptors::open): Always use O_CLOEXEC when opening a new
13075 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13076 then set FD_CLOEXEC.
13078 * sparc.cc (class Target_sparc): Add has_got_section.
13079 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13080 make sure we have a GOT section.
13082 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13083 (Target_sparc::Scan::local): Likewise.
13084 (Target_sparc::Scan::global): Likewise.
13085 (Target_sparc::Relocate::relocate): Likewise.
13086 (Target_sparc::Relocate::relocate_tls): Likewise.
13088 * symtab.cc (Symbol_table::define_default_version): New function,
13089 broken out of add_from_object.
13090 (Symbol_table::add_from_object): Call define_default_version.
13091 (Symbol_table::define_special_symbol): Add resolve_oldsym
13092 parameter. Change all callers. If the version for a symbol comes
13093 from a version script, resolve it with the symbol with the same
13094 name with no version. Also add the symbol without a version if
13096 (do_define_in_output_data): If resolving with oldsym, don't delete
13098 (do_define_in_output_segment): Likewise.
13099 (do_define_as_constant): Likewise.
13100 * symtab.h (class Symbol_table): Update declarations.
13102 2009-03-13 Ian Lance Taylor <iant@google.com>
13104 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13105 (Read_symbols::requeue): New function.
13106 (Read_symbols::do_read_symbols): If make_elf_object fails because
13107 the target type is not configured, and the file was searched for,
13108 issue a warning and retry with the next directory.
13109 (Add_symbols::run): If the file has an incompatible format, and
13110 it was searched for, requeue the Read_symbols task. On error,
13111 release the object.
13112 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13113 dirindex parameter to constructor. Change all callers. Declare
13114 incompatible_warning and requeue.
13115 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13116 input_argument_ and input_group_ fields. Add them to
13117 constructor. Change all callers.
13118 (class Read_script): Add dirindex_ field. Add it to constructor.
13119 Change all callers.
13120 * archive.cc (Archive::setup): Remove input_objects parameter.
13121 Change all callers.
13122 (Archive::get_file_and_offset): Likewise.
13123 (Archive::read_all_symbols): Likewise.
13124 (Archive::read_symbols): Likewise.
13125 (Archive::get_elf_object_for_member): Remove input_objects
13126 parameter. Add punconfigured parameter. Change all callers.
13127 (Archive::add_symbols): Change return type to bool. Check return
13128 value of include_member.
13129 (Archive::include_all_members): Likewise.
13130 (Archive::include_member): Change return type to bool. Return
13131 false if first included object has incompatible target. Set
13132 included_member_ field.
13133 (Add_archive_symbols::run): If add_symbols returns false, requeue
13135 * archive.h (class Archive): Add included_member_ field.
13136 Initialize it in constructor. Add input_file and searched_for
13137 methods. Update declarations.
13138 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13139 input_argument_ fields. Add them to constructor. Change all
13141 * script.cc: Include "target-select.h".
13142 (class Parser_closure): Add skip_on_incompatible_target_ and
13143 found_incompatible_target_ fields. Add
13144 skip_on_incompatible_target parameter to constructor. Change all
13145 callers. Add methods skip_on_incompatible_target,
13146 clear_skip_on_incompatible_target, found_incompatible_target, and
13147 set_found_incompatible_target.
13148 (read_input_script): Add dirindex parameter. Change all callers.
13149 If parser finds an incompatible target, requeue Read_symbols
13151 (script_set_symbol): Clear skip_on_incompatible_target in
13153 (script_add_assertion, script_parse_option): Likewise.
13154 (script_start_sections, script_add_phdr): Likewise.
13155 (script_check_output_format): New function.
13156 * script.h (read_input_script): Update declaration.
13157 * script-c.h (script_check_output_format): Declare.
13158 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13159 (ignore_cmd): Remove OUTPUT_FORMAT.
13160 * fileread.cc (Input_file::Input_file): Add explicit this.
13161 (Input_file::will_search_for): New function.
13162 (Input_file::open): Add pindex parameter. Change all callers.
13163 * fileread.h (class Input_file): Add input_file_argument method.
13164 Declare will_search_for. Update declarations.
13165 * object.cc (make_elf_object): Add punconfigured parameter.
13166 Change all callers.
13167 * object.h (class Object): Make input_file public. Add
13168 searched_for method.
13169 (make_elf_object): Update declaration.
13170 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13172 * dirsearch.h (class Dirsearch): Update declaration.
13173 * options.h (class General_options): Add --warn-search-mismatch.
13174 * parameters.cc (Parameters::is_compatible_target): New function.
13175 * parameters.h (class Parameters): Declare is_compatible_target.
13176 * workqueue.cc (Workqueue::add_blocker): New function.
13177 * workqueue.h (class Workqueue): Declare add_blocker.
13179 * fileread.cc (Input_file::open): Remove options parameter.
13180 Change all callers.
13181 (Input_file::open_binary): Likewise.
13182 * script.cc (read_input_script): Likewise.
13183 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13184 options parameter from constructor. Change all callers.
13185 (class Read_script): Likewise.
13186 * fileread.h (class Input_file): Update declarations.
13187 * script.h (read_input_script): Update declaration.
13189 2009-03-10 Nick Clifton <nickc@redhat.com>
13191 * po/es.po: New Spanish translation.
13193 2009-03-06 Cary Coutant <ccoutant@google.com>
13195 * options.cc (parse_short_option): Keep dash_z from registering itself.
13197 2009-03-03 Ian Lance Taylor <iant@google.com>
13200 * target-reloc.h (relocate_section): Pass output_section to
13202 * i386.cc (Target_i386::should_apply_static_reloc): Add
13203 output_section parameter. Change all callers.
13204 (Target_i386::Relocate::relocate): Add output_section parameter.
13205 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13206 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13207 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13208 * testsuite/two_file_shared.sh: New script.
13209 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13210 (check_DATA): Add two_file_shared.dbg.
13211 (two_file_shared.dbg): New target.
13212 * testsuite/Makefile.in: Rebuild.
13214 2009-03-01 Ian Lance Taylor <iant@google.com>
13216 * configure.ac: Check for byteswap.h.
13217 * configure: Rebuild.
13218 * config.in: Rebuild.
13220 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13222 * layout.cc (Layout::find_or_add_kept_section): New function.
13223 (Layout::add_comdat): Removed.
13224 * layout.h (struct Kept_section): Move out of class Layout.
13225 Remove trailing underscores from field names. Add group_sections
13226 field. Rename group_ field to is_group. Change all uses.
13227 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13228 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13229 comdat_groups_ field.
13230 (Sized_relobj::include_section_group): Use
13231 find_or_add_kept_section and Kept_section::group_sections.
13232 (Sized_relobj::include_linkonce_section): Likewise.
13233 * object.cc (class Sized_relobj): Don't define Comdat_group or
13234 Comdat_group_table. Remove find_comdat_group and
13235 add_comdat_group. Remove comdat_groups_ field.
13236 * plugin.cc (include_comdat_group): Use
13237 Layout::find_or_add_kept_section.
13239 2009-02-28 Ian Lance Taylor <iant@google.com>
13241 * README: --gc-sections and map files are now supported. Document
13242 some build requirements.
13245 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13246 relocatable link set the value of the section symbol to zero.
13247 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13248 relocatable link don't include the section address in the local
13251 2009-02-27 Ian Lance Taylor <iant@google.com>
13254 * options.h (class Search_directory): Add is_system_directory.
13255 (class General_options): Declare is_in_system_directory.
13256 * options.cc (get_relative_sysroot): Make static.
13257 (get_default_sysroot): Make static.
13258 (General_optoins::is_in_system_directory): New function.
13259 * fileread.cc (Input_file::is_in_system_directory): New function.
13260 * fileread.h (class Input_file): Declare is_in_system_directory.
13261 * object.h (class Object): Add is_in_system_directory.
13262 (class Input_objects): Remove system_library_directory_ field.
13263 * object.cc (Input_objects::add_object): Don't set
13264 system_library_directory_.
13265 (input_objects::found_in_system_library_directory): Remove.
13266 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13267 parameter. Change all callers.
13268 (Symbol_table::sized_write_globals): Likewise.
13269 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13270 Call Object::is_in_system_directory.
13271 * symtab.h (class Symbol_table): Update declarations.
13274 * descriptors.h (Open_descriptor): Add is_on_stack field.
13275 * descriptors.cc (Descriptors::open): If the descriptor is on the
13276 top of the stack, remove it. Initialize is_on_stack field.
13277 (Descriptors::release): Only add pod to stack if it is not on the
13279 (Descriptors::close_some_descriptor): Clear stack_next and
13280 is_on_stack fields.
13283 * output.cc (Output_section::find_starting_output_address): Rename
13284 from starting_output_address; add PADDR parameter; change return
13286 * output.h (class Output_section): Declare
13287 find_starting_output_address instead of starting_output_address.
13288 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13289 section symbol for which we can't find a merge section.
13292 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13293 hidden or internal, force the symbol to be local.
13294 * resolve.cc (Symbol::override_visibility): Define.
13295 (Symbol::override_base): Use override_visibility.
13296 (Symbol_table::resolve): Likewise.
13297 (Symbol::override_base_with_special): Likewise.
13298 (Symbol_table::override_with_special): If the visibility is hidden
13299 or internal, force the symbol to be local.
13300 * symtab.h (class Symbol): Add set_visibility and
13301 override_visibility.
13302 * testsuite/ver_test_1.sh: New file.
13303 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13304 (check_DATA): Add ver_test_1.syms.
13305 (ver_test_1.syms): New target.
13306 * testsuite/Makefile.in: Rebuild.
13308 2009-02-25 Cary Coutant <ccoutant@google.com>
13310 * layout.cc (Layout::choose_output_section): Don't rename sections
13311 when using a linker script that has a SECTIONS clause.
13312 * Makefile.in: Regenerate.
13314 * testsuite/Makefile.am (script_test_5.sh): New test case.
13315 * testsuite/Makefile.in: Regenerate.
13316 * testsuite/script_test_5.cc: New file.
13317 * testsuite/script_test_5.sh: New file.
13318 * testsuite/script_test_5.t: New file.
13320 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13322 * archive.cc (Archive::include_member): Update calls to add_symbols.
13323 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13324 the Layout argument.
13325 * dynobj.h (do_add_symbols): Add the Layout argument.
13326 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13328 * object.h (Object::add_symbols): Add the Layout argument.
13329 (Object::do_add_symbols): Add the Layout argument.
13330 (Sized_relobj::do_add_symbols): Add the Layout argument.
13331 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13332 Unify the two versions.
13333 (Add_plugin_symbols): Remove.
13334 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13335 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13336 (Add_plugin_symbols): Remove.
13337 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13338 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13339 (Add_symbols::run): Make it work with Pulginobj.
13341 2009-02-06 Ian Lance Taylor <iant@google.com>
13343 * object.cc (Sized_relobj::do_layout): Make info message start
13344 with lower case letter.
13346 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13348 * binary.cc: Fix file comment.
13350 * options.h (enum Incremental_disposition): Define.
13351 (class General_options): Add new options: --incremental,
13352 --incremental_changed, --incremental_unchanged,
13353 --incremental_unknown. Add incremental_disposition_ and
13354 implicit_incremental_ fields.
13355 (General_options::incremental_disposition): New function.
13356 (class Position_dependent_options): Add incremental_disposition
13358 (Position_dependent_options::copy_from_options): Set incremental
13360 * options.cc (General_options::parse_incremental_changed): New
13362 (General_options::parse_incremental_unchanged): New function.
13363 (General_options::parse_incremental_unknown): New function.
13364 (General_options::General_options): Initialize new fields
13365 incremental_disposition_ and implicit_incremental_.
13366 (General_options::finalize): Check for uasge of --incremental-*
13367 without --incremental.
13369 2009-02-06 Chris Demetriou <cgd@google.com>
13371 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13372 pointer and to report location as the file name associated with
13374 (gold_undefined_symbol_at_location): New function to replace the
13375 old gold_undefined_symbol functionality.
13376 * target-reloc.h (relocate_section): Update to use
13377 gold_undefined_symbol_at_location.
13378 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13379 Call gold_undefined_symbol function rather than gold_error.
13380 * errors.h (Errors::undefined_symbol): Take location as a
13381 string, rather than calculating it from a relocation.
13382 * errors.cc (Errors::fatal): Print "fatal error:" before the
13384 (Errors::error, Errors::error_at_location): Print "error: "
13385 before the formatted message.
13386 (Errors::undefined_symbol): Take location as a string, rather
13387 than calculating it from a relocation.
13388 (gold_undefined_symbol_at_location): New function akin to
13389 old gold_undefined_symbol, calculates location from relocation.
13390 (gold_undefined_symbol): Change to take only a Symbol pointer
13391 and to report location as the file name associated with the symbol.
13392 * testsuite/debug_msg.sh: Update for changed error messages.
13393 * testsuite/undef_symbol.sh: Likewise.
13395 2009-02-04 Duncan Sands <baldrick@free.fr>
13398 * reduced_debug_output.h
13399 (Output_reduced_debug_abbrev_section::failed): Use format for
13401 (Output_reduced_debug_info_section::faild): Likewise.
13403 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13405 * script.cc (Lazy_demangler): New class.
13406 (Version_script_info::get_symbol_version_helper): Demangle a
13409 2009-01-29 Cary Coutant <ccoutant@google.com>
13411 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13413 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13415 2009-01-28 Ian Lance Taylor <iant@google.com>
13417 * version.cc (version_string): Bump to 1.9.
13419 * gold.h: Include <cstring> and <stdint.h>.
13420 * version.cc: Include <cstdio>.
13421 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13423 * reduced_debug_output.cc (insert_into_vector): Rename from
13424 Insert_into_vector; change all callers. Use Swap_unaligned to
13425 avoid aliasing issue; remove union since it is unnecessary.
13427 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13429 * Makefile.am (CCFILES): Add gc.cc.
13430 (HFILES): Add gc.h.
13431 * Makefile.in: Regenerate.
13432 * gold.cc (Gc_runner): New class.
13433 (queue_initial_tasks): Call garbage collection related tasks
13434 when corresponding options are invoked.
13435 (queue_middle_gc_tasks): New function.
13436 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13437 processed early before laying out sections during garbage collection.
13438 * gold.h (queue_middle_gc_tasks): New function.
13439 (is_prefix_of): Move from "layout.cc".
13440 * i386.cc (Target_i386::gc_process_relocs): New function.
13441 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13442 * main.cc (main): Create object of class "Garbage_collection".
13443 * object.cc (Relobj::copy_symbols_data): New function.
13444 (Relobj::is_section_name_included): New function.
13445 (Sized_relobj::do_layout): Allow this function to be called twice
13446 during garbage collection and defer layout of section during the
13448 * object.h (Relobj::get_symbols_data): New function.
13449 (Relobj::is_section_name_included): New function.
13450 (Relobj::copy_symbols_data): New function.
13451 (Relobj::set_symbols_data): New function.
13452 (Relobj::get_relocs_data): New function.
13453 (Relobj::set_relocs_data): New function.
13454 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13455 (Relobj::gc_process_relocs): New function.
13456 (Relobj::do_gc_process_relocs): New pure virtual function.
13457 (Relobj::sd_): New data member.
13458 (Sized_relobj::is_output_section_offset_invalid): New function.
13459 (Sized_relobj::do_gc_process_relocs): New function.
13460 * options.h (General_options::gc_sections): Modify to not be a no-op.
13461 (General_options::print_gc_sections): New option.
13462 * plugin.cc (Plugin_finish::run): Remove function call to
13463 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13464 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13465 * reloc.cc (Read_relocs::run): Add task to process relocs and
13466 determine unreferenced sections when doing garbage collection.
13467 (Gc_process_relocs): New class.
13468 (Sized_relobj::do_gc_process_relocs): New function.
13469 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13470 sections that are garbage collected.
13471 * reloc.h (Gc_process_relocs): New class.
13472 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13473 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13474 symbols whose corresponding sections are garbage collected.
13475 (Symbol_table::Symbol_table): Add new parameter for the garbage
13477 (Symbol_table::gc_mark_undef_symbols): New function.
13478 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13479 (Symbol_table::gc_mark_dyn_syms): New function.
13480 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13482 (Symbol_table::add_from_object): Likewise.
13483 (Symbol_table::add_from_relobj): When building shared objects, do not
13484 treat externally visible symbols as garbage.
13485 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13486 table information for static and relocatable links.
13487 * symtab.h (Symbol_table::set_gc): New function.
13488 (Symbol_table::gc): New function.
13489 (Symbol_table::gc_mark_undef_symbols): New function.
13490 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13491 (Symbol_table::gc_mark_dyn_syms): New function.
13492 (Symbol_table::gc_): New data member.
13493 * target.h (Sized_target::gc_process_relocs): New pure virtual
13495 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13496 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13498 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13500 * options.h (General_options::gc_sections): Define as a no-op for now.
13501 (General_options::no_keep_memory): Ditto.
13502 (General_options::Bshareable): Define.
13503 * options.cc (General_options::finalize): Honor -Bshareable.
13505 2009-01-20 Andreas Schwab <schwab@suse.de>
13507 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13508 read the value in the contents, since we don't use it. Use the
13509 template endianness when writing.
13510 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13512 2009-01-19 Andreas Schwab <schwab@suse.de>
13514 * configure.tgt (powerpc64-*): Fix targ_obj.
13516 2009-01-15 Ian Lance Taylor <iant@google.com>
13518 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13519 local symbols when stripping all symbols.
13521 2009-01-14 Cary Coutant <ccoutant@google.com>
13523 * output.cc (Output_reloc): Add explicit instantiations.
13525 2009-01-14 Cary Coutant <ccoutant@google.com>
13527 * archive.cc (Archive::get_elf_object_for_member): Remove call
13528 to File_read::claim_for_plugin.
13529 * descriptors.cc (Descriptors::open): Remove reference to
13531 (Descriptors::claim_for_plugin): Remove.
13532 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13533 (Descriptors::is_claimed): Remove.
13534 (claim_descriptor_for_plugin): Remove.
13535 * fileread.cc (File_read::claim_for_plugin): Remove.
13536 * fileread.h (File_read::claim_for_plugin): Remove.
13537 (File_read::descriptor): Reopen descriptor if necessary.
13538 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13539 (Plugin_manager::all_symbols_read): Add task parameter. Change
13541 (Plugin_manager::get_input_file): New function.
13542 (Plugin_manager::release_input_file): New function.
13543 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13544 corresponding data member.
13545 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13546 and pass to base constructor. Change all callers.
13547 (get_input_file, release_input_file): New functions.
13548 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13549 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13550 (Plugin_manager::all_symbols_read): Add task parameter.
13551 (Plugin_manager::get_input_file): New function.
13552 (Plugin_manager::release_input_file): New function.
13553 (Plugin_manager::task_): New data member.
13554 (Pluginobj::Pluginobj): Add filesize parameter.
13555 (Pluginobj::filename): New function.
13556 (Pluginobj::descriptor): New function.
13557 (Pluginobj::filesize): New function.
13558 (Pluginobj::filesize_): New data member.
13559 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13560 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13561 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13563 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13564 with archive libraries.
13565 * testsuite/Makefile.in: Regenerate.
13566 * testsuite/plugin_test.c (struct sym_info): New type.
13567 (get_input_file, release_input_file): New static variables.
13568 (onload): Capture new transfer vector entries.
13569 (claim_file_hook): Stop reading at end of file according to filesize.
13570 Factor out parsing of readelf output into separate function.
13571 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13572 APIs and get the source file name from the symbol table. Convert
13573 source file name to corresponding object file name. Print info
13574 message when adding new input files.
13575 (parse_readelf_line): New function.
13576 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13577 * testsuite/plugin_test_2.sh: Likewise.
13578 * testsuite/plugin_test_3.sh: Likewise.
13579 * testsuite/plugin_test_4.sh: New test case.
13581 2009-01-07 Ian Lance Taylor <iant@google.com>
13583 * version.cc (version_string): Bump to 1.8.
13585 2008-12-23 Cary Coutant <ccoutant@google.com>
13587 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13588 * plugin.cc (Plugin_manager::finish): Rename as
13589 layout_deferred_objects. Move cleanup to separate function.
13590 (Plugin_manager::cleanup): New function.
13591 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13593 * plugin.h (Plugin_manager::finish): Rename as
13594 layout_deferred_objects.
13595 (Plugin_manager::cleanup): New function.
13596 (Plugin_manager::cleanup_done): New field.
13598 2008-12-23 Cary Coutant <ccoutant@google.com>
13600 * plugin.cc (is_visible_from_outside): New function.
13601 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13602 so we don't return "IR only" status for exported symbols or -r links.
13604 * testsuite/Makefile.am (plugin_test_3): New test case.
13605 * testsuite/Makefile.in: Regenerate.
13606 * testsuite/plugin_test_3.sh: New file.
13608 2008-12-22 Cary Coutant <ccoutant@google.com>
13610 * object.cc (Sized_relobj::layout_section): New function.
13611 (Sized_relobj::do_layout): Defer layout of input sections until after
13612 plugin has provided replacement files.
13613 (Sized_relobj::do_layout_deferred_sections): New function.
13614 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13615 (Relobj::layout_deferred_sections): New function.
13616 (Relobj::do_layout_deferred_sections): New function.
13617 (Sized_relobj::do_layout_deferred_sections): New function.
13618 (Sized_relobj::layout_section): New function.
13619 (Sized_relobj::Deferred_layout): New structure.
13620 (Sized_relobj::deferred_layout_): New field.
13621 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13622 Change all callers. Layout deferred sections.
13623 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13625 (Plugin_hook::run): Move code from do_plugin_hook inline.
13626 (Plugin_hook::do_plugin_hook): Remove.
13627 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13628 (Plugin_manager::finish): Renamed, was cleanup.
13629 (Plugin_manager::should_defer_layout): New function.
13630 (Plugin_manager::add_deferred_layout_object): New function.
13631 (Plugin_manager::Deferred_layout_list): New type.
13632 (Plugin_manager::deferred_layout_objects_): New field.
13633 (Plugin_hook::do_plugin_hook): Remove.
13635 2008-12-17 Ian Lance Taylor <iant@google.com>
13637 * options.h (class General_options): Add --no case for
13640 2008-12-16 Cary Coutant <ccoutant@google.com>
13642 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13644 (Plugin_manager::claim_file): Create plugin object even if
13645 plugin did not call the add_symbols callback.
13646 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13647 asking for more symbols than were added.
13648 * testsuite/Makefile.am (plugin_test_1): Add test case with
13650 (empty.syms): New target.
13651 * testsuite/Makefile.in: Regenerate.
13652 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13653 message. Don't call add_symbols if no globals.
13654 (all_symbols_read_hook): Don't provide replacement for empty
13657 2008-12-12 Ian Lance Taylor <iant@google.com>
13659 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13660 r_type == 0 for a local symbol with r_sym == 0.
13661 (scan_relocatable_relocs): Pass r_sym to
13662 local_non_section_strategy.
13663 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13666 * configure.ac: Update test for TLS descriptors: they are
13667 supported as of glibc 2.9.
13668 * configure: Rebuild.
13670 2008-12-11 Ian Lance Taylor <iant@google.com>
13673 * target-reloc.h (Default_scan_relocatable_relocs): For each
13674 function, map r_type == 0 to RELOC_DISCARD.
13676 2008-12-10 Cary Coutant <ccoutant@google.com>
13678 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13679 object to override a kept COMDAT group from a plugin object.
13681 2008-12-09 Ian Lance Taylor <iant@google.com>
13684 * yyscript.y (file_cmd): Handle INPUT.
13686 * testsuite/initpri1.c: Change all declarations to be full
13687 prototypes by adding void, to avoid compiler warnings.
13689 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13691 * options.cc (General_options::parse_plugin_opt): New.
13692 (General_options::add_plugin): The argument now is just the filename.
13693 (General_options::add_plugin_option): New.
13694 * options.h (plugin_opt): New.
13695 (add_plugin): Change argument name.
13696 (add_plugin_option): New.
13697 * plugin.cc (Plugin::load): Don't parse the plugin option.
13698 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13699 (Plugin::add_option): New.
13700 (Plugin::args_): Change type.
13701 (Plugin::filename_): New.
13702 (Plugin_manager::add_plugin_option): New.
13703 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13704 * testsuite/Makefile.in: Regenerate.
13706 2008-12-05 Cary Coutant <ccoutant@google.com>
13708 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13709 Handle --strip-lto-sections option.
13710 * options.h (strip_lto_sections): New option.
13712 2008-12-01 Cary Coutant <ccoutant@google.com>
13714 * plugin.cc (ld_plugin_message): Change format parameter to const.
13715 Fix mismatch between new[] and delete.
13717 2008-11-14 Cary Coutant <ccoutant@google.com>
13719 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13722 2008-11-05 Craig Silverstein <csilvers@google.com>
13724 * options.cc (General_options::parse_dynamic_list): New function.
13725 * options.h (General_options): New flags dynamic_list,
13726 dynamic_list_data, dynamic_list_cpp_new, and
13727 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13728 (General_options::in_dynamic_list): New function.
13729 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13730 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13731 (Lex::can_continue_name): Likewise.
13733 (read_script_file): New parameter script_options.
13734 (read_dynamic_list): New function.
13735 (Script_options::define_dynamic_list): New function.
13736 (dynamic_list_keyword_parsecodes): New variable.
13737 (dynamic_list_keywords): New variable.
13738 * script.h (Script_options::define_dynamic_list): New function
13740 (read_dynamic_list): New function prototype.
13741 * symtab.cc (strprefix): New macro.
13742 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13743 dynamic_list_data, dynamic_list_cpp_new, and
13744 dynamic_list_cpp_typeinfo.
13745 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13746 (dynamic_list_expr): New rule.
13747 (dynamic_list_nodes): Likewise.
13748 (dynamic_list_node): Likewise.
13749 * testsuite/Makefile.am (dynamic_list): New test.
13750 * testsuite/Makefile.in: Regenerated.
13751 * testsuite/dynamic_list.t: New file.
13752 * testsuite/dynamic_list.sh: New file.
13754 2008-11-05 Craig Silverstein <csilvers@google.com>
13756 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13757 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13758 (t11_last): Likewise.
13759 * testsuite/ver_test_6.c (main): Likewise.
13761 2008-10-07 Cary Coutant <ccoutant@google.com>
13763 * options.c (General_options::finalize): Add check for -static and
13765 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13768 2008-10-02 Cary Coutant <ccoutant@google.com>
13770 * plugin.cc (make_sized_plugin_object): Fix conditional
13771 compilation to work when not all targets are enabled.
13773 2008-09-29 Cary Coutant <ccoutant@google.com>
13775 * archive.cc (Archive::get_file_and_offset): Use filename instead
13776 of name to get library path.
13777 (Archive::include_member): Unlock external member of a thin archive.
13779 * testsuite/Makefile.am (TEST_AR): New variable.
13780 (thin_archive_test_1): New test.
13781 (thin_archive_test_2): New test.
13782 * testsuite/Makefile.in: Regenerate.
13783 * testsuite/thin_archive_main.cc: New file.
13784 * testsuite/thin_archive_test_1.cc: New file.
13785 * testsuite/thin_archive_test_2.cc: New file.
13786 * testsuite/thin_archive_test_3.cc: New file.
13787 * testsuite/thin_archive_test_4.cc: New file.
13789 2008-09-29 Cary Coutant <ccoutant@google.com>
13791 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13792 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13794 (Sized_relobj::do_finalize_local_symbols): Likewise.
13795 (Sized_relobj::map_to_kept_section): Likewise.
13796 * object.h (Sized_relobj::invalid_address): New constant.
13797 (Sized_relobj::do_output_section_offset): Check for invalid_address
13799 * output.cc (Output_reloc::local_section_offset): Use constant
13800 invalid_address instead of -1U.
13801 (Output_reloc::get_address): Likewise.
13802 (Output_section::output_address): Change -1U to -1ULL.
13803 * output.h (Output_reloc::invalid_address): New constant.
13804 * reloc.cc (Sized_relobj::write_sections): Use constant
13805 invalid_address instead of -1U.
13806 (Sized_relobj::relocate_sections): Likewise.
13807 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13808 values for merge sections.
13809 * target-reloc.h (relocate_for_relocatable): Use constant
13810 invalid_address instead of -1U.
13812 2008-09-19 Cary Coutant <ccoutant@google.com>
13814 Add plugin functionality for link-time optimization (LTO).
13815 * configure.ac (plugins): Add --enable-plugins option.
13816 * configure: Regenerate.
13817 * config.in: Regenerate.
13818 * Makefile.am (LIBDL): New variable.
13819 (CCFILES): Add plugin.cc.
13820 (HFILES): Add plugin.h.
13821 (ldadd_var): Add LIBDL.
13822 * Makefile.in: Regenerate.
13824 * archive.cc: Include "plugin.h".
13825 (Archive::setup): Don't preread archive symbols when using a plugin.
13826 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13827 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13829 (Archive::include_member): Add symbols from plugin objects.
13830 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13831 * descriptors.cc (Descriptors::open): Check for file descriptors
13832 abandoned by plugins.
13833 (Descriptors::claim_for_plugin): New function.
13834 * descriptors.h (Descriptors::claim_for_plugin): New function.
13835 (Open_descriptor::is_claimed): New field.
13836 (claim_descriptor_for_plugin): New function.
13837 * fileread.cc (File_read::claim_for_plugin): New function.
13838 * fileread.h (File_read::claim_for_plugin): New function.
13839 (File_read::descriptor): New function.
13840 * gold.cc: Include "plugin.h".
13841 (queue_initial_tasks): Add task to call plugin hooks for generating
13843 * main.cc: Include "plugin.h".
13844 (main): Load plugin libraries.
13845 * object.h (Pluginobj): Declare.
13846 (Object::pluginobj): New function.
13847 (Object::do_pluginobj): New function.
13848 (Object::set_target): New function.
13849 * options.cc: Include "plugin.h".
13850 (General_options::parse_plugin): New function.
13851 (General_options::General_options): Initialize plugins_ field.
13852 (General_options::add_plugin): New function.
13853 * options.h (Plugin_manager): Declare.
13854 (General_options): Add --plugin option.
13855 (General_options::has_plugins): New function.
13856 (General_options::plugins): New function.
13857 (General_options::add_plugin): New function.
13858 (General_options::plugins_): New field.
13859 * plugin.cc: New file.
13860 * plugin.h: New file.
13861 * readsyms.cc: Include "plugin.h".
13862 (Read_symbols::do_read_symbols): Check for archive before checking
13863 for ELF file. Call plugin hooks to claim files.
13864 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13865 from a real object file; force override when processing replacement
13867 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13868 (Symbol::init_base_object): Likewise.
13869 (Symbol::init_base_output_data): Likewise.
13870 (Symbol::init_base_output_segment): Likewise.
13871 (Symbol::init_base_constant): Likewise.
13872 (Symbol::init_base_undefined): Likewise.
13873 (Symbol::output_section): Assert that object is not a plugin.
13874 (Symbol_table::add_from_pluginobj): New function.
13875 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13877 (Symbol_table::sized_write_globals): Likewise.
13878 (Symbol_table::add_from_pluginobj): Instantiate template.
13879 * symtab.h (Sized_pluginobj): Declare.
13880 (Symbol::in_real_elf): New function.
13881 (Symbol::set_in_real_elf): New function.
13882 (Symbol::in_real_elf_): New field.
13883 (Symbol_table::add_from_pluginobj): New function.
13885 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13886 (LIBDL): New variable.
13887 (LDADD): Add LIBDL.
13888 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13889 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13890 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13891 (MOSTLYCLEANFILES): Likewise.
13892 * testsuite/Makefile.in: Regenerate.
13893 * testsuite/plugin_test.c: New file.
13894 * testsuite/plugin_test_1.sh: New file.
13895 * testsuite/plugin_test_2.sh: New file.
13897 2008-09-16 Ian Lance Taylor <iant@google.com>
13899 * target-reloc.h (relocate_section): Check whether a symbol is
13900 defined by the ABI before reporting an undefined symbol error.
13901 * target.h (Target::is_defined_by_abi): Make parameter const.
13902 (Target::do_is_defined_by_abi): Likewise.
13903 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13904 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13905 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13906 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13907 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13908 * testsuite/Makefile.in: Rebuild.
13910 * fileread.cc (make_view): Add casts to avoid warning.
13912 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13914 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13915 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13917 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13919 * options.h (General_options::output_is_executable): New.
13920 (General_options::output_is_pie): New.
13921 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13922 for shared libraries.
13923 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13925 2008-09-11 Chris Demetriou <cgd@google.com>
13927 * options.h (origin): New -z option.
13928 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13929 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13932 2008-09-05 Cary Coutant <ccoutant@google.com>
13934 * fileread.cc (File_read::make_view): Add check for attempt to map
13935 beyond end of file.
13937 2008-09-05 Cary Coutant <ccoutant@google.com>
13939 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13940 explicit instantiations.
13942 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13945 * options.cc (General_options::finalize): Allow undefined symbols
13946 in shlibs if linking -shared.
13949 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13950 symbols as not needing a dynsym entry.
13952 2008-08-20 Craig Silverstein <csilvers@google.com>
13954 * fileread.cc (File_read::open): Do not lock the file unless it
13955 was successfully opened.
13957 2008-08-14 Cary Coutant <ccoutant@google.com>
13959 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13960 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13961 * testsuite/tls_test.cc (struct int128): 128-bit struct
13962 for testing TLS relocs with non-zero addend.
13963 (v12): New TLS variable.
13965 (t_last): Add check for v12.
13966 * testsuite/tls_test.h (t12): New function.
13967 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13969 2008-08-13 Ian Lance Taylor <iant@google.com>
13971 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13972 set tls_segment_ or relro_segment_.
13973 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13975 * output.h (Output_section::clear_is_relro): New function.
13976 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13977 sections specially even when output_data_ is empty.
13978 (Output_segment::maximum_alignment): When first section is relro,
13979 only force alignment for PT_LOAD segments.
13980 * script.cc (script_data_segment_align): New function.
13981 (script_data_segment_relro_end): New function.
13982 * script-c.h (script_data_segment_align): Declare.
13983 (script_data_segment_relro_end): Declare.
13984 * script-sections.h (class Script_sections): Declare
13985 data_segment_align and data_segment_relro_end. Add fields
13986 segment_align_index_ and saw_relro_end_.
13987 * script-sections.cc (class Sections_element): Add set_is_relro
13988 virtual function. Add new bool* parameter to place_orphan_here.
13989 Add get_output_section virtual function.
13990 (class Output_section_definition): Add set_is_relro. Add new
13991 bool* parameter to place_orphan_here. Add get_output_section.
13992 Add is_relro_ field.
13993 (Output_section_definition::Output_section_definition): Initialize
13994 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13995 and is_relro_ fields.
13996 (Output_section_definition::place_orphan_here): Add is_relro
13998 (Output_section_definition::set_section_addresses): Set relro for
14000 (Output_section_definition::alternate_constraint): Likewise.
14001 (class Orphan_output_section): Add new bool* parameter to
14002 place_orphan_here. Add get_output_section.
14003 (Orphan_output_section::place_orphan_here): Add is_relro
14005 (Script_sections::Script_sections): Initialize
14006 data_segment_align_index_ and saw_relro_end_.
14007 (Script_sections::data_segment_align): New function.
14008 (Script_sections::data_segment_relro_end): New function.
14009 (Script_sections::place_orphan): Set or clear is_relro.
14010 (Script_sections::set_section_addresses): Force alignment of first
14012 * yyscript.y (exp): Call script_data_segment_align and
14013 script_data_segment_relro_end.
14014 * testsuite/relro_script_test.t: New file.
14015 * testsuite/relro_test.cc (using_script): Declare.
14016 (t1, t2): Test using_script.
14017 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14018 (relro_script_test_SOURCES): Define.
14019 (relro_script_test_DEPENDENCIES): Define.
14020 (relro_script_test_LDFLAGS): Define.
14021 (relro_script_test_LDADD): Define.
14022 (relro_script_test.so): New target.
14023 * testsuite/Makefile.in: Rebuild.
14025 2008-08-06 Cary Coutant <ccoutant@google.com>
14027 * archive.cc (Archive::total_archives, Archive::total_members)
14028 (Archive::total_members_loaded): New variables.
14029 (Archive::setup): Add parameter. Add option to preread
14031 (Archive::read_armap): Add counter.
14032 (Archive::get_file_and_offset): New function.
14033 (Archive::get_elf_object_for_member): New function.
14034 (Archive::read_all_symbols): New function.
14035 (Archive::read_symbols): New function.
14036 (Archive::add_symbols): Add counters.
14037 (Archive::include_all_members): Use armap to find members if it's
14039 (Archive::include_member): Skip reading symbols if already read.
14040 Factored code into Archive::get_file_and_offset and
14041 Archive::get_elf_object_for_member. Changed call to
14042 Mapfile::report_include_archive_member.
14043 (Archive::print_stats): New function.
14044 * archive.h: Declare Object and Read_symbols_data classes.
14045 (Archive::Archive): Add initializers for new members.
14046 (Archive::setup): Add parameter.
14047 (Archive::print_stats): New function.
14048 (Archive::total_archives, Archive::total_members)
14049 (Archive::total_members_loaded): New variables.
14050 (Archive::get_file_and_offset): New function.
14051 (Archive::get_elf_object_for_member): New function.
14052 (Archive::read_all_symbols): New function.
14053 (Archive::read_symbols): New function.
14054 (Archive::Archive_member): New class.
14055 (Archive::members_): New member.
14056 (Archive::num_members_): New member.
14057 * main.cc: Include archive.h.
14058 (main): Call Archive::print_stats.
14059 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14060 archive parameter; member_name is now the fully-decorated name.
14061 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14062 * options.h: (General_options): Add --preread-archive-symbols option.
14063 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14066 2008-08-04 Ian Lance Taylor <iant@google.com>
14068 * symtab.h (Symbol::use_plt_offset): New function.
14069 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14070 * powerpc.cc (Relocate::relocate): Likewise.
14071 * sparc.cc (Relocate::relocate): Likewise.
14072 * x86_64.cc (Relocate::relocate): Likewise.
14073 * testsuite/weak_plt.sh: New test.
14074 * testsuite/weak_plt_main.cc: New test.
14075 * testsuite/weak_plt_shared.cc: New test.
14076 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14077 (check_PROGRAMS): Add weak_plt.
14078 (check_DATA): Add weak_plt_shared.so.
14079 (weak_plt_main_pic.o, weak_plt): New targets.
14080 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14081 * testsuite/Makefile.in: Rebuild.
14083 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14085 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14086 * testsuite/Makefile.in: Rebuild.
14088 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14090 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14091 * Makefile.in: Regenerate.
14092 * po/POTFILES.in: Regenerate.
14094 2008-07-29 Ian Lance Taylor <iant@google.com>
14096 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14097 symbols before other symbols.
14098 * testsuite/script_test_2.cc (test_addr): Declare.
14099 (test_addr_alias): Declare.
14100 (main): Check that test_addr and test_addr_alias have the right
14102 * testsuite/script_test_2.t: Define test_addr_alias and
14105 2008-07-24 Ian Lance Taylor <iant@google.com>
14108 * descriptors.cc: New file.
14109 * descriptors.h: New file.
14110 * gold-threads.h (class Hold_optional_lock): New class.
14111 * fileread.cc: Include "descriptors.h".
14112 (File_read::~File_read): Release descriptor rather than closing
14114 (File_read::open) [file]: Call open_descriptor rather than open.
14115 Set is_descriptor_opened_.
14116 (File_read::open) [memory]: Assert that descriptor is not open.
14117 (File_read::reopen_descriptor): New function.
14118 (File_read::release): Release descriptor.
14119 (File_read::do_read): Make non-const. Reopen descriptor.
14120 (File_read::read): Make non-const.
14121 (File_read::make_view): Reopen descriptor.
14122 (File_read::do_readv): Likewise.
14123 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14124 Update declarations.
14125 * layout.cc: Include "descriptors.h".
14126 (Layout::create_build_id): Use open_descriptor rather than open.
14127 * output.cc: Include "descriptors.h".
14128 (Output_file::open): Use open_descriptor rather than open.
14129 * archive.cc (Archive::const_iterator): Change Archive to be
14131 (Archive::begin, Archive::end): Make non-const.
14132 (Archive::count_members): Likewise.
14133 * archive.h (class Archive): Update declarations.
14134 * object.h (Object::read): Make non-const.
14135 * Makefile.am (CCFILES): Add descriptors.cc.
14136 (HFILES): Add descriptors.h.
14137 * Makefile.in: Rebuild.
14140 * gold.h: Always include <clocale>. Add Solaris workarounds
14141 following code in binutils/sysdep.h.
14144 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14145 this->eh_frame_hdr_ is NULL before using it.
14147 * dynobj.cc (Versions::Versions): Update comment.
14149 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14150 the base version name.
14152 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14153 array size plus one.
14154 (Stringpool_template::set_string_offsets): Subtract one from key
14155 before using it as an array index.
14156 (Stringpool_template::get_offset_with_length): Likewise.
14157 (Stringpool_template::write_to_buffer): Likewise.
14158 * stringpool.h (Stringpool_template::get_offset_from_key):
14161 2008-07-23 Ian Lance Taylor <iant@google.com>
14164 * object.h (Merged_symbol_value::value): Do our best to handle a
14168 * script.cc (Version_script_info::get_versions): Don't add empty
14169 version tag to return value.
14170 (Version_script_info::get_symbol_version_helper): Change return
14171 type to bool. Add pversion parameter. Change all callers.
14172 (script_register_vers_node): Don't require a non-NULL tag.
14173 * script.h (class Version_script_info): Update declarations.
14174 (Version_script_info::get_symbol_version): Change return type to
14175 bool. Add version parameter. Change all callers.
14176 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14177 handling. Handle an empty version from a version script.
14178 (Symbol_table::define_special_symbol): Likewise.
14179 * testsuite/ver_test_10.script: New file.
14180 * testsuite/ver_test_10.sh: New file.
14181 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14182 (check_DATA): Add ver_test_10.syms.
14183 (ver_test_10.syms, ver_test_10.so): New target.
14184 * testsuite/Makefile.in: Rebuild.
14186 2008-07-23 Simon Baldwin <simonb@google.com>
14188 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14189 to zero for undefined symbols from dynamic libraries.
14191 2008-07-23 Ian Lance Taylor <iant@google.com>
14193 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14194 Change all callers.
14195 * symtab.h (class Symbol_table): Update declaration.
14196 * testsuite/ver_test_9.cc: New file.
14197 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14198 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14199 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14200 (ver_test_9.so, ver_test_9.o): New targets.
14201 * testsuite/Makefile.in: Rebuild.
14203 2008-07-22 Ian Lance Taylor <iant@google.com>
14205 * options.h (class General_options): Define --check-sections.
14206 * layout.cc (Layout::set_segment_offsets): Handle
14209 * options.h (class General_options): Define -n/--nmagic and
14211 * options.cc (General_options::finalize): For -n/--nmagic or
14212 -N/--omagic, set -static.
14213 * layout.cc (Layout::attach_allocated_section_to_segment): If
14214 -N/--omagic, don't put read-only and read-write sections in
14215 different segments.
14216 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14217 finding a read-only segment.
14218 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14219 don't set the minimum segment alignment to the common page size,
14220 and don't set the file offset to the address modulo the page size.
14221 * script-sections.cc (Script_sections::create_segments): If
14222 -n/--omagic, don't put read-only and read-write sections in
14223 different segments.
14225 * cref.cc: New file.
14226 * cref.h: New file.
14227 * options.h (class General_options): Add --print-symbol-counts.
14228 * main.cc (main): Issue defined symbol report if requested.
14229 * archive.cc (Archive::interpret_header): Make into a const member
14231 (Archive::add_symbols): Call Input_objects::archive_start and
14233 (Archive::const_iterator): Define new class.
14234 (Archive::begin, Archive::end): New functions.
14235 (Archive::include_all_members): Rewrite to use iterator.
14236 (Archive::count_members): New function.
14237 * archive.h (class Archive): Update declarations.
14238 (Archive::filename): New function.
14239 * object.cc: Include "cref.h".
14240 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14241 (Sized_relobj::do_get_global_symbol_counts): New function.
14242 (Input_objects::add_object): Add object to cross-referencer.
14243 (Input_objects::archive_start): New function.
14244 (Input_objects::archive_stop): New function.
14245 (Input_objects::print_symbol_counts): New function.
14246 * object.h: Declare Cref and Archive.
14247 (Object::get_global_symbol_counts): New function.
14248 (Object::do_get_global_symbol_counts): New pure virtual function.
14249 (class Sized_relobj): Add defined_count_ field. Update
14251 (class Input_objects): Add cref_ field. Update constructor.
14252 Update declarations.
14253 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14255 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14257 (Sized_dynobj::do_get_global_symbol_counts): New function.
14258 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14259 defined_count_. Update declarations. Define Symbols typedef.
14260 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14261 parameter. Change all callers.
14262 (Symbol_table::add_from_dynobj): Add sympointers and defined
14263 parameters. Change all callers.
14264 * symtab.h (class Symbol_table): Update declarations.
14265 * Makefile.am (CCFILES): Add cref.cc.
14266 (HFILES): Add cref.h.
14267 * Makefile.in: Rebuild.
14269 2008-07-22 Simon Baldwin <simonb@google.com>
14271 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14272 to zero when writing undefined symbols.
14274 2008-07-22 Ian Lance Taylor <iant@google.com>
14276 * output.cc (Output_section::add_input_section): Don't try to
14277 merge empty merge sections.
14279 2008-07-21 Craig Silverstein <csilvers@google.com>
14281 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14282 Include symbol version in error message.
14284 2008-07-20 Chris Demetriou <cgd@google.com>
14286 * configure.ac (gold_cv_c_random_seed): New configured variable.
14287 (RANDOM_SEED_CFLAGS): New substituted variable.
14288 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14289 * configure: Rebuild.
14290 * Makefile.in: Likewise.
14291 * testsuite/Makefile.in: Likewise.
14293 2008-07-18 Ian Lance Taylor <iant@google.com>
14295 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14296 where we see NAME/NULL and NAME/VERSION as separate symbols.
14297 * testsuite/ver_test_main.cc (main): Call t4.
14298 (t4, t4_2a): Define.
14299 * testsuite/ver_test_2.cc (t4_2): Define.
14300 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14301 * testsuite/ver_test_4.cc (t4_2a): Define.
14302 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14303 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14305 2008-07-17 Ian Lance Taylor <iant@google.com>
14307 * dynobj.cc (Versions::add_def): If we give an error about a
14308 missing version, go ahead and create the version anyhow.
14310 2008-07-10 Ian Lance Taylor <iant@google.com>
14312 Handle output sections with more than 0x7fffffff bytes.
14313 * object.h (class Relobj): Change map_to_output_ to
14314 output_sections_, and just keep a section pointer. Change all
14315 uses. Move comdat group support to Sized_relobj.
14316 (Relobj::is_section_specially_mapped): Remove.
14317 (Relobj::output_section): Remove poff parameter. Change all
14319 (Relobj::output_section_offset): New function.
14320 (Relobj::set_section_offset): Rewrite.
14321 (Relobj::map_to_output): Remove.
14322 (Relobj::output_sections): New function.
14323 (Relobj::do_output_section_offset): New pure virtual function.
14324 (Relobj::do_set_section_offset): Likewise.
14325 (class Sized_relobj): Add section_offsets_ field. Add comdat
14326 group support from Relobj. Update declarations.
14327 (Sized_relobj::get_output_section_offset): New function.
14328 (Sized_relobj::do_output_section_offset): New function.
14329 (Sized_relobj::do_set_section_offset): New function.
14330 * object.cc (Relobj::output_section_address): Remove.
14331 (Sized_relobj::Sized_relobj): Initialize new fields.
14332 (Sized_relobj::include_section_group): Cast find_kept_object to
14334 (Sized_relobj::include_linkonce_section): Likewise.
14335 (Sized_relobj::do_layout): Use separate arrays for output section
14337 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14339 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14340 output_sections and section_offsets.
14341 (Sized_relobj::write_local_symbols): Likewise.
14342 (map_to_kept_section): Compute output address directly.
14343 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14344 output_sections and section_offsets.
14345 (Sized_relobj::write_sections): Likewise.
14346 (Sized_relobj::relocate_sections): Likewise.
14347 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14348 * output.h (class Output_reloc): Update declarations. Change
14349 u2_.relobj to Sized_relobj*.
14350 (class Output_data_reloc): Change add functions to use
14352 * output.cc (Output_reloc::Output_reloc): Change relobj to
14354 (Output_reloc::local_section_offset): Change return type to
14355 Elf_Addr. Use get_output_section_offset.
14356 (Output_reloc::get_address): Likewise.
14357 (Output_section::is_input_address_mapped): Don't call
14358 is_section_specially_mapped.
14359 (Output_section::output_offset): Likewise.
14360 (Output_section::output_address): Likewise.
14361 (Output_section::starting_output_address): Likewise.
14362 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14363 parameter to Sized_relobj*.
14364 (Copy_relocs::need_copy_reloc): Likewise.
14365 (Copy_relocs::save): Likewise.
14366 * copy-relocs.h (class Copy_relocs): Update declarations.
14367 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14368 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14369 * target-reloc.h (relocate_for_relocatable): Change
14370 offset_in_output_section type to Elf_Addr. Change code that uses
14372 * layout.cc (Layout::layout): Always set *off.
14373 * mapfile.cc (Mapfile::print_input_section): Use
14374 output_section_offset.
14375 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14377 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14378 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14379 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14381 2008-07-03 Ian Lance Taylor <iant@google.com>
14383 * layout.cc (Layout::include_section): Do not discard unrecognized
14384 SHT_STRTAB sections.
14386 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14388 * script.cc (Lex::can_continue_name): Make '?' allowable in
14389 version-script names.
14390 * testsuite/version_script.map: Change glob pattern to use '?'
14392 2008-06-30 Manish Singh <yosh@gimp.org>
14395 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14398 2008-06-30 Ian Lance Taylor <iant@google.com>
14402 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14403 versions]: Don't try to read the value in the contents, since we
14404 don't use it. Use the template endianness when writing.
14406 2008-06-25 Cary Coutant <ccoutant@google.com>
14408 * fileread.cc (File_read::make_view): Assert on zero-length view.
14409 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14410 symbol table when there are no symbols to read.
14412 2008-06-23 Craig Silverstein <csilvers@google.com>
14414 * version.cc (version_string): Bump to 1.7
14416 2008-06-18 Craig Silverstein <csilvers@google.com>
14418 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14419 constant 0xFFFF to type Valtype.
14420 (Powerpc_relocate_functions::rel16_ha): Likewise.
14422 2008-06-17 Ian Lance Taylor <iant@google.com>
14424 * output.h (Output_section::Input_section): Initialize p2align_ to
14425 zero for Output_section_data constructors.
14426 (Output_section::Input_section::addralign): If not an input
14427 section, return the alignment of the Output_section_data.
14428 * testsuite/copy_test.cc: New file.
14429 * testsuite/copy_test_1.cc: New file.
14430 * testsuite/copy_test_2.cc: New file.
14431 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14432 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14433 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14434 (copy_test_1_pic.o, copy_test_1.so): New targets.
14435 (copy_test_2_pic.o, copy_test_2.so): New targets.
14436 * testsuite/Makefile.in: Rebuild.
14438 * script-sections.cc (Script_sections::place_orphan): Initialize
14439 local variable exact.
14441 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14443 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14445 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14446 David S. Miller <davem@davemloft.net>
14448 * powerpc.cc: New file.
14449 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14450 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14451 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14452 * Makefile.in: Rebuild.
14454 2008-06-09 Ian Lance Taylor <iant@google.com>
14456 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14458 (throwing, orig_terminate): New static variables.
14459 (terminate_handler): New static function.
14460 (t2): Set terminate handler.
14462 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14465 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14468 2008-05-30 Cary Coutant <ccoutant@google.com>
14470 * archive.cc (Archive::include_all_members) Correct to step
14471 over symbol table and extended name table in thin archives.
14473 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14476 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14479 2008-05-28 Caleb Howe <cshowe@google.com>
14481 * reduced_debug_output.cc: New file.
14482 * reduced_debug_output.h: New file.
14483 * options.h (class General_options): Add --strip-debug-non-line.
14484 * options.cc (General_options::finalize): Add strip_debug_non_line
14485 to the strip heirarchy.
14486 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14488 * layout.cc: Include "reduced_debug_output.h".
14489 (Layout::Layout): Initialize new fields.
14490 (line_only_debug_sections): New static array.
14491 (is_lines_only_debug_sections): New static inline function.
14492 (Layout::include_section): Handle --strip-debug-non-line.
14493 (Layout::make_output_section): If --strip-debug-non-line, build
14494 new output sections for .debug_abbrev and .debug_info.
14495 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14496 gold. Warn about possible overflow.
14497 (read_signed_LEB_128): Likewise.
14498 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14499 (read_signed_LEB_128): Declare.
14500 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14501 (HFILES): Add reduced_debug_output.h.
14502 * Makefile.in: Rebuild.
14504 2008-05-21 Ian Lance Taylor <iant@google.com>
14506 * mapfile.cc: New file.
14507 * mapfile.h: New file.
14508 * options.h (class General_options): Add -M/--print-map and -Map.
14509 * options.cc (General_options::finalize): Make -M equivalent to
14511 * main.cc: Include <cstdio> and "mapfile.h".
14512 (main): Open mapfile if requested.
14513 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14514 constructor. Change caller.
14515 (queue_initial_tasks): Add mapfile parameter. Change caller.
14516 (queue_middle_tasks): Likewise.
14517 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14519 * archive.cc: Include "mapfile.h".
14520 (Archive::add_symbols): Add mapfile parameter. Change all
14521 callers. Pass mapfile, symbol, and reason to include_member.
14522 (Archive::include_all_members): Add mapfile parameter. Change all
14524 (Archive::include_member): Add mapfile, sym, and why parameters.
14525 Change all callers. Report inclusion to map file.
14526 * archive.h: Include "fileread.h".
14527 (class Archive): Update declarations.
14528 (Archive::file): New const method.
14529 (class Add_archive_symbols): Add mapfile_ field. Update
14530 constructor. Change all callers.
14531 * readsyms.h (class Read_symbols): Likewise.
14532 (class Finish_group): Likewise.
14533 (class Read_script): Likewise.
14534 * common.cc: Include "mapfile.h".
14535 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14537 (Symbol_table::do_allocate_commons): Likewise.
14538 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14539 symbol allocation to mapfile.
14540 * common.h (class Allocate_commons_task): Add mapfile_ field.
14541 Update constructor. Change all callers.
14542 * symtab.h (class Symbol_table): Update declarations.
14543 * layout.cc: Include "mapfile.h".
14544 (Layout_task_runner::run): Print information to mapfile.
14545 (Layout::create_gold_note): Change Output_data_fixed_space to
14546 Output_data_zero_fill.
14547 (Layout::create_build_id): Likewise.
14548 (Layout::print_to_mapfile): New function.
14549 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14550 constructor. Change caller.
14551 (class Layout): Declare print_to_mapfile.
14552 * output.cc (Output_section::Input_section::print_to_mapfile): New
14554 (Output_section::add_input_section): If producing a map, always
14555 add to input_sections_ list.
14556 (Output_section::do_print_to_mapfile): New function.
14557 (Output_segment::print_sections_to_mapfile): New function.
14558 (Output_segment::print_section_list_to_mapfile): New function.
14559 * output.h: Include "mapfile.h".
14560 (Output_data::print_to_mapfile): New function.
14561 (Output_data::do_print_to_mapfile): New virtual function.
14562 (Output_segment_headers::do_print_to_mapfile): New function.
14563 (Output_file_header::do_print_to_mapfile): New function.
14564 (Output_data_const::do_print_to_mapfile): New function.
14565 (class Output_data_const_buffer): Add map_name_ field. Update
14566 constructor. Change all callers. Add do_print_to_mapfile
14568 (class Output_data_fixed_space): Likewise.
14569 (class Output_data_space): Likewise.
14570 (class Output_data_zero_fill): New class.
14571 (Output_data_strtab::do_print_to_mapfile): New function.
14572 (Output_data_reloc_base::do_print_to_mapfile): New function.
14573 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14574 (Output_data_group::do_print_to_mapfile): New function.
14575 (Output_data_got::do_print_to_mapfile): New function.
14576 (Output_data_dynamic::do_print_to_mapfile): New function.
14577 (Output_symtab_xindex::do_print_to_mapfile): New function.
14578 (class Output_section): Declare do_print_to_mapflie. Declare
14579 print_to_mapfile in Input_section.
14580 (class Output_segment): Declare new functions.
14581 * object.h (Sized_relobj::symbol_count): New function.
14582 * script-sections.cc
14583 (Output_section_element_dot_assignment::set_section_addresses):
14584 Change Output_data_fixed_space to Output_data_zero_fill.
14585 (Output_data_expression::do_print_to_mapfile): New function.
14586 * script.cc (read_input_script): Add mapfile parameter. Change
14588 * script.h (read_input_script): Update declaration.
14589 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14590 (Eh_frame::do_print_to_mapfile): New function.
14591 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14592 (Output_merge_string::do_print_to_mapfile): New function.
14593 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14595 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14597 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14599 * Makefile.am (CCFILES): Add mapfile.cc.
14600 (HFILES): Add mapfile.h.
14601 * Makefile.in: Rebuild.
14603 2008-05-19 Ian Lance Taylor <iant@google.com>
14605 * options.h (class General_options): Add -z relro.
14606 * layout.cc (Layout::Layout): Initialize relro_segment_.
14607 (Layout::add_output_section_data): Return the output section.
14608 (Layout::make_output_section): Rcognize relro sections and mark
14609 them appropriately.
14610 (Layout::attach_allocated_section_to_segment): Put relro sections
14611 in a PT_GNU_RELRO segment.
14612 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14614 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14616 (Layout::linkonce_mapping): Map d.rel.ro.local to
14617 .data.rel.ro.local.
14618 (Layout::output_section_name): Us .data.rel.ro.local for any
14619 section which begins with that.
14620 * layout.h (class Layout): Update add_output_section_data
14621 declaration. Add relro_segment_ field.
14622 * output.cc (Output_section::Output_section): Initialize is_relro_
14623 and is_relro_local_ fields.
14624 (Output_segment::add_output_section): Group relro sections.
14625 (Output_segment::is_first_section_relro): New function.
14626 (Output_segment::maximum_alignment): If there is a relro section,
14627 align the segment to the common page size.
14628 (Output_segment::set_section_addresses): Track whether we are
14629 looking at relro sections. If the last section is a relro
14630 section, align to the common page size.
14631 (Output_segment::set_section_list_addresses): Add in_relro
14632 parameter. Change all callers. Align to the page size when
14633 moving from relro to non-relro section.
14634 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14636 * output.h (class Output_section): Add is_relro_ and
14637 is_relro_local_ fields.
14638 (Output_section::is_relro): New function.
14639 (Output_section::set_is_relro): New function.
14640 (Output_section::is_relro_local): New function.
14641 (Output_section::set_is_relro_local): New function.
14642 (class Output_segment): Update declarations.
14643 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14644 * sparc.cc (Target_sparc::got_section): Likewise.
14645 * x86_64.cc (Target_x86_64::got_section): Likewise.
14646 * testsuite/relro_test_main.cc: New file.
14647 * testsuite/relro_test.cc: New file.
14648 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14649 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14650 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14651 (relro_test.so, relro_test_pic.o): New targets.
14652 * testsuite/Makefile.in: Rebuild.
14654 2008-05-16 Ian Lance Taylor <iant@google.com>
14656 * output.cc (Output_segment::add_output_section): Remove front
14658 * output.h (class Output_segment): Remove
14659 add_initial_output_section and overloaded add_output_section.
14660 Update declaration of remaining add_output_section.
14661 * layout.cc (Layout::create_interp): Call add_output_section
14662 rather than add_initial_output_section.
14663 (Layout::finish_dynamic_section): Likewise.
14665 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14666 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14667 know the dynamic type.
14668 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14669 field. Initialize it in constructor.
14670 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14671 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14672 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14675 * output.cc (Output_reloc::get_address): Change return type to
14677 * output.h (class Output_reloc): Update get_address declaration.
14678 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14679 for section addresses.
14681 2008-05-09 Ian Lance Taylor <iant@google.com>
14684 * gold.cc (gold_nomem): Use return value of write.
14686 2008-05-08 Ian Lance Taylor <iant@google.com>
14688 * symtab.c (Symbol::init_base_output_data): Add version
14689 parameter. Change all callers.
14690 (Symbol::init_base_output_segment): Likewise.
14691 (Symbol::init_base_constant): Likewise.
14692 (Symbol::init_base_undefined): Likewise.
14693 (Sized_symbol::init_output_data): Likewise.
14694 (Sized_symbol::init_output_segment): Likewise.
14695 (Sized_symbol::init_constant): Likewise.
14696 (Sized_symbol::init_undefined): Likewise.
14697 (Symbol_table::do_define_in_output_data): If the new symbol has a
14698 version, mark it as the default.
14699 (Symbol_table::do_define_in_output_segment): Likewise.
14700 (Symbol_table::do_define_as_constant): Likewise.
14701 * symtab.h (class Symbol): Update declarations.
14702 (class Sized_symbol): Likewise.
14703 * resolve.cc (Symbol::override_version): New function.
14704 (Symbol::override_base): Call override_version.
14705 (Symbol::override_base_with_special): Likewise.
14706 * testsuite/ver_script_8.script: New file.
14707 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14708 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14709 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14710 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14712 2008-05-06 Ian Lance Taylor <iant@google.com>
14715 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14717 (class General_options): Remove existing --undefined, and add
14718 --no-undefined instead. Add new --undefined as synonym for -u.
14719 * archive.cc (Archive::add_symbols): Check whether symbol was
14721 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14722 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14723 all uses. Add IS_UNDEFINED. Update declarations to split
14724 different versions of init_base. Declare init_base_undefined.
14725 (Symbol::is_defined): Handle IS_UNDEFINED.
14726 (Symbol::is_undefined): Likewise.
14727 (Symbol::is_weak_undefined): Call is_undefined.
14728 (Symbol::is_absolute): Handle IS_CONSTANT.
14729 (class Sized_symbol): Update declarations to split different
14730 versions of init. Declare init_undefined.
14731 (class Symbol_table): Declare new functions.
14732 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14733 Change all callers.
14734 (Symbol::init_base_output_data): Likewise.
14735 (Symbol::init_base_output_segment): Likewise.
14736 (Symbol::init_base_constant): Likewise.
14737 (Symbol::init_base_undefined): New function.
14738 (Sized_symbol::init_object): Rename from init. Change all
14740 (Sized_symbol::init_output_data): Likewise.
14741 (Sized_symbol::init_output_segment): Likewise.
14742 (Sized_symbol::init_constant): Likewise.
14743 (Sized_symbol::init_undefined): New function.
14744 (Symbol_table::add_undefined_symbols_from_command_line): New
14746 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14748 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14749 (Symbol::output_section): Likewise.
14750 (Symbol::set_output_section): Likewise.
14751 (Symbol_table::sized_finalize_symbol): Likewise.
14752 (Symbol_table::sized_write_globals): Likewise.
14753 * resolve.cc (Symbol_table::should_override): Likewise.
14754 (Symbol::override_base_with_special): Likewise.
14756 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14757 symbol, change it to have default visibility.
14758 * testsuite/protected_1.cc: New file.
14759 * testsuite/protected_2.cc: New file.
14760 * testsuite/protected_3.cc: New file.
14761 * testsuite/protected_main_1.cc: New file.
14762 * testsuite/protected_main_2.cc: New file.
14763 * testsuite/protected_main_3.cc: New file.
14764 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14765 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14766 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14767 (protected_1.so): New target.
14768 (protected_1_pic.o, protected_2_pic.o): New targets.
14769 (protected_3_pic.o): New target.
14770 (check_PROGRAMS): Add protected_2.
14771 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14772 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14773 * testsuite/Makefile.in: Rebuild.
14775 * options.h (DEFINE_var): Add set_user_set_##varname__.
14776 (DEFINE_bool_alias): New macro.
14777 (class General_options): Define -Bstatic using DEFINE_bool_alias
14778 rather than DEFINE_special. Add --undefined as an alias for -z
14780 * options.cc (General_options::parse_Bstatic): Remove.
14782 * options.h (class General_options): Add --fatal-warnings.
14783 * main.cc (main): Implement --fatal-warnings.
14784 * errors.h (Errors::warning_count): New function.
14786 * options.h (class General_options): Add -Bsymbolic-functions.
14787 * symtab.h (Symbol::is_preemptible): Check for
14788 -Bsymbolic-functions.
14790 2008-05-05 Ian Lance Taylor <iant@google.com>
14792 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14793 as noVARNAME rather than no-VARNAME.
14794 (class General_options): Add option -z combreloc.
14795 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14797 (Output_reloc::sort_before) [SHT_REL]: New function.
14798 (Output_reloc::sort_before) [SHT_RELA]: New function.
14799 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14800 Sort_relocs_comparison.
14801 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14802 parameter. Change all callers.
14803 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14804 sort_relocs parameter. Change all callers.
14805 * output.cc (Output_reloc::get_address): New function, broken out
14807 (Output_reloc::write_rel): Call it.
14808 (Output_reloc::compare): New function.
14809 (Output_data_reloc_base::do_write): Optionally sort relocs.
14811 * configure.ac: If targ_extra_obj is set, link it in.
14812 * configure.tgt: Initialize all variables.
14813 (x86_64*): Set targ_extra_obj and targ_extra_size.
14814 * configure: Rebuild.
14816 * object.cc (Sized_relobj::include_section_group): Adjust section
14817 indexes read from group data. Build vector to pass to
14819 * layout.cc (Layout::layout_group): Add flags and shndxes
14820 parameters. Remove contents parameter. Change caller. Update
14821 explicit instantiations.
14822 * layout.h (class Layout): Update layout_group declaration.
14823 * output.cc (Output_data_group::Output_data_group): Add flags and
14824 input_shndxes parameters. Remove contents parameter. Change
14826 (Output_data_group::do_write): Change input_sections_ to
14828 * output.h (class Output_data_group): Update constructor
14829 declaration. Rename input_sections_ to input_shndxes_.
14830 * testsuite/many_sections_test.cc: Add template.
14832 2008-04-30 Cary Coutant <ccoutant@google.com>
14834 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14836 * layout.cc (Layout::include_section): Refactored check for debug
14838 (Layout::add_comdat): Add new parameters. Change type
14839 of signature parameter. Add object and shndx to signatures table.
14840 (Layout::find_kept_object): New function.
14841 * layout.h: Include <cstring>.
14842 (Layout::is_debug_info_section): New function.
14843 (Layout::add_comdat): Add new parameters.
14844 (Layout::find_kept_object): New function.
14845 (Layout::Kept_section): New struct.
14846 (Layout::Signatures): Change type of map range.
14847 * object.cc (Relobj::output_section_address): New function.
14848 (Sized_relobj::include_section_group): Add new parameters. Change
14849 calls to Layout::add_comdat. Change to build table of kept comdat
14850 groups and table mapping discarded sections to kept sections.
14851 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14852 (Sized_relobj::do_layout): Change calls to include_section_group and
14853 include_linkonce_section.
14854 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14855 value to zero when section is discarded.
14856 (Sized_relobj::map_to_kept_section): New function.
14857 * object.h (Relobj::output_section_address): New function.
14858 (Relobj::Comdat_group): New type.
14859 (Relobj::find_comdat_group): New function.
14860 (Relobj::Comdat_group_table): New type.
14861 (Relobj::Kept_comdat_section): New type.
14862 (Relobj::Kept_comdat_section_table): New type.
14863 (Relobj::add_comdat_group): New function.
14864 (Relobj::set_kept_comdat_section): New function.
14865 (Relobj::get_kept_comdat_section): New function.
14866 (Relobj::comdat_groups_): New field.
14867 (Relobj::kept_comdat_sections_): New field.
14868 (Symbol_value::input_value): Update comment.
14869 (Sized_relobj::map_to_kept_section) New function.
14870 (Sized_relobj::include_linkonce_section): Add new parameter.
14871 * target-reloc.h (Comdat_behavior): New type.
14872 (get_comdat_behavior): New function.
14873 (relocate_section): Add code to map a discarded section to the
14874 corresponding kept section when applying a relocation.
14876 2008-04-30 Craig Silverstein <csilvers@google.com>
14878 * dwarf_reader.cc (next_generation_count): New static var.
14879 (Addr2line_cache_entry): New struct.
14880 (addr2line_cache): New static var.
14881 (Dwarf_line_info::one_addr2line): Added caching.
14882 (Dwarf_line_info::clear_addr2line_cache): New function.
14883 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14884 cache-size parameter.
14885 (Dwarf_line_info::one_addr2line_cache): New function.
14886 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14887 new cache-size argument to one_addr2line(), and clear cache.
14889 2008-04-28 Cary Coutant <ccoutant@google.com>
14891 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14892 R_386_PC8 relocations.
14894 2008-04-23 Ian Lance Taylor <iant@google.com>
14896 * object.cc (Sized_relobj::include_section_group): Check for
14897 invalid section group.
14899 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14902 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14903 than read for file header.
14904 * archive.cc (Archive::include_member): Likewise.
14906 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14908 * aclocal.m4: Regenerate.
14909 * configure: Regenerate.
14911 2008-04-19 Ian Lance Taylor <iant@google.com>
14913 * version.cc (version_string): Bump to 1.6.
14915 * testsuite/Makefile.am (many_sections_r_test): New target.
14916 (many_sections_r_test_SOURCES): Remove.
14917 (many_sections_r_test_DEPENDENCIES): Remove.
14918 (many_sections_r_test_LDFLAGS): Remove.
14919 (many_sections_r_test_LDADD): Remove.
14921 * object.cc (Sized_relobj::do_add_symbols): Always pass
14922 local_symbol_count_ to add_from_relobj.
14924 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14925 every thousand variables.
14926 * testsuite/Makefile.in: Rebuild.
14928 * object.cc (Xindex::initialize_symtab_xindex): New function.
14929 (Xindex::read_symtab_xindex): New function.
14930 (Xindex::sym_xindex_to_shndx): New function.
14931 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14933 (Sized_relobj::do_initialize_xindex): New function.
14934 (Sized_relobj::do_read_symbols): Adjust section links.
14935 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14936 parameter. Change all callers.
14937 (Sized_relobj::include_section_group): Adjust section links and
14938 symbol section indexes.
14939 (Sized_relobj::do_layout): Adjust section links.
14940 (Sized_relobj::do_count_local_symbols): Adjust section links and
14941 symbol section indexes.
14942 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14943 ordinary and special symbols.
14944 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14945 dynsym_xindex parameters. Change all callers. Adjust section
14946 links. Use SHN_XINDEX when needed.
14947 (Sized_relobj::get_symbol_location_info): Adjust section links.
14948 Don't get fooled by special symbols.
14949 * object.h (class Xindex): Define.
14950 (class Object): Add xindex_ parameter. Declare virtual functoin
14951 do_initialize_xindex.
14952 (Object::adjust_sym_shndx): New function.
14953 (Object::set_xindex): New protected function.
14954 (class Symbol_value): Add is_ordinary_shndx_ field.
14955 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14956 (Symbol_value::value): Assert ordinary section.
14957 (Symbol_value::initialize_input_to_output_map): Likewise.
14958 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14959 Change all callers.
14960 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14962 (class Sized_relobj): Update declarations.
14963 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14964 parameter. Change all callers.
14965 (Sized_relobj::adjust_shndx): New function.
14966 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14968 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14969 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14970 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14971 (Sized_dynobj::read_dynsym_section): Adjust section links.
14972 (Sized_dynobj::read_dynamic): Likewise.
14973 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14975 (Sized_dynobj::do_initialize_xindex): New function.
14976 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14977 do_initialize_xindex.
14978 (Sized_dynobj::adjust_shndx): New function.
14979 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14980 dynsym_xindex_ fields.
14981 (Layout::finalize): Add a call to set_section_indexes before
14982 creating the symtab sections.
14983 (Layout::set_section_indexes): Don't do anything if the section
14984 already has a section index.
14985 (Layout::create_symtab_sections): Add shnum parameter. Change
14986 caller. Create .symtab_shndx section if needed.
14987 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14989 (Layout::allocated_output_section_count): New function.
14990 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14992 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14993 fields. Update declarations.
14994 (Layout::symtab_xindex): New function.
14995 (Layout::dynsym_xindex): New function.
14996 (class Write_symbols_task): Add layout_ field.
14997 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14999 * output.cc (Output_section_headers::Output_section_headers): Add
15000 shstrtab_section parameter. Change all callers.
15001 (Output_section_headers::do_sized_write): Store overflow values
15002 for section count and section string table section index in
15003 section header zero.
15004 (Output_file_header::do_sized_write): Check for overflow of
15005 section count and section string table section index.
15006 (Output_symtab_xindex::do_write): New function.
15007 (Output_symtab_xindex::endian_do_write): New function.
15008 * output.h (class Output_section_headers): Add shstrtab_section_.
15009 Update declarations.
15010 (class Output_symtab_xindex): Define.
15011 (Output_section::has_out_shndx): New function.
15012 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15014 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15015 Change all callers.
15016 (Sized_symbol::init): Likewise.
15017 (Symbol::output_section): Check for ordinary symbol.
15018 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15019 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15021 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15022 Change all callers. Simplify handling of symbols from sections
15023 not included in the link.
15024 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15026 (Weak_alias_sorter::operator()): Assert that symbols are
15028 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15030 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15031 parameters. Change all callers.
15032 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15033 symbol distinction. Use SHN_XINDEX when needed.
15034 (Symbol_table::write_section_symbol): Add symtab_xindex
15035 parameter. Change all callers.
15036 (Symbol_table::sized_write_section_symbol): Likewise. Use
15037 SHN_XINDEX when needed.
15038 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15040 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15041 (Symbol::is_defined): Check is_ordinary.
15042 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15043 (Symbol::is_absolute, Symbol::is_common): Likewise.
15044 (class Sized_symbol): Update declarations.
15045 (class Symbol_table): Update declarations.
15046 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15047 parameters. Change all callers.
15048 (Sized_symbol::override): Likewise.
15049 (Symbol_table::override): Likewise.
15050 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15051 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15052 is_ordinary, and orig_st_shndx parameters. Change all callers.
15053 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15054 to be in an ordinary section.
15055 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15056 object and is_ordinary parameters. Change all callers.
15057 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15058 Change all callers. Don't add undefined or non-ordinary symbols
15060 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15061 Change all callers.
15062 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15064 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15065 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15066 (Sized_relobj::relocate_sections): Likewise.
15067 * target-reloc.h (scan_relocs): Adjust section symbol index.
15068 (scan_relocatable_relocs): Likewise.
15069 * i386.cc (Scan::local): Check for ordinary symbols.
15070 * sparc.cc (Scan::local): Likewise.
15071 * x86_64.cc (Scan::local): Likewise.
15072 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15073 to symbol_section_and_value.
15074 * testsuite/many_sections_test.cc: New file.
15075 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15076 (check_PROGRAMS): Add many_sections_test.
15077 (many_sections_test_SOURCES): Define.
15078 (many_sections_test_DEPENDENCIES): Define.
15079 (many_sections_test_LDFLAGS): Define.
15080 (BUILT_SOURCES): Add many_sections_define.h.
15081 (many_sections_define.h): New target.
15082 (BUILT_SOURCES): Add many_sections_check.h.
15083 (many_sections_check.h): New target.
15084 (check_PROGRAMS): Add many_sections_r_test.
15085 (many_sections_r_test_SOURCES): Define.
15086 (many_sections_r_test_DEPENDENCIES): Define.
15087 (many_sections_r_test_LDFLAGS): Define.
15088 (many_sections_r_test_LDADD): Define.
15089 (many_sections_r_test.o): New target.
15090 * testsuite/Makefile.in: Rebuild.
15092 2008-04-17 Cary Coutant <ccoutant@google.com>
15094 * errors.cc (Errors::info): New function.
15095 (gold_info): New function.
15096 * errors.h (Errors::info): New function.
15097 * gold.h (gold_info): New function.
15098 * object.cc (Input_objects::add_object): Print trace output.
15099 * options.cc (options::parse_set): New function.
15100 (General_options::parse_wrap): Deleted.
15101 (General_options::General_options): Deleted initializer.
15102 * options.h (options::String_set): New typedef.
15103 (options::parse_set): New function.
15104 (DEFINE_set): New macro.
15105 (General_options::wrap): Changed to use DEFINE_set. Changed
15106 callers of any_wrap_symbols and is_wrap_symbol.
15107 (General_options::trace, General_options::trace_symbol):
15109 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15110 (General_options::wrap_symbols_): Deleted.
15111 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15113 2008-04-17 David S. Miller <davem@davemloft.net>
15115 * options.cc (General_options::parse_V): New function.
15116 * options.h: Add entries for -V and -Qy.
15118 2008-04-17 Ian Lance Taylor <iant@google.com>
15120 * common.cc (Symbol_table::allocate_commons): Remove options
15121 parameter. Change caller.
15122 (Symbol_table::do_allocate_commons): Remove options parameter.
15123 Change caller. Just call do_allocate_commons_list twice.
15124 (Symbol_table::do_allocate_commons_list): New function, broken out
15125 of do_allocate_commons.
15126 * common.h (class Allocate_commons_task): Remove options_ field.
15127 Update constructor.
15128 * symtab.cc (Symbol_table::Symbol_table): Initialize
15130 (Symbol_table::add_from_object): Put TLS common symbols on
15132 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15133 which are IN_OUTPUT_DATA.
15134 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15135 allocate_commons and do_allocate_commons declarations. Declare
15136 do_allocate_commons_list.
15137 * gold.cc (queue_middle_tasks): Update creation of
15138 Allocate_commons_task to not pass options.
15139 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15140 (TLS_TEST_C_FLAGS): New variable.
15141 (tls_test_c_pic.o): New target.
15142 (tls_test_shared.so): Link in tls_test_c_pic.o.
15143 (tls_test_c_pic_ie.o): New target.
15144 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15145 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15146 (tls_test_c.o): New target.
15147 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15148 (tls_pic_test_LDADD): Likewise.
15149 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15150 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15151 (tls_test_c_gnu2.o): New target.
15152 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15154 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15155 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15156 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15157 * testsuite/tls_test.cc: Include "config.h".
15158 (t_last): Call t11_last.
15159 * testsuite/tls_test.h (t11, t11_last): Declare.
15160 * testsuite/tls_test_c.c: New file.
15161 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15162 * configure.ac: Check for OpenMP support.
15163 * configure, config.in, Makefile.in: Rebuild.
15164 * testsuite/Makefile.in: Rebuild.
15166 2008-04-16 Cary Coutant <ccoutant@google.com>
15168 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15169 (Target_i386::tls_base_symbol_defined_): New field.
15170 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15171 (Target_i386::Scan::global): Likewise.
15172 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15173 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15174 (Target_x86_64::tls_base_symbol_defined_): New field.
15175 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15176 (Target_x86_64::Scan::global): Likewise.
15178 2008-04-16 Cary Coutant <ccoutant@google.com>
15180 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15181 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15182 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15183 building shared libraries.
15184 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15185 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15186 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15187 * testsuite/Makefile.in: Rebuild.
15188 * testsuite/weak_undef.h: New file.
15189 * testsuite/weak_undef_file1.cc: Add extra test cases.
15190 * testsuite/weak_undef_file2.cc: Likewise.
15191 * testsuite/weak_undef_test.cc: Likewise.
15193 2008-04-16 David S. Miller <davem@davemloft.net>
15195 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15196 Add issued_non_pic_error_ field. Declare check_non_pic.
15197 (Target_sparc::Scan::check_non_pic): New function.
15198 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15199 (Target_sparc::Scan::global): Likewise.
15201 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15202 * configure: Rebuild.
15204 * options.h (DEFINE_enable): New macro.
15205 (new_dtags): New enable option.
15206 (initfirst, interpose, loadfltr, nodefaultlib,
15207 nodelete, nodlopen, nodump): New -z options.
15208 * layout.cc (Layout:finish_dynamic_section): If new
15209 dtags enabled, emit DT_RUNPATH. Also, emit a
15210 DT_FLAGS_1 containing any specified -z flags.
15212 2008-04-16 Ian Lance Taylor <iant@google.com>
15214 * copy-relocs.cc: New file.
15215 * copy-relocs.h: New file.
15216 * reloc.cc: Remove Copy_relocs code.
15217 * reloc.h: Likewise.
15218 * reloc-types.h (struct Reloc_types) [both versions]: Add
15219 get_reloc_addend_noerror.
15220 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15221 variants of add_global which take an addend which must be zero.
15222 * i386.cc: Include "copy-relocs.h".
15223 (class Target_i386): Change type of copy_relocs_ to variable,
15224 update initializer.
15225 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15226 Change all callers.
15227 (Target_i386::do_finalize_sections): Change handling of
15229 * sparc.cc: Include "copy-relocs.h".
15230 (class Target_sparc): Change type of copy_relocs_ to variable,
15231 update initializer.
15232 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15233 Change all callers.
15234 (Target_sparc::do_finalize_sections): Change handling of
15236 * x86_64.cc: Include "copy-relocs.h".
15237 (class Target_x86_64): Change type of copy_relocs_ to variable,
15238 update initializer.
15239 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15240 class. Change all callers.
15241 (Target_x86_64::do_finalize_sections): Change handling of
15243 * Makefile.am (CCFILES): Add copy-relocs.cc.
15244 (HFILES): Add copy-relocs.h.
15246 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15248 * testsuite/script_test_4.sh: Permit leading zeroes.
15250 2008-04-15 Ian Lance Taylor <iant@google.com>
15252 * script-sections.cc (Script_sections::create_segments): Use
15253 header_size_adjustment even when there is enough room for the
15255 * testsuite/script_test_4.sh: New file.
15256 * testsuite/script_test_4.t: New file.
15257 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15258 (check_DATA): Add script_test_4.stdout.
15259 (MOSTLYCLEANFILES): Likewise.
15260 (script_test_4): New target.
15261 (script_test_4.stdout): New target.
15262 * testsuite/Makefile.in: Rebuild.
15264 * sparc.cc: Add definitions for Output_data_plt_sparc class
15267 2008-04-14 David S. Miller <davem@davemloft.net>
15269 * sparc.cc: New file.
15270 * Makefile.am (TARGETSOURCES): Add sparc.cc
15271 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15272 * configure.tgt: Document targ_extra_size and
15273 targ_extra_big_endian. Add entries for sparc-* and
15275 * configure.ac: Handle targ_extra_size and
15276 targ_extra_big_endian.
15277 * Makefile.in: Rebuild.
15278 * configure: Likewise.
15279 * po/POTFILES.in: Likewise.
15280 * po/gold.pot: Likewise.
15282 2008-04-14 Ian Lance Taylor <iant@google.com>
15284 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15285 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15286 in the name/type/flags to section mapping. Don't call
15287 allocate_output_section.
15288 (Layout::choose_output_section): Change parameter from adjust_name
15289 to is_input_section. Don't permit input sections after sections
15290 are attached to segments. Don't call allocate_output_section.
15291 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15292 not write_enable_output_section.
15293 (Layout::make_output_section): Don't push to
15294 unattached_section_list_ nor call attach_to_segment. Call
15295 attach_section_to_segment if sections are attached.
15296 (Layout::attach_sections_to_segments): New function.
15297 (Layout::attach_section_to_segment): New function.
15298 (Layout::attach_allocated_section_to_segment): Rename from
15299 attach_to_segment. Remove flags parameter.
15300 (Layout::allocate_output_section): Remove function.
15301 (Layout::write_enable_output_section): Remove function.
15302 * layout.h (class Layout): Update for above changes. Add new
15303 field sections_are_attached_.
15304 * output.h (Output_section::update_flags_for_input_section): New
15306 * output.cc (Output_section::add_input_section): Call
15307 update_flags_for_input_section.
15308 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15310 2008-04-11 Cary Coutant <ccoutant@google.com>
15312 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15313 thought unnecessary.
15314 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15316 2008-04-11 Ian Lance Taylor <iant@google.com>
15318 * output.h (class Output_section_data): Remove inline definition
15320 * output.cc (Output_section_data::set_addralign): New function.
15322 2008-04-11 Cary Coutant <ccoutant@google.com>
15324 Add support for TLS descriptors for i386 and x86_64.
15325 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15326 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15327 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15329 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15330 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15331 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15333 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15334 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15335 Fix problem with initial-exec relocations.
15336 (Target_i386::Relocate::relocate_tls): Likewise.
15337 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15339 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15340 support for section-plus-offset dynamic table entries.
15341 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15342 (Output_data_dynamic::Dynamic_entry): Add support for
15343 section-plus-offset dynamic table entries.
15344 (Output_data_dynamic::Classification): Likewise.
15345 (Output_data_dynamic::classification_): Renamed offset_.
15346 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15347 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15348 (Target_x86_64::make_plt_section): New function.
15349 (Target_x86_64::reserve_tlsdesc_entries): New function.
15350 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15351 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15352 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15353 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15354 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15355 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15356 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15357 add extra PLT entry for TLS descriptors.
15358 (Output_data_plt_x86_64::got_): New field.
15359 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15360 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15362 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15364 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15365 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15366 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15367 R_386_TLS_DESC_CALL relocations.
15368 (Target_x86_64::Scan::global): Likewise.
15369 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15370 for TLS descriptors.
15371 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15372 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15373 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15374 GD-to-IE relaxation.
15375 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15376 and TLS_DESCRIPTORS.
15377 * Makefile.in: Rebuild.
15378 * configure: Rebuild.
15379 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15380 (tls_test_shared2.so): New target.
15381 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15382 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15383 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15384 (tls_shared_gd_to_ie_test_LDADD): New variable.
15385 (tls_shared_gnu2_gd_to_ie_test): New target.
15386 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15388 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15389 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15390 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15391 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15392 (tls_shared_gnu2_test): New target.
15393 (tls_test_gnu2_shared.so): New target.
15394 (tls_shared_gnu2_test_SOURCES): New variable.
15395 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15396 (tls_shared_gnu2_test_LDFLAGS): New variable.
15397 (tls_shared_gnu2_test_LDADD): New variable.
15398 * testsuite/Makefile.in: Rebuild.
15399 * testsuite/Makefile.
15401 2008-04-11 Ian Lance Taylor <iant@google.com>
15403 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15405 * testsuite/Makefile.in: Rebuild.
15407 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15409 * testsuite/script_test_2.cc (main): Adjust test.
15411 2008-04-11 David S. Miller <davem@davemloft.net>
15412 Ian Lance Taylor <iant@google.com>
15414 * options.h (General_options): Add entries for '-Y' and
15416 * options.cc (General_options:finalize): If -Y was used, add those
15417 entries to the library path instead of the default "/lib" and
15420 2008-04-11 David S. Miller <davem@davemloft.net>
15422 * testsuite/justsyms.t: Start at 0x100.
15423 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15424 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15426 * testsuite/script_test_2.cc: Adjust string and section length
15429 2008-04-09 Ian Lance Taylor <iant@google.com>
15432 * script-sections.cc (Sections_element::allocate_to_segment): Add
15434 (Output_section_definition::allocate_to_segment): Likewise.
15435 (Orphan_output_section::allocate_to_segment): Likewise.
15436 (Script_sections::attach_sections_using_phdrs_clause): Don't
15437 propagate non-PT_LOAD segments to orphan sections.
15438 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15439 readelf rather than objdump.
15440 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15441 .interp section and PT_INTERP segment are the same size.
15442 * testsuite/Makefile.in: Rebuild.
15444 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15445 aliases for symbols defined in the same object.
15446 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15447 (weak_alias_test_SOURCES): New variable.
15448 (weak_alias_test_DEPENDENCIES): New variable.
15449 (weak_alias_test_LDFLAGS): New variable.
15450 (weak_alias_test_LDADD): New variable.
15451 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15452 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15453 (weak_alias_test_3.o): New target.
15454 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15455 * testsuite/weak_alias_test_main.cc: New file.
15456 * testsuite/weak_alias_test_1.cc: New file.
15457 * testsuite/weak_alias_test_2.cc: New file.
15458 * testsuite/weak_alias_test_3.cc: New file.
15460 2008-04-08 Ian Lance Taylor <iant@google.com>
15462 * options.h (class General_options): Add --noinhibit-exec option.
15463 * main.cc (main): Check --noinhibit-exec.
15465 * options.h (class General_options): Define --wrap as a special
15466 option. Add wrap_symbols_ field.
15467 (General_options::any_wrap_symbols): New function.
15468 (General_options::is_wrap_symbol): New function.
15469 * options.cc (General_options::parse_wrap): New function.
15470 (General_options::General_options): Initialize wrap_symbols_.
15471 * symtab.cc (Symbol_table::wrap_symbol): New function.
15472 (Symbol_table::add_from_object): Handle --wrap.
15473 * symtab.h (class Symbol_table): Declare wrap_symbol.
15474 * target.h (Target::wrap_char): New function.
15475 (Target::Target_info): Add wrap_char field.
15476 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15477 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15478 * testsuite/testfile.cc (Target_test::test_target_info):
15481 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15484 * layout.h (class Layout): Add added_eh_frame_data_ field.
15485 * layout.cc (Layout::Layout): Initialize new field.
15486 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15487 output section until we find a section we merged successfully.
15488 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15489 that the size be non-zero.
15491 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15494 2008-04-08 Craig Silverstein <csilvers@google.com>
15496 * configure.ac: Export new conditional variable HAVE_ZLIB.
15497 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15499 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15500 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15502 2008-04-07 Ian Lance Taylor <iant@google.com>
15504 * version.cc (version_string): Set to "1.5".
15506 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15507 Add issued_non_pic_error_ field. Declare check_non_pic.
15508 (Target_x86_64::Scan::check_non_pic): New function.
15509 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15510 (Target_x86_64::Scan::global): Likewise.
15512 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15513 addend parameter. Change caller. Handle merge sections.
15514 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15515 Address to Addend. Don't add in the result of
15516 local_section_offset, pass down the addend and use the returned
15518 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15519 Update declarations of local_section_offset and symbol_value.
15520 * testsuite/two_file_test_1.cc (t18): New function.
15521 * testsuite/two_file_test_2.cc (f18): New function.
15522 * testsuite/two_file_test_main.cc (main): Call t18.
15523 * testsuite/two_file_test.h (t18, f18): Declare.
15525 * configure.ac: Don't test for objdump, c++filt, or readelf.
15526 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15528 (TEST_READELF): New variable.
15529 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15530 (check_PROGRAMS): Add two_file_strip_test.
15531 (two_file_strip_test): New target.
15532 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15533 (two_file_same_shared_strip_test_SOURCES): New variable.
15534 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15535 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15536 (two_file_same_shared_strip_test_LDADD): New variable.
15537 (two_file_shared_strip.so): New target.
15538 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15539 (ver_test_5.syms, ver_test_7.syms): Likewise.
15540 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15541 (strip_test_3.stdout): Use TEST_OBJDUMP.
15542 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15544 2008-04-04 Cary Coutant <ccoutant@google.com>
15546 * symtab.h (Symbol::is_weak_undefined): New function.
15547 (Symbol::is_strong_undefined): New function.
15548 (Symbol::is_absolute): New function.
15549 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15550 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15552 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15553 (weak_undef_test): New target.
15554 * testsuite/Makefile.in: Rebuild.
15555 * testsuite/weak_undef_file1.cc: New file.
15556 * testsuite/weak_undef_file2.cc: New file.
15557 * testsuite/weak_undef_test.cc: New file.
15559 2008-04-03 Craig Silverstein <csilvers@google.com>
15561 * compressed_output.h (class Output_compressed_section): Use
15563 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15565 (zlib_compressed_suffix): Removed.
15566 (Output_compressed_section::set_final_data_size): Use unsigned
15568 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15569 Fix linker invocation.
15570 (flagstest_o_specialfile_and_compress_debug_sections):
15572 * testsuite/Makefile.in: Regenerated.
15574 2008-04-02 David S. Miller <davem@davemloft.net>
15576 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15577 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15579 2008-04-02 Craig Silverstein <csilvers@google.com>
15583 2008-04-02 Ian Lance Taylor <iant@google.com>
15585 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15586 parameters. Update for new key type to views_. Change all
15588 (File_read::read): Adjust for byteshift in returned view.
15589 (File_read::add_view): New function, broken out of
15590 find_and_make_view.
15591 (File_read::make_view): New function, broken out of
15592 find_and_make_view.
15593 (File_read::find_or_make_view): Add offset and aligned
15594 parameters. Rewrite accordingly. Change all callers.
15595 (File_read::get_view): Add offset and aligned parameters. Adjust
15596 for byteshift in return value.
15597 (File_read::get_lasting_view): Likewise.
15598 * fileread.h (class File_read): Update declarations.
15599 (class File_read::View): Add byteshift_ field. Add byteshift to
15600 constructor. Add byteshift method.
15601 * archive.h (Archive::clear_uncached_views): New function.
15602 (Archive::get_view): Add aligned parameter. Change all callers.
15603 * object.h (Object::get_view): Add aligned parameter. Change all
15605 (Object::get_lasting_view): Likewise.
15607 * fileread.cc (File_read::release): Don't call clear_views if
15608 there are multiple objects.
15609 * fileread.h (File_read::clear_uncached_views): New function.
15610 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15613 2008-03-31 Cary Coutant <ccoutant@google.com>
15615 Add thin archive support.
15616 * archive.cc (Archive::armagt): New const.
15617 (Archive::setup): Remove task parameter and calls to unlock.
15618 (Archive::unlock_nested_archives): New function.
15619 (Archive::read_header): Add nested_off parameter. Change
15621 (Archive::interpret_header): Likewise.
15622 (Archive::include_all_members): Change to handle thin
15624 (Archive::include_member): Likewise.
15625 * archive.h (Archive::Archive): Add new parameters and
15627 (Archive::armagt): New const.
15628 (Archive::setup): Remove task parameter.
15629 (Archive::unlock_nested_archives): New function.
15630 (Archive::read_header): Add nested_off parameter.
15631 (Archive::interpret_header): Likewise.
15632 (Archive::Nested_archive_table): New typedef.
15633 (Archive::is_thin_archive_): New field.
15634 (Archive::nested_archives_): New field.
15635 (Archive::options_): New field.
15636 (Archive::dirpath_): New field.
15637 (Archive::task_): New field.
15638 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15639 for thin archives. Pass additional parameters to
15640 Archive::Archive. Unlock the archive file after calling
15643 2008-03-29 Ian Lance Taylor <iant@google.com>
15645 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15646 version symbol to be local.
15647 * testsuite/ver_test_4.sh: New file.
15648 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15649 (check_DATA): Add ver_test_4.syms.
15650 (ver_test_4.syms): New target.
15651 * testsuite/Makefile.in: Rebuild.
15654 (Output_section::Input_section_sort_entry::has_priority): New
15656 (Output_section::Input_section_sort_entry::match_file_name): New
15658 (Output_section::Input_section_sort_entry::match_section_name):
15660 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15662 (Output_section::Input_section_sort_entry::match_section_file):
15664 (Output_section::Input_section_sort_compare::operator()): Rewrite
15665 using new Input_section_sort_entry functions. Sort crtbegin and
15666 crtend first. Sort sections with no priority before sections with
15668 * testsuite/initpri1.c (d3): Check j != 4.
15669 (cd5): New constructor/destructor function.
15670 (main): Check j != 2.
15672 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15673 new symbol when resolving, don't call set_is_default.
15674 * testsuite/ver_test_7.cc: New file.
15675 * testsuite/ver_test_7.sh: New file.
15676 * testsuite/Makefile.am (ver_test_7.so): New target.
15677 (ver_test_7.o): New target.
15678 (check_SCRIPTS): Add ver_test_7.sh.
15679 (check_DATA): Add ver_test_7.syms.
15680 (ver_test_7.syms): New target.
15682 2008-03-28 Ian Lance Taylor <iant@google.com>
15684 * layout.cc (Layout::layout): If we see an input section with a
15685 name that needs sorting, set the must_sort flag for the output
15687 (Layout::make_output_section): If the name of the output section
15688 indicates that it might require sorting, set the may_sort flag.
15689 * output.h (Output_section::may_sort_attached_input_sections): New
15691 (Output_section::set_may_sort_attached_input_sections): New
15693 (Output_section::must_sort_attached_input_sections): New
15695 (Output_section::set_must_sort_attached_input_sections): New
15697 (class Output_section): Declare Input_section_sort_entry. Define
15698 Input_section_sort_compare. Declare
15699 sort_attached_input_sections. Add new fields:
15700 may_sort_attached_input_sections_,
15701 must_sort_attached_input_sections_,
15702 attached_input_sections_are_sorted_.
15703 * output.cc (Output_section::Output_section): Initialize new
15705 (Output_section::add_input_section): Add an entry to
15706 input_sections_ if may_sort or must_sort are true.
15707 (Output_section::set_final_data_size): Call
15708 sort_attached_input_sections if necessary.
15709 (Output_section::Input_section_sort_entry): Define new class.
15710 (Output_section::Input_section_sort_compare::operator()): New
15712 (Output_section::sort_attached_input_sections): New function.
15713 * configure.ac: Check whether the compiler supports constructor
15714 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15715 * testsuite/initpri1.c: New file.
15716 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15717 CONSTRUCTOR_PRIORITY.
15718 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15719 (initpri1_LDFLAGS): New variable.
15720 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15722 2008-03-27 Ian Lance Taylor <iant@google.com>
15724 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15725 * testsuite/common_test_1.c: New file.
15726 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15727 (common_test_1_SOURCES): New variable.
15728 (common_test_1_DEPENDENCIES): New variable.
15729 (common_test_1_LDFLAGS): New variable.
15731 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15732 and commons_ correctly when NAME/VERSION does not override
15734 * testsuite/ver_test_6.c: New file.
15735 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15736 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15737 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15739 2008-03-26 Ian Lance Taylor <iant@google.com>
15741 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15742 of an undefined symbol from a version script.
15743 * testsuite/Makefile.am (ver_test_5.so): New target.
15744 (ver_test_5.o): New target.
15745 (check_SCRIPTS): Add ver_test_5.sh.
15746 (check_DATA): Add ver_test_5.syms.
15747 (ver_test_5.syms): New target.
15748 * testsuite/ver_test_5.cc: New file.
15749 * testsuite/ver_test_5.script: New file.
15750 * testsuite/ver_test_5.sh: New file.
15751 * Makefile.in, testsuite/Makefile.in: Rebuild.
15754 Fix problems building gold with gcc 4.3.0.
15755 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15756 (gold_error_at_location, gold_warning_at_location): Use it.
15757 * configure.ac: Check whether we can compile and use a template
15758 function with a printf attribute.
15759 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15760 when jumping over bytes.
15761 * object.cc: Instantiate Object::read_section_data.
15762 * debug.h: Include <cstring>
15763 * dwarf_reader.cc: Include <algorithm>
15764 * main.cc: Include <cstring>.
15765 * options.cc: Include <cstring>.
15766 * output.cc: Include <cstring>.
15767 * script.cc: Include <cstring>.
15768 * script.h: Include <string>.
15769 * symtab.cc: Include <cstring> and <algorithm>.
15770 * target-select.cc: Include <cstring>.
15771 * version.cc: Include <string>.
15772 * testsuite/testmain.cc: Include <cstdlib>.
15773 * configure, config.in: Rebuild.
15775 2008-03-25 Ian Lance Taylor <iant@google.com>
15777 * options.cc: Include "../bfd/bfdver.h".
15778 (options::help): Print bug reporting address.
15780 * version.cc (print_version): Adjust output for current value of
15781 BFD_VERSION_STRING.
15785 * options.cc (options::help): Print list of supported targets.
15786 * target-select.h: Include <vector>.
15787 (class Target_selector): Make machine_, size_, and is_big_endian_
15788 fields const. Add bfd_name_ and instantiated_target_ fields.
15789 (Target_selector::Target_selector): Add bfd_name parameter.
15790 (Target_selector::recognize): Make non-virtual, call
15792 (Target_selector::recognize_by_name): Make non-virtual, call
15793 do_recognize_by_name.
15794 (Target_selector::supported_names): New function.
15795 (Target_selector::bfd_name): New function.
15796 (Target_selector::do_instantiate_target): New pure virtual
15798 (Target_selector::do_recognize): New virtual function.
15799 (Target_selector::do_recognize_by_name): New virtual function.
15800 (Target_selector::instantiate_target): New private function.
15801 (supported_target_names): Declare.
15802 * target-select.cc (Target_selector::Target_selector): Update for
15803 new parameter and fields.
15804 (select_target_by_name): Check that the name matches before
15805 calling recognize_by_name.
15806 (supported_target_names): New function.
15807 * i386.cc (class Target_selector_i386): Update Target_selector
15808 constructor call. Remove recognize and recognize_by_name. Add
15809 do_instantiate_target.
15810 * x86_64.cc (class Target_selector_x86_64): Likewise.
15811 * testsuite/testfile.cc (class Target_selector_test): Update for
15812 changes to Target_selector.
15814 * README: Rewrite, with some notes on unsupported features.
15816 2008-03-24 Cary Coutant <ccoutant@google.com>
15818 * i386.cc (Target_i386::Got_type): New enum declaration.
15819 (Target_i386::Scan::local): Updated callers of Output_data_got
15821 (Target_i386::Scan::global): Likewise.
15822 (Target_i386::Relocate::relocate): Likewise.
15823 (Target_i386::Relocate::relocate_tls): Likewise.
15824 * object.h (Got_offset_list): New class.
15825 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15826 (Sized_relobj::local_got_offset): Likewise.
15827 (Sized_relobj::set_local_got_offset): Likewise.
15828 (Sized_relobj::local_has_tls_got_offset): Removed.
15829 (Sized_relobj::local_tls_got_offset): Removed.
15830 (Sized_relobj::set_local_tls_got_offset): Removed.
15831 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15832 * output.cc (Output_data_got::add_global): Added got_type parameter.
15833 (Output_data_got::add_global_with_rel): Likewise.
15834 (Output_data_got::add_global_with_rela): Likewise.
15835 (Output_data_got::add_global_pair_with_rel): New function.
15836 (Output_data_got::add_global_pair_with_rela): New function.
15837 (Output_data_got::add_local): Added got_type parameter.
15838 (Output_data_got::add_local_with_rel): Likewise.
15839 (Output_data_got::add_local_with_rela): Likewise.
15840 (Output_data_got::add_local_pair_with_rel): New function.
15841 (Output_data_got::add_local_pair_with_rela): New function.
15842 (Output_data_got::add_global_tls): Removed.
15843 (Output_data_got::add_global_tls_with_rel): Removed.
15844 (Output_data_got::add_global_tls_with_rela): Removed.
15845 (Output_data_got::add_local_tls): Removed.
15846 (Output_data_got::add_local_tls_with_rel): Removed.
15847 (Output_data_got::add_local_tls_with_rela): Removed.
15848 * output.h (Output_data_got::add_global): Added got_type parameter.
15849 (Output_data_got::add_global_with_rel): Likewise.
15850 (Output_data_got::add_global_with_rela): Likewise.
15851 (Output_data_got::add_global_pair_with_rel): New function.
15852 (Output_data_got::add_global_pair_with_rela): New function.
15853 (Output_data_got::add_local): Added got_type parameter.
15854 (Output_data_got::add_local_with_rel): Likewise.
15855 (Output_data_got::add_local_with_rela): Likewise.
15856 (Output_data_got::add_local_pair_with_rel): New function.
15857 (Output_data_got::add_local_pair_with_rela): New function.
15858 (Output_data_got::add_global_tls): Removed.
15859 (Output_data_got::add_global_tls_with_rel): Removed.
15860 (Output_data_got::add_global_tls_with_rela): Removed.
15861 (Output_data_got::add_local_tls): Removed.
15862 (Output_data_got::add_local_tls_with_rel): Removed.
15863 (Output_data_got::add_local_tls_with_rela): Removed.
15864 * resolve.cc (Symbol::override_base_with_special): Removed
15865 reference to has_got_offset_ field.
15866 * symtab.cc (Symbol::init_fields): Replaced initialization
15867 of got_offset_ with got_offsets_. Removed initialization
15869 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15870 (Symbol::got_offset): Likewise.
15871 (Symbol::set_got_offset): Likewise.
15872 (Symbol::has_tls_got_offset): Removed.
15873 (Symbol::tls_got_offset): Removed.
15874 (Symbol::set_tls_got_offset): Removed.
15875 (Symbol::got_offset_): Removed.
15876 (Symbol::tls_mod_got_offset_): Removed.
15877 (Symbol::tls_pair_got_offset_): Removed.
15878 (Symbol::got_offsets_): New field.
15879 (Symbol::has_got_offset): Removed.
15880 (Symbol::has_tls_mod_got_offset): Removed.
15881 (Symbol::has_tls_pair_got_offset): Removed.
15882 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15883 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15885 (Target_x86_64::Scan::global): Likewise.
15886 (Target_x86_64::Relocate::relocate): Likewise.
15887 (Target_x86_64::Relocate::relocate_tls): Likewise.
15889 2008-03-25 Ben Elliston <bje@au.ibm.com>
15891 * yyscript.y: Fix spelling error in comment.
15893 2008-03-24 Ian Lance Taylor <iant@google.com>
15895 * options.h (class General_options): Define build_id option.
15896 * layout.h (class Layout): Declare write_build_id, create_note,
15897 create_build_id. Add build_id_note_ member.
15898 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15899 "libiberty.h", "md5.h", "sha1.h".
15900 (Layout::Layout): Initialize eh_frame_data_,
15901 eh_frame_hdr_section_, and build_id_note_.
15902 (Layout::finalize): Call create_build_id.
15903 (Layout::create_note): New function, broken out of
15904 Layout::create_gold_note.
15905 (Layout::create_gold_note): Call create_note.
15906 (Layout::create_build_id): New function.
15907 (Layout::write_build_id): New function.
15908 (Close_task_runner::run): Call write_build_id.
15910 * x86_64.cc: Correct license to GPLv3.
15912 2008-03-23 Ian Lance Taylor <iant@google.com>
15914 * options.cc: Include "demangle.h".
15915 (parse_optional_string): New function.
15916 (parse_long_option): Handle takes_optional_argument.
15917 (parse_short_option): Update dash_z initializer. Handle
15918 takes_optional_argument.
15919 (General_options::General_options): Initialize do_demangle_.
15920 (General_options::finalize): Set do_demangle_. Handle demangling
15922 * options.h (parse_optional_string): Declare.
15923 (struct One_option): Add optional_arg field. Update constructor.
15924 Update call constructor calls. Add takes_optional_argument
15926 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15927 (DEFINE_optional_string): Define.
15928 (General_options::demangle): Change from DEFINE_bool to
15929 DEFINE_optional_string.
15930 (General_options::no_demangle): New function.
15931 (General_options::do_demangle): New function.
15932 (General_options::set_do_demangle): New function.
15933 (General_options::execstack_status_): Move definition to end of
15935 (General_options::static_): Likewise.
15936 (General_options::do_demangle_): New field.
15937 * object.cc (big_endian>::get_symbol_location_info): Call
15938 Options::do_demangle, not Options::demangle.
15939 * symtab.cc (demangle): Likewise.
15941 2008-03-22 Ian Lance Taylor <iant@google.com>
15943 * gold.h: Include <cstddef> and <sys/types.h>
15944 * options.h: Include <cstring>.
15946 2008-03-21 Ian Lance Taylor <iant@google.com>
15948 * Added source code to GNU binutils.
15950 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15952 Copying and distribution of this file, with or without modification,
15953 are permitted in any medium without royalty provided the copyright
15954 notice and this notice are preserved.
15960 version-control: never